[m-dev.] diff: adding MR_ prefixes

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Nov 15 15:50:17 AEDT 2000


This diff is long and boring, and doesn't really need a review. What I can use
is input as to what grades it needs to be bootchecked in before checkin. It has
already passed asm_fast.gc and hlc.gc, their .par variants (except for a couple
of test cases that are also failed without this change), and I am now running
their .prof variants; anyone wants any bootchecks in other grades? Bear in
mind that any problems caused by this diff should be quite trivial to fix.

Estimated hours taken: 8

Make everything in the runtime use MR_ prefixes, and make the compiler
bootstrap with -DMR_NO_BACKWARDS_COMPAT.

runtime/mercury_*.[ch]
	Add MR_ prefixes to all functions, global variables and almost all
	macros that could pollute the namespace. The (intentional) exceptions
	are
	
	1. some function, variable, and type names that already start with
	   MR_, mercury_, Mercury or _entry;
	2. some standard C macros in mercury_std.h;
	3. the macros used in autoconfiguration (since they are used in scripts
	   as well as the runtime, the MR_ prefix may not be appropriate for
	   those).

	In some cases, I deleted things instead of adding prefixes
	if the "things" were obsolete and not user visible.

runtime/mercury_bootstrap.h:
	Provide MR_-less forms of the macros for bootstrapping and for
	backward compatibility for user code.

runtime/mercury_debug.[ch]:
	Add a FILE * parameter to a function that needs it.

compiler/code_info.m:
compiler/export.m:
compiler/fact_table.m:
compiler/llds.m:
compiler/llds_out.m:
compiler/pragma_c_gen.m:
compiler/trace.m:
	Add MR_ prefixes to the C code generated by the compiler.

library/*.m:
	Add MR_ prefixes to handwritten code.

trace/mercury_trace_*.c:
util/mkinit.c:
	Add MR_ prefixes as necessary.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.257
diff -u -b -r1.257 code_info.m
--- compiler/code_info.m	2000/10/13 04:04:14	1.257
+++ compiler/code_info.m	2000/10/21 10:43:30
@@ -1759,11 +1759,11 @@
 			% inside MR_commit_{mark,cut}.
 			Components = [
 				pragma_c_raw_code(
-					"\tsave_transient_registers();\n"),
+					"\tMR_save_transient_registers();\n"),
 				pragma_c_raw_code(
 					"\tMR_commit_mark();\n"),
 				pragma_c_raw_code(
-					"\trestore_transient_registers();\n")
+					"\tMR_restore_transient_registers();\n")
 			],
 			MarkCode = node([
 				pragma_c([], Components, will_not_call_mercury,
Index: compiler/export.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/export.m,v
retrieving revision 1.38
diff -u -b -r1.38 export.m
--- compiler/export.m	2000/11/05 12:03:04	1.38
+++ compiler/export.m	2000/11/13 05:31:48
@@ -104,7 +104,7 @@
 	% For each exported procedure, produce a C function.
 	% The code we generate is in the form
 	%
-	% Declare_entry(<label of called proc>); /* or Declare_static */
+	% MR_declare_entry(<label of called proc>); /* or MR_declare_static */
 	%
 	% #if SEMIDET
 	%   bool
@@ -117,8 +117,8 @@
 	%			MR_Word *Mercury__Argument2...)
 	%			/* Word for input, Word* for output */
 	% {
-	% #if NUM_REAL_REGS > 0
-	%	MR_Word c_regs[NUM_REAL_REGS];
+	% #if MR_NUM_REAL_REGS > 0
+	%	MR_Word c_regs[MR_NUM_REAL_REGS];
 	% #endif
 	% #if FUNCTION
 	%	MR_Word retval;
@@ -128,7 +128,7 @@
 	% #endif 
 	%
 	%		/* save the registers that our C caller may be using */
-	%	save_regs_to_mem(c_regs);
+	%	MR_save_regs_to_mem(c_regs);
 	%
 	%		/* 
 	%		** start a new Mercury engine inside this POSIX 
@@ -148,21 +148,21 @@
 	%		** multi-threaded init_thread (above) takes care
 	%		** of making a new engine if required.
 	%		*/
-	%	restore_registers();
+	%	MR_restore_registers();
 	%	<copy input arguments from Mercury__Arguments into registers>
 	%		/* save the registers which may be clobbered      */
 	%		/* by the C function call MR_call_engine().       */
-	%	save_transient_registers();
+	%	MR_save_transient_registers();
 	%
-	%	(void) MR_call_engine(ENTRY(<label of called proc>), FALSE);
+	%	(void) MR_call_engine(MR_ENTRY(<label of called proc>), FALSE);
 	%
 	%		/* restore the registers which may have been      */
 	%		/* clobbered by the return from the C function    */
 	%		/* MR_call_engine()				  */
-	%	restore_transient_registers();
+	%	MR_restore_transient_registers();
 	% #if SEMIDET
 	%	if (!r1) {
-	%		restore_regs_from_mem(c_regs);
+	%		MR_restore_regs_from_mem(c_regs);
 	%		return FALSE;
 	%	}
 	% #elif FUNCTION
@@ -174,7 +174,7 @@
 	% 		finalize_thread_engine();
 	% 	}
 	% #endif 
-	%	restore_regs_from_mem(c_regs);
+	%	MR_restore_regs_from_mem(c_regs);
 	% #if SEMIDET
 	%	return TRUE;
 	% #elif FUNCTION
@@ -202,9 +202,9 @@
 	llds_out__get_proc_label(ProcLabel, yes, ProcLabelString),
 
 	( Exported = yes ->
-		DeclareString = "Declare_entry"
+		DeclareString = "MR_declare_entry"
 	;
-		DeclareString = "Declare_static"
+		DeclareString = "MR_declare_static"
 	),
 
 	string__append_list([	"\n",
@@ -212,24 +212,24 @@
 				"\n",
 				C_RetType, "\n", 
 				C_Function, "(", ArgDecls, ")\n{\n",
-				"#if NUM_REAL_REGS > 0\n",
-				"\tMR_Word c_regs[NUM_REAL_REGS];\n",
+				"#if MR_NUM_REAL_REGS > 0\n",
+				"\tMR_Word c_regs[MR_NUM_REAL_REGS];\n",
 				"#endif\n",
 				"#if MR_THREAD_SAFE\n",
 				"\tMR_Bool must_finalize_engine;\n", 
 				"#endif\n",
 				MaybeDeclareRetval,
 				"\n",
-				"\tsave_regs_to_mem(c_regs);\n", 
+				"\tMR_save_regs_to_mem(c_regs);\n", 
 				"#if MR_THREAD_SAFE\n",
 				"\tmust_finalize_engine = init_thread(MR_use_now);\n", 
 				"#endif\n",
-				"\trestore_registers();\n", 
+				"\tMR_restore_registers();\n", 
 				InputArgs,
-				"\tsave_transient_registers();\n",
-				"\t(void) MR_call_engine(ENTRY(",
+				"\tMR_save_transient_registers();\n",
+				"\t(void) MR_call_engine(MR_ENTRY(",
 					ProcLabelString, "), FALSE);\n",
-				"\trestore_transient_registers();\n",
+				"\tMR_restore_transient_registers();\n",
 				MaybeFail,
 				OutputArgs,
 				"#if MR_THREAD_SAFE\n",
@@ -237,7 +237,7 @@
 				"\t\t finalize_thread_engine();\n", 
 				"\t}\n", 
 				"#endif\n",
-				"\trestore_regs_from_mem(c_regs);\n", 
+				"\tMR_restore_regs_from_mem(c_regs);\n", 
 				MaybeSucceed,
 				"}\n\n"],
 				Code),
@@ -312,7 +312,7 @@
 		MaybeDeclareRetval = "",
 		string__append_list([
 			"\tif (!r1) {\n",
-			"\t\trestore_regs_from_mem(c_regs);\n",
+			"\t\tMR_restore_regs_from_mem(c_regs);\n",
 			"\treturn FALSE;\n",
 			"\t}\n"
 				], MaybeFail),
Index: compiler/fact_table.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/fact_table.m,v
retrieving revision 1.33
diff -u -b -r1.33 fact_table.m
--- compiler/fact_table.m	2000/10/27 06:26:49	1.33
+++ compiler/fact_table.m	2000/11/13 04:15:44
@@ -686,7 +686,7 @@
 			StructContents1, Result),
 		{
 			IsOutput = yes,
-			string__format("\tFloat V_%d;\n", [i(I)], 
+			string__format("\tMR_Float V_%d;\n", [i(I)], 
 				StructContents0),
 			string__append(StructContents0, StructContents1, 
 				StructContents)
@@ -2527,18 +2527,18 @@
 
 	ExtraCodeTemplate = "
 
-Define_extern_entry(%s);
-Declare_label(%s_i1);
+MR_define_extern_entry(%s);
+MR_declare_label(%s_i1);
 
-BEGIN_MODULE(%s_module)
-	init_entry(%s);
-	init_label(%s_i1);
-BEGIN_CODE
-Define_entry(%s);
-	MR_mkframe(""%s/%d"", 1, LABEL(%s_i1));
+MR_BEGIN_MODULE(%s_module)
+	MR_init_entry(%s);
+	MR_init_label(%s_i1);
+MR_BEGIN_CODE
+MR_define_entry(%s);
+	MR_mkframe(""%s/%d"", 1, MR_LABEL(%s_i1));
 	MR_framevar(1) = (MR_Integer) 0;
-	GOTO(LABEL(%s_i1));
-Define_label(%s_i1);
+	MR_GOTO(MR_LABEL(%s_i1));
+MR_define_label(%s_i1);
 	if (MR_framevar(1) >= %s) MR_fail();
 	{
 		/* declare argument vars */
@@ -2551,9 +2551,9 @@
 	}
 	MR_framevar(1)++;
 	MR_succeed();
-END_MODULE
+MR_END_MODULE
 
-extern ModuleFunc %s_module;
+extern MR_ModuleFunc %s_module;
 
 /*
 INIT sys_init_%s_module
@@ -2614,8 +2614,8 @@
 	MR_maxfr = MR_prevfr_slot(MR_curfr);
 	MR_curfr = MR_succfr_slot(MR_curfr);
 	{
-		Declare_entry(%s);
-		GOTO(ENTRY(%s));
+		MR_declare_entry(%s);
+		MR_GOTO(MR_ENTRY(%s));
 	}
 	",
 
@@ -3000,8 +3000,7 @@
 		    % Unique modes need to allow destructive update so we
 		    % need to make a copy of the string on the heap.
 		    Template = 
-"		incr_hp_atomic(tmp, (strlen(%s) + sizeof(MR_Word))
-			/ sizeof(MR_Word));
+"		MR_incr_hp_atomic(tmp, (strlen(%s) + sizeof(MR_Word)) / sizeof(MR_Word));
 		%s = (MR_String) tmp;
 		strcpy(%s, %s);
 ",
@@ -3041,15 +3040,15 @@
 
 	ExtraCodeTemplate = "
 
-Define_extern_entry(%s);
-Declare_label(%s_i1);
+MR_define_extern_entry(%s);
+MR_declare_label(%s_i1);
 
-	BEGIN_MODULE(%s_module)
-	init_entry(%s);
-	init_label(%s_i1);
-BEGIN_CODE
-Define_entry(%s);
-	MR_mkframe(""%s/%d"", %d, LABEL(%s_i1));
+MR_BEGIN_MODULE(%s_module)
+	MR_init_entry(%s);
+	MR_init_label(%s_i1);
+MR_BEGIN_CODE
+MR_define_entry(%s);
+	MR_mkframe(""%s/%d"", %d, MR_LABEL(%s_i1));
 	{
 		/* create argument vars */
 %s
@@ -3071,7 +3070,7 @@
 	failure_code_%s:
 		MR_fail();
 	}
-Define_label(%s_i1);
+MR_define_label(%s_i1);
 	if (MR_framevar(1) >= %s) 
 		MR_fail();
 	{
@@ -3091,9 +3090,9 @@
 	}
 	MR_framevar(1)++;
 	MR_succeed();
-END_MODULE
+MR_END_MODULE
 
-extern ModuleFunc %s_module;
+extern MR_ModuleFunc %s_module;
 
 /*
 INIT sys_init_%s_module
@@ -3341,15 +3340,15 @@
 
 	ExtraCodeTemplate = "
 
-Define_extern_entry(%s);
-Declare_label(%s_i1);
+MR_define_extern_entry(%s);
+MR_declare_label(%s_i1);
 
-BEGIN_MODULE(%s_module)
-	init_entry(%s);
-	init_label(%s_i1);
-BEGIN_CODE
-Define_entry(%s);
-	MR_mkframe(""%s/%d"", 4, LABEL(%s_i1));
+MR_BEGIN_MODULE(%s_module)
+	MR_init_entry(%s);
+	MR_init_label(%s_i1);
+MR_BEGIN_CODE
+MR_define_entry(%s);
+	MR_mkframe(""%s/%d"", 4, MR_LABEL(%s_i1));
 	{
 		/* create argument vars */
 %s
@@ -3373,7 +3372,7 @@
 	failure_code_%s:
 		MR_fail();
 	}
-Define_label(%s_i1);
+MR_define_label(%s_i1);
 	{
 		/* create argument vars */
 %s
@@ -3408,9 +3407,9 @@
 	failure_code_%s:
 		MR_fail();
 	}
-END_MODULE
+MR_END_MODULE
 
-extern ModuleFunc %s_module;
+extern MR_ModuleFunc %s_module;
 
 /*
 INIT sys_init_%s_module
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.268
diff -u -b -r1.268 llds.m
--- compiler/llds.m	2000/10/31 02:15:43	1.268
+++ compiler/llds.m	2000/10/31 07:54:32
@@ -893,7 +893,7 @@
 	;	code_addr_const(code_addr)
 	;	data_addr_const(data_addr)
 	;	label_entry(label).
-			% the address of the label (uses ENTRY macro).
+			% the address of the label (uses MR_ENTRY macro).
 
 :- type data_addr
 	--->	data_addr(module_name, data_name)
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.164
diff -u -b -r1.164 llds_out.m
--- compiler/llds_out.m	2000/11/10 12:55:23	1.164
+++ compiler/llds_out.m	2000/11/13 04:28:19
@@ -651,7 +651,7 @@
 output_init_bunch_def([Module | Modules], ModuleName, SplitFiles) -->
 	{ Module = comp_gen_c_module(C_ModuleName, _) },
 	( { SplitFiles = yes } ->
-		io__write_string("\t{ extern ModuleFunc "),
+		io__write_string("\t{ extern MR_ModuleFunc "),
 		io__write_string(C_ModuleName),
 		io__write_string(";\n"),
 		io__write_string("\t  "),
@@ -872,17 +872,17 @@
 	io__write_string("\n"),
 	output_c_procedure_list_decls(Procedures, DeclSet0, DeclSet),
 	io__write_string("\n"),
-	io__write_string("BEGIN_MODULE("),
+	io__write_string("MR_BEGIN_MODULE("),
 	io__write_string(ModuleName),
 	io__write_string(")\n"),
 	{ gather_c_module_labels(Procedures, Labels) },
 	output_c_label_init_list(Labels, StackLayoutLabels),
-	io__write_string("BEGIN_CODE\n"),
+	io__write_string("MR_BEGIN_CODE\n"),
 	io__write_string("\n"),
 	globals__io_lookup_bool_option(auto_comments, PrintComments),
 	globals__io_lookup_bool_option(emit_c_loops, EmitCLoops),
 	output_c_procedure_list(Procedures, PrintComments, EmitCLoops),
-	io__write_string("END_MODULE\n").
+	io__write_string("MR_END_MODULE\n").
 
 :- pred output_comp_gen_c_var_list(list(comp_gen_c_var)::in,
 	decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
@@ -1077,7 +1077,7 @@
 	%
 	(
 		{ Label = exported(_) },
-		io__write_string("Define_extern_entry(")
+		io__write_string("MR_define_extern_entry(")
 	;
 		{ Label = local(_) },
 		% The code for procedures local to a Mercury module
@@ -1088,16 +1088,16 @@
 		globals__io_lookup_bool_option(split_c_files,
 			SplitFiles),
 		( { SplitFiles = no } ->
-			io__write_string("Declare_static(")
+			io__write_string("MR_declare_static(")
 		;
-			io__write_string("Define_extern_entry(")
+			io__write_string("MR_define_extern_entry(")
 		)
 	;
 		{ Label = c_local(_) },
-		io__write_string("Declare_local(")
+		io__write_string("MR_declare_local(")
 	;
 		{ Label = local(_, _) },
-		io__write_string("Declare_label(")
+		io__write_string("MR_declare_label(")
 	),
 	{ decl_set_insert(DeclSet1, code_addr(label(Label)), DeclSet) },
 	output_label(Label),
@@ -1160,16 +1160,16 @@
 	},
 	(
 		{ Label = exported(_) },
-		{ TabInitMacro = "\tinit_entry" }
+		{ TabInitMacro = "\tMR_init_entry" }
 	;
 		{ Label = local(_) },
-		{ TabInitMacro = "\tinit_entry" }
+		{ TabInitMacro = "\tMR_init_entry" }
 	;
 		{ Label = c_local(_) },
-		{ TabInitMacro = "\tinit_local" }
+		{ TabInitMacro = "\tMR_init_local" }
 	;
 		{ Label = local(_, _) },
-		{ TabInitMacro = "\tinit_label" }
+		{ TabInitMacro = "\tMR_init_label" }
 	),
 	io__write_string(TabInitMacro),
 	io__write_string(SuffixOpen),
@@ -1705,7 +1705,7 @@
 	output_goto(CodeAddr, CallerLabel).
 
 output_instruction(computed_goto(Rval, Labels), _) -->
-	io__write_string("\tCOMPUTED_GOTO("),
+	io__write_string("\tMR_COMPUTED_GOTO("),
 	output_rval_as_type(Rval, unsigned),
 	io__write_string(",\n\t\t"),
 	output_label_list(Labels),
@@ -1866,7 +1866,7 @@
 output_pragma_c_component(pragma_c_raw_code(C_Code)) -->
 	io__write_string(C_Code).
 output_pragma_c_component(pragma_c_fail_to(Label)) -->
-	io__write_string("if (!r1) GOTO_LABEL("),
+	io__write_string("if (!r1) MR_GOTO_LABEL("),
 	output_label(Label),
 	io__write_string(");\n").
 output_pragma_c_component(pragma_c_noop) --> [].
@@ -1964,7 +1964,7 @@
 	;
         	{ Type = term__functor(term__atom("float"), [], _) }
 	->
-		io__write_string("float_to_word("),
+		io__write_string("MR_float_to_word("),
 		io__write_string(VarName),
 		io__write_string(")")
 	;
@@ -2858,7 +2858,7 @@
 output_code_addr_decls(label(Label)) -->
 	output_label_as_code_addr_decls(Label).
 output_code_addr_decls(imported(ProcLabel)) -->
-	io__write_string("Declare_entry("),
+	io__write_string("MR_declare_entry("),
 	output_proc_label(ProcLabel),
 	io__write_string(");\n").
 output_code_addr_decls(succip) --> [].
@@ -2869,7 +2869,7 @@
 		{ UseMacro = yes }
 	;
 		{ UseMacro = no },
-		io__write_string("Declare_entry("),
+		io__write_string("MR_declare_entry("),
 		io__write_string("do_redo"),
 		io__write_string(");\n")
 	).
@@ -2879,42 +2879,42 @@
 		{ UseMacro = yes }
 	;
 		{ UseMacro = no },
-		io__write_string("Declare_entry("),
+		io__write_string("MR_declare_entry("),
 		io__write_string("do_fail"),
 		io__write_string(");\n")
 	).
 output_code_addr_decls(do_trace_redo_fail_shallow) -->
-	io__write_string("Declare_entry(MR_do_trace_redo_fail_shallow);\n").
+	io__write_string("MR_declare_entry(MR_do_trace_redo_fail_shallow);\n").
 output_code_addr_decls(do_trace_redo_fail_deep) -->
-	io__write_string("Declare_entry(MR_do_trace_redo_fail_deep);\n").
+	io__write_string("MR_declare_entry(MR_do_trace_redo_fail_deep);\n").
 output_code_addr_decls(do_call_closure) -->
-	io__write_string("Declare_entry(mercury__do_call_closure);\n").
+	io__write_string("MR_declare_entry(mercury__do_call_closure);\n").
 output_code_addr_decls(do_call_class_method) -->
-	io__write_string("Declare_entry(mercury__do_call_class_method);\n").
+	io__write_string("MR_declare_entry(mercury__do_call_class_method);\n").
 output_code_addr_decls(do_det_aditi_call) -->
-	io__write_string("Declare_entry(do_det_aditi_call);\n").
+	io__write_string("MR_declare_entry(do_det_aditi_call);\n").
 output_code_addr_decls(do_semidet_aditi_call) -->
-	io__write_string("Declare_entry(do_semidet_aditi_call);\n").
+	io__write_string("MR_declare_entry(do_semidet_aditi_call);\n").
 output_code_addr_decls(do_nondet_aditi_call) -->
-	io__write_string("Declare_entry(do_nondet_aditi_call);\n").
+	io__write_string("MR_declare_entry(do_nondet_aditi_call);\n").
 output_code_addr_decls(do_aditi_insert) -->
-	io__write_string("Declare_entry(do_aditi_insert);\n").
+	io__write_string("MR_declare_entry(do_aditi_insert);\n").
 output_code_addr_decls(do_aditi_delete) -->
-	io__write_string("Declare_entry(do_aditi_delete);\n").
+	io__write_string("MR_declare_entry(do_aditi_delete);\n").
 output_code_addr_decls(do_aditi_bulk_insert) -->
-	io__write_string("Declare_entry(do_aditi_bulk_insert);\n").
+	io__write_string("MR_declare_entry(do_aditi_bulk_insert);\n").
 output_code_addr_decls(do_aditi_bulk_delete) -->
-	io__write_string("Declare_entry(do_aditi_bulk_delete);\n").
+	io__write_string("MR_declare_entry(do_aditi_bulk_delete);\n").
 output_code_addr_decls(do_aditi_bulk_modify) -->
-	io__write_string("Declare_entry(do_aditi_bulk_modify);\n").
+	io__write_string("MR_declare_entry(do_aditi_bulk_modify);\n").
 output_code_addr_decls(do_not_reached) -->
-	io__write_string("Declare_entry(do_not_reached);\n").
+	io__write_string("MR_declare_entry(do_not_reached);\n").
 
 :- pred output_label_as_code_addr_decls(label, io__state, io__state).
 :- mode output_label_as_code_addr_decls(in, di, uo) is det.
 
 output_label_as_code_addr_decls(exported(ProcLabel)) -->
-	io__write_string("Declare_entry("),
+	io__write_string("MR_declare_entry("),
 	output_label(exported(ProcLabel)),
 	io__write_string(");\n").
 output_label_as_code_addr_decls(local(ProcLabel)) -->
@@ -2922,7 +2922,7 @@
 	( { SplitFiles = no } ->
 		[]
 	;
-		io__write_string("Declare_entry("),
+		io__write_string("MR_declare_entry("),
 		output_label(local(ProcLabel)),
 		io__write_string(");\n")
 	).
@@ -3056,7 +3056,7 @@
 	(
 		{ bintree_set__is_member(Label, ContLabelSet) }
 	->
-		io__write_string("\tupdate_prof_current_proc(LABEL("),
+		io__write_string("\tMR_update_prof_current_proc(MR_LABEL("),
 		output_label(CallerLabel),
 		io__write_string("));\n")
 	;
@@ -3069,45 +3069,45 @@
 :- mode output_goto(in, in, di, uo) is det.
 
 	% Note that we do some optimization here:
-	% instead of always outputting `GOTO(<label>)', we
+	% instead of always outputting `MR_GOTO(<label>)', we
 	% output different things for each different kind of label.
 
 output_goto(label(Label), CallerLabel) -->
 	(
 		{ Label = exported(_) },
-		io__write_string("tailcall("),
+		io__write_string("MR_tailcall("),
 		output_label_as_code_addr(Label),
 		io__write_string(",\n\t\t"),
 		output_label_as_code_addr(CallerLabel),
 		io__write_string(");\n")
 	;
 		{ Label = local(_) },
-		io__write_string("tailcall("),
+		io__write_string("MR_tailcall("),
 		output_label_as_code_addr(Label),
 		io__write_string(",\n\t\t"),
 		output_label_as_code_addr(CallerLabel),
 		io__write_string(");\n")
 	;
 		{ Label = c_local(_) },
-		io__write_string("localtailcall("),
+		io__write_string("MR_localtailcall("),
 		output_label(Label),
 		io__write_string(",\n\t\t"),
 		output_label_as_code_addr(CallerLabel),
 		io__write_string(");\n")
 	;
 		{ Label = local(_, _) },
-		io__write_string("GOTO_LABEL("),
+		io__write_string("MR_GOTO_LABEL("),
 		output_label(Label),
 		io__write_string(");\n")
 	).
 output_goto(imported(ProcLabel), CallerLabel) -->
-	io__write_string("tailcall(ENTRY("),
+	io__write_string("MR_tailcall(MR_ENTRY("),
 	output_proc_label(ProcLabel),
 	io__write_string("),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(succip, _) -->
-	io__write_string("proceed();\n").
+	io__write_string("MR_proceed();\n").
 output_goto(do_succeed(Last), _) -->
 	(
 		{ Last = no },
@@ -3123,7 +3123,7 @@
 		io__write_string("MR_redo();\n")
 	;
 		{ UseMacro = no },
-		io__write_string("GOTO(ENTRY(do_redo));\n")
+		io__write_string("MR_GOTO(MR_ENTRY(do_redo));\n")
 	).
 output_goto(do_fail, _) -->
 	globals__io_lookup_bool_option(use_macro_for_redo_fail, UseMacro),
@@ -3132,60 +3132,60 @@
 		io__write_string("MR_fail();\n")
 	;
 		{ UseMacro = no },
-		io__write_string("GOTO(ENTRY(do_fail));\n")
+		io__write_string("MR_GOTO(MR_ENTRY(do_fail));\n")
 	).
 output_goto(do_trace_redo_fail_shallow, _) -->
-	io__write_string("GOTO(ENTRY(MR_do_trace_redo_fail_shallow));\n").
+	io__write_string("MR_GOTO(MR_ENTRY(MR_do_trace_redo_fail_shallow));\n").
 output_goto(do_trace_redo_fail_deep, _) -->
-	io__write_string("GOTO(ENTRY(MR_do_trace_redo_fail_deep));\n").
+	io__write_string("MR_GOTO(MR_ENTRY(MR_do_trace_redo_fail_deep));\n").
 output_goto(do_call_closure, CallerLabel) -->
 	% see comment in output_call for why we use `noprof_' etc. here
 	io__write_string("MR_set_prof_ho_caller_proc("),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n\t\t"),
 	io__write_string(
-		"noprof_tailcall(ENTRY(mercury__do_call_closure));\n").
+		"MR_noprof_tailcall(MR_ENTRY(mercury__do_call_closure));\n").
 output_goto(do_call_class_method, CallerLabel) -->
 	% see comment in output_call for why we use `noprof_' etc. here
 	io__write_string("MR_set_prof_ho_caller_proc("),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n\t\t"),
 	io__write_string(
-		"noprof_tailcall(ENTRY(mercury__do_call_class_method));\n").
+		"MR_noprof_tailcall(MR_ENTRY(mercury__do_call_class_method));\n").
 output_goto(do_det_aditi_call, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_det_aditi_call),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_det_aditi_call),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_semidet_aditi_call, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_semidet_aditi_call),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_semidet_aditi_call),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_nondet_aditi_call, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_nondet_aditi_call),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_nondet_aditi_call),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_aditi_insert, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_aditi_insert),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_aditi_insert),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_aditi_delete, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_aditi_delete),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_aditi_delete),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_aditi_bulk_insert, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_aditi_bulk_insert),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_aditi_bulk_insert),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_aditi_bulk_delete, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_aditi_bulk_delete),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_aditi_bulk_delete),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_aditi_bulk_modify, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_aditi_bulk_modify),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_aditi_bulk_modify),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 output_goto(do_not_reached, CallerLabel) -->
-	io__write_string("tailcall(ENTRY(do_not_reached),\n\t\t"),
+	io__write_string("MR_tailcall(MR_ENTRY(do_not_reached),\n\t\t"),
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 
@@ -3218,9 +3218,10 @@
 		io__write_string("MR_set_prof_ho_caller_proc("),
 		output_label_as_code_addr(CallerLabel),
 		io__write_string(");\n\t"),
-		io__write_string("noprof_")
+		io__write_string("MR_noprof_")
 	;
-		{ ProfileCall = yes }
+		{ ProfileCall = yes },
+		io__write_string("MR_")
 	),
 	(
 		{ Target = label(Label) },
@@ -3256,7 +3257,7 @@
 output_code_addr(label(Label)) -->
 	output_label_as_code_addr(Label).
 output_code_addr(imported(ProcLabel)) -->
-	io__write_string("ENTRY("),
+	io__write_string("MR_ENTRY("),
 	output_proc_label(ProcLabel),
 	io__write_string(")").
 output_code_addr(succip) -->
@@ -3264,41 +3265,41 @@
 output_code_addr(do_succeed(Last)) -->
 	(
 		{ Last = no },
-		io__write_string("ENTRY(do_succeed)")
+		io__write_string("MR_ENTRY(do_succeed)")
 	;
 		{ Last = yes },
-		io__write_string("ENTRY(do_last_succeed)")
+		io__write_string("MR_ENTRY(do_last_succeed)")
 	).
 output_code_addr(do_redo) -->
-	io__write_string("ENTRY(do_redo)").
+	io__write_string("MR_ENTRY(do_redo)").
 output_code_addr(do_fail) -->
-	io__write_string("ENTRY(do_fail)").
+	io__write_string("MR_ENTRY(do_fail)").
 output_code_addr(do_trace_redo_fail_shallow) -->
-	io__write_string("ENTRY(MR_do_trace_redo_fail_shallow)").
+	io__write_string("MR_ENTRY(MR_do_trace_redo_fail_shallow)").
 output_code_addr(do_trace_redo_fail_deep) -->
-	io__write_string("ENTRY(MR_do_trace_redo_fail_deep)").
+	io__write_string("MR_ENTRY(MR_do_trace_redo_fail_deep)").
 output_code_addr(do_call_closure) -->
-	io__write_string("ENTRY(mercury__do_call_closure)").
+	io__write_string("MR_ENTRY(mercury__do_call_closure)").
 output_code_addr(do_call_class_method) -->
-	io__write_string("ENTRY(mercury__do_call_class_method)").
+	io__write_string("MR_ENTRY(mercury__do_call_class_method)").
 output_code_addr(do_det_aditi_call) -->
-	io__write_string("ENTRY(do_det_aditi_call)").
+	io__write_string("MR_ENTRY(do_det_aditi_call)").
 output_code_addr(do_semidet_aditi_call) -->
-	io__write_string("ENTRY(do_semidet_aditi_call)").
+	io__write_string("MR_ENTRY(do_semidet_aditi_call)").
 output_code_addr(do_nondet_aditi_call) -->
-	io__write_string("ENTRY(do_nondet_aditi_call)").
+	io__write_string("MR_ENTRY(do_nondet_aditi_call)").
 output_code_addr(do_aditi_insert) -->
-	io__write_string("ENTRY(do_aditi_insert)").
+	io__write_string("MR_ENTRY(do_aditi_insert)").
 output_code_addr(do_aditi_delete) -->
-	io__write_string("ENTRY(do_aditi_delete)").
+	io__write_string("MR_ENTRY(do_aditi_delete)").
 output_code_addr(do_aditi_bulk_insert) -->
-	io__write_string("ENTRY(do_aditi_bulk_insert)").
+	io__write_string("MR_ENTRY(do_aditi_bulk_insert)").
 output_code_addr(do_aditi_bulk_delete) -->
-	io__write_string("ENTRY(do_aditi_bulk_delete)").
+	io__write_string("MR_ENTRY(do_aditi_bulk_delete)").
 output_code_addr(do_aditi_bulk_modify) -->
-	io__write_string("ENTRY(do_aditi_bulk_modify)").
+	io__write_string("MR_ENTRY(do_aditi_bulk_modify)").
 output_code_addr(do_not_reached) -->
-	io__write_string("ENTRY(do_not_reached)").
+	io__write_string("MR_ENTRY(do_not_reached)").
 
 	% The code should be kept in sync with output_data_addr/2 below.
 llds_out__make_stack_layout_name(Label, Name) :-
@@ -3403,26 +3404,26 @@
 :- mode output_label_as_code_addr(in, di, uo) is det.
 
 output_label_as_code_addr(exported(ProcLabel)) -->
-	io__write_string("ENTRY("),
+	io__write_string("MR_ENTRY("),
 	output_label(exported(ProcLabel)),
 	io__write_string(")").
 output_label_as_code_addr(local(ProcLabel)) -->
 	globals__io_lookup_bool_option(split_c_files, SplitFiles),
 	( { SplitFiles = no } ->
-		io__write_string("STATIC("),
+		io__write_string("MR_STATIC("),
 		output_label(local(ProcLabel)),
 		io__write_string(")")
 	;
-		io__write_string("ENTRY("),
+		io__write_string("MR_ENTRY("),
 		output_label(local(ProcLabel)),
 		io__write_string(")")
 	).
 output_label_as_code_addr(c_local(ProcLabel)) -->
-	io__write_string("LABEL("),
+	io__write_string("MR_LABEL("),
 	output_label(c_local(ProcLabel)),
 	io__write_string(")").
 output_label_as_code_addr(local(N, ProcLabel)) -->
-	io__write_string("LABEL("),
+	io__write_string("MR_LABEL("),
 	output_label(local(N, ProcLabel)),
 	io__write_string(")").
 
@@ -3431,7 +3432,7 @@
 
 output_label_list([]) --> [].
 output_label_list([Label | Labels]) -->
-	io__write_string("LABEL("),
+	io__write_string("MR_LABEL("),
 	output_label(Label),
 	io__write_string(")"),
 	output_label_list_2(Labels).
@@ -3441,8 +3442,8 @@
 
 output_label_list_2([]) --> [].
 output_label_list_2([Label | Labels]) -->
-	io__write_string(" AND\n\t\t"),
-	io__write_string("LABEL("),
+	io__write_string(" MR_AND\n\t\t"),
+	io__write_string("MR_LABEL("),
 	output_label(Label),
 	io__write_string(")"),
 	output_label_list_2(Labels).
@@ -3451,7 +3452,7 @@
 :- mode output_label_defn(in, di, uo) is det.
 
 output_label_defn(exported(ProcLabel)) -->
-	io__write_string("Define_entry("),
+	io__write_string("MR_define_entry("),
 	output_label(exported(ProcLabel)),
 	io__write_string(");\n").
 output_label_defn(local(ProcLabel)) -->
@@ -3462,20 +3463,20 @@
 	% visible to the other C files for that Mercury module.
 	globals__io_lookup_bool_option(split_c_files, SplitFiles),
 	( { SplitFiles = no } ->
-		io__write_string("Define_static("),
+		io__write_string("MR_define_static("),
 		output_label(local(ProcLabel)),
 		io__write_string(");\n")
 	;
-		io__write_string("Define_entry("),
+		io__write_string("MR_define_entry("),
 		output_label(local(ProcLabel)),
 		io__write_string(");\n")
 	).
 output_label_defn(c_local(ProcLabel)) -->
-	io__write_string("Define_local("),
+	io__write_string("MR_define_local("),
 	output_label(c_local(ProcLabel)),
 	io__write_string(");\n").
 output_label_defn(local(Num, ProcLabel)) -->
-	io__write_string("Define_label("),
+	io__write_string("MR_define_label("),
 	output_label(local(Num, ProcLabel)),
 	io__write_string(");\n").
 
@@ -3673,7 +3674,7 @@
 		% Convertions to/from float must be treated specially;
 		% for the others, we can just use a cast.
 		( { DesiredType = float } ->
-			io__write_string("word_to_float("),
+			io__write_string("MR_word_to_float("),
 			output_rval(Rval),
 			io__write_string(")")
 		; { ActualType = float } ->
@@ -3730,7 +3731,7 @@
 		io__write_string(FloatName)
 	;
 		output_llds_type_cast(data_ptr),
-		io__write_string("float_to_word("),
+		io__write_string("MR_float_to_word("),
 		output_rval(Rval),
 		io__write_string(")")
 	).
@@ -3757,7 +3758,7 @@
 		io__write_string("&mercury_float_const_"),
 		io__write_string(FloatName)
 	;
-		io__write_string("float_to_word("),
+		io__write_string("MR_float_to_word("),
 		output_rval(Rval),
 		io__write_string(")")
 	).
@@ -3963,7 +3964,7 @@
 	io__write_string("&"),
 	output_data_addr(DataAddr).
 output_rval_const(label_entry(Label)) -->
-	io__write_string("ENTRY("),
+	io__write_string("MR_ENTRY("),
 	output_label(Label),
 	io__write_string(")").
 
@@ -4037,7 +4038,7 @@
 	io__write_string("&"),
 	output_data_addr(DataAddr).
 output_rval_static_const(label_entry(Label)) -->
-	io__write_string("ENTRY("),
+	io__write_string("MR_ENTRY("),
 	output_label(Label),
 	io__write_string(")").
 
@@ -4202,14 +4203,14 @@
 
 llds_out__reg_to_string(r, N, Description) :-
 	( N > 32 ->
-		Template = "r(%d)"
+		Template = "MR_r(%d)"
 	;
-		Template = "r%d"
+		Template = "MR_r%d"
 	),
 	string__format(Template, [i(N)], Description).
 llds_out__reg_to_string(f, N, Description) :-
 	string__int_to_string(N, N_String),
-	string__append("f(", N_String, Tmp),
+	string__append("MR_f(", N_String, Tmp),
 	string__append(Tmp, ")", Description).
 
 %-----------------------------------------------------------------------------%
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.38
diff -u -b -r1.38 pragma_c_gen.m
--- compiler/pragma_c_gen.m	2000/09/20 00:21:52	1.38
+++ compiler/pragma_c_gen.m	2000/10/21 10:39:51
@@ -53,11 +53,11 @@
 %	#define MR_PROC_LABEL <procedure label> /* see note (5) below */
 %
 %	<assignment of input values from registers to local variables>
-%	save_registers(); /* see notes (1) and (2) below */
+%	MR_save_registers(); /* see notes (1) and (2) below */
 %	{ <the c code itself> }
 %	<for semidet code, check of r1>
 %	#ifndef CONSERVATIVE_GC
-%	  restore_registers(); /* see notes (1) and (3) below */
+%	  MR_restore_registers(); /* see notes (1) and (3) below */
 %	#endif
 %	<assignment of the output values from local variables to registers>
 %
@@ -92,7 +92,7 @@
 %	<declaration of one local variable to point to save struct>
 %	<assignment of input values from registers to local variables>
 %	<assignment to save struct pointer>
-%	save_registers(); /* see notes (1) and (2) below */
+%	MR_save_registers(); /* see notes (1) and (2) below */
 %	#define MR_PROC_LABEL <procedure label> /* see note (5) below */
 %	#define SUCCEED()	goto callsuccesslabel
 %	#define SUCCEED_LAST()	goto calllastsuccesslabel
@@ -100,11 +100,11 @@
 %	{ <the user-written call c code> }
 %	{ <the user-written shared c code> }
 % callsuccesslabel:
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed()
 % calllastsuccesslabel: /* see note (4) below) */
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed_discard()
 % 	#undef SUCCEED
@@ -112,13 +112,13 @@
 % 	#undef FAIL
 %	#undef MR_PROC_LABEL /* see note (5) below */
 % }
-% Define_label(xxx_i1)
+% MR_define_label(xxx_i1)
 % <code for entry to a later disjunct>
 % {
 %	<declaration of one local variable for each output arg>
 %	<declaration of one local variable to point to save struct>
 %	<assignment to save struct pointer>
-%	save_registers(); /* see notes (1) and (2) below */
+%	MR_save_registers(); /* see notes (1) and (2) below */
 %	#define MR_PROC_LABEL <procedure label> /* see note (5) below */
 %	#define SUCCEED()	goto retrysuccesslabel
 %	#define SUCCEED_LAST()	goto retrylastsuccesslabel
@@ -126,11 +126,11 @@
 %	{ <the user-written retry c code> }
 %	{ <the user-written shared c code> }
 % retrysuccesslabel:
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed()
 % retrylastsuccesslabel: /* see note (4) below) */
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed_discard()
 % 	#undef SUCCEED
@@ -153,7 +153,7 @@
 %	<declaration of one local variable to point to save struct>
 %	<assignment of input values from registers to local variables>
 %	<assignment to save struct pointer>
-%	save_registers(); /* see notes (1) and (2) below */
+%	MR_save_registers(); /* see notes (1) and (2) below */
 %	#define MR_PROC_LABEL <procedure label> /* see note (5) below */
 %	#define SUCCEED()	goto callsuccesslabel
 %	#define SUCCEED_LAST()	goto calllastsuccesslabel
@@ -161,11 +161,11 @@
 %	{ <the user-written call c code> }
 %	GOTO_LABEL(xxx_i2)
 % callsuccesslabel: /* see note (4) below */
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed()
 % calllastsuccesslabel: /* see note (4) below */
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed_discard()
 % 	#undef SUCCEED
@@ -173,13 +173,13 @@
 % 	#undef FAIL
 %	#undef MR_PROC_LABEL /* see note (5) below */
 % }
-% Define_label(xxx_i1)
+% MR_define_label(xxx_i1)
 % <code for entry to a later disjunct>
 % {
 %	<declaration of one local variable for each output arg>
 %	<declaration of one local variable to point to save struct>
 %	<assignment to save struct pointer>
-%	save_registers(); /* see notes (1) and (2) below */
+%	MR_save_registers(); /* see notes (1) and (2) below */
 %	#define MR_PROC_LABEL <procedure label> /* see note (5) below */
 %	#define SUCCEED()	goto retrysuccesslabel
 %	#define SUCCEED_LAST()	goto retrylastsuccesslabel
@@ -187,11 +187,11 @@
 %	{ <the user-written retry c code> }
 %	GOTO_LABEL(xxx_i2)
 % retrysuccesslabel: /* see note (4) below */
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed()
 % retrylastsuccesslabel: /* see note (4) below */
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed_discard()
 % 	#undef SUCCEED
@@ -199,7 +199,7 @@
 % 	#undef FAIL
 %	#undef MR_PROC_LABEL /* see note (5) below */
 % }
-% Define_label(xxx_i2)
+% MR_define_label(xxx_i2)
 % {
 %	<declaration of one local variable for each output arg>
 %	<declaration of one local variable to point to save struct>
@@ -210,11 +210,11 @@
 %	#define FAIL()		fail()
 %	{ <the user-written shared c code> }
 % sharedsuccesslabel:
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed()
 % sharedlastsuccesslabel: /* see note (4) below */
-%	restore_registers(); /* see notes (1) and (3) below */
+%	MR_restore_registers(); /* see notes (1) and (3) below */
 %	<assignment of the output values from local variables to registers>
 %	succeed_discard()
 % 	#undef SUCCEED
@@ -264,13 +264,13 @@
 %	If a pragma c_code(will_not_call_mercury, ...) declaration was used,
 %	they will not be emitted.
 %
-% (2)	The call to save_registers() is needed so that if the
-%	C code calls Mercury code, we can call restore_registers()
+% (2)	The call to MR_save_registers() is needed so that if the
+%	C code calls Mercury code, we can call MR_restore_registers()
 %	on entry to the Mercury code (see export.m) to get the
 %	right values of `sp', `hp', `curfr' and `maxfr' for the
 %	recursive invocation of Mercury.
 %
-% (3)	The call to restore_registers() is needed in case the
+% (3)	The call to MR_restore_registers() is needed in case the
 %	C code calls Mercury code which allocates some data
 %	on the heap, and this data is returned from Mercury
 %	through C back to Mercury.  In that case, we need to
@@ -281,7 +281,7 @@
 %	using conservative gc, there is nothing that needs restoring.
 %
 %	When calling nondet code, maxfr may be changed. This is why
-%	we must call restore_registers() from the code we generate for
+%	we must call MR_restore_registers() from the code we generate for
 %	nondet pragma C codes even if we are not using conservative gc.
 %
 % (4)	These labels and the code following them can be optimized away
@@ -435,13 +435,13 @@
 	{ InputComp = pragma_c_inputs(InputDescs) },
 
 	%
-	% save_registers(); /* see notes (1) and (2) above */
+	% MR_save_registers(); /* see notes (1) and (2) above */
 	%
 	{ MayCallMercury = will_not_call_mercury ->
 		SaveRegsComp = pragma_c_raw_code("")
 	;
 		SaveRegsComp = pragma_c_raw_code(
-			"\tsave_registers();\n"
+			"\tMR_save_registers();\n"
 		)
 	},
 
@@ -482,14 +482,14 @@
 
 	%
 	% #ifndef CONSERVATIVE_GC
-	%   restore_registers(); /* see notes (1) and (3) above */
+	%   MR_restore_registers(); /* see notes (1) and (3) above */
 	% #endif
 	%
 	{ MayCallMercury = will_not_call_mercury ->
 		RestoreRegsComp = pragma_c_noop
 	;
 		RestoreRegsComp = pragma_c_raw_code(
-		    "#ifndef CONSERVATIVE_GC\n\trestore_registers();\n#endif\n"
+		"#ifndef CONSERVATIVE_GC\n\tMR_restore_registers();\n#endif\n"
 		)
 	},
 
@@ -688,21 +688,21 @@
 	},
 
 	%
-	% save_registers(); /* see notes (1) and (2) above */
+	% MR_save_registers(); /* see notes (1) and (2) above */
 	%
 	{ MayCallMercury = will_not_call_mercury ->
 		SaveRegs = ""
 	;
-		SaveRegs = "\tsave_registers();\n"
+		SaveRegs = "\tMR_save_registers();\n"
 	},
 
 	%
-	% restore_registers(); /* see notes (1) and (3) above */
+	% MR_restore_registers(); /* see notes (1) and (3) above */
 	%
 	{ MayCallMercury = will_not_call_mercury ->
 		RestoreRegs = ""
 	;
-		RestoreRegs = "\trestore_registers();\n"
+		RestoreRegs = "\tMR_restore_registers();\n"
 	},
 
 	{
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.38
diff -u -b -r1.38 trace.m
--- compiler/trace.m	2000/11/07 15:17:39	1.38
+++ compiler/trace.m	2000/11/08 06:32:03
@@ -493,7 +493,8 @@
 			LayoutAddrStr),
 		string__append_list([
 			FillThreeSlots, "\n",
-			"\t\t", RedoLayoutStr, " = (MR_Word) (const MR_Word *) &",
+			"\t\t", RedoLayoutStr,
+			" = (MR_Word) (const MR_Word *) &",
 			LayoutAddrStr, ";"
 		], FillFourSlots),
 		MaybeLayoutLabel = yes(RedoLayoutLabel)
@@ -754,9 +755,9 @@
 	LayoutLabelInfo = layout_label_info(VarInfoSet, TvarDataMap),
 	llds_out__get_label(Label, yes, LabelStr),
 	DeclStmt = "\t\tCode *MR_jumpaddr;\n",
-	SaveStmt = "\t\tsave_transient_registers();\n",
-	RestoreStmt = "\t\trestore_transient_registers();\n",
-	GotoStmt = "\t\tif (MR_jumpaddr != NULL) GOTO(MR_jumpaddr);"
+	SaveStmt = "\t\tMR_save_transient_registers();\n",
+	RestoreStmt = "\t\tMR_restore_transient_registers();\n",
+	GotoStmt = "\t\tif (MR_jumpaddr != NULL) MR_GOTO(MR_jumpaddr);"
 	},
 	{ string__append_list([
 		"\t\tMR_jumpaddr = MR_trace(\n",
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing library
Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.77
diff -u -b -r1.77 array.m
--- library/array.m	2000/11/14 16:28:27	1.77
+++ library/array.m	2000/11/15 03:07:10
@@ -350,32 +350,32 @@
 
 MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(array, array, 1, MR_TYPECTOR_REP_ARRAY);
 
-Declare_entry(mercury__array__array_equal_2_0);
-Declare_entry(mercury__array__array_compare_3_0);
+MR_declare_entry(mercury__array__array_equal_2_0);
+MR_declare_entry(mercury__array__array_compare_3_0);
 
-BEGIN_MODULE(array_module_builtins)
-	init_entry(mercury____Unify___array__array_1_0);
-	init_entry(mercury____Compare___array__array_1_0);
-BEGIN_CODE
+MR_BEGIN_MODULE(array_module_builtins)
+	MR_init_entry(mercury____Unify___array__array_1_0);
+	MR_init_entry(mercury____Compare___array__array_1_0);
+MR_BEGIN_CODE
 
-Define_entry(mercury____Unify___array__array_1_0);
+MR_define_entry(mercury____Unify___array__array_1_0);
 	/* this is implemented in Mercury, not hand-coded low-level C */
-	tailcall(ENTRY(mercury__array__array_equal_2_0),
-		ENTRY(mercury____Unify___array__array_1_0));
+	MR_tailcall(MR_ENTRY(mercury__array__array_equal_2_0),
+		MR_ENTRY(mercury____Unify___array__array_1_0));
 
-Define_entry(mercury____Compare___array__array_1_0);
+MR_define_entry(mercury____Compare___array__array_1_0);
 	/* this is implemented in Mercury, not hand-coded low-level C */
-	tailcall(ENTRY(mercury__array__array_compare_3_0),
-		ENTRY(mercury____Compare___array__array_1_0));
+	MR_tailcall(MR_ENTRY(mercury__array__array_compare_3_0),
+		MR_ENTRY(mercury____Compare___array__array_1_0));
 
-END_MODULE
+MR_END_MODULE
 
 /* Ensure that the initialization code for the above module gets run. */
 /*
 INIT sys_init_array_module_builtins
 */
 
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc array_module_builtins;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc array_module_builtins;
 
 void sys_init_array_module_builtins(void);
 		/* suppress gcc -Wmissing-decl warning */
Index: library/benchmarking.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/benchmarking.m,v
retrieving revision 1.35
diff -u -b -r1.35 benchmarking.m
--- library/benchmarking.m	2000/10/16 01:33:41	1.35
+++ library/benchmarking.m	2000/10/25 06:47:40
@@ -88,7 +88,7 @@
 #include <stdlib.h>
 #include ""mercury_prof_mem.h""
 #include ""mercury_heap_profile.h""
-#include ""mercury_wrapper.h""		/* for time_at_last_stat */
+#include ""mercury_wrapper.h""		/* for MR_time_at_last_stat */
 
 #ifdef PROFILE_MEMORY
 
@@ -155,8 +155,8 @@
 	** Print timing and stack usage information
 	*/
 
-	time_at_prev_stat = time_at_last_stat;
-	time_at_last_stat = MR_get_user_cpu_miliseconds();
+	time_at_prev_stat = MR_time_at_last_stat;
+	MR_time_at_last_stat = MR_get_user_cpu_miliseconds();
 
 #ifndef MR_HIGHLEVEL_CODE
 	eng = MR_get_engine();
@@ -165,7 +165,7 @@
 	fprintf(stderr, 
 		""[Time: +%.3fs, %.3fs,"",
 		(time_at_last_stat - time_at_prev_stat) / 1000.0,
-		(time_at_last_stat - time_at_start) / 1000.0
+		(time_at_last_stat - MR_time_at_start) / 1000.0
 	);
 
 #ifndef MR_HIGHLEVEL_CODE
@@ -637,7 +637,7 @@
 :- impure pred new_int_reference(int::in, int_reference::out) is det.
 :- pragma inline(new_int_reference/2).
 :- pragma c_code(new_int_reference(X::in, Ref::out), will_not_call_mercury, "
-	incr_hp(Ref, 1);
+	MR_incr_hp(Ref, 1);
 	* (MR_Integer *) Ref = X;
 ").
 
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.43
diff -u -b -r1.43 builtin.m
--- library/builtin.m	2000/11/12 05:26:11	1.43
+++ library/builtin.m	2000/11/13 04:16:33
@@ -311,7 +311,7 @@
 /*
 INIT sys_init_builtin_types_module
 */
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc builtin_types_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc builtin_types_module;
 extern void mercury__private_builtin__init(void);
 
 void sys_init_builtin_types_module(void); /* suppress gcc warning */
@@ -381,14 +381,14 @@
 Using `pragma c_code' doesn't work, due to the lack of support for
 aliasing, and in particular the lack of support for `ui' modes.
 :- pragma c_code(copy(Value::ui, Copy::uo), "
-	save_transient_registers();
+	MR_save_transient_registers();
 	Copy = deep_copy(&Value, TypeInfo_for_T, NULL, NULL);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 ").
 :- pragma c_code(copy(Value::in, Copy::uo), "
-	save_transient_registers();
+	MR_save_transient_registers();
 	Copy = deep_copy(&Value, TypeInfo_for_T, NULL, NULL);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 ").
 *************/
 
@@ -430,44 +430,44 @@
 
 #else /* ! MR_HIGHLEVEL_CODE */
 
-Define_extern_entry(mercury__copy_2_0);
-Define_extern_entry(mercury__copy_2_1);
+MR_define_extern_entry(mercury__copy_2_0);
+MR_define_extern_entry(mercury__copy_2_1);
 
-BEGIN_MODULE(copy_module)
-	init_entry(mercury__copy_2_0);
-	init_entry(mercury__copy_2_1);
-BEGIN_CODE
+MR_BEGIN_MODULE(copy_module)
+	MR_init_entry(mercury__copy_2_0);
+	MR_init_entry(mercury__copy_2_1);
+MR_BEGIN_CODE
 
 #ifdef PROFILE_CALLS
-  #define fallthru(target, caller) { tailcall((target), (caller)); }
+  #define fallthru(target, caller) { MR_tailcall((target), (caller)); }
 #else
   #define fallthru(target, caller)
 #endif
 
-Define_entry(mercury__copy_2_0);
-fallthru(ENTRY(mercury__copy_2_1), ENTRY(mercury__copy_2_0))
-Define_entry(mercury__copy_2_1);
+MR_define_entry(mercury__copy_2_0);
+fallthru(MR_ENTRY(mercury__copy_2_1), MR_ENTRY(mercury__copy_2_0))
+MR_define_entry(mercury__copy_2_1);
 {
 	MR_Word value, copy, type_info;
 
 	type_info = r1;
 	value = r2;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	copy = deep_copy(&value, (MR_TypeInfo) type_info, NULL, NULL);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	r1 = copy;
-	proceed();
+	MR_proceed();
 }
-END_MODULE
+MR_END_MODULE
 
 /* Ensure that the initialization code for the above module gets run. */
 
 /*
 INIT sys_init_copy_module
 */
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc copy_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc copy_module;
 void sys_init_copy_module(void);
 	/* extra declaration to suppress gcc -Wmissing-decl warning */
 void sys_init_copy_module(void) {
@@ -493,12 +493,16 @@
 	mercury____Unify___builtin__c_pointer_0_0,
 	mercury____Compare___builtin__c_pointer_0_0);
 
-BEGIN_MODULE(unify_c_pointer_module)
-	init_entry(mercury____Unify___builtin__c_pointer_0_0);
-	init_entry(mercury____Compare___builtin__c_pointer_0_0);
+MR_declare_entry(mercury____Unify___builtin__c_pointer_0_0);
+MR_declare_entry(mercury____Index___builtin__c_pointer_0_0);
+MR_declare_entry(mercury____Compare___builtin__c_pointer_0_0);
+
+MR_BEGIN_MODULE(unify_c_pointer_module)
+	MR_init_entry(mercury____Unify___builtin__c_pointer_0_0);
+	MR_init_entry(mercury____Compare___builtin__c_pointer_0_0);
 
-BEGIN_CODE
-Define_entry(mercury____Unify___builtin__c_pointer_0_0);
+MR_BEGIN_CODE
+MR_define_entry(mercury____Unify___builtin__c_pointer_0_0);
 	/*
 	** For c_pointer, we assume that equality and comparison
 	** can be based on object identity (i.e. using address comparisons).
@@ -507,15 +511,15 @@
 	** However, it might not be correct in general...
 	*/
 	r1 = (r1 == r2);
-	proceed();
+	MR_proceed();
 
-Define_entry(mercury____Compare___builtin__c_pointer_0_0);
+MR_define_entry(mercury____Compare___builtin__c_pointer_0_0);
 	r1 = (r1 == r2 ? MR_COMPARE_EQUAL :
 			  r1 < r2 ? MR_COMPARE_LESS :
 			  MR_COMPARE_GREATER);
-	proceed();
+	MR_proceed();
 
-END_MODULE
+MR_END_MODULE
 
 /* Ensure that the initialization code for the above module gets run. */
 /*
@@ -523,7 +527,7 @@
 */
 
 
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc unify_c_pointer_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc unify_c_pointer_module;
 void sys_init_unify_c_pointer_module(void);
 	/* duplicate declaration to suppress gcc -Wmissing-decl warning */
 void sys_init_unify_c_pointer_module(void) {
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.32
diff -u -b -r1.32 exception.m
--- library/exception.m	2000/11/05 12:04:12	1.32
+++ library/exception.m	2000/11/13 04:28:07
@@ -918,7 +918,7 @@
 		entry_layout = return_label_layout->MR_sll_entry;
 		if (!MR_DETISM_DET_STACK(entry_layout->MR_sle_detism)
 		    && MR_redoip_slot(current_frame) ==
-			ENTRY(exception_handler_do_fail))
+			MR_ENTRY(exception_handler_do_fail))
 		{
 			return NULL;
 		}
@@ -944,10 +944,10 @@
 			WARNING(problem);
 			return NULL;
 		}
-		restore_transient_registers();
+		MR_restore_transient_registers();
 		MR_sp = det_stack_pointer;
 		MR_curfr = current_frame;
-		save_transient_registers();
+		MR_save_transient_registers();
 	}
 	return NULL;
 }
@@ -968,28 +968,28 @@
 	MR_solutions_heap_zone = swap_heaps_temp_hp_zone;		\\
 }
 
-Define_extern_entry(mercury__exception__builtin_catch_3_0); /* det */
-Define_extern_entry(mercury__exception__builtin_catch_3_1); /* semidet */
-Define_extern_entry(mercury__exception__builtin_catch_3_2); /* cc_multi */
-Define_extern_entry(mercury__exception__builtin_catch_3_3); /* cc_nondet */
-Define_extern_entry(mercury__exception__builtin_catch_3_4); /* multi */
-Define_extern_entry(mercury__exception__builtin_catch_3_5); /* nondet */
+MR_define_extern_entry(mercury__exception__builtin_catch_3_0); /* det */
+MR_define_extern_entry(mercury__exception__builtin_catch_3_1); /* semidet */
+MR_define_extern_entry(mercury__exception__builtin_catch_3_2); /* cc_multi */
+MR_define_extern_entry(mercury__exception__builtin_catch_3_3); /* cc_nondet */
+MR_define_extern_entry(mercury__exception__builtin_catch_3_4); /* multi */
+MR_define_extern_entry(mercury__exception__builtin_catch_3_5); /* nondet */
 
-Define_extern_entry(mercury__exception__builtin_throw_1_0);
+MR_define_extern_entry(mercury__exception__builtin_throw_1_0);
 
 /* the following is defined in runtime/mercury_ho_call.c */
-Declare_entry(mercury__do_call_closure);
+MR_declare_entry(mercury__do_call_closure);
 
 /* the following is defined in runtime/mercury_trace_base.c */
-Declare_entry(MR_do_trace_redo_fail);
+MR_declare_entry(MR_do_trace_redo_fail);
 
-Declare_label(mercury__exception__builtin_catch_3_2_i2);
-Declare_label(mercury__exception__builtin_catch_3_3_i2);
-Declare_label(mercury__exception__builtin_catch_3_5_i2);
+MR_declare_label(mercury__exception__builtin_catch_3_2_i2);
+MR_declare_label(mercury__exception__builtin_catch_3_3_i2);
+MR_declare_label(mercury__exception__builtin_catch_3_5_i2);
 #ifdef MR_USE_TRAIL
-  Declare_label(mercury__exception__builtin_catch_3_5_i3);
+  MR_declare_label(mercury__exception__builtin_catch_3_5_i3);
 #endif
-Declare_label(mercury__exception__builtin_throw_1_0_i1);
+MR_declare_label(mercury__exception__builtin_throw_1_0_i1);
 
 #define BUILTIN_THROW_STACK_SIZE 1
 
@@ -1033,22 +1033,22 @@
   MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_5, 3);
 #endif
 
-BEGIN_MODULE(exceptions_module)
-	init_entry(mercury__exception__builtin_catch_3_0);
-	init_entry(mercury__exception__builtin_catch_3_1);
-	init_entry_sl(mercury__exception__builtin_catch_3_2);
-	init_entry_sl(mercury__exception__builtin_catch_3_3);
-	init_entry(mercury__exception__builtin_catch_3_4);
-	init_entry_sl(mercury__exception__builtin_catch_3_5);
-	init_label_sl(mercury__exception__builtin_catch_3_2_i2);
-	init_label_sl(mercury__exception__builtin_catch_3_3_i2);
-	init_label_sl(mercury__exception__builtin_catch_3_5_i2);
+MR_BEGIN_MODULE(exceptions_module)
+	MR_init_entry(mercury__exception__builtin_catch_3_0);
+	MR_init_entry(mercury__exception__builtin_catch_3_1);
+	MR_init_entry_sl(mercury__exception__builtin_catch_3_2);
+	MR_init_entry_sl(mercury__exception__builtin_catch_3_3);
+	MR_init_entry(mercury__exception__builtin_catch_3_4);
+	MR_init_entry_sl(mercury__exception__builtin_catch_3_5);
+	MR_init_label_sl(mercury__exception__builtin_catch_3_2_i2);
+	MR_init_label_sl(mercury__exception__builtin_catch_3_3_i2);
+	MR_init_label_sl(mercury__exception__builtin_catch_3_5_i2);
 #ifdef MR_USE_TRAIL
-	init_label(mercury__exception__builtin_catch_3_5_i3);
+	MR_init_label(mercury__exception__builtin_catch_3_5_i3);
 #endif
-	init_entry(mercury__exception__builtin_throw_1_0);
-	init_label(mercury__exception__builtin_throw_1_0_i1);
-BEGIN_CODE
+	MR_init_entry(mercury__exception__builtin_throw_1_0);
+	MR_init_label(mercury__exception__builtin_throw_1_0_i1);
+MR_BEGIN_CODE
 
 /*
 ** builtin_catch(Goal, Handler, Result)
@@ -1061,20 +1061,20 @@
 ** the Goal to execute in r2 and the Handler in r3.
 ** On exit, we should put Result in r1.
 */
-Define_entry(mercury__exception__builtin_catch_3_0); /* det */
+MR_define_entry(mercury__exception__builtin_catch_3_0); /* det */
 #ifdef PROFILE_CALLS
 {
-	tailcall(ENTRY(mercury__exception__builtin_catch_3_2), 
-		ENTRY(mercury__exception__builtin_catch_3_0));
+	MR_tailcall(MR_ENTRY(mercury__exception__builtin_catch_3_2), 
+		MR_ENTRY(mercury__exception__builtin_catch_3_0));
 }
 #endif
-Define_entry(mercury__exception__builtin_catch_3_2); /* cc_multi */
+MR_define_entry(mercury__exception__builtin_catch_3_2); /* cc_multi */
 	/*
 	** Create an exception handler entry on the nondet stack.
 	** (Register r3 holds the Handler closure.)
 	*/
 	MR_create_exception_handler(""builtin_catch/3 [model_det]"",
-		MR_MODEL_DET_HANDLER, r3, ENTRY(do_fail));
+		MR_MODEL_DET_HANDLER, r3, MR_ENTRY(do_fail));
 	
 	/*
 	** Now call `Goal(Result)'.
@@ -1082,12 +1082,13 @@
 	r1 = r2;	/* The Goal to call */
 	r2 = 0;		/* Zero additional input arguments */
 	r3 = 1;		/* One output argument */
-	call(ENTRY(mercury__do_call_closure), 
-		LABEL(mercury__exception__builtin_catch_3_2_i2),
-		ENTRY(mercury__exception__builtin_catch_3_2));
-		
-Define_label(mercury__exception__builtin_catch_3_2_i2);
-	update_prof_current_proc(LABEL(mercury__exception__builtin_catch_3_2));
+	MR_call(MR_ENTRY(mercury__do_call_closure), 
+		MR_LABEL(mercury__exception__builtin_catch_3_2_i2),
+		MR_ENTRY(mercury__exception__builtin_catch_3_2));
+		
+MR_define_label(mercury__exception__builtin_catch_3_2_i2);
+	MR_update_prof_current_proc(
+		MR_LABEL(mercury__exception__builtin_catch_3_2));
 	/*
 	** On exit from mercury__do_call_closure, Result is in r1
 	**
@@ -1111,20 +1112,20 @@
 ** the Goal to execute in r2 and the Handler in r3,
 ** and on exit, we should put Result in r2.
 */
-Define_entry(mercury__exception__builtin_catch_3_1); /* semidet */
+MR_define_entry(mercury__exception__builtin_catch_3_1); /* semidet */
 #ifdef PROFILE_CALLS
 {
-	tailcall(ENTRY(mercury__exception__builtin_catch_3_3), 
-		ENTRY(mercury__exception__builtin_catch_3_1));
+	MR_tailcall(MR_ENTRY(mercury__exception__builtin_catch_3_3), 
+		MR_ENTRY(mercury__exception__builtin_catch_3_1));
 }
 #endif
-Define_entry(mercury__exception__builtin_catch_3_3); /* cc_nondet */
+MR_define_entry(mercury__exception__builtin_catch_3_3); /* cc_nondet */
 	/*
 	** Create an exception handler entry on the nondet stack.
 	** (Register r3 holds the Handler closure.)
 	*/
 	MR_create_exception_handler(""builtin_catch/3 [model_semi]"",
-		MR_MODEL_SEMI_HANDLER, r3, ENTRY(do_fail));
+		MR_MODEL_SEMI_HANDLER, r3, MR_ENTRY(do_fail));
 	
 	/*
 	** Now call `Goal(Result)'.
@@ -1132,12 +1133,13 @@
 	r1 = r2;	/* The Goal to call */
 	r2 = 0;		/* Zero additional input arguments */
 	r3 = 1;		/* One output argument */
-	call(ENTRY(mercury__do_call_closure), 
-		LABEL(mercury__exception__builtin_catch_3_3_i2),
-		ENTRY(mercury__exception__builtin_catch_3_3));
-		
-Define_label(mercury__exception__builtin_catch_3_3_i2);
-	update_prof_current_proc(LABEL(mercury__exception__builtin_catch_3_3));
+	MR_call(MR_ENTRY(mercury__do_call_closure), 
+		MR_LABEL(mercury__exception__builtin_catch_3_3_i2),
+		MR_ENTRY(mercury__exception__builtin_catch_3_3));
+		
+MR_define_label(mercury__exception__builtin_catch_3_3_i2);
+	MR_update_prof_current_proc(
+		MR_LABEL(mercury__exception__builtin_catch_3_3));
 	/*
 	** On exit from do_call_semidet_closure, the success/failure
 	** indicator is in r1, and Result is in r2.
@@ -1166,14 +1168,14 @@
 ** the Goal to execute in r2 and the Handler in r3.
 ** On exit, we should put Result in r1.
 */
-Define_entry(mercury__exception__builtin_catch_3_4); /* multi */
+MR_define_entry(mercury__exception__builtin_catch_3_4); /* multi */
 #ifdef PROFILE_CALLS
 {
-	tailcall(ENTRY(mercury__exception__builtin_catch_3_5), 
-		ENTRY(mercury__exception__builtin_catch_3_4));
+	MR_tailcall(MR_ENTRY(mercury__exception__builtin_catch_3_5), 
+		MR_ENTRY(mercury__exception__builtin_catch_3_4));
 }
 #endif
-Define_entry(mercury__exception__builtin_catch_3_5); /* nondet */
+MR_define_entry(mercury__exception__builtin_catch_3_5); /* nondet */
 	/*
 	** Create an exception handler entry on the nondet stack.
 	** (Register r3 holds the Handler closure.)
@@ -1181,10 +1183,10 @@
 #ifdef MR_USE_TRAIL
 	MR_create_exception_handler(""builtin_catch/3 [model_nondet]"",
 		MR_MODEL_NON_HANDLER, r3,
-		LABEL(mercury__exception__builtin_catch_3_5_i3));
+		MR_LABEL(mercury__exception__builtin_catch_3_5_i3));
 #else
 	MR_create_exception_handler(""builtin_catch/3 [model_nondet]"",
-		MR_MODEL_NON_HANDLER, r3, ENTRY(do_fail));
+		MR_MODEL_NON_HANDLER, r3, MR_ENTRY(do_fail));
 #endif
 	
 
@@ -1194,12 +1196,13 @@
 	r1 = r2;	/* the Goal to call */
 	r2 = 0;		/* Zero additional input arguments */
 	r3 = 1;		/* One output argument */
-	call(ENTRY(mercury__do_call_closure), 
-		LABEL(mercury__exception__builtin_catch_3_5_i2),
-		ENTRY(mercury__exception__builtin_catch_3_5));
-		
-Define_label(mercury__exception__builtin_catch_3_5_i2);
-	update_prof_current_proc(LABEL(mercury__exception__builtin_catch_3_5));
+	MR_call(MR_ENTRY(mercury__do_call_closure), 
+		MR_LABEL(mercury__exception__builtin_catch_3_5_i2),
+		MR_ENTRY(mercury__exception__builtin_catch_3_5));
+
+MR_define_label(mercury__exception__builtin_catch_3_5_i2);
+	MR_update_prof_current_proc(
+		MR_LABEL(mercury__exception__builtin_catch_3_5));
 	/*
 	** On exit from do_call_nondet_closure, Result is in r1
 	**
@@ -1211,7 +1214,7 @@
 	MR_succeed();
 
 #ifdef MR_USE_TRAIL
-Define_label(mercury__exception__builtin_catch_3_5_i3);
+MR_define_label(mercury__exception__builtin_catch_3_5_i3);
 	MR_discard_ticket();
 	MR_fail();
 #endif
@@ -1227,7 +1230,7 @@
 **
 ** On entry, we have Exception in r1.
 */
-Define_entry(mercury__exception__builtin_throw_1_0);
+MR_define_entry(mercury__exception__builtin_throw_1_0);
 {
 	MR_Word exception = r1;
 	MR_Word handler;
@@ -1241,10 +1244,10 @@
 	if (MR_trace_enabled) {
 		MR_Code *MR_jumpaddr;
 		MR_trace_set_exception_value(exception);
-		save_transient_registers();
+		MR_save_transient_registers();
 		MR_jumpaddr = MR_trace_throw(MR_succip, MR_sp, MR_curfr);
-		restore_transient_registers();
-		if (MR_jumpaddr != NULL) GOTO(MR_jumpaddr);
+		MR_restore_transient_registers();
+		if (MR_jumpaddr != NULL) MR_GOTO(MR_jumpaddr);
 	}
 
 	/*
@@ -1258,7 +1261,9 @@
 	** behind.
 	*/
 	orig_curfr = MR_curfr;
-	while (MR_redoip_slot(MR_curfr) != ENTRY(exception_handler_do_fail)) {
+	while (MR_redoip_slot(MR_curfr)
+			!= MR_ENTRY(exception_handler_do_fail))
+	{
 		MR_curfr = MR_succfr_slot(MR_curfr);
 		if (MR_curfr < MR_CONTEXT(nondetstack_zone)->min) {
 			MR_Word *save_succip;
@@ -1270,7 +1275,7 @@
 			** and then terminate execution.
 			**
 			** We need to save the registers to the fake_reg
-			** array using save_registers() before calling
+			** array using MR_save_registers() before calling
 			** ML_report_uncaught_exception, since that is
 			** Mercury code and the C->Mercury interface expects
 			** the registers to be saved.
@@ -1279,14 +1284,14 @@
 			** may clobber MR_succip (and also the Mercury
 			** registers r1, r2, r3, etc., but for those we don't
 			** care, since we don't use them).
-			** Note that the save_registers() alone is not
+			** Note that the MR_save_registers() alone is not
 			** sufficient since the Mercury code may clobber the
 			** copy of MR_succip in the fake_reg.
 			*/
 			MR_curfr = orig_curfr;
 			fflush(stdout);
 			save_succip = MR_succip;
-			save_registers();
+			MR_save_registers();
 			ML_report_uncaught_exception(exception);
 			MR_succip = save_succip;
 			MR_trace_report(stderr);
@@ -1370,12 +1375,12 @@
 	*/
 	assert(MR_EXCEPTION_FRAMEVARS->heap_ptr <=
 		MR_EXCEPTION_FRAMEVARS->heap_zone->top);
-	save_transient_registers();
+	MR_save_transient_registers();
 	exception = deep_copy(&exception,
 		(MR_TypeInfo) &mercury_data_std_util__type_ctor_info_univ_0,
 		MR_EXCEPTION_FRAMEVARS->heap_ptr,
 		MR_EXCEPTION_FRAMEVARS->heap_zone->top);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	/* switch back to the ordinary heap */
 	swap_heaps();
@@ -1387,11 +1392,11 @@
 	/* deep_copy the exception back to the ordinary heap */
 	assert(MR_EXCEPTION_FRAMEVARS->solns_heap_ptr <=
 		MR_solutions_heap_zone->top);
-	save_transient_registers();
+	MR_save_transient_registers();
 	exception = deep_copy(&exception,
 		(MR_TypeInfo) &mercury_data_std_util__type_ctor_info_univ_0,
 		saved_solns_heap_ptr, MR_solutions_heap_zone->top);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	/* reset the solutions heap */
 	assert(MR_EXCEPTION_FRAMEVARS->solns_heap_ptr <= saved_solns_heap_ptr);
@@ -1442,7 +1447,7 @@
 #endif
 
 		MR_ENGINE(e_exception) = (MR_Word *) exception;
-		save_registers();
+		MR_save_registers();
 		longjmp(*(MR_ENGINE(e_jmp_buf)), 1);
 	}
 
@@ -1459,28 +1464,29 @@
 	** If the catch was semidet, we need to set the success indicator
 	** r1 to TRUE and return the result in r2; otherwise, we return
 	** the result in r1, which is where mercury__do_call_closure puts it,
-	** so we can to a tailcall.
+	** so we can do a tailcall.
 	*/
 	if (catch_code_model != MR_MODEL_SEMI_HANDLER) {
-		tailcall(ENTRY(mercury__do_call_closure), 
-			ENTRY(mercury__exception__builtin_throw_1_0));
+		MR_tailcall(MR_ENTRY(mercury__do_call_closure), 
+			MR_ENTRY(mercury__exception__builtin_throw_1_0));
 	}
 	MR_incr_sp_push_msg(1, ""builtin_throw/1"");
 	MR_stackvar(1) = (MR_Word) MR_succip;
-	call(ENTRY(mercury__do_call_closure), 
-		LABEL(mercury__exception__builtin_throw_1_0_i1),
-		ENTRY(mercury__exception__builtin_throw_1_0));
+	MR_call(MR_ENTRY(mercury__do_call_closure), 
+		MR_LABEL(mercury__exception__builtin_throw_1_0_i1),
+		MR_ENTRY(mercury__exception__builtin_throw_1_0));
 }
-Define_label(mercury__exception__builtin_throw_1_0_i1);
-	update_prof_current_proc(LABEL(mercury__exception__builtin_throw_1_0));
+MR_define_label(mercury__exception__builtin_throw_1_0_i1);
+	MR_update_prof_current_proc(
+		MR_LABEL(mercury__exception__builtin_throw_1_0));
 	/* we've just returned from mercury__do_call_closure */
 	r2 = r1;
 	r1 = TRUE;
 	MR_succip = (MR_Code *) MR_stackvar(1);
 	MR_decr_sp_pop_msg(1);
-	proceed(); /* return to the caller of `builtin_catch' */
+	MR_proceed(); /* return to the caller of `builtin_catch' */
 
-END_MODULE
+MR_END_MODULE
 
 
 /* Ensure that the initialization code for the above module gets run. */
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.212
diff -u -b -r1.212 io.m
--- library/io.m	2000/11/12 08:51:34	1.212
+++ library/io.m	2000/11/13 00:11:03
@@ -1408,7 +1408,7 @@
 		}
 	}
 	if (Res == 0) {
-		incr_hp_atomic_msg(LVALUE_CAST(MR_Word, RetString),
+		MR_incr_hp_atomic_msg(MR_LVALUE_CAST(MR_Word, RetString),
 			ML_IO_BYTES_TO_WORDS((i + 1) * sizeof(MR_Char)),
 			MR_PROC_LABEL, ""string:string/0"");
 		memcpy(RetString, read_buffer, i * sizeof(MR_Char));
@@ -1620,7 +1620,7 @@
 :- pragma c_code(io__alloc_buffer(Size::in, Buffer::uo),
 		[will_not_call_mercury, thread_safe],
 "{
-	incr_hp_atomic_msg(Buffer,
+	MR_incr_hp_atomic_msg(Buffer,
 		(Size * sizeof(MR_Char) + sizeof(MR_Word) - 1)
 			/ sizeof(MR_Word),
 		MR_PROC_LABEL, ""io:buffer/0"");
@@ -1639,7 +1639,7 @@
 #else
 	if (buffer0 + OldSize == (MR_Char *) MR_hp) {
 		MR_Word next;
-		incr_hp_atomic_msg(next, 
+		MR_incr_hp_atomic_msg(next, 
 		   (NewSize * sizeof(MR_Char) + sizeof(MR_Word) - 1)
 		   	/ sizeof(MR_Word),
 		   MR_PROC_LABEL,
@@ -1648,7 +1648,7 @@
 	    	buffer = buffer0;
 	} else {
 		/* just have to alloc and copy */
-		incr_hp_atomic_msg(Buffer,
+		MR_incr_hp_atomic_msg(Buffer,
 		   (NewSize * sizeof(MR_Char) + sizeof(MR_Word) - 1)
 		   	/ sizeof(MR_Word),
 		   MR_PROC_LABEL, ""io:buffer/0"");
@@ -2872,9 +2872,9 @@
 	va_end(args);
 
 	/* copy the error message to a Mercury string */
-	restore_registers(); /* for MR_hp */
+	MR_restore_registers(); /* for MR_hp */
 	MR_make_aligned_string_copy(message_as_mercury_string, message);
-	save_registers(); /* for MR_hp */
+	MR_save_registers(); /* for MR_hp */
 
 	/* call some Mercury code to throw the exception */
 	ML_throw_io_error((MR_String) message_as_mercury_string);
@@ -3533,7 +3533,7 @@
 		** on the compiler.
 		*/
 		MR_make_aligned_string(
-			LVALUE_CAST(MR_ConstString, PrognameOut),
+			MR_LVALUE_CAST(MR_ConstString, PrognameOut),
 			progname);
 	} else {
 		PrognameOut = DefaultProgname;
@@ -3694,7 +3694,7 @@
 
 	len = strlen(Dir) + 1 + 5 + 3 + 1 + 3 + 1;
 		/* Dir + / + Prefix + counter_high + . + counter_low + \\0 */
-	incr_hp_atomic_msg(LVALUE_CAST(MR_Word, FileName),
+	MR_incr_hp_atomic_msg(MR_LVALUE_CAST(MR_Word, FileName),
 		(len + sizeof(MR_Word)) / sizeof(MR_Word),
 		MR_PROC_LABEL, ""string:string/0"");
 	if (ML_io_tempnam_counter == 0) {
@@ -3746,7 +3746,7 @@
 ** This is defined as a macro rather than a C function
 ** to avoid worrying about the `hp' register being
 ** invalidated by the function call.
-** It also needs to be a macro because incr_hp_atomic_msg()
+** It also needs to be a macro because MR_incr_hp_atomic_msg()
 ** stringizes the procname argument.
 */
 #define ML_maybe_make_err_msg(was_error, msg, procname, error_msg)	\\
@@ -3758,7 +3758,7 @@
 		if (was_error) {					\\
 			errno_msg = strerror(errno);			\\
 			total_len = strlen(msg) + strlen(errno_msg);	\\
-			incr_hp_atomic_msg(tmp,				\\
+			MR_incr_hp_atomic_msg(tmp,			\\
 				(total_len + sizeof(MR_Word))		\\
 					/ sizeof(MR_Word),		\\
 				procname,				\\
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.57
diff -u -b -r1.57 private_builtin.m
--- library/private_builtin.m	2000/10/31 07:54:01	1.57
+++ library/private_builtin.m	2000/11/13 04:16:36
@@ -347,13 +347,13 @@
 MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(private_builtin, typeclass_info, 1,
 	MR_TYPECTOR_REP_TYPECLASSINFO);
 
-BEGIN_MODULE(type_info_module)
-	init_entry(mercury____Unify___private_builtin__type_info_1_0);
-	init_entry(mercury____Compare___private_builtin__type_info_1_0);
-	init_entry(mercury____Unify___private_builtin__typeclass_info_1_0);
-	init_entry(mercury____Compare___private_builtin__typeclass_info_1_0);
-BEGIN_CODE
-Define_entry(mercury____Unify___private_builtin__type_info_1_0);
+MR_BEGIN_MODULE(type_info_module)
+	MR_init_entry(mercury____Unify___private_builtin__type_info_1_0);
+	MR_init_entry(mercury____Compare___private_builtin__type_info_1_0);
+	MR_init_entry(mercury____Unify___private_builtin__typeclass_info_1_0);
+	MR_init_entry(mercury____Compare___private_builtin__typeclass_info_1_0);
+MR_BEGIN_CODE
+MR_define_entry(mercury____Unify___private_builtin__type_info_1_0);
 {
 	/*
 	** Unification for type_info.
@@ -363,14 +363,14 @@
 	*/
 	int	comp;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	comp = MR_compare_type_info((MR_TypeInfo) r1, (MR_TypeInfo) r2);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	r1 = (comp == MR_COMPARE_EQUAL);
-	proceed();
+	MR_proceed();
 }
 
-Define_entry(mercury____Compare___private_builtin__type_info_1_0);
+MR_define_entry(mercury____Compare___private_builtin__type_info_1_0);
 {
 	/*
 	** Comparison for type_info:
@@ -380,29 +380,29 @@
 	*/
 	int	comp;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	comp = MR_compare_type_info((MR_TypeInfo) r1, (MR_TypeInfo) r2);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	r1 = comp;
-	proceed();
+	MR_proceed();
 }
 
-Define_entry(mercury____Unify___private_builtin__typeclass_info_1_0);
+MR_define_entry(mercury____Unify___private_builtin__typeclass_info_1_0);
 {
 	MR_fatal_error(""attempt to unify typeclass_info"");
 }
 
-Define_entry(mercury____Compare___private_builtin__typeclass_info_1_0);
+MR_define_entry(mercury____Compare___private_builtin__typeclass_info_1_0);
 {
 	MR_fatal_error(""attempt to compare typeclass_info"");
 }
-END_MODULE
+MR_END_MODULE
 
 /* Ensure that the initialization code for the above module gets run. */
 /*
 INIT sys_init_type_info_module
 */
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc type_info_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc type_info_module;
 void sys_init_type_info_module(void); /* suppress gcc -Wmissing-decl warning */
 void sys_init_type_info_module(void) {
 	type_info_module();
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.205
diff -u -b -r1.205 std_util.m
--- library/std_util.m	2000/11/12 23:02:37	1.205
+++ library/std_util.m	2000/11/13 04:16:38
@@ -883,11 +883,11 @@
   #define MR_PARTIAL_DEEP_COPY(SolutionsHeapPtr,			\\
   		OldVar, NewVal, TypeInfo_for_T)				\\
   	do {								\\
-		save_transient_hp();					\\
+		MR_save_transient_hp();					\\
 		NewVal = deep_copy(&OldVal, (MR_TypeInfo) TypeInfo_for_T,\\
 				(const MR_Word *) SolutionsHeapPtr,	\\
 				MR_ENGINE(solutions_heap_zone)->top);	\\
-		restore_transient_hp();					\\
+		MR_restore_transient_hp();				\\
 	} while (0)
 #endif
 
@@ -962,12 +962,12 @@
 :- pragma inline(new_mutvar/2).
 :- pragma c_code(new_mutvar(X::in, Ref::out), will_not_call_mercury,
 "
-	incr_hp_msg(Ref, 1, MR_PROC_LABEL, ""std_util:mutvar/1"");
+	MR_incr_hp_msg(Ref, 1, MR_PROC_LABEL, ""std_util:mutvar/1"");
 	*(MR_Word *) Ref = X;
 ").
 :- pragma c_code(new_mutvar(X::di, Ref::uo), will_not_call_mercury,
 "
-	incr_hp_msg(Ref, 1, MR_PROC_LABEL, ""std_util:mutvar/1"");
+	MR_incr_hp_msg(Ref, 1, MR_PROC_LABEL, ""std_util:mutvar/1"");
 	*(MR_Word *) Ref = X;
 ").
 
@@ -1079,7 +1079,7 @@
 */
 
 #include ""mercury_type_info.h""
-#include ""mercury_heap.h""	/* for incr_hp_msg() etc. */
+#include ""mercury_heap.h""	/* for MR_incr_hp_msg() etc. */
 #include ""mercury_misc.h""	/* for MR_fatal_error() */
 #include ""mercury_string.h""	/* for MR_make_aligned_string() */
 
@@ -1095,11 +1095,11 @@
 	% of the type_info for this type, and then store the input argument
 	% in the second field.
 :- pragma c_code(type_to_univ(Value::di, Univ::uo), will_not_call_mercury, "
-    incr_hp_msg(Univ, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+    MR_incr_hp_msg(Univ, 2, MR_PROC_LABEL, ""std_util:univ/0"");
     MR_define_univ_fields(Univ, TypeInfo_for_T, Value);
 ").
 :- pragma c_code(type_to_univ(Value::in, Univ::out), will_not_call_mercury, "
-    incr_hp_msg(Univ, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+    MR_incr_hp_msg(Univ, 2, MR_PROC_LABEL, ""std_util:univ/0"");
     MR_define_univ_fields(Univ, TypeInfo_for_T, Value);
 ").
 
@@ -1112,10 +1112,10 @@
 	int	    comp;
 
 	univ_type_info = MR_field(MR_mktag(0), Univ, UNIV_OFFSET_FOR_TYPEINFO);
-	save_transient_registers();
+	MR_save_transient_registers();
 	comp = MR_compare_type_info((MR_TypeInfo) univ_type_info,
 		(MR_TypeInfo) TypeInfo_for_T);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	if (comp == MR_COMPARE_EQUAL) {
 		Value = MR_field(MR_mktag(0), Univ, UNIV_OFFSET_FOR_DATA);
 		SUCCESS_INDICATOR = TRUE;
@@ -1142,7 +1142,7 @@
 
 #ifndef	COMPACT_ARGS
 
-Declare_label(mercury____Compare___std_util__univ_0_0_i1);
+MR_declare_label(mercury____Compare___std_util__univ_0_0_i1);
 
 MR_MAKE_PROC_LAYOUT(mercury____Compare___std_util__univ_0_0,
 	MR_DETISM_DET, 1, MR_LONG_LVAL_STACKVAR(1),
@@ -1151,16 +1151,16 @@
 
 #endif
 
-Define_extern_entry(mercury____Unify___std_util__type_desc_0_0);
-Define_extern_entry(mercury____Compare___std_util__type_desc_0_0);
+MR_define_extern_entry(mercury____Unify___std_util__type_desc_0_0);
+MR_define_extern_entry(mercury____Compare___std_util__type_desc_0_0);
 
-BEGIN_MODULE(unify_univ_module)
-	init_entry(mercury____Unify___std_util__univ_0_0);
-	init_entry(mercury____Compare___std_util__univ_0_0);
-	init_entry(mercury____Unify___std_util__type_desc_0_0);
-	init_entry(mercury____Compare___std_util__type_desc_0_0);
-BEGIN_CODE
-Define_entry(mercury____Unify___std_util__univ_0_0);
+MR_BEGIN_MODULE(unify_univ_module)
+	MR_init_entry(mercury____Unify___std_util__univ_0_0);
+	MR_init_entry(mercury____Compare___std_util__univ_0_0);
+	MR_init_entry(mercury____Unify___std_util__type_desc_0_0);
+	MR_init_entry(mercury____Compare___std_util__type_desc_0_0);
+MR_BEGIN_CODE
+MR_define_entry(mercury____Unify___std_util__univ_0_0);
 {
 	/*
 	** Unification for univ.
@@ -1176,13 +1176,13 @@
 	/* First check the type_infos compare equal */
 	typeinfo1 = MR_field(MR_mktag(0), univ1, UNIV_OFFSET_FOR_TYPEINFO);
 	typeinfo2 = MR_field(MR_mktag(0), univ2, UNIV_OFFSET_FOR_TYPEINFO);
-	save_transient_registers();
+	MR_save_transient_registers();
 	comp = MR_compare_type_info((MR_TypeInfo) typeinfo1,
 		(MR_TypeInfo) typeinfo2);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	if (comp != MR_COMPARE_EQUAL) {
 		r1 = FALSE;
-		proceed();
+		MR_proceed();
 	}
 
 	/*
@@ -1193,13 +1193,13 @@
 	r2 = MR_field(MR_mktag(0), univ1, UNIV_OFFSET_FOR_DATA);
 	r3 = MR_field(MR_mktag(0), univ2, UNIV_OFFSET_FOR_DATA);
 	{
-		Declare_entry(mercury__unify_2_0);
-		tailcall(ENTRY(mercury__unify_2_0),
-			LABEL(mercury____Unify___std_util__univ_0_0));
+		MR_declare_entry(mercury__unify_2_0);
+		MR_tailcall(MR_ENTRY(mercury__unify_2_0),
+			MR_LABEL(mercury____Unify___std_util__univ_0_0));
 	}
 }
 
-Define_entry(mercury____Compare___std_util__univ_0_0);
+MR_define_entry(mercury____Compare___std_util__univ_0_0);
 {
 	/*
 	** Comparison for univ:
@@ -1215,13 +1215,13 @@
 	/* First compare the type_infos */
 	typeinfo1 = MR_field(MR_mktag(0), univ1, UNIV_OFFSET_FOR_TYPEINFO);
 	typeinfo2 = MR_field(MR_mktag(0), univ2, UNIV_OFFSET_FOR_TYPEINFO);
-	save_transient_registers();
+	MR_save_transient_registers();
 	comp = MR_compare_type_info((MR_TypeInfo) typeinfo1,
 		(MR_TypeInfo) typeinfo2);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	if (comp != MR_COMPARE_EQUAL) {
 		r1 = comp;
-		proceed();
+		MR_proceed();
 	}
 
 	/*
@@ -1233,47 +1233,47 @@
 	r2 = MR_field(MR_mktag(0), univ1, UNIV_OFFSET_FOR_DATA);
 	r3 = MR_field(MR_mktag(0), univ2, UNIV_OFFSET_FOR_DATA);
 	{
-		Declare_entry(mercury__compare_3_0);
-		tailcall(ENTRY(mercury__compare_3_0),
-			LABEL(mercury____Compare___std_util__univ_0_0));
+		MR_declare_entry(mercury__compare_3_0);
+		MR_tailcall(MR_ENTRY(mercury__compare_3_0),
+			MR_LABEL(mercury____Compare___std_util__univ_0_0));
 	}
 }
 
-Define_entry(mercury____Unify___std_util__type_desc_0_0);
+MR_define_entry(mercury____Unify___std_util__type_desc_0_0);
 {
 	/*
 	** Unification for type_desc.
 	*/
 	int	comp;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	comp = MR_compare_type_info((MR_TypeInfo) r1, (MR_TypeInfo) r2);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	r1 = (comp == MR_COMPARE_EQUAL);
-	proceed();
+	MR_proceed();
 }
 
-Define_entry(mercury____Compare___std_util__type_desc_0_0);
+MR_define_entry(mercury____Compare___std_util__type_desc_0_0);
 {
 	/*
 	** Comparison for type_desc.
 	*/
 	int	comp;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	comp = MR_compare_type_info((MR_TypeInfo) r1, (MR_TypeInfo) r2);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	r1 = comp;
-	proceed();
+	MR_proceed();
 }
 
-END_MODULE
+MR_END_MODULE
 
 /* Ensure that the initialization code for the above module gets run. */
 /*
 INIT sys_init_unify_univ_module
 */
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc unify_univ_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc unify_univ_module;
 void sys_init_unify_univ_module(void); /* suppress gcc -Wmissing-decl warning */
 void sys_init_unify_univ_module(void) {
 	unify_univ_module();
@@ -1351,7 +1351,7 @@
 ** type_ctor_info pointers. This still allows higher-order terms with
 ** 1024 arguments, which is more than ../LIMITATIONS promises.
 */
-#define MR_MAX_VARIABLE_ARITY         MAX_VIRTUAL_REG
+#define MR_MAX_VARIABLE_ARITY         MR_MAX_VIRTUAL_REG
 
 /*
 ** Constructors for the MR_TypeCtorDesc ADT
@@ -1467,10 +1467,10 @@
 	** probably isn't very important anyway.
 	*/
 #if 0
-	save_transient_registers();
+	MR_save_transient_registers();
 	TypeInfo = (MR_Word) MR_collapse_equivalences(
 		(MR_TypeInfo) TypeInfo_for_T);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 #endif
 
 }
@@ -1563,9 +1563,9 @@
 	MR_TypeCtorInfo type_ctor_info;
 	MR_TypeInfo	type_info;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	type_info = MR_collapse_equivalences((MR_TypeInfo) TypeInfo);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	type_ctor_info = MR_TYPEINFO_GET_TYPE_CTOR_INFO(type_info);
 
@@ -1617,7 +1617,7 @@
 }
 
 /*
-** You need to wrap save/restore_transient_registers() around
+** You need to wrap MR_{save/restore}_transient_registers() around
 ** calls to this function.
 */
 
@@ -1656,13 +1656,13 @@
 	MR_TypeCtorDesc type_ctor_desc;
 	MR_TypeInfo	type_info;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 
 	type_info = (MR_TypeInfo) TypeDesc;
 	ML_type_ctor_and_args(type_info, TRUE, &type_ctor_desc, &ArgTypes);
 	TypeCtorDesc = (MR_Word) type_ctor_desc;
 
-	restore_transient_registers();
+	MR_restore_transient_registers();
 }
 ").
 
@@ -1702,9 +1702,10 @@
 	if (list_length != arity) {
 		SUCCESS_INDICATOR = FALSE;
 	} else {
-		save_transient_registers();
-		TypeDesc = (MR_Word) ML_make_type(arity, type_ctor_desc, ArgTypes);
-		restore_transient_registers();
+		MR_save_transient_registers();
+		TypeDesc = (MR_Word) ML_make_type(arity, type_ctor_desc,
+			ArgTypes);
+		MR_restore_transient_registers();
 		SUCCESS_INDICATOR = TRUE;
 	}
 }
@@ -1722,13 +1723,13 @@
 	MR_TypeCtorDesc type_ctor_desc;
 	MR_TypeInfo	type_info;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 
 	type_info = (MR_TypeInfo) TypeDesc;
 	ML_type_ctor_and_args(type_info, FALSE, &type_ctor_desc, &ArgTypes);
 	TypeCtorDesc = (MR_Word) type_ctor_desc;
 
-	restore_transient_registers();
+	MR_restore_transient_registers();
 }
 ").
 
@@ -1769,9 +1770,9 @@
 :- pragma c_code(num_functors(TypeInfo::in) = (Functors::out),
 	will_not_call_mercury, "
 {
-	save_transient_registers();
+	MR_save_transient_registers();
 	Functors = ML_get_num_functors((MR_TypeInfo) TypeInfo);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 }
 ").
 
@@ -1792,10 +1793,10 @@
         ** type and if the functor number is in range, we
         ** succeed.
         */
-    save_transient_registers();
+    MR_save_transient_registers();
     success = ML_get_functors_check_range(FunctorNumber,
                 type_info, &construct_info);
-    restore_transient_registers();
+    MR_restore_transient_registers();
 
         /*
         ** Get the functor name and arity, construct the list
@@ -1811,17 +1812,17 @@
         if (MR_TYPE_CTOR_INFO_IS_TUPLE(
                         MR_TYPEINFO_GET_TYPE_CTOR_INFO(type_info)))
         {
-            save_transient_registers();
+            MR_save_transient_registers();
             TypeInfoList = ML_type_params_vector_to_list(Arity,
                     MR_TYPEINFO_GET_TUPLE_ARG_VECTOR(type_info));
-            restore_transient_registers();
+            MR_restore_transient_registers();
         } else {
-            save_transient_registers();
+            MR_save_transient_registers();
             TypeInfoList = ML_pseudo_type_info_vector_to_type_info_list(
                 arity,
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
                 construct_info.arg_pseudo_type_infos);
-            restore_transient_registers();
+            MR_restore_transient_registers();
         }
     }
     SUCCESS_INDICATOR = success;
@@ -1843,10 +1844,10 @@
         ** type and if the functor number is in range, we
         ** succeed.
         */
-    save_transient_registers();
+    MR_save_transient_registers();
     success = ML_get_functors_check_range(FunctorNumber, type_info,
         &construct_info);
-    restore_transient_registers();
+    MR_restore_transient_registers();
 
     if (success) {
         switch (construct_info.type_ctor_rep) {
@@ -1895,12 +1896,12 @@
         ** Check range of FunctorNum, get info for this
         ** functor.
         */
-    save_transient_registers();
+    MR_save_transient_registers();
     success =
         ML_get_functors_check_range(FunctorNumber, type_info, &construct_info)
         && ML_typecheck_arguments(type_info, construct_info.arity, ArgList,
                 construct_info.arg_pseudo_type_infos);
-    restore_transient_registers();
+    MR_restore_transient_registers();
 
         /*
         ** Build the new term in `new_data'.
@@ -1964,7 +1965,7 @@
                 case MR_SECTAG_REMOTE:
                     arity = functor_desc->MR_du_functor_orig_arity;
 
-                    tag_incr_hp_msg(new_data, ptag, arity + 1,
+                    MR_tag_incr_hp_msg(new_data, ptag, arity + 1,
                         MR_PROC_LABEL, ""<created by std_util:construct/3>"");
 
                     MR_field(ptag, new_data, 0) =
@@ -1981,7 +1982,7 @@
                 case MR_SECTAG_NONE:
                     arity = functor_desc->MR_du_functor_orig_arity;
 
-                    tag_incr_hp_msg(new_data, ptag, arity,
+                    MR_tag_incr_hp_msg(new_data, ptag, arity,
                         MR_PROC_LABEL, ""<created by std_util:construct/3>"");
 
                     for (i = 0; i < arity; i++) {
@@ -2010,7 +2011,7 @@
                 if (arity == 0) {
                     new_data = (MR_Word) NULL;
                 } else {
-                    incr_hp_msg(new_data, arity, MR_PROC_LABEL,
+                    MR_incr_hp_msg(new_data, arity, MR_PROC_LABEL,
                             ""<created by std_util:construct/3>"");
             
                     arg_list = ArgList;
@@ -2037,7 +2038,7 @@
         ** Create a univ.
         */
 
-        incr_hp_msg(Term, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+        MR_incr_hp_msg(Term, 2, MR_PROC_LABEL, ""std_util:univ/0"");
         MR_define_univ_fields(Term, type_info, new_data);
     }
 
@@ -2064,10 +2065,10 @@
 	/*
 	** Construct a type_info for the tuple.
 	*/
-	save_transient_registers();
+	MR_save_transient_registers();
 	type_info = ML_make_type(Arity, MR_TYPECTOR_DESC_MAKE_TUPLE(Arity),
 			ArgTypes);
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	/*
 	** Create the tuple.
@@ -2075,7 +2076,7 @@
 	if (Arity == 0) {
 		new_data = (MR_Word) NULL;
 	} else {
-		incr_hp_msg(new_data, Arity, MR_PROC_LABEL,
+		MR_incr_hp_msg(new_data, Arity, MR_PROC_LABEL,
 			""<created by std_util:construct_tuple/1>"");
 		for (i = 0; i < Arity; i++) {
 			arg_value = MR_field(MR_mktag(0), MR_list_head(Args),
@@ -2088,7 +2089,7 @@
 	/*
 	** Create a univ.
 	*/
-	incr_hp_msg(Term, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+	MR_incr_hp_msg(Term, 2, MR_PROC_LABEL, ""std_util:univ/0"");
 	MR_define_univ_fields(Term, type_info, new_data);
 }
 ").
@@ -2351,11 +2352,11 @@
         type_ctor_info = MR_TYPECTOR_DESC_GET_VA_TYPE_CTOR_INFO(
             type_ctor_desc);
 
-        restore_transient_registers();
-        incr_hp_atomic_msg(LVALUE_CAST(MR_Word, new_type_info_arena),
+        MR_restore_transient_registers();
+        MR_incr_hp_atomic_msg(MR_LVALUE_CAST(MR_Word, new_type_info_arena),
             MR_higher_order_type_info_size(arity),
             ""mercury__std_util__ML_make_type"", ""type_info"");
-        save_transient_registers();
+        MR_save_transient_registers();
         MR_fill_in_higher_order_type_info(new_type_info_arena,
             type_ctor_info, arity, new_type_info_args);
     } else {
@@ -2366,11 +2367,11 @@
             return (MR_TypeInfo) type_ctor_info;
         }
 
-        restore_transient_registers();
-        incr_hp_atomic_msg(LVALUE_CAST(MR_Word, new_type_info_arena),
+        MR_restore_transient_registers();
+        MR_incr_hp_atomic_msg(MR_LVALUE_CAST(MR_Word, new_type_info_arena),
             MR_first_order_type_info_size(arity),
             ""mercury__std_util__ML_make_type"", ""type_info"");
-        save_transient_registers();
+        MR_save_transient_registers();
         MR_fill_in_first_order_type_info(new_type_info_arena,
             type_ctor_info, new_type_info_args);
     }
@@ -2423,7 +2424,7 @@
     MR_TypeInfo arg_type;
     MR_Word     type_info_list;
 
-    restore_transient_registers();
+    MR_restore_transient_registers();
     type_info_list = MR_list_empty();
 
     while (arity > 0) {
@@ -2431,7 +2432,7 @@
 		type_info_list);
 	--arity;
     }
-    save_transient_registers();
+    MR_save_transient_registers();
 
     return type_info_list;
 }
@@ -2454,27 +2455,27 @@
     MR_TypeInfo arg_type;
     MR_Word     type_info_list;
 
-    restore_transient_registers();
+    MR_restore_transient_registers();
     type_info_list = MR_list_empty();
 
     while (--arity >= 0) {
             /* Get the argument type_info */
 
             /* Fill in any polymorphic pseudo type_infos */
-        save_transient_registers();
+        MR_save_transient_registers();
         arg_type = MR_create_type_info(type_params,
             arg_pseudo_type_infos[arity]);
-        restore_transient_registers();
+        MR_restore_transient_registers();
 
             /* Look past any equivalences */
-        save_transient_registers();
+        MR_save_transient_registers();
         arg_type = MR_collapse_equivalences(arg_type);
-        restore_transient_registers();
+        MR_restore_transient_registers();
 
             /* Join the argument to the front of the list */
         type_info_list = MR_list_cons((MR_Word) arg_type, type_info_list);
     }
-    save_transient_registers();
+    MR_save_transient_registers();
 
     return type_info_list;
 }
@@ -2650,12 +2651,12 @@
 **  ML_expand increments the heap pointer, however, on
 **  some platforms the register windows mean that transient
 **  Mercury registers may be lost. Before calling ML_expand,
-**  call save_transient_registers(), and afterwards, call
-**  restore_transient_registers().
+**  call MR_save_transient_registers(), and afterwards, call
+**  MR_restore_transient_registers().
 **
 **  If writing a C function that calls deep_copy, make sure you
-**  document that around your function, save_transient_registers()
-**  restore_transient_registers() need to be used.
+**  document that around your function, MR_save_transient_registers()
+**  MR_restore_transient_registers() need to be used.
 **
 **  If you change this code you will also have reflect any changes in
 **  runtime/mercury_deep_copy_body.h and runtime/mercury_tabling.c
@@ -2850,7 +2851,7 @@
 
                 data_word = *data_word_ptr;
                 sprintf(buf, ""%ld"", (long) data_word);
-                incr_saved_hp_atomic(LVALUE_CAST(MR_Word, str),
+                MR_incr_saved_hp_atomic(MR_LVALUE_CAST(MR_Word, str),
                     (strlen(buf) + sizeof(MR_Word)) / sizeof(MR_Word));
                 strcpy(str, buf);
                 expand_info->functor = str;
@@ -2869,7 +2870,7 @@
                 char    *str;
 
                 data_word = *data_word_ptr;
-                incr_saved_hp_atomic(LVALUE_CAST(MR_Word, str),
+                MR_incr_saved_hp_atomic(MR_LVALUE_CAST(MR_Word, str),
                     (3 + sizeof(MR_Word)) / sizeof(MR_Word));
                     sprintf(str, ""\'%c\'"", (char) data_word);
                 expand_info->functor = str;
@@ -2888,9 +2889,9 @@
                 char        *str;
 
                 data_word = *data_word_ptr;
-                f = word_to_float(data_word);
+                f = MR_word_to_float(data_word);
                 sprintf(buf, ""%#.15g"", f);
-                incr_saved_hp_atomic(LVALUE_CAST(MR_Word, str),
+                MR_incr_saved_hp_atomic(MR_LVALUE_CAST(MR_Word, str),
                     (strlen(buf) + sizeof(MR_Word)) / sizeof(MR_Word));
                 strcpy(str, buf);
                 expand_info->functor = str;
@@ -2908,7 +2909,7 @@
                 char    *str;
 
                 data_word = *data_word_ptr;
-                incr_saved_hp_atomic(LVALUE_CAST(MR_Word, str),
+                MR_incr_saved_hp_atomic(MR_LVALUE_CAST(MR_Word, str),
                     (strlen((MR_String) data_word) + 2 + sizeof(MR_Word))
                     / sizeof(MR_Word));
                 sprintf(str, ""%c%s%c"", '""', (MR_String) data_word, '""');
@@ -3175,9 +3176,9 @@
     expand_info.need_functor = TRUE;
     expand_info.need_args = FALSE;
 
-    save_transient_registers();
+    MR_save_transient_registers();
     ML_expand(type_info, &Term, &expand_info);
-    restore_transient_registers();
+    MR_restore_transient_registers();
 
         /*
         ** Check for attempts to deconstruct a non-canonical type:
@@ -3193,7 +3194,7 @@
     }
 
         /* Copy functor onto the heap */
-    MR_make_aligned_string(LVALUE_CAST(MR_ConstString, Functor),
+    MR_make_aligned_string(MR_LVALUE_CAST(MR_ConstString, Functor),
         expand_info.functor);
 
     Arity = expand_info.arity;
@@ -3217,7 +3218,7 @@
     type_info = (MR_TypeInfo) TypeInfo_for_T;
     exp_arg_type_info = (MR_TypeInfo) TypeInfo_for_ArgT;
 
-    save_transient_registers();
+    MR_save_transient_registers();
     success = ML_arg(type_info, &Term, ArgumentIndex,
         &arg_type_info, &argument_ptr);
 
@@ -3232,7 +3233,7 @@
         }
     }
 
-    restore_transient_registers();
+    MR_restore_transient_registers();
     SUCCESS_INDICATOR = success;
 }").
 
@@ -3246,14 +3247,14 @@
 
     type_info = (MR_TypeInfo) TypeInfo_for_T;
 
-    save_transient_registers();
+    MR_save_transient_registers();
     success = ML_arg(type_info, &Term, ArgumentIndex,
         &arg_type_info, &argument_ptr);
-    restore_transient_registers();
+    MR_restore_transient_registers();
 
     if (success) {
         /* Allocate enough room for a univ */
-        incr_hp_msg(ArgumentUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+        MR_incr_hp_msg(ArgumentUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
         MR_define_univ_fields(ArgumentUniv, arg_type_info, *argument_ptr);
     }
 
@@ -3295,9 +3296,9 @@
     expand_info.need_functor = TRUE;
     expand_info.need_args = TRUE;
 
-    save_transient_registers();
+    MR_save_transient_registers();
     ML_expand(type_info, &Term, &expand_info);
-    restore_transient_registers();
+    MR_restore_transient_registers();
 
         /*
         ** Check for attempts to deconstruct a non-canonical type:
@@ -3313,7 +3314,7 @@
     }
 
         /* Get functor */
-    MR_make_aligned_string(LVALUE_CAST(MR_ConstString, Functor),
+    MR_make_aligned_string(MR_LVALUE_CAST(MR_ConstString, Functor),
         expand_info.functor);
 
         /* Get arity */
@@ -3326,7 +3327,7 @@
     while (--i >= 0) {
 
             /* Create an argument on the heap */
-        incr_hp_msg(Argument, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+        MR_incr_hp_msg(Argument, 2, MR_PROC_LABEL, ""std_util:univ/0"");
         MR_define_univ_fields(Argument,
             expand_info.arg_type_infos[i],
             expand_info.arg_values[i + expand_info.num_extra_args]);
@@ -3392,7 +3393,7 @@
             functor_desc = type_ctor_info->type_functors.functors_notag;
             exp_type_info = MR_pseudo_type_info_is_ground(
                 functor_desc->MR_notag_functor_arg_type);
-            incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+            MR_incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
             MR_define_univ_fields(ExpUniv, exp_type_info, value);
             SUCCESS_INDICATOR = TRUE;
             break;
@@ -3403,7 +3404,7 @@
             exp_type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
                 functor_desc->MR_notag_functor_arg_type);
-            incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+            MR_incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
             MR_define_univ_fields(ExpUniv, exp_type_info, value);
             SUCCESS_INDICATOR = TRUE;
             break;
@@ -3434,7 +3435,7 @@
         case MR_TYPECTOR_REP_EQUIV:
             exp_type_info = MR_pseudo_type_info_is_ground(
                 type_ctor_info->type_layout.layout_equiv);
-            incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+            MR_incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
             MR_define_univ_fields(ExpUniv, exp_type_info, value);
             SUCCESS_INDICATOR = TRUE;
             break;
@@ -3443,7 +3444,7 @@
             exp_type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
                 type_ctor_info->type_layout.layout_equiv);
-            incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
+            MR_incr_hp_msg(ExpUniv, 2, MR_PROC_LABEL, ""std_util:univ/0"");
             MR_define_univ_fields(ExpUniv, exp_type_info, value);
             SUCCESS_INDICATOR = TRUE;
             break;
@@ -3555,7 +3556,7 @@
                                 functor_desc->MR_du_functor_arg_types[i]);
                         }
 
-                        incr_hp_msg(arg, 2, MR_PROC_LABEL,
+                        MR_incr_hp_msg(arg, 2, MR_PROC_LABEL,
                             ""std_util:univ/0"");
                         MR_define_univ_fields(arg,
                             arg_type_info, arg_vector[i]);
Index: library/store.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/store.m,v
retrieving revision 1.24
diff -u -b -r1.24 store.m
--- library/store.m	2000/10/16 01:33:50	1.24
+++ library/store.m	2000/10/21 11:09:53
@@ -247,7 +247,7 @@
 :- pragma c_code(new_mutvar(Val::in, Mutvar::out, S0::di, S::uo),
 		will_not_call_mercury,
 "
-	incr_hp_msg(Mutvar, 1, MR_PROC_LABEL, ""store:mutvar/2"");
+	MR_incr_hp_msg(Mutvar, 1, MR_PROC_LABEL, ""store:mutvar/2"");
 	* (MR_Word *) Mutvar = Val;
 	S = S0;
 ").
@@ -273,7 +273,7 @@
 :- pragma c_code(unsafe_new_uninitialized_mutvar(Mutvar::out, S0::di, S::uo),
 		will_not_call_mercury,
 "
-	incr_hp_msg(Mutvar, 1, MR_PROC_LABEL, ""store:mutvar/2"");
+	MR_incr_hp_msg(Mutvar, 1, MR_PROC_LABEL, ""store:mutvar/2"");
 	S = S0;
 ").
 
@@ -287,7 +287,7 @@
 :- pragma c_code(new_ref(Val::di, Ref::out, S0::di, S::uo),
 		will_not_call_mercury,
 "
-	incr_hp_msg(Ref, 1, MR_PROC_LABEL, ""store:ref/2"");
+	MR_incr_hp_msg(Ref, 1, MR_PROC_LABEL, ""store:ref/2"");
 	* (MR_Word *) Ref = Val;
 	S = S0;
 ").
@@ -335,7 +335,7 @@
 	type_info = (MR_TypeInfo) TypeInfo_for_T;
 	exp_arg_type_info = (MR_TypeInfo) TypeInfo_for_ArgT;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 
 	if (!ML_arg(type_info, (MR_Word *) Ref, ArgNum,
 			&arg_type_info, &arg_ref))
@@ -350,7 +350,7 @@
 		MR_fatal_error(""store__arg_ref: argument has wrong type"");
 	}
 
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	ArgRef = (MR_Word) arg_ref;
 	S = S0;
@@ -367,7 +367,7 @@
 	type_info = (MR_TypeInfo) TypeInfo_for_T;
 	exp_arg_type_info = (MR_TypeInfo) TypeInfo_for_ArgT;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 
 	if (!ML_arg(type_info, (MR_Word *) &Val, ArgNum,
 			&arg_type_info, &arg_ref))
@@ -383,7 +383,7 @@
 			""store__new_arg_ref: argument has wrong type"");
 	}
 
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	/*
 	** For no_tag types, the argument may have the same address as the
@@ -393,7 +393,7 @@
 	*/
 
 	if (arg_ref == &Val) {
-		incr_hp_msg(ArgRef, 1, MR_PROC_LABEL, ""store:ref/2"");
+		MR_incr_hp_msg(ArgRef, 1, MR_PROC_LABEL, ""store:ref/2"");
 		* (MR_Word *) ArgRef = Val;
 	} else {
 		ArgRef = (MR_Word) arg_ref;
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.136
diff -u -b -r1.136 string.m
--- library/string.m	2000/11/13 08:06:16	1.136
+++ library/string.m	2000/11/14 01:27:26
@@ -1344,9 +1344,9 @@
 :- func format_float(string, float) = string.
 :- pragma c_code(format_float(FormatStr::in, Val::in) = (Str::out),
 		[will_not_call_mercury, thread_safe], "{
-	save_transient_hp();
+	MR_save_transient_hp();
 	Str = MR_make_string(MR_PROC_LABEL, FormatStr, (long double) Val);
-	restore_transient_hp();
+	MR_restore_transient_hp();
 }").
 
 	% Create a string from a int using the format string.
@@ -1355,9 +1355,9 @@
 :- func format_int(string, int) = string.
 :- pragma c_code(format_int(FormatStr::in, Val::in) = (Str::out),
 		[will_not_call_mercury, thread_safe], "{
-	save_transient_hp();
+	MR_save_transient_hp();
 	Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
-	restore_transient_hp();
+	MR_restore_transient_hp();
 }").
 
 	% Create a string from a string using the format string.
@@ -1375,9 +1375,9 @@
 :- func format_char(string, char) = string.
 :- pragma c_code(format_char(FormatStr::in, Val::in) = (Str::out),
 		[will_not_call_mercury, thread_safe], "{
-	save_transient_hp();
+	MR_save_transient_hp();
 	Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
-	restore_transient_hp();
+	MR_restore_transient_hp();
 }").
 
 %-----------------------------------------------------------------------------%
@@ -1707,7 +1707,8 @@
 	MR_Word tmp;
 	if (Start < 0) Start = 0;
 	if (Count <= 0) {
-		MR_make_aligned_string(LVALUE_CAST(MR_ConstString, SubString),
+		MR_make_aligned_string(
+			MR_LVALUE_CAST(MR_ConstString, SubString),
 			"""");
 	} else {
 		len = strlen(Str);
@@ -1752,7 +1753,7 @@
 	MR_Integer len;
 	MR_Word tmp;
 	if (Count <= 0) {
-		MR_make_aligned_string(LVALUE_CAST(MR_ConstString, Left),
+		MR_make_aligned_string(MR_LVALUE_CAST(MR_ConstString, Left),
 			"""");
 		Right = Str;
 	} else {
Index: library/table_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/table_builtin.m,v
retrieving revision 1.2
diff -u -b -r1.2 table_builtin.m
--- library/table_builtin.m	2000/10/16 01:33:52	1.2
+++ library/table_builtin.m	2000/10/21 10:08:27
@@ -878,7 +878,7 @@
 		&mercury_data___type_ctor_info_float_0);
 #else
 	MR_TABLE_SAVE_ANSWER(table, Offset,
-		float_to_word(F),
+		MR_float_to_word(F),
 		&mercury_data___type_ctor_info_float_0);
 #endif
 ").
@@ -923,7 +923,7 @@
 #ifdef MR_HIGHLEVEL_CODE
 	F = MR_unbox_float(MR_TABLE_GET_ANSWER(table, Offset));
 #else
-	F = word_to_float(MR_TABLE_GET_ANSWER(table, Offset));
+	F = MR_word_to_float(MR_TABLE_GET_ANSWER(table, Offset));
 #endif
 ").
 
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury.c,v
retrieving revision 1.15
diff -u -b -r1.15 mercury.c
--- runtime/mercury.c	2000/11/14 16:28:33	1.15
+++ runtime/mercury.c	2000/11/15 03:07:21
@@ -17,7 +17,7 @@
 #include "mercury.h"
 #include "mercury_type_info.h"	/* for MR_TYPECTOR_REP* */
 #include "mercury_misc.h"	/* for MR_fatal_error() */
-#include "mercury_heap.h"	/* for create[1-3]() prototypes */
+#include "mercury_heap.h"	/* for MR_create[1-3]() prototypes */
 
 #ifdef MR_HIGHLEVEL_CODE
 
@@ -943,7 +943,7 @@
 /* provide definitions for functions declared `extern inline' */
 
 MR_Word
-create1(MR_Word w1) 
+MR_create1(MR_Word w1) 
 {
 	MR_Word *p = (MR_Word *) MR_new_object(MR_Word,
 		1 * sizeof(MR_Word), "create1");
@@ -952,7 +952,7 @@
 }
 
 MR_Word
-create2(MR_Word w1, MR_Word w2) 
+MR_create2(MR_Word w1, MR_Word w2) 
 {
 	MR_Word *p = (MR_Word *) MR_new_object(MR_Word,
 		2 * sizeof(MR_Word), "create2");
@@ -962,7 +962,7 @@
 }
 
 MR_Word
-create3(MR_Word w1, MR_Word w2, MR_Word w3) 
+MR_create3(MR_Word w1, MR_Word w2, MR_Word w3) 
 {
 	MR_Word *p = (MR_Word *) MR_new_object(MR_Word,
 		3 * sizeof(MR_Word), "create3");
Index: runtime/mercury_accurate_gc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_accurate_gc.c,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_accurate_gc.c
--- runtime/mercury_accurate_gc.c	2000/11/07 08:58:32	1.9
+++ runtime/mercury_accurate_gc.c	2000/11/13 02:54:31
@@ -19,13 +19,16 @@
 /*
 ** Function prototypes.
 */
-static	void	garbage_collect(MR_Code *saved_success, MR_Word *stack_pointer,
+static	void	garbage_collect(MR_Code *saved_success,
+			MR_Word *stack_pointer,
 			MR_Word *max_frame, MR_Word *current_frame);
 static	void	garbage_collect_roots(void);
 static	void	copy_long_value(MR_Long_Lval locn, MR_TypeInfo type_info, 
-		bool copy_regs, MR_Word *stack_pointer, MR_Word *current_frame);
+			bool copy_regs, MR_Word *stack_pointer,
+			MR_Word *current_frame);
 static	void	copy_short_value(MR_Short_Lval locn, MR_TypeInfo type_info,
-		bool copy_regs, MR_Word *stack_pointer, MR_Word *current_frame);
+			bool copy_regs, MR_Word *stack_pointer,
+			MR_Word *current_frame);
 
 /*
 ** Global variables (only used in this module, however).
@@ -158,7 +161,7 @@
 	if (MR_DETISM_DET_STACK(determinism)) {
 
 		if (type != MR_LONG_LVAL_TYPE_STACKVAR) {
-			fatal_error("can only handle stackvars");
+			MR_fatal_error("can only handle stackvars");
 		}
 
 		/*
@@ -170,7 +173,7 @@
 	} else {
 		/*
 		** XXX we don't support nondet stack frames yet.
-		fatal_error("cannot schedule in nondet stack frame");
+		MR_fatal_error("cannot schedule in nondet stack frame");
 		*/
 
 		saved_success_location = &MR_based_framevar(curfr_at_signal,
@@ -210,15 +213,15 @@
         /* record that the collector is running */
 	gc_running = TRUE;
 
-	save_registers();
+	MR_save_registers();
 	garbage_collect(saved_success, MR_sp, MR_maxfr, MR_curfr);
-	restore_registers();
+	MR_restore_registers();
 	gc_scheduled = FALSE;
 	gc_running = FALSE;
 
 	MR_succip = saved_success;
-	proceed();
-	fatal_error("Unreachable code reached");
+	MR_proceed();
+	MR_fatal_error("Unreachable code reached");
 
 END_MODULE
 
@@ -239,16 +242,16 @@
     int                             i, count;
     const MR_Stack_Layout_Label     *internal_layout;
     const MR_Stack_Layout_Vars      *vars;
-    MemoryZone                      *old_heap, *new_heap;
+    MR_MemoryZone                   *old_heap, *new_heap;
     MR_TypeInfoParams               type_params;
     bool                            succeeded;
     bool                            top_frame = TRUE;
     MR_MemoryList                   allocated_memory_cells = NULL;
     MR_Word                            *old_hp, *new_hp;
     MR_Stack_Layout_Entry           *entry_layout;
-    MR_Word                            *first_stack_pointer,
-    					*first_current_frame,
-    					*first_max_frame;
+    MR_Word                         *first_stack_pointer;
+    MR_Word                         *first_current_frame,
+    MR_Word                         *first_max_frame;
 
     old_heap = MR_ENGINE(heap_zone);
     new_heap = MR_ENGINE(heap_zone2);
@@ -275,7 +278,7 @@
     ** Swap the two heaps.
     */
     {
-        MemoryZone *tmp;
+        MR_MemoryZone *tmp;
 
         tmp = MR_ENGINE(heap_zone2);
         MR_ENGINE(heap_zone2) = MR_ENGINE(heap_zone);
@@ -402,7 +405,7 @@
             (MR_Word **) &stack_pointer, &current_frame, &problem);
 
         if (result == STEP_ERROR_BEFORE || result == STEP_ERROR_AFTER) {
-            fatal_error(problem);
+            MR_fatal_error(problem);
         } 
 */
 
@@ -557,8 +560,8 @@
 ** 	Copies a value in a register or stack frame,
 ** 	replacing the original with the new copy.
 **
-** 	The copying is done using agc_deep_copy, which is
-** 	the accurate GC version of deep_copy (it leaves
+** 	The copying is done using MR_agc_deep_copy, which is
+** 	the accurate GC version of MR_deep_copy (it leaves
 ** 	forwarding pointers in the old copy of the data, if
 ** 	it is on the old heap).
 */
@@ -572,8 +575,8 @@
 	switch (MR_LONG_LVAL_TYPE(locn)) {
 		case MR_LONG_LVAL_TYPE_R:
 			if (copy_regs) {
-				virtual_reg(locn_num) = agc_deep_copy(
-					&virtual_reg(locn_num), type_info,
+				MR_virtual_reg(locn_num) = agc_deep_copy(
+					&MR_virtual_reg(locn_num), type_info,
 					MR_ENGINE(heap_zone2->min),
 					MR_ENGINE(heap_zone2->hardmax));
 			}
@@ -584,7 +587,7 @@
 
 		case MR_LONG_LVAL_TYPE_STACKVAR:
 			MR_based_stackvar(stack_pointer, locn_num) =
-				agc_deep_copy(&MR_based_stackvar(
+				MR_agc_deep_copy(&MR_based_stackvar(
 						stack_pointer,locn_num),
 					type_info, MR_ENGINE(heap_zone2->min),
 					MR_ENGINE(heap_zone2->hardmax));
@@ -592,7 +595,7 @@
 
 		case MR_LONG_LVAL_TYPE_FRAMEVAR:
 			MR_based_framevar(current_frame, locn_num) =
-				agc_deep_copy(
+				MR_agc_deep_copy(
 				&MR_based_framevar(current_frame, locn_num),
 				type_info,
 				MR_ENGINE(heap_zone2->min),
@@ -622,7 +625,7 @@
 			break;
 
 		default:
-			fatal_error("Unknown MR_Long_Lval_Type in copy_long_value");
+			MR_fatal_error("Unknown MR_Long_Lval_Type in copy_long_value");
 			break;
 	}
 }
@@ -682,7 +685,7 @@
 	MR_RootList current = root_list;
 
 	while (current != NULL) {
-		*current->root = agc_deep_copy(current->root,
+		*current->root = MR_agc_deep_copy(current->root,
 			current->type_info, MR_ENGINE(heap_zone2->min), 
 			MR_ENGINE(heap_zone2->hardmax));
 		current = current->next;
Index: runtime/mercury_agc_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_agc_debug.c,v
retrieving revision 1.12
diff -u -b -r1.12 mercury_agc_debug.c
--- runtime/mercury_agc_debug.c	2000/11/07 08:58:32	1.12
+++ runtime/mercury_agc_debug.c	2000/11/13 03:56:45
@@ -18,7 +18,7 @@
 /*
 ** Function prototypes.
 */
-static	void	dump_long_value(MR_Long_Lval locn, MemoryZone *heap_zone,
+static	void	dump_long_value(MR_Long_Lval locn, MR_MemoryZone *heap_zone,
 			MR_Word * stack_pointer, MR_Word *current_frame,
 			bool do_regs);
 static	void	dump_short_value(MR_Short_Lval locn, MemoryZone *heap_zone,
@@ -35,7 +35,7 @@
 MR_agc_dump_roots(MR_RootList roots)
 {
 #ifdef NATIVE_GC
-	MR_Word	saved_regs[MAX_FAKE_REG];
+	MR_Word	saved_regs[MR_MAX_FAKE_REG];
 
 	fflush(NULL);
 	fprintf(stderr, "Dumping roots\n");
@@ -50,8 +50,8 @@
 		** call Mercury soon, and we don't want it messing with
 		** the saved registers).
 		*/
-		restore_registers();
-		MR_copy_regs_to_saved_regs(MAX_FAKE_REG, saved_regs);
+		MR_restore_registers();
+		MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG, saved_regs);
 
 		MR_hp = MR_ENGINE(debug_heap_zone->min);
 		MR_virtual_hp = MR_ENGINE(debug_heap_zone->min);
@@ -61,8 +61,8 @@
 		fflush(NULL);
 		fprintf(stderr, "\n");
 
-		MR_copy_saved_regs_to_regs(MAX_FAKE_REG, saved_regs);
-		save_registers();
+		MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG, saved_regs);
+		MR_save_registers();
 		roots = roots->next;
 	}
   #endif /* MR_DEBUG_AGC_PRINT_VARS */
@@ -160,11 +160,11 @@
 }
 
 void
-MR_agc_dump_stack_frames(MR_Internal *label, MemoryZone *heap_zone,
+MR_agc_dump_stack_frames(MR_Internal *label, MR_MemoryZone *heap_zone,
 	MR_Word *stack_pointer, MR_Word *current_frame)
 {
 #ifdef NATIVE_GC
-	MR_Word saved_regs[MAX_FAKE_REG];
+	MR_Word saved_regs[MR_MAX_FAKE_REG];
 	int i, short_var_count, long_var_count;
 	const MR_Stack_Layout_Vars *vars;
 	MR_Word *type_params, type_info, value;
@@ -206,7 +206,7 @@
 			type = MR_LONG_LVAL_TYPE(location);
 			number = MR_LONG_LVAL_NUMBER(location);
 			if (type != MR_LONG_LVAL_TYPE_STACKVAR) {
-				fatal_error("can only handle stackvars");
+				MR_fatal_error("can only handle stackvars");
 			}
 			                                
 			success_ip = (MR_Code *) 
@@ -236,7 +236,7 @@
 	MR_TypeInfo type_info;
 	MR_Word value;
 	MR_TypeInfoParams type_params;
-        MR_Word saved_regs[MAX_FAKE_REG];
+        MR_Word saved_regs[MR_MAX_FAKE_REG];
         MR_Word *current_regs;
 
 	vars = &(layout->MR_sll_var_info);
@@ -250,7 +250,7 @@
 	** not live yet for any call except the top one.
 	*/
 	restore_registers();
-	MR_copy_regs_to_saved_regs(MAX_FAKE_REG, saved_regs);
+	MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG, saved_regs);
 	if (top_frame) {
 		current_regs = saved_regs;
 	} else {
@@ -322,13 +322,13 @@
 	}
 
 
-	MR_copy_saved_regs_to_regs(MAX_FAKE_REG, saved_regs);
+	MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG, saved_regs);
 	save_registers();
 	free(type_params);
 }
 
 static void
-dump_long_value(MR_Long_Lval locn, MemoryZone *heap_zone, 
+dump_long_value(MR_Long_Lval locn, MR_MemoryZone *heap_zone, 
 	MR_Word *stack_pointer, MR_Word *current_frame, bool do_regs)
 {
 #ifdef NATIVE_GC
@@ -341,7 +341,7 @@
 	switch (MR_LONG_LVAL_TYPE(locn)) {
 		case MR_LONG_LVAL_TYPE_R:
 			if (do_regs) {
-				value = virtual_reg(locn_num);
+				value = MR_virtual_reg(locn_num);
 				have_value = TRUE;
 				fprintf(stderr, "r%d\t", locn_num);
 			} else {
Index: runtime/mercury_agc_debug.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_agc_debug.h,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_agc_debug.h
--- runtime/mercury_agc_debug.h	2000/11/07 08:58:32	1.4
+++ runtime/mercury_agc_debug.h	2000/11/08 06:38:42
@@ -14,7 +14,7 @@
 
 #include "mercury_types.h"		/* for MR_Word */
 #include "mercury_label.h"		/* for MR_Internal */
-#include "mercury_memory_zones.h"	/* for MemoryZone */
+#include "mercury_memory_zones.h"	/* for MR_MemoryZone */
 #include "mercury_accurate_gc.h"	/* for MR_RootList */
 
 /*---------------------------------------------------------------------------*/
@@ -28,8 +28,9 @@
 ** 	which the data is stored upon. 
 */
 
-extern	void	MR_agc_dump_stack_frames(MR_Internal *label, MemoryZone
-		*heap_zone, MR_Word *stack_pointer, MR_Word *current_frame);
+extern	void	MR_agc_dump_stack_frames(MR_Internal *label,
+			MR_MemoryZone *heap_zone,
+			MR_Word *stack_pointer, MR_Word *current_frame);
 
 /*
 ** MR_agc_dump_nondet_stack_frames:
@@ -40,8 +41,8 @@
 ** 	which the data is stored upon. 
 */
 extern	void	MR_agc_dump_nondet_stack_frames(MR_Internal *label,
-			MemoryZone *heap_zone, Word *stack_pointer,
-			Word *current_frame, Word *max_frame);
+			MR_MemoryZone *heap_zone, MR_Word *stack_pointer,
+			MR_Word *current_frame, MR_Word *max_frame);
 
 /*
 ** MR_agc_dump_roots:
Index: runtime/mercury_bootstrap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_bootstrap.h,v
retrieving revision 1.16
diff -u -b -r1.16 mercury_bootstrap.h
--- runtime/mercury_bootstrap.h	2000/10/16 01:33:55	1.16
+++ runtime/mercury_bootstrap.h	2000/11/14 02:42:55
@@ -15,6 +15,205 @@
 #ifndef	MERCURY_BOOTSTRAP_H
 #define	MERCURY_BOOTSTRAP_H
 
+#define	r1				MR_r1
+#define	r2				MR_r2
+#define	r3				MR_r3
+#define	r4				MR_r4
+#define	r5				MR_r5
+#define	r6				MR_r6
+#define	r7				MR_r7
+#define	r8				MR_r8
+#define	r9				MR_r9
+#define	r10				MR_r10
+#define	r11				MR_r11
+#define	r12				MR_r12
+#define	r13				MR_r13
+#define	r14				MR_r14
+#define	r15				MR_r15
+#define	r16				MR_r16
+#define	r17				MR_r17
+#define	r18				MR_r18
+#define	r19				MR_r19
+#define	r20				MR_r20
+#define	r21				MR_r21
+#define	r22				MR_r22
+#define	r23				MR_r23
+#define	r24				MR_r24
+#define	r25				MR_r25
+#define	r26				MR_r26
+#define	r27				MR_r27
+#define	r28				MR_r28
+#define	r29				MR_r29
+#define	r30				MR_r30
+#define	r31				MR_r31
+#define	r32				MR_r32
+
+#define	r(N)				MR_r(N)
+
+#define	NUM_REAL_REGS			MR_NUM_REAL_REGS
+
+#define	progname			MR_progname
+#define	program_entry_point		MR_program_entry_point
+#define	address_of_init_gc		MR_address_of_init_gc
+#define	address_of_init_modules		MR_address_of_init_modules
+#define	address_of_init_modules_debugger	\
+					MR_address_of_init_modules_debugger
+#define	address_of_init_modules_type_tables	\
+					MR_address_of_init_modules_type_tables
+#define	do_init_modules			MR_do_init_modules
+#define	do_init_modules_debugger	MR_do_init_modules_debugger
+#define	do_init_modules_type_tables	MR_do_init_modules_type_tables
+#define	time_at_last_stat		MR_time_at_last_stat
+#define	time_at_start			MR_time_at_start
+
+#define	deep_copy(w, ti, l, u)		MR_deep_copy((w), (ti), (l), (u))
+#define	agc_deep_copy(w, ti, l, u)	MR_agc_deep_copy((w), (ti), (l), (u))
+
+#define	init_context(context)		MR_init_context(context)
+#define	create_context()		MR_create_context()
+#define	destroy_context(context)	MR_destroy_context(context)
+#define	init_thread_stuff(context)	MR_init_thread_stuff(context)
+#define	finalize_runqueue()		MR_finalize_runqueue()
+#define	flounder()			MR_flounder()
+#define	schedule(context)		MR_schedule(context)
+#define	set_min_heap_reclamation_point(c) MR_set_min_heap_reclamation_point(c)
+#define	save_hp_in_context(context)	MR_save_hp_in_context(context)
+#define	load_context(cptr)		MR_load_context(cptr)
+#define	save_context(cptr)		MR_save_context(cptr)
+
+#define	load_engine_regs(eng)		MR_load_engine_regs(eng)
+#define	save_engine_regs(eng)		MR_save_engine_regs(eng)
+
+#define	tag_incr_hp_n(d, t, c)		MR_tag_incr_hp_n((d), (t), (c))
+#define	tag_incr_hp_atomic(d, t, c)	MR_tag_incr_hp_atomic((d), (t), (c))
+#define	tag_incr_hp(d, t, c)		MR_tag_incr_hp((d), (t), (c))
+#define	mark_hp(d)			MR_mark_hp((d))
+#define	restore_hp(d)			MR_restore_hp((d))
+#define	hp_alloc(c)			MR_hp_alloc((c))
+#define	hp_alloc_atomic(c)		MR_hp_alloc_atomic((c))
+#define	tag_incr_hp_msg(d, t, c, p, ty)	MR_tag_incr_hp_msg((d), (t),	    \
+						(c), p, (ty))
+#define	tag_incr_hp_atomic_msg(d, t, c, p, ty)				    \
+					MR_tag_incr_hp_atomic_msg((d), (t), \
+						(c), p, (ty))
+#define	incr_hp(d, c)			MR_incr_hp((d), (c))
+#define	incr_hp_msg(d, c, p, t)		MR_incr_hp_msg((d), (c), p, (t))
+#define	incr_hp_atomic(d, c)		MR_incr_hp_atomic((d), (c))
+#define	incr_hp_atomic_msg(d, c, p, t)	MR_incr_hp_atomic_msg((d), (c), p, (t))
+#define	incr_saved_hp(A, B)		MR_incr_saved_hp((A), (B))
+#define	incr_saved_hp_atomic(A, B)	MR_incr_saved_hp_atomic((A), (B))
+#define	save_transient_hp()		MR_save_transient_hp()
+#define	restore_transient_hp()		MR_restore_transient_hp()
+
+#define	create1(w1)			MR_create1((w1))
+#define	create2(w1, w2)			MR_create2((w1), (w2))
+#define	create3(w1, w2, w3)		MR_create3((w1), (w2), (w3))
+#define	create1_msg(w1, p, t)		MR_create1_msg((w1), p, (t))
+#define	create2_msg(w1, w2, p, t)	MR_create2_msg((w1), (w2), p, (t))
+#define	create3_msg(w1, w2, w3, p, t)	MR_create3_msg((w1), (w2), (w3), p, (t))
+
+#define	paste(a,b)			MR_paste(a,b)
+#define	stringify(s)			MR_stringify(s)
+#define	entry(label)			MR_entry(label)
+#define	skip(label)			MR_skip(label)
+
+#define	make_label(n, a, l)		MR_make_label((n), (a), (l))
+#define	make_label_ai(n, a, l)		MR_make_label_ai((n), (a), (l))
+#define	make_label_sl(n, a, l)		MR_make_label_sl((n), (a), (l))
+#define	make_local(n, a, l)		MR_make_local((n), (a), (l))
+#define	make_local_ai(n, a, l)		MR_make_local_ai((n), (a), (l))
+#define	make_local_sl(n, a, l)		MR_make_local_sl((n), (a), (l))
+#define	make_entry(n, a, l)		MR_make_entry((n), (a), (l))
+#define	make_entry_ai(n, a, l)		MR_make_entry_ai((n), (a), (l))
+#define	make_entry_sl(n, a, l)		MR_make_entry_sl((n), (a), (l))
+
+#define	init_label(l)			MR_init_label(l)
+#define	init_label_ai(l)		MR_init_label_ai(l)
+#define	init_label_sl(l)		MR_init_label_sl(l)
+#define	init_local(l)			MR_init_local(l)
+#define	init_local_ai(l)		MR_init_local_ai(l)
+#define	init_local_sl(l)		MR_init_local_sl(l)
+#define	init_entry(l)			MR_init_entry(l)
+#define	init_entry_ai(l)		MR_init_entry_ai(l)
+#define	init_entry_sl(l)		MR_init_entry_sl(l)
+
+#define	Declare_entry(l)		MR_declare_entry(l)
+#define	Define_extern_entry(l)		MR_define_extern_entry(l)
+#define	Define_entry(l)			MR_define_entry(l)
+#define	Declare_static(l)		MR_declare_static(l)
+#define	Define_static(l)		MR_define_static(l)
+#define	Declare_local(l)		MR_declare_local(l)
+#define	Define_local(l)			MR_define_local(l)
+#define	Declare_label(l)		MR_declare_label(l)
+#define	Define_label(l)			MR_define_label(l)
+
+#define	ASM_JUMP(label)			MR_ASM_JUMP(label)
+#define	JUMP(label)			MR_JUMP(label)
+#define	ENTRY(label)			MR_ENTRY(label)
+#define	STATIC(label)			MR_STATIC(label)
+#define	LOCAL(label)			MR_LOCAL(label)
+#define	LABEL(label)			MR_LABEL(label)
+#define	GOTO(label)			MR_GOTO(label)
+#define	GOTO_ENTRY(label)		MR_GOTO_ENTRY(label)
+#define	GOTO_STATIC(label)		MR_GOTO_STATIC(label)
+#define	GOTO_LOCAL(label)		MR_GOTO_LOCAL(label)
+#define	GOTO_LABEL(label)		MR_GOTO_LABEL(label)
+
+/*
+** These two cannot be defined in terms of their MR_ equivalents,
+** since that loses token structure. We therefore duplicate the definition.
+*/
+
+#define	COMPUTED_GOTO(val, labels)			\
+	{						\
+		static MR_Code *jump_table[] = {	\
+			labels				\
+		};					\
+		MR_GOTO(jump_table[val]);		\
+	}
+
+#define	AND				,
+
+#define	BEGIN_MODULE(m)			MR_BEGIN_MODULE(m)
+#define	BEGIN_CODE			MR_BEGIN_CODE
+#define	END_MODULE			MR_END_MODULE
+
+#define	ModuleFunc			MR_ModuleFunc
+
+#define	noprof_localcall(label)		MR_noprof_localcall(label)
+#define	noprof_call(label, cont)	MR_noprof_call(label, cont)
+#define	noprof_call_localret(label, cont)	\
+					MR_noprof_call_localret(label, cont)
+#define	localcall(label, cont, cur)	MR_localcall(label, cont, cur)
+#define	call(proc, cont, cur)		MR_call(proc, cont, cur)
+#define	call_localret(proc, cont, cur)	MR_call_localret(proc, cont, cur)
+#define	localtailcall(label, cur)	MR_localtailcall(label, cur)
+#define	tailcall(proc, cur)		MR_tailcall(proc, (cur))
+#define	noprof_tailcall(proc)		MR_noprof_tailcall(proc)
+#define	proceed()			MR_proceed()
+
+#define	set_prof_current_proc(target)	 MR_set_prof_current_proc(target)
+#define	update_prof_current_proc(target) MR_update_prof_current_proc(target)
+
+#define	float_to_word(f)		MR_float_to_word(f)
+#define	word_to_float(w)		MR_word_to_float(w)
+#define	float_const(f)			MR_float_const(f)
+#define	hash_float(f)			MR_hash_float(f)
+
+#if 0
+/*
+** All the places that use these macros
+** should have been updated to use the new forms.
+*/
+#define LVALUE_CAST(type, lval)		MR_LVALUE_CAST((type), (lval))
+#define LVALUE_SEQ(expr, lval)		MR_LVALUE_SEQ((expr), (lval))
+#define LVALUE_COND(expr, x, y)		MR_LVALUE_COND((expr), (x), (y))
+
+#define	count_usage(num, reg)		MR_count_usage((num), (reg))
+#define	saved_reg(save_area, n)		MR_saved_reg((save_area), (n))
+#define	virtual_reg(n)			MR_virtual_reg((n))
+#endif
+
 /*---------------------------------------------------------------------------*/
 /*
 ** This stuff is enabled by default,
@@ -25,6 +224,26 @@
 
 #ifndef MR_NO_BACKWARDS_COMPAT
 
+#define	save_regs_to_mem(save_area)					\
+				MR_save_regs_to_mem(save_area)
+#define	restore_regs_from_mem(save_area) 				\
+				MR_restore_regs_from_mem(save_area)
+
+#define	save_transient_regs_to_mem(save_area)				\
+				MR_save_transient_regs_to_mem(save_area)
+#define	restore_transient_regs_from_mem(save_area)			\
+				MR_restore_transient_regs_from_mem(save_area)
+
+#define	save_registers()		MR_save_registers()
+#define	restore_registers()		MR_restore_registers()
+
+#define	save_transient_registers()	MR_save_transient_registers()
+#define	restore_transient_registers()	MR_restore_transient_registers()
+
+#define	save_transient_hp()		MR_save_transient_hp()
+#define	restore_transient_hp()		MR_restore_transient_hp()
+
+
 /* 
 ** For a long time the Mercury C types were defined as Char, Float,
 ** Integer, Word, etc.  There will doubtless be lots of C code in
@@ -47,7 +266,6 @@
 typedef MR_ConstString 		ConstString;
 typedef MR_Bool 		Bool;
 
-
 #define	COMPARE_EQUAL		MR_COMPARE_EQUAL
 #define	COMPARE_LESS		MR_COMPARE_LESS
 #define	COMPARE_GREATER		MR_COMPARE_GREATER
@@ -159,130 +377,6 @@
 #define	const_field(t, p, i)	MR_const_field((t), (p), (i))
 #define	mask_field(p, i)	MR_mask_field((p), (i))
 #define	const_mask_field(p, i)	MR_const_mask_field((p), (i))
-
-/*
-** The code generated by Mercury 0.8 includes references to these macros.
-*/
-
-#define MR_OBTAIN_GLOBAL_C_LOCK()	MR_OBTAIN_GLOBAL_LOCK("pragma c code")
-#define MR_RELEASE_GLOBAL_C_LOCK()	MR_RELEASE_GLOBAL_LOCK("pragma c code")
-
-
-/*
-** Generated code will create references to base_type_* which has been
-** renamed.  Builtin types use hand-defined type_ctor_*, so we need to
-** #define the old names for these structures so the stage 1 compiler
-** will link.  The stage 2 compiler will just generate type_ctor_*
-** references anyway, so then these #defines are not needed.
-*/
-
-#define MR_INIT_BASE_TYPE_INFO		MR_INIT_TYPE_CTOR_INFO
-
-#define mercury_data_array__base_type_functors_array_1 \
-	mercury_data_array__type_ctor_functors_array_1 
-
-#define mercury_data_array__base_type_functors_array_1_struct \
-	mercury_data_array__type_ctor_functors_array_1_struct
-
-#define mercury_data_array__base_type_layout_array_1 \
-	mercury_data_array__type_ctor_layout_array_1 
-
-#define mercury_data_array__base_type_layout_array_1_struct \
-	mercury_data_array__type_ctor_layout_array_1_struct
-
-
-#define mercury_data_builtin__base_type_functors_c_pointer_0 \
-	mercury_data_builtin__type_ctor_functors_c_pointer_0 
-
-#define mercury_data_builtin__base_type_functors_c_pointer_0_struct \
-	mercury_data_builtin__type_ctor_functors_c_pointer_0_struct
-
-#define mercury_data_builtin__base_type_layout_c_pointer_0 \
-	mercury_data_builtin__type_ctor_layout_c_pointer_0 
-
-#define mercury_data_builtin__base_type_layout_c_pointer_0_struct \
-	mercury_data_builtin__type_ctor_layout_c_pointer_0_struct
-
-
-#define mercury_data_std_util__base_type_functors_type_info_0 \
-	mercury_data_std_util__type_ctor_functors_type_info_0 
-
-#define mercury_data_std_util__base_type_functors_type_info_0_struct \
-	mercury_data_std_util__type_ctor_functors_type_info_0_struct
-
-#define mercury_data_std_util__base_type_layout_type_info_0 \
-	mercury_data_std_util__type_ctor_layout_type_info_0 
-
-#define mercury_data_std_util__base_type_layout_type_info_0_struct \
-	mercury_data_std_util__type_ctor_layout_type_info_0_struct
-
-
-#define mercury_data_std_util__base_type_functors_univ_0 \
-	mercury_data_std_util__type_ctor_functors_univ_0 
-
-#define mercury_data_std_util__base_type_functors_univ_0_struct \
-	mercury_data_std_util__type_ctor_functors_univ_0_struct
-
-#define mercury_data_std_util__base_type_layout_univ_0 \
-	mercury_data_std_util__type_ctor_layout_univ_0 
-
-#define mercury_data_std_util__base_type_layout_univ_0_struct \
-	mercury_data_std_util__type_ctor_layout_univ_0_struct
-
-#define mercury_data___base_type_info_int_0_struct \
-	mercury_data___type_ctor_info_int_0_struct
-
-#define mercury_data___base_type_info_int_0 \
-	mercury_data___type_ctor_info_int_0
-
-#define mercury_data___base_type_info_string_0_struct \
-	mercury_data___type_ctor_info_string_0_struct
-
-#define mercury_data___base_type_info_string_0 \
-	mercury_data___type_ctor_info_string_0
-
-#define mercury_data___base_type_info_character_0 \
-	mercury_data___type_ctor_info_character_0
-
-#define mercury_data___base_type_info_character_0_struct \
-	mercury_data___type_ctor_info_character_0_struct
-
-#define mercury_data___base_type_info_float_0 \
-	mercury_data___type_ctor_info_float_0
-
-#define mercury_data___base_type_info_float_0_struct \
-	mercury_data___type_ctor_info_float_0_struct
-
-#define mercury_data___base_type_info_pred_0 \
-	mercury_data___type_ctor_info_pred_0
-
-#define mercury_data___base_type_info_pred_0_struct \
-	mercury_data___type_ctor_info_pred_0_struct
-
-#define mercury_data_private_builtin__base_type_info_type_info_1 \
-	mercury_data_private_builtin__type_ctor_info_type_info_1
-
-#define mercury_data_private_builtin__base_type_info_type_info_1_struct \
-	mercury_data_private_builtin__type_ctor_info_type_info_1_struct
-
-
-/*
-** These definitions are needed to bootstrap the change of all
-** type_ctor_info structures to use the MR_TypeCtorInfo type.
-*/
-
-#define mercury_data___type_ctor_info_int_0_struct \
-	MR_TypeCtorInfo_struct
-#define mercury_data___type_ctor_info_string_0_struct \
-	MR_TypeCtorInfo_struct
-#define mercury_data___type_ctor_info_float_0_struct \
-	MR_TypeCtorInfo_struct
-#define mercury_data___type_ctor_info_character_0_struct \
-	MR_TypeCtorInfo_struct
-#define mercury_data___type_ctor_info_pred_0_struct \
-	MR_TypeCtorInfo_struct
-#define mercury_data___type_ctor_info_func_0_struct \
-	MR_TypeCtorInfo_struct
 
 #endif	/* MR_EXTRA_BACKWARDS_COMPAT */
 
Index: runtime/mercury_calls.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_calls.h,v
retrieving revision 1.8
diff -u -b -r1.8 mercury_calls.h
--- runtime/mercury_calls.h	2000/09/14 04:31:24	1.8
+++ runtime/mercury_calls.h	2000/11/13 04:29:40
@@ -14,11 +14,11 @@
 #include "mercury_debug.h"	/* we need to debug them */
 #include "mercury_prof.h"	/* we need to profile them */
 
-#define	noprof_localcall(label, succ_cont)			\
+#define	MR_noprof_localcall(label, succ_cont)			\
 		do {						\
-			debugcall(LABEL(label), (succ_cont));	\
+			MR_debugcall(MR_LABEL(label), (succ_cont));\
 			MR_succip = (succ_cont);			\
-			GOTO_LABEL(label);			\
+			MR_GOTO_LABEL(label);			\
 		} while (0)
 
 /*
@@ -40,87 +40,87 @@
 ** So it is simpler (and more efficient) to just comment it out.
 */
 #if 0
-  #define	noprof_call(proc, succ_cont)			\
+  #define	MR_noprof_call(proc, succ_cont)			\
 		({						\
 			__label__ fixup_gp;			\
-			debugcall((proc), (succ_cont));		\
+			MR_debugcall((proc), (succ_cont));	\
 			MR_succip = (&&fixup_gp);		\
-			GOTO(proc);				\
+			MR_GOTO(proc);				\
 		fixup_gp:					\
 			ASM_FIXUP_REGS				\
-			GOTO(succ_cont); 			\
+			MR_GOTO(succ_cont); 			\
 		})
-	/* same as above, but with GOTO_LABEL rather than GOTO */
-  #define	noprof_call_localret(proc, succ_cont)		\
+	/* same as above, but with MR_GOTO_LABEL rather than MR_GOTO */
+  #define	MR_noprof_call_localret(proc, succ_cont)	\
 		({						\
 			__label__ fixup_gp;			\
-			debugcall((proc), (succ_cont));		\
+			MR_debugcall((proc), (succ_cont));	\
 			MR_succip = (&&fixup_gp);		\
-			GOTO(proc);				\
+			MR_GOTO(proc);				\
 		fixup_gp:					\
 			ASM_FIXUP_REGS				\
-			GOTO_LABEL(succ_cont); 			\
+			MR_GOTO_LABEL(succ_cont); 		\
 		})
 #else
-  #define	noprof_call(proc, succ_cont)			\
+  #define	MR_noprof_call(proc, succ_cont)			\
 		do {						\
-			debugcall((proc), (succ_cont));		\
+			MR_debugcall((proc), (succ_cont));	\
 			MR_succip = (succ_cont);		\
-			GOTO(proc);				\
+			MR_GOTO(proc);				\
 		} while (0)
-  #define noprof_call_localret(proc, succ_cont) 		\
-		noprof_call((proc), LABEL(succ_cont))
+  #define 	MR_noprof_call_localret(proc, succ_cont) 	\
+		MR_noprof_call((proc), MR_LABEL(succ_cont))
 #endif
 
-#define	localcall(label, succ_cont, current_label)		\
+#define	MR_localcall(label, succ_cont, current_label)		\
 		do {						\
-			debugcall(LABEL(label), (succ_cont));	\
+			MR_debugcall(MR_LABEL(label), (succ_cont)); \
 			MR_succip = (succ_cont);		\
-			PROFILE(LABEL(label), (current_label));	\
-			set_prof_current_proc(LABEL(label));	\
-			GOTO_LABEL(label);			\
+			MR_PROFILE(MR_LABEL(label), (current_label)); \
+			MR_set_prof_current_proc(MR_LABEL(label)); \
+			MR_GOTO_LABEL(label);			\
 		} while (0)
 
-#define	call(proc, succ_cont, current_label)			\
+#define	MR_call(proc, succ_cont, current_label)			\
 		do {						\
-			PROFILE((proc), (current_label));	\
-			set_prof_current_proc(proc);		\
-			noprof_call((proc), (succ_cont));	\
+			MR_PROFILE((proc), (current_label));	\
+			MR_set_prof_current_proc(proc);		\
+			MR_noprof_call((proc), (succ_cont));	\
 		} while (0)
 
-#define	call_localret(proc, succ_cont, current_label)		\
+#define	MR_call_localret(proc, succ_cont, current_label)	\
 		do {						\
-			PROFILE((proc), (current_label));	\
-			set_prof_current_proc(proc);		\
-			noprof_call_localret(proc, succ_cont);	\
+			MR_PROFILE((proc), (current_label));	\
+			MR_set_prof_current_proc(proc);		\
+			MR_noprof_call_localret(proc, succ_cont);\
 		} while (0)
 
-#define	localtailcall(label, current_label)			\
+#define	MR_localtailcall(label, current_label)			\
 		do {						\
-			debugtailcall(LABEL(label));		\
-			PROFILE(LABEL(label), (current_label)); \
-			set_prof_current_proc(LABEL(label));	\
-			GOTO_LABEL(label);			\
+			MR_debugtailcall(MR_LABEL(label));	\
+			MR_PROFILE(MR_LABEL(label), (current_label)); \
+			MR_set_prof_current_proc(MR_LABEL(label)); \
+			MR_GOTO_LABEL(label);			\
 		} while (0)
 
-#define	tailcall(proc, current_label)				\
+#define	MR_tailcall(proc, current_label)			\
 		do {						\
-			debugtailcall(proc);			\
-			PROFILE((proc), (current_label));	\
-			set_prof_current_proc(proc);		\
-			GOTO(proc);				\
+			MR_debugtailcall(proc);			\
+			MR_PROFILE((proc), (current_label));	\
+			MR_set_prof_current_proc(proc);		\
+			MR_GOTO(proc);				\
 		} while (0)
 
-#define	noprof_tailcall(proc)					\
+#define	MR_noprof_tailcall(proc)				\
 		do {						\
-			debugtailcall(proc);			\
-			GOTO(proc);				\
+			MR_debugtailcall(proc);			\
+			MR_GOTO(proc);				\
 		} while (0)
 
-#define	proceed()						\
+#define	MR_proceed()						\
 		do {						\
-			debugproceed();				\
-			GOTO(MR_succip);			\
+			MR_debugproceed();			\
+			MR_GOTO(MR_succip);			\
 		} while (0)
 
 #endif /* not MERCURY_CALLS_H */
Index: runtime/mercury_context.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.c,v
retrieving revision 1.26
diff -u -b -r1.26 mercury_context.c
--- runtime/mercury_context.c	2000/10/31 07:54:06	1.26
+++ runtime/mercury_context.c	2000/10/31 07:54:47
@@ -40,10 +40,10 @@
 
 /*
 ** free_context_list is a global linked list of unused context
-** structures. If the MemoryZone pointers are not NULL,
-** then they point to allocated MemoryZones, which will
+** structures. If the MR_MemoryZone pointers are not NULL,
+** then they point to allocated MR_MemoryZones, which will
 ** need to be reinitialized, but have space allocated to
-** them. (see comments in mercury_memory.h about reset_zone())
+** them. (see comments in mercury_memory.h about MR_reset_zone())
 */
 static MR_Context *free_context_list = NULL;
 #ifdef	MR_THREAD_SAFE
@@ -51,7 +51,7 @@
 #endif
 
 void
-init_thread_stuff(void)
+MR_init_thread_stuff(void)
 {
 #ifdef	MR_THREAD_SAFE
 
@@ -75,7 +75,7 @@
 }
 
 void
-finalize_runqueue(void)
+MR_finalize_runqueue(void)
 {
 #ifdef	MR_THREAD_SAFE
 	pthread_mutex_destroy(MR_runqueue_lock);
@@ -85,30 +85,30 @@
 }
 
 void 
-init_context(MR_Context *c)
+MR_init_context(MR_Context *c)
 {
 	c->next = NULL;
 	c->resume = NULL;
 #ifdef	MR_THREAD_SAFE
 	c->owner_thread = (MercuryThread) NULL;
 #endif
-	c->context_succip = ENTRY(do_not_reached);
+	c->context_succip = MR_ENTRY(do_not_reached);
 
 	if (c->detstack_zone != NULL) {
-		reset_redzone(c->detstack_zone);
+		MR_reset_redzone(c->detstack_zone);
 	} else {
-		c->detstack_zone = create_zone("detstack", 0,
-			detstack_size, next_offset(), detstack_zone_size, 
-			default_handler);
+		c->detstack_zone = MR_create_zone("detstack", 0,
+			MR_detstack_size, MR_next_offset(),
+			MR_detstack_zone_size, MR_default_handler);
 	}
 	c->context_sp = c->detstack_zone->min;
 
 	if (c->nondetstack_zone != NULL) {
-		reset_redzone(c->nondetstack_zone);
+		MR_reset_redzone(c->nondetstack_zone);
 	} else {
-		c->nondetstack_zone = create_zone("nondetstack", 0,
-			nondstack_size, next_offset(), nondstack_zone_size,
-			default_handler);
+		c->nondetstack_zone = MR_create_zone("nondetstack", 0,
+			MR_nondstack_size, MR_next_offset(),
+			MR_nondstack_zone_size, MR_default_handler);
 	}
 	/*
 	** Note that maxfr and curfr point to the last word in the frame,
@@ -118,39 +118,39 @@
 	*/
 	c->context_maxfr = c->nondetstack_zone->min + MR_NONDET_FIXED_SIZE - 1;
 	c->context_curfr = c->context_maxfr;
-	MR_redoip_slot(c->context_curfr) = ENTRY(do_not_reached);
+	MR_redoip_slot(c->context_curfr) = MR_ENTRY(do_not_reached);
 	MR_redofr_slot(c->context_curfr) = NULL;
 	MR_prevfr_slot(c->context_curfr) = NULL;
-	MR_succip_slot(c->context_curfr) = ENTRY(do_not_reached);
+	MR_succip_slot(c->context_curfr) = MR_ENTRY(do_not_reached);
 	MR_succfr_slot(c->context_curfr) = NULL;
 
 #ifdef	MR_USE_MINIMAL_MODEL
 	if (c->generatorstack_zone != NULL) {
-		reset_redzone(c->generatorstack_zone);
+		MR_reset_redzone(c->generatorstack_zone);
 	} else {
-		c->generatorstack_zone = create_zone("generatorstack", 0,
-			generatorstack_size, next_offset(),
-			generatorstack_zone_size, default_handler);
+		c->generatorstack_zone = MR_create_zone("generatorstack", 0,
+			MR_generatorstack_size, MR_next_offset(),
+			MR_generatorstack_zone_size, MR_default_handler);
 	}
 	c->context_gen_next = 0;
 
 	if (c->cutstack_zone != NULL) {
-		reset_redzone(c->cutstack_zone);
+		MR_reset_redzone(c->cutstack_zone);
 	} else {
-		c->cutstack_zone = create_zone("cutstack", 0,
-			cutstack_size, next_offset(),
-			cutstack_zone_size, default_handler);
+		c->cutstack_zone = MR_create_zone("cutstack", 0,
+			MR_cutstack_size, MR_next_offset(),
+			MR_cutstack_zone_size, MR_default_handler);
 	}
 	c->context_cut_next = 0;
 #endif
 
 #ifdef MR_USE_TRAIL
 	if (c->trail_zone != NULL) {
-		reset_redzone(c->trail_zone);
+		MR_reset_redzone(c->trail_zone);
 	} else {
-		c->trail_zone = create_zone("trail", 0,
-			trail_size, next_offset(), trail_zone_size, 
-			default_handler);
+		c->trail_zone = MR_create_zone("trail", 0,
+			MR_trail_size, MR_next_offset(),
+			MR_trail_zone_size, MR_default_handler);
 	}
 	c->context_trail_ptr = (MR_TrailEntry *) c->trail_zone->min;
 	c->context_ticket_counter = 1;
@@ -161,7 +161,7 @@
 }
 
 MR_Context *
-create_context(void)
+MR_create_context(void)
 {
 	MR_Context *c;
 
@@ -180,13 +180,13 @@
 		MR_UNLOCK(free_context_list_lock, "create_context ii");
 	}
 
-	init_context(c);
+	MR_init_context(c);
 
 	return c;
 }
 
 void 
-destroy_context(MR_Context *c)
+MR_destroy_context(MR_Context *c)
 {
 	MR_LOCK(free_context_list_lock, "destroy_context");
 	c->next = free_context_list;
@@ -195,7 +195,7 @@
 }
 
 void 
-flounder(void)
+MR_flounder(void)
 {
 	MR_fatal_error("computation floundered");
 }
@@ -207,7 +207,7 @@
 ** block or not.
 */
 static int
-check_pending_contexts(MR_Bool block)
+MR_check_pending_contexts(MR_Bool block)
 {
 #ifdef	MR_CAN_DO_PENDING_IO
 
@@ -224,15 +224,21 @@
 	max_id = -1;
 	for (pctxt = MR_pending_contexts ; pctxt ; pctxt = pctxt -> next) {
 		if (pctxt->waiting_mode & MR_PENDING_READ) {
-			if (max_id > pctxt->fd) max_id = pctxt->fd;
+			if (max_id > pctxt->fd) {
+				max_id = pctxt->fd;
+			}
 			FD_SET(pctxt->fd, &rd_set);
 		}
 		if (pctxt->waiting_mode & MR_PENDING_WRITE) {
-			if (max_id > pctxt->fd) max_id = pctxt->fd;
+			if (max_id > pctxt->fd) {
+				max_id = pctxt->fd;
+			}
 			FD_SET(pctxt->fd, &wr_set);
 		}
 		if (pctxt->waiting_mode & MR_PENDING_EXEC) {
-			if (max_id > pctxt->fd) max_id = pctxt->fd;
+			if (max_id > pctxt->fd) {
+				max_id = pctxt->fd;
+			}
 			FD_SET(pctxt->fd, &ex_set);
 		}
 	}
@@ -265,7 +271,7 @@
 				&& FD_ISSET(pctxt->fd, &ex_set))
 		    )
 		{
-			schedule(pctxt->context);
+			MR_schedule(pctxt->context);
 		}
 	}
 
@@ -278,9 +284,8 @@
 #endif
 }
 
-
 void
-schedule(MR_Context *ctxt)
+MR_schedule(MR_Context *ctxt)
 {
 	ctxt->next = NULL;
 	MR_LOCK(MR_runqueue_lock, "schedule");
@@ -295,13 +300,13 @@
 	MR_UNLOCK(MR_runqueue_lock, "schedule");
 }
 
-Define_extern_entry(do_runnext);
+MR_define_extern_entry(do_runnext);
 
-BEGIN_MODULE(scheduler_module)
-	init_entry_ai(do_runnext);
-BEGIN_CODE
+MR_BEGIN_MODULE(scheduler_module)
+	MR_init_entry_ai(do_runnext);
+MR_BEGIN_CODE
 
-Define_entry(do_runnext);
+MR_define_entry(do_runnext);
 #ifdef MR_THREAD_SAFE
 {
 	MR_Context *tmp, *prev;
@@ -316,7 +321,7 @@
 	while (1) {
 		if (MR_exit_now == TRUE) {
 			MR_UNLOCK(MR_runqueue_lock, "do_runnext (ii)");
-			destroy_thread(MR_cur_engine());
+			MR_destroy_thread(MR_cur_engine());
 		}
 		tmp = MR_runqueue_head;
 		/* XXX check pending io */
@@ -344,8 +349,8 @@
 		MR_runqueue_tail = prev;
 	}
 	MR_UNLOCK(MR_runqueue_lock, "do_runnext (iii)");
-	load_context(MR_ENGINE(this_context));
-	GOTO(MR_ENGINE(this_context)->resume);
+	MR_load_context(MR_ENGINE(this_context));
+	MR_GOTO(MR_ENGINE(this_context)->resume);
 }
 #else /* !MR_THREAD_SAFE */
 {
@@ -354,7 +359,7 @@
 	}
 
 	while (MR_runqueue_head == NULL) {
-		check_pending_contexts(TRUE); /* block */
+		MR_check_pending_contexts(TRUE); /* block */
 	}
 
 	MR_ENGINE(this_context) = MR_runqueue_head;
@@ -363,12 +368,12 @@
 		MR_runqueue_tail = NULL;
 	}
 
-	load_context(MR_ENGINE(this_context));
-	GOTO(MR_ENGINE(this_context)->resume);
+	MR_load_context(MR_ENGINE(this_context));
+	MR_GOTO(MR_ENGINE(this_context)->resume);
 }
 #endif
 
-END_MODULE
+MR_END_MODULE
 
 void mercury_sys_init_scheduler_wrapper(void); /* suppress gcc warning */
 void mercury_sys_init_scheduler_wrapper(void) {
Index: runtime/mercury_context.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.h,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_context.h
--- runtime/mercury_context.h	2000/08/03 06:18:37	1.14
+++ runtime/mercury_context.h	2000/10/25 04:37:58
@@ -15,7 +15,7 @@
 ** Contexts are initally stored in a free-list.
 ** When one is running, the Posix thread that is executing it has a pointer
 ** to its context structure `this_context'. When a context suspends, it
-** calls `save_context(context_ptr)' which copies the context from the
+** calls `MR_save_context(context_ptr)' which copies the context from the
 ** various registers and global variables into the structure referred to
 ** by `context_ptr'. The context contains no rN or fN registers - all
 ** registers are "context save" (by analogy to caller-save).
@@ -49,9 +49,9 @@
 
 #include "mercury_types.h"		/* for MR_Word */
 #include "mercury_trail.h"		/* for MR_TrailEntry */
-#include "mercury_memory.h"		/* for MemoryZone */
+#include "mercury_memory.h"		/* for MR_MemoryZone */
 #include "mercury_thread.h"		/* for MercuryLock */
-#include "mercury_goto.h"		/* for GOTO() */
+#include "mercury_goto.h"		/* for MR_GOTO() */
 
 #ifdef	MR_THREAD_SAFE
   #define MR_IF_THREAD_SAFE(x)	x
@@ -65,9 +65,9 @@
 ** are prefixed with `context_' so that they don't get replaced
 ** during macro expansion.
 */
-typedef struct MR_context_struct MR_Context;
-struct MR_context_struct {
-	struct MR_context_struct *next;	
+typedef struct MR_Context_Struct MR_Context;
+struct MR_Context_Struct {
+	MR_Context	 *next;	
 		/*
 		** if this context is in the free-list `next' will point
 		** to the next free context. If this context is suspended
@@ -95,30 +95,30 @@
 	MR_Code		*context_succip;
 		/* succip for this context */
 
-	MemoryZone	*detstack_zone;
+	MR_MemoryZone	*detstack_zone;
 		/* pointer to the detstack_zone for this context */
 	MR_Word		*context_sp;
 		/* saved stack pointer for this context */
 
-	MemoryZone	*nondetstack_zone;
+	MR_MemoryZone	*nondetstack_zone;
 		/* pointer to the nondetstack_zone for this context */
 	MR_Word		*context_maxfr;
 		/* saved maxfr pointer for this context */
 	MR_Word		*context_curfr;
 		/* saved curfr pointer for this context */
 #ifdef	MR_USE_MINIMAL_MODEL
-	MemoryZone	*generatorstack_zone;
+	MR_MemoryZone	*generatorstack_zone;
 		/* pointer to the generatorstack_zone for this context */
 	MR_Integer		context_gen_next;
 		/* saved generator stack index for this context */
-	MemoryZone	*cutstack_zone;
+	MR_MemoryZone	*cutstack_zone;
 		/* pointer to the cutstack_zone for this context */
 	MR_Integer		context_cut_next;
 		/* saved cut stack index for this context */
 #endif
 
 #ifdef	MR_USE_TRAIL
-	MemoryZone	*trail_zone;
+	MR_MemoryZone	*trail_zone;
 		/* pointer to the MR_trail_zone for this context */
 	MR_TrailEntry	*context_trail_ptr;
 		/* saved MR_trail_ptr for this context */
@@ -173,8 +173,8 @@
 	MR_PENDING_EXEC  = 0x04
 } MR_WaitingMode;
 
-typedef struct MR_PENDING_CONTEXT {
-	struct MR_PENDING_CONTEXT	*next;
+typedef struct MR_PendingContext_Struct {
+	struct MR_PendingContext_Struct	*next;
 	MR_Context			*context;
 	int				fd;
 	MR_WaitingMode			waiting_mode;
@@ -188,49 +188,49 @@
 /*
 ** Initializes a context structure.
 */
-void	init_context(MR_Context *context);
+extern	void		MR_init_context(MR_Context *context);
 
 /*
 ** create_context() allocates and initializes a new context
 ** structure.
 */
-MR_Context *create_context(void);
+extern	MR_Context 	*MR_create_context(void);
 
 /*
 ** destroy_context(ptr) returns the context structure pointed
 ** to by ptr to the free list, and releases resources as
 ** necessary.
 */
-void	destroy_context(MR_Context *context);
+extern	void		MR_destroy_context(MR_Context *context);
 
 /*
 ** init_thread_stuff() initializes the lock structures for the runqueue.
 */
-void	init_thread_stuff(void);
+extern	void		MR_init_thread_stuff(void);
 
 /*
 ** finialize_runqueue() finalizes the lock structures for the runqueue.
 */
-void	finalize_runqueue(void);
+extern	void		MR_finalize_runqueue(void);
 
 /*
 ** flounder() aborts with a runtime error message. It is called if
 ** the runqueue becomes empty and none of the running processes are
 ** working - ie the computation has floundered.
 */
-void	flounder(void);
+extern	void		MR_flounder(void);
 
 /*
 ** schedule(MR_Context *cptr):
 **	Append a context onto the end of the run queue.
 */
 
-void schedule(MR_Context *ctxt);
+extern	void		MR_schedule(MR_Context *ctxt);
 
-Declare_entry(do_runnext);
-#define runnext()						\
+MR_declare_entry(do_runnext);
+#define MR_runnext()						\
 	do {							\
-		GOTO(ENTRY(do_runnext));			\
+		MR_GOTO(MR_ENTRY(do_runnext));			\
 	} while (0)						\
 
 #ifdef	MR_THREAD_SAFE
@@ -249,7 +249,7 @@
 #define MR_fork_new_context(child, parent, numslots) do {		\
 		MR_Context	*f_n_c_context;				\
 		int	fork_new_context_i;				\
-		f_n_c_context = create_context();			\
+		f_n_c_context = MR_create_context();			\
 		IF_MR_THREAD_SAFE(					\
 			f_n_c_context->owner_thread = NULL;		\
 		)							\
@@ -261,8 +261,8 @@
 			f_n_c_context->context_sp++;			\
 		}							\
 		f_n_c_context->resume = (child);			\
-		schedule(f_n_c_context);				\
-		GOTO(parent);						\
+		MR_schedule(f_n_c_context);				\
+		MR_GOTO(parent);					\
 	} while (0)
 
 #ifndef	CONSERVATIVE_GC
@@ -295,7 +295,7 @@
   ** furthest back that we can backtrack is the same as it was last time we
   ** were executing.
   */
-  #define set_min_heap_reclamation_point(ctxt)	do {		\
+  #define MR_set_min_heap_reclamation_point(ctxt)	do {	\
 		if (MR_hp != (ctxt)->context_hp 		\
 			|| (ctxt)->context_hp == NULL)		\
 		{						\
@@ -308,7 +308,7 @@
 		}						\
 	} while (0)
 
-  #define save_hp_in_context(ctxt)				\
+  #define MR_save_hp_in_context(ctxt)				\
   	do {							\
 		(ctxt)->context_hp = MR_hp;			\
 		(ctxt)->min_hp_rec = MR_min_hp_rec;		\
@@ -316,9 +316,9 @@
 
 #else
 
-  #define set_min_heap_reclamation_point(ctxt)	do { } while (0)
+  #define MR_set_min_heap_reclamation_point(ctxt)	do { } while (0)
 
-  #define save_hp_in_context(ctxt)		do { } while (0)
+  #define MR_save_hp_in_context(ctxt)			do { } while (0)
 
 #endif
 
@@ -334,7 +334,7 @@
   #define MR_IF_USE_MINIMAL_MODEL(x)
 #endif
 
-#define load_context(cptr)						\
+#define MR_load_context(cptr)						\
 	do {								\
 		MR_Context	*load_context_c;			\
 		load_context_c = (cptr);				\
@@ -368,10 +368,10 @@
 		    MR_cut_stack = (MR_CutStackFrame *)			\
 				MR_ENGINE(context).cutstack_zone;	\
 	    	)							\
-		set_min_heap_reclamation_point(load_context_c);		\
+		MR_set_min_heap_reclamation_point(load_context_c);	\
 	} while (0)
 
-#define save_context(cptr)						\
+#define MR_save_context(cptr)						\
 	do {								\
 		MR_Context	*save_context_c;			\
 		save_context_c = (cptr);				\
@@ -405,11 +405,11 @@
 		    assert(MR_cut_stack == (MR_CutStackFrame *)		\
 				MR_ENGINE(context).cutstack_zone);	\
 		)							\
-		save_hp_in_context(save_context_c);			\
+		MR_save_hp_in_context(save_context_c);			\
 	} while (0)
 
-typedef struct sync_term_struct SyncTerm;
-struct sync_term_struct {
+typedef struct MR_Sync_Term_Struct MR_SyncTerm;
+struct MR_Sync_Term_Struct {
   #ifdef MR_THREAD_SAFE
 	MercuryLock	lock;
   #endif
@@ -435,13 +435,13 @@
 		if (st->count == 0) {					\
 			assert(st->parent != NULL);			\
 			MR_UNLOCK(&(st->lock), "terminate i");		\
-			schedule(st->parent);				\
+			MR_schedule(st->parent);			\
 		} else {						\
 			assert(st->count > 0);				\
 			MR_UNLOCK(&(st->lock), "terminate ii");		\
 		}							\
-		destroy_context(MR_ENGINE(this_context));		\
-		runnext();						\
+		MR_destroy_context(MR_ENGINE(this_context));		\
+		MR_runnext();						\
 	} while (0)
 
 #define MR_join_and_continue(sync_term, where_to)			\
@@ -451,14 +451,14 @@
 		(st->count)--;						\
 		if (st->count == 0) {					\
 			MR_UNLOCK(&(st->lock), "continue i");		\
-			GOTO((where_to));				\
+			MR_GOTO((where_to));				\
 		}							\
 		assert(st->count > 0);					\
-		save_context(MR_ENGINE(this_context));			\
+		MR_save_context(MR_ENGINE(this_context));		\
 		MR_ENGINE(this_context)->resume = (where_to);		\
 		st->parent = MR_ENGINE(this_context); 			\
 		MR_UNLOCK(&(st->lock), "continue ii");			\
-		runnext();						\
+		MR_runnext();						\
 	} while (0)
 
 #endif /* not MERCURY_CONTEXT_H */
Index: runtime/mercury_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_debug.c,v
retrieving revision 1.2
diff -u -b -r1.2 mercury_debug.c
--- runtime/mercury_debug.c	2000/08/03 06:18:38	1.2
+++ runtime/mercury_debug.c	2000/10/25 06:29:33
@@ -16,7 +16,7 @@
 
 /*--------------------------------------------------------------------*/
 
-static void	print_ordinary_regs(void);
+static void	MR_print_ordinary_regs(void);
 static void	MR_printdetslot_as_label(const MR_Integer offset);
 
 /* debugging messages */
@@ -24,172 +24,159 @@
 #ifdef MR_LOWLEVEL_DEBUG
 
 void 
-mkframe_msg(const char *predname)
+MR_mkframe_msg(const char *predname)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	printf("\nnew choice point for procedure %s\n", predname);
-	printf("new  fr: "); printnondstack(MR_curfr);
-	printf("prev fr: "); printnondstack(MR_prevfr_slot(MR_curfr));
-	printf("succ fr: "); printnondstack(MR_succfr_slot(MR_curfr));
-	printf("succ ip: "); printlabel(MR_succip_slot(MR_curfr));
-	printf("redo ip: "); printlabel(MR_redoip_slot(MR_curfr));
+	printf("new  fr: "); MR_printnondstack(MR_curfr);
+	printf("prev fr: "); MR_printnondstack(MR_prevfr_slot(MR_curfr));
+	printf("succ fr: "); MR_printnondstack(MR_succfr_slot(MR_curfr));
+	printf("succ ip: "); MR_printlabel(stdout, MR_succip_slot(MR_curfr));
+	printf("redo ip: "); MR_printlabel(stdout, MR_redoip_slot(MR_curfr));
 
 	if (MR_detaildebug) {
-		dumpnondstack();
+		MR_dumpnondstack();
 	}
 }
 
 void 
-succeed_msg(void)
+MR_succeed_msg(void)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	printf("\nsucceeding from procedure\n");
-	printf("curr fr: "); printnondstack(MR_curfr);
-	printf("succ fr: "); printnondstack(MR_succfr_slot(MR_curfr));
-	printf("succ ip: "); printlabel(MR_succip_slot(MR_curfr));
+	printf("curr fr: "); MR_printnondstack(MR_curfr);
+	printf("succ fr: "); MR_printnondstack(MR_succfr_slot(MR_curfr));
+	printf("succ ip: "); MR_printlabel(stdout, MR_succip_slot(MR_curfr));
 
 	if (MR_detaildebug) {
-		printregs("registers at success");
+		MR_printregs("registers at success");
 	}
 }
 
 void 
-succeeddiscard_msg(void)
+MR_succeeddiscard_msg(void)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	printf("\nsucceeding from procedure\n");
-	printf("curr fr: "); printnondstack(MR_curfr);
-	printf("succ fr: "); printnondstack(MR_succfr_slot(MR_curfr));
-	printf("succ ip: "); printlabel(MR_succip_slot(MR_curfr));
+	printf("curr fr: "); MR_printnondstack(MR_curfr);
+	printf("succ fr: "); MR_printnondstack(MR_succfr_slot(MR_curfr));
+	printf("succ ip: "); MR_printlabel(stdout, MR_succip_slot(MR_curfr));
 
 	if (MR_detaildebug) {
-		printregs("registers at success");
+		MR_printregs("registers at success");
 	}
 }
 
 void 
-fail_msg(void)
+MR_fail_msg(void)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	printf("\nfailing from procedure\n");
-	printf("curr fr: "); printnondstack(MR_curfr);
-	printf("fail fr: "); printnondstack(MR_prevfr_slot(MR_curfr));
-	printf("fail ip: "); printlabel(MR_redoip_slot(MR_prevfr_slot(MR_curfr)));
+	printf("curr fr: "); MR_printnondstack(MR_curfr);
+	printf("fail fr: "); MR_printnondstack(MR_prevfr_slot(MR_curfr));
+	printf("fail ip: "); MR_printlabel(stdout,
+				MR_redoip_slot(MR_prevfr_slot(MR_curfr)));
 }
 
 void 
-redo_msg(void)
+MR_redo_msg(void)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	printf("\nredo from procedure\n");
-	printf("curr fr: "); printnondstack(MR_curfr);
-	printf("redo fr: "); printnondstack(MR_maxfr);
-	printf("redo ip: "); printlabel(MR_redoip_slot(MR_maxfr));
+	printf("curr fr: "); MR_printnondstack(MR_curfr);
+	printf("redo fr: "); MR_printnondstack(MR_maxfr);
+	printf("redo ip: "); MR_printlabel(stdout, MR_redoip_slot(MR_maxfr));
 }
 
 void 
-call_msg(/* const */ MR_Code *proc, /* const */ MR_Code *succcont)
+MR_call_msg(/* const */ MR_Code *proc, /* const */ MR_Code *succ_cont)
 {
-	printf("\ncalling      "); printlabel(proc);
-	printf("continuation "); printlabel(succcont);
-	printregs("registers at call");
+	printf("\ncalling      "); MR_printlabel(stdout, proc);
+	printf("continuation "); MR_printlabel(stdout, succ_cont);
+	MR_printregs("registers at call");
 }
 
 void 
-tailcall_msg(/* const */ MR_Code *proc)
+MR_tailcall_msg(/* const */ MR_Code *proc)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
-	printf("\ntail calling "); printlabel(proc);
-	printf("continuation "); printlabel(MR_succip);
-	printregs("registers at tailcall");
+	printf("\ntail calling "); MR_printlabel(stdout, proc);
+	printf("continuation "); MR_printlabel(stdout, MR_succip);
+	MR_printregs("registers at tailcall");
 }
 
 void 
-proceed_msg(void)
+MR_proceed_msg(void)
 {
 	printf("\nreturning from determinate procedure\n");
-	printregs("registers at proceed");
+	MR_printregs("registers at proceed");
 }
 
 void 
-cr1_msg(MR_Word val0, const MR_Word *addr)
+MR_cr1_msg(MR_Word val0, const MR_Word *addr)
 {
 	printf("put value %9lx at ", (long) (MR_Integer) val0);
-	printheap(addr);
+	MR_printheap(addr);
 }
 
 void 
-cr2_msg(MR_Word val0, MR_Word val1, const MR_Word *addr)
+MR_cr2_msg(MR_Word val0, MR_Word val1, const MR_Word *addr)
 {
 	printf("put values %9lx,%9lx at ",	
 		(long) (MR_Integer) val0, (long) (MR_Integer) val1);
-	printheap(addr);
+	MR_printheap(addr);
 }
 
 void 
-incr_hp_debug_msg(MR_Word val, const MR_Word *addr)
+MR_incr_hp_debug_msg(MR_Word val, const MR_Word *addr)
 {
 #ifdef CONSERVATIVE_GC
 	printf("allocated %ld words at %p\n", (long) val, addr);
 #else
 	printf("increment hp by %ld from ", (long) (MR_Integer) val);
-	printheap(addr);
+	MR_printheap(addr);
 #endif
 }
 
 void 
-incr_sp_msg(MR_Word val, const MR_Word *addr)
+MR_incr_sp_msg(MR_Word val, const MR_Word *addr)
 {
 	printf("increment sp by %ld from ", (long) (MR_Integer) val);
-	printdetstack(addr);
+	MR_printdetstack(addr);
 }
 
 void 
-decr_sp_msg(MR_Word val, const MR_Word *addr)
+MR_decr_sp_msg(MR_Word val, const MR_Word *addr)
 {
 	printf("decrement sp by %ld from ", (long) (MR_Integer) val);
-	printdetstack(addr);
+	MR_printdetstack(addr);
 }
 
-void 
-push_msg(MR_Word val, const MR_Word *addr)
-{
-	printf("push value %9lx to ", (long) (MR_Integer) val);
-	printdetstack(addr);
-}
-
-void 
-pop_msg(MR_Word val, const MR_Word *addr)
-{
-	printf("pop value %9lx from ", (long) (MR_Integer) val);
-	printdetstack(addr);
-}
-
 #endif /* defined(MR_LOWLEVEL_DEBUG) */
 
 #ifdef MR_DEBUG_GOTOS
 
 void 
-goto_msg(/* const */ MR_Code *addr)
+MR_goto_msg(/* const */ MR_Code *addr)
 {
 	printf("\ngoto ");
-	printlabel(addr);
+	MR_printlabel(stdout, addr);
 }
 
 void 
-reg_msg(void)
+MR_reg_msg(void)
 {
 	int	i;
 	MR_Integer	x;
 
 	for(i=1; i<=8; i++) {
-		x = (MR_Integer) get_reg(i);
+		x = (MR_Integer) MR_get_reg(i);
 #ifndef CONSERVATIVE_GC
 		if ((MR_Integer) MR_ENGINE(heap_zone)->min <= x
 				&& x < (MR_Integer) MR_ENGINE(heap_zone)->top) {
@@ -210,19 +197,19 @@
 /* debugging printing tools */
 
 void 
-printint(MR_Word n)
+MR_printint(MR_Word n)
 {
 	printf("int %ld\n", (long) (MR_Integer) n);
 }
 
 void 
-printstring(const char *s)
+MR_printstring(const char *s)
 {
 	printf("string %p %s\n", (const void *) s, s);
 }
 
 void 
-printheap(const MR_Word *h)
+MR_printheap(const MR_Word *h)
 {
 #ifndef CONSERVATIVE_GC
 	printf("ptr %p, offset %3ld words\n",
@@ -235,17 +222,17 @@
 }
 
 void 
-dumpframe(/* const */ MR_Word *fr)
+MR_dumpframe(/* const */ MR_Word *fr)
 {
 	reg	int	i;
 
 	printf("frame at ptr %p, offset %3ld words\n",
 		(const void *) fr, 
 		(long) (MR_Integer) (fr - MR_CONTEXT(nondetstack_zone)->min));
-	printf("\t succip    "); printlabel(MR_succip_slot(fr));
-	printf("\t redoip    "); printlabel(MR_redoip_slot(fr));
-	printf("\t succfr    "); printnondstack(MR_succfr_slot(fr));
-	printf("\t prevfr    "); printnondstack(MR_prevfr_slot(fr));
+	printf("\t succip    "); MR_printlabel(stdout, MR_succip_slot(fr));
+	printf("\t redoip    "); MR_printlabel(stdout, MR_redoip_slot(fr));
+	printf("\t succfr    "); MR_printnondstack(MR_succfr_slot(fr));
+	printf("\t prevfr    "); MR_printnondstack(MR_prevfr_slot(fr));
 
 	for (i = 1; &MR_based_framevar(fr,i) > MR_prevfr_slot(fr); i++) {
 		printf("\t framevar(%d)  %ld 0x%lx\n",
@@ -255,51 +242,51 @@
 }
 
 void 
-dumpnondstack(void)
+MR_dumpnondstack(void)
 {
 	reg	MR_Word	*fr;
 
 	printf("\nnondstack dump\n");
 	for (fr = MR_maxfr; fr > MR_CONTEXT(nondetstack_zone)->min;
 			fr = MR_prevfr_slot(fr)) {
-		dumpframe(fr);
+		MR_dumpframe(fr);
 	}
 }
 
 void 
-printframe(const char *msg)
+MR_printframe(const char *msg)
 {
 	printf("\n%s\n", msg);
-	dumpframe(MR_curfr);
+	MR_dumpframe(MR_curfr);
 
-	print_ordinary_regs();
+	MR_print_ordinary_regs();
 }
 
 void 
-printregs(const char *msg)
+MR_printregs(const char *msg)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	printf("\n%s\n", msg);
 
-	printf("%-9s", "succip:");  printlabel(MR_succip);
-	printf("%-9s", "curfr:");   printnondstack(MR_curfr);
-	printf("%-9s", "maxfr:");   printnondstack(MR_maxfr);
-	printf("%-9s", "hp:");      printheap(MR_hp);
-	printf("%-9s", "sp:");      printdetstack(MR_sp);
+	printf("%-9s", "succip:");  MR_printlabel(stdout, MR_succip);
+	printf("%-9s", "curfr:");   MR_printnondstack(MR_curfr);
+	printf("%-9s", "maxfr:");   MR_printnondstack(MR_maxfr);
+	printf("%-9s", "hp:");      MR_printheap(MR_hp);
+	printf("%-9s", "sp:");      MR_printdetstack(MR_sp);
 
-	print_ordinary_regs();
+	MR_print_ordinary_regs();
 }
 
 static void 
-print_ordinary_regs(void)
+MR_print_ordinary_regs(void)
 {
 	int	i;
 	MR_Integer	value;
 
 	for (i = 0; i < 8; i++) {
 		printf("r%d:      ", i + 1);
-		value = (MR_Integer) get_reg(i+1);
+		value = (MR_Integer) MR_get_reg(i+1);
 
 #ifndef	CONSERVATIVE_GC
 		if ((MR_Integer) MR_ENGINE(heap_zone)->min <= value &&
@@ -325,7 +312,8 @@
 {
 	MR_printdetstackptr(&MR_CONTEXT(detstack_zone)->min[offset]);
 	printf(" ");
-	printlabel((MR_Code *) (MR_CONTEXT(detstack_zone)->min[offset]));
+	MR_printlabel(stdout,
+		(MR_Code *) (MR_CONTEXT(detstack_zone)->min[offset]));
 }
 
 void 
@@ -343,7 +331,7 @@
 }
 
 void 
-printdetstack(const MR_Word *s)
+MR_printdetstack(const MR_Word *s)
 {
 	printf("ptr %p, offset %3ld words\n",
 		(const void *) s,
@@ -365,7 +353,7 @@
 }
 
 void 
-printnondstack(const MR_Word *s)
+MR_printnondstack(const MR_Word *s)
 {
 	printf("ptr %p, offset %3ld words\n",
 		(const void *) s,
@@ -416,8 +404,8 @@
 }
 
 void 
-printlabel(/* const */ MR_Code *w)
+MR_printlabel(FILE *fp, /* const */ MR_Code *w)
 {
-	MR_print_label(stdout, w);
-	fprintf(stdout, "\n");
+	MR_print_label(fp, w);
+	fprintf(fp, "\n");
 }
Index: runtime/mercury_debug.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_debug.h,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_debug.h
--- runtime/mercury_debug.h	2000/08/03 06:18:38	1.9
+++ runtime/mercury_debug.h	2000/10/22 01:14:44
@@ -14,129 +14,113 @@
 
 /*---------------------------------------------------------------------------*/
 
-#ifdef DEBUG_ON
-	#define DEBUG(X) X
+#ifdef MR_DEBUG_ON
+	#define MR_DEBUG(X) X
 #else
-	#define DEBUG(X)
+	#define MR_DEBUG(X)
 #endif
 
 #if !defined(MR_DEBUG_GOTOS)
 
-#define	debuggoto(label)			((void)0)
-#define	debugsreg()				((void)0)
+#define	MR_debuggoto(label)			((void)0)
+#define	MR_debugsreg()				((void)0)
 
 #else
 
-#define	debuggoto(label) \
+#define	MR_debuggoto(label) \
 	(MR_assert(label), \
-	IF (MR_gotodebug, (save_transient_registers(), goto_msg(label))))
+	IF (MR_gotodebug, (MR_save_transient_registers(), MR_goto_msg(label))))
 
-#define	debugsreg() \
-	IF (MR_sregdebug, (save_transient_registers(), reg_msg()))
+#define	MR_debugsreg() \
+	IF (MR_sregdebug, (MR_save_transient_registers(), MR_reg_msg()))
 
 #endif
 
 #ifndef MR_LOWLEVEL_DEBUG
 
-#define	dump_push_msg(msg)			((void)0)
-#define	dump_pop_msg()				((void)0)
+#define	MR_debugcr1(val0, hp)			((void)0)
+#define	MR_debugcr2(val0, val1, hp)		((void)0)
+#define	MR_debugincrhp(val, hp)			((void)0)
+#define	MR_debugincrsp(val, sp)			((void)0)
+#define	MR_debugdecrsp(val, sp)			((void)0)
+#define	MR_debugregs(msg)			((void)0)
+#define	MR_debugframe(msg)			((void)0)
+#define	MR_debugmkframe(predname)		((void)0)
+#define	MR_debugsucceed()			((void)0)
+#define	MR_debugsucceeddiscard()		((void)0)
+#define	MR_debugfail()				((void)0)
+#define	MR_debugredo()				((void)0)
+#define	MR_debugcall(proc, succ_cont)		((void)0)
+#define	MR_debugtailcall(proc)			((void)0)
+#define	MR_debugproceed()			((void)0)
+#define	MR_debugmsg0(msg)			((void)0)
+#define	MR_debugmsg1(msg, arg1)			((void)0)
+#define	MR_debugmsg2(msg, arg1, arg2)		((void)0)
+#define	MR_debugmsg3(msg, arg1, arg2, arg3)	((void)0)
 
-#define	debugcr1(val0, hp)			((void)0)
-#define	debugcr2(val0, val1, hp)		((void)0)
-#define	debugincrhp(val, hp)			((void)0)
-#define	debugincrsp(val, sp)			((void)0)
-#define	debugdecrsp(val, sp)			((void)0)
-#define	debugpush(val, sp)			((void)0)
-#define	debugpop(val, sp)			((void)0)
-#define	debugregs(msg)				((void)0)
-#define	debugframe(msg)				((void)0)
-#define	debugmkframe(predname)			((void)0)
-#define	debugsucceed()				((void)0)
-#define	debugsucceeddiscard()			((void)0)
-#define	debugfail()				((void)0)
-#define	debugredo()				((void)0)
-#define	debugcall(proc, succ_cont)		((void)0)
-#define	debugtailcall(proc)			((void)0)
-#define	debugproceed()				((void)0)
-#define	debugmsg0(msg)				((void)0)
-#define	debugmsg1(msg, arg1)			((void)0)
-#define	debugmsg2(msg, arg1, arg2)		((void)0)
-#define	debugmsg3(msg, arg1, arg2, arg3)	((void)0)
-
 #else
-
-#define	dump_push_msg(msg)	\
-	(((const char **)dumpstack_zone->min)[dumpindex++] = msg)
-#define	dump_pop_msg()				(--dumpindex)
 
-#define	debugcr1(val0, hp) \
-	IF (MR_heapdebug, (save_transient_registers(), cr1_msg(val0, hp)))
+#define	MR_debugcr1(val0, hp) \
+	IF (MR_heapdebug, (MR_save_transient_registers(), MR_cr1_msg(val0, hp)))
 
-#define	debugcr2(val0, val1, hp) \
-	IF (MR_heapdebug, (save_transient_registers(), cr2_msg(val0, val1, hp)))
+#define	MR_debugcr2(val0, val1, hp) \
+	IF (MR_heapdebug, (MR_save_transient_registers(), MR_cr2_msg(val0, val1, hp)))
 
-#define	debugincrhp(val, hp) \
+#define	MR_debugincrhp(val, hp) \
 	IF (MR_heapdebug, \
-		(save_transient_registers(), incr_hp_debug_msg((val), (hp))))
+		(MR_save_transient_registers(), MR_incr_hp_debug_msg((val), (hp))))
 
-#define	debugincrsp(val, sp) \
+#define	MR_debugincrsp(val, sp) \
 	IF (MR_detstackdebug, \
-		(save_transient_registers(), incr_sp_msg((val), (sp))))
+		(MR_save_transient_registers(), MR_incr_sp_msg((val), (sp))))
 
-#define	debugdecrsp(val, sp) \
+#define	MR_debugdecrsp(val, sp) \
 	IF (MR_detstackdebug, \
-		(save_transient_registers(), decr_sp_msg((val), (sp))))
-
-#define	debugpush(val, sp) \
-	IF (MR_detstackdebug, \
-		(save_transient_registers(), push_msg((val), (sp))))
-
-#define	debugpop(val, sp) \
-	IF (MR_detstackdebug, (save_transient_registers(), pop_msg(val, sp)))
+		(MR_save_transient_registers(), MR_decr_sp_msg((val), (sp))))
 
-#define	debugregs(msg) \
-	IF (MR_progdebug, (save_transient_registers(), printregs(msg)))
+#define	MR_debugregs(msg) \
+	IF (MR_progdebug, (MR_save_transient_registers(), MR_printregs(msg)))
 
-#define	debugmkframe(predname) \
+#define	MR_debugmkframe(predname) \
 	IF (MR_nondstackdebug, \
-		(save_transient_registers(), mkframe_msg(predname)))
+		(MR_save_transient_registers(), MR_mkframe_msg(predname)))
 
-#define	debugframe(msg)	 \
-	IF (MR_progdebug, (save_transient_registers(), printframe(msg)))
+#define	MR_debugframe(msg)	 \
+	IF (MR_progdebug, (MR_save_transient_registers(), MR_printframe(msg)))
 
-#define	debugsucceed() \
-	IF (MR_nondstackdebug, (save_transient_registers(), succeed_msg()))
+#define	MR_debugsucceed() \
+	IF (MR_nondstackdebug, (MR_save_transient_registers(), MR_succeed_msg()))
 
-#define	debugsucceeddiscard() \
+#define	MR_debugsucceeddiscard() \
 	IF (MR_nondstackdebug, \
-		(save_transient_registers(), succeeddiscard_msg()))
+		(MR_save_transient_registers(), MR_succeeddiscard_msg()))
 
-#define	debugfail() \
-	IF (MR_nondstackdebug, (save_transient_registers(), fail_msg()))
+#define	MR_debugfail() \
+	IF (MR_nondstackdebug, (MR_save_transient_registers(), MR_fail_msg()))
 
-#define	debugredo() \
-	IF (MR_nondstackdebug, (save_transient_registers(), redo_msg()))
+#define	MR_debugredo() \
+	IF (MR_nondstackdebug, (MR_save_transient_registers(), MR_redo_msg()))
 
-#define	debugcall(proc, succ_cont) \
+#define	MR_debugcall(proc, succ_cont) \
 	IF (MR_calldebug, \
-		(save_transient_registers(), call_msg(proc, succ_cont)))
+		(MR_save_transient_registers(), MR_call_msg(proc, succ_cont)))
 
-#define	debugtailcall(proc) \
-	IF (MR_calldebug, (save_transient_registers(), tailcall_msg(proc)))
+#define	MR_debugtailcall(proc) \
+	IF (MR_calldebug, (MR_save_transient_registers(), MR_tailcall_msg(proc)))
 
-#define	debugproceed() \
-	IF (MR_calldebug, (save_transient_registers(), proceed_msg()))
+#define	MR_debugproceed() \
+	IF (MR_calldebug, (MR_save_transient_registers(), MR_proceed_msg()))
 
-#define	debugmsg0(msg) \
+#define	MR_debugmsg0(msg) \
 	IF (MR_progdebug, (printf(msg)))
 
-#define	debugmsg1(msg, arg1) \
+#define	MR_debugmsg1(msg, arg1) \
 	IF (MR_progdebug, (printf(msg, arg1)))
 
-#define	debugmsg2(msg, arg1, arg2) \
+#define	MR_debugmsg2(msg, arg1, arg2) \
 	IF (MR_progdebug, (printf(msg, arg1, arg2)))
 
-#define	debugmsg3(msg, arg1, arg2, arg3) \
+#define	MR_debugmsg3(msg, arg1, arg2, arg3) \
 	IF (MR_progdebug, (printf(msg, arg1, arg2, arg3)))
 
 #endif /* MR_LOWLEVEL_DEBUG */
@@ -144,48 +128,46 @@
 /*---------------------------------------------------------------------------*/
 
 #ifdef MR_LOWLEVEL_DEBUG
-extern	void	mkframe_msg(const char *);
-extern	void	succeed_msg(void);
-extern	void	succeeddiscard_msg(void);
-extern	void	fail_msg(void);
-extern	void	redo_msg(void);
-extern	void	call_msg(/* const */ MR_Code *proc, /* const */ MR_Code *succcont);
-extern	void	tailcall_msg(/* const */ MR_Code *proc);
-extern	void	proceed_msg(void);
-extern	void	cr1_msg(MR_Word val0, const MR_Word *addr);
-extern	void	cr2_msg(MR_Word val0, MR_Word val1, const MR_Word *addr);
-extern	void	incr_hp_debug_msg(MR_Word val, const MR_Word *addr);
-extern	void	incr_sp_msg(MR_Word val, const MR_Word *addr);
-extern	void	decr_sp_msg(MR_Word val, const MR_Word *addr);
-extern	void	push_msg(MR_Word val, const MR_Word *addr);
-extern	void	pop_msg(MR_Word val, const MR_Word *addr);
+extern	void	MR_mkframe_msg(const char *);
+extern	void	MR_succeed_msg(void);
+extern	void	MR_succeeddiscard_msg(void);
+extern	void	MR_fail_msg(void);
+extern	void	MR_redo_msg(void);
+extern	void	MR_call_msg(/* const */ MR_Code *proc, /* const */ MR_Code *succcont);
+extern	void	MR_tailcall_msg(/* const */ MR_Code *proc);
+extern	void	MR_proceed_msg(void);
+extern	void	MR_cr1_msg(MR_Word val0, const MR_Word *addr);
+extern	void	MR_cr2_msg(MR_Word val0, MR_Word val1, const MR_Word *addr);
+extern	void	MR_incr_hp_debug_msg(MR_Word val, const MR_Word *addr);
+extern	void	MR_incr_sp_msg(MR_Word val, const MR_Word *addr);
+extern	void	MR_decr_sp_msg(MR_Word val, const MR_Word *addr);
 #endif
 
 #ifdef MR_DEBUG_GOTOS
-extern	void	goto_msg(/* const */ MR_Code *addr);
-extern	void	reg_msg(void);
+extern	void	MR_goto_msg(/* const */ MR_Code *addr);
+extern	void	MR_reg_msg(void);
 #endif
 
 #ifdef MR_LOWLEVEL_DEBUG
-extern	void	printint(MR_Word n);
-extern	void	printstring(const char *s);
-extern	void	printheap(const MR_Word *h);
-extern	void	dumpframe(/* const */ MR_Word *);
-extern	void	dumpnondstack(void);
-extern	void	printlist(MR_Word p);
-extern	void	printframe(const char *);
-extern	void	printregs(const char *msg);
+extern	void	MR_printint(MR_Word n);
+extern	void	MR_printstring(const char *s);
+extern	void	MR_printheap(const MR_Word *h);
+extern	void	MR_dumpframe(/* const */ MR_Word *);
+extern	void	MR_dumpnondstack(void);
+extern	void	MR_printlist(MR_Word p);
+extern	void	MR_printframe(const char *);
+extern	void	MR_printregs(const char *msg);
 #endif
 
-extern	void	printdetstack(const MR_Word *s);
+extern	void	MR_printdetstack(const MR_Word *s);
 extern	void	MR_printdetstackptr(const MR_Word *s);
 extern	void	MR_print_detstackptr(FILE *fp, const MR_Word *s);
-extern	void	printnondstack(const MR_Word *s);
+extern	void	MR_printnondstack(const MR_Word *s);
 extern	void	MR_printnondstackptr(const MR_Word *s);
 extern	void	MR_print_nondstackptr(FILE *fp, const MR_Word *s);
 extern	void	MR_print_heapptr(FILE *fp, const MR_Word *s);
 extern	void	MR_print_label(FILE *fp, /* const */ MR_Code *w);
-extern	void	printlabel(/* const */ MR_Code *w);
+extern	void	MR_printlabel(FILE *fp, /* const */ MR_Code *w);
 
 /*---------------------------------------------------------------------------*/
 
Index: runtime/mercury_deep_copy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy.c,v
retrieving revision 1.20
diff -u -b -r1.20 mercury_deep_copy.c
--- runtime/mercury_deep_copy.c	2000/11/07 08:58:33	1.20
+++ runtime/mercury_deep_copy.c	2000/11/14 01:48:42
@@ -5,7 +5,7 @@
 */
 
 /*
-** This module defines the deep_copy() functions.
+** This module defines the MR_deep_copy() functions.
 **
 ** Deep copy is used for a number of different purposes.  Each variant
 ** has the same basic control structure, but differs in how memory
@@ -20,7 +20,7 @@
 
 
 /*
-** deep_copy(): see mercury_deep_copy.h for documentation.
+** MR_deep_copy(): see mercury_deep_copy.h for documentation.
 */
 
 #undef  in_range
@@ -34,16 +34,16 @@
 #define	maybeconst	const
 
 #undef  copy
-#define copy		deep_copy
+#define copy		MR_deep_copy
 
 #undef  copy_arg
-#define copy_arg	deep_copy_arg
+#define copy_arg	MR_deep_copy_arg
 
 #undef  copy_type_info
-#define copy_type_info	deep_copy_type_info
+#define copy_type_info	MR_deep_copy_type_info
 
 #undef  copy_typeclass_info
-#define copy_typeclass_info	deep_copy_typeclass_info
+#define copy_typeclass_info	MR_deep_copy_typeclass_info
 
 #undef  leave_forwarding_pointer
 #define leave_forwarding_pointer(DataPtr, NewData)
@@ -71,16 +71,16 @@
 #define	maybeconst
 
 #undef  copy
-#define copy		agc_deep_copy
+#define copy		MR_agc_deep_copy
 
 #undef  copy_arg
-#define copy_arg	agc_deep_copy_arg
+#define copy_arg	MR_agc_deep_copy_arg
 
 #undef  copy_type_info
-#define copy_type_info	agc_deep_copy_type_info
+#define copy_type_info	MR_agc_deep_copy_type_info
 
 #undef  copy_typeclass_info
-#define copy_typeclass_info	agc_deep_copy_typeclass_info
+#define copy_typeclass_info	MR_agc_deep_copy_typeclass_info
 
 #ifdef MR_DEBUG_AGC_FORWARDING
   #define FORWARD_DEBUG_MSG(Msg, Data)	\
@@ -126,7 +126,7 @@
 {
 	MR_Word result;
 
-	restore_transient_hp();	/* Because we play with MR_hp */
+	MR_restore_transient_hp();	/* Because we play with MR_hp */
 
 	if (lower_limit < MR_heap_zone->bottom ||
 			lower_limit > MR_heap_zone->top) {
@@ -134,20 +134,20 @@
 	}
 
 	/* temporarily swap the heap with the global heap */
-	SWAP(MR_heap_zone, MR_global_heap_zone, MemoryZone *);
+	SWAP(MR_heap_zone, MR_global_heap_zone, MR_MemoryZone *);
 	SWAP(MR_hp, MR_global_hp, MR_Word *);
 
 	/* copy values from the heap to the global heap */
-	save_transient_hp();
-	result = deep_copy(&term, type_info, lower_limit,
+	MR_save_transient_hp();
+	result = MR_deep_copy(&term, type_info, lower_limit,
 			MR_global_heap_zone->top);
-	restore_transient_hp();
+	MR_restore_transient_hp();
 
 	/* swap the heap and global heap back again */
-	SWAP(MR_heap_zone, MR_global_heap_zone, MemoryZone *);
+	SWAP(MR_heap_zone, MR_global_heap_zone, MR_MemoryZone *);
 	SWAP(MR_hp, MR_global_hp, MR_Word *);
 
-	save_transient_hp();	/* Because we played with MR_hp */
+	MR_save_transient_hp();	/* Because we played with MR_hp */
 
 	return result;
 }
Index: runtime/mercury_deep_copy.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy.h,v
retrieving revision 1.11
diff -u -b -r1.11 mercury_deep_copy.h
--- runtime/mercury_deep_copy.h	2000/08/03 06:18:39	1.11
+++ runtime/mercury_deep_copy.h	2000/11/14 01:49:01
@@ -4,7 +4,7 @@
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
 */
 
-/* deepcopy.h - declares the deep_copy() function. */
+/* deepcopy.h - declares the MR_deep_copy() function. */
 
 #ifndef	MERCURY_DEEP_COPY_H
 #define	MERCURY_DEEP_COPY_H
@@ -13,7 +13,7 @@
 #include "mercury_type_info.h"	/* for `MR_TypeInfo' */
 
 /*
-** deep_copy:
+** MR_deep_copy:
 **
 ** 	Copy a data item, completely.
 **
@@ -36,24 +36,24 @@
 **	or if the data is just a simple type like a constant
 **	or integer, it will be the constant or integer itself.
 **
-** 	Please note - deep_copy increments the heap pointer, 
+** 	Please note - MR_deep_copy increments the heap pointer, 
 ** 	however on some platforms (notably, SPARCs) the 
 ** 	register-windows mean the transient Mercury registers
-** 	may be lost. So before calling deep_copy, call
-** 		save_transient_hp();
+** 	may be lost. So before calling MR_deep_copy, call
+** 		MR_save_transient_hp();
 **
-**	deep_copy will use restore_transient_hp()
+**	MR_deep_copy will use MR_restore_transient_hp()
 **	to restore and modify the heap pointer, and
-**	then call save_transient_hp() to save it again.
+**	then call MR_save_transient_hp() to save it again.
 **	(This may also restore/save other registers in the process.)
 **
-**	After calling deep_copy, be sure to do a 
-**		restore_transient_hp();
+**	After calling MR_deep_copy, be sure to do a 
+**		MR_restore_transient_hp();
 **	so that the registers are restored.
 **
-**	If writing a C function that calls deep_copy, make sure
+**	If writing a C function that calls MR_deep_copy, make sure
 **	you document that around your function,
-**	save_transient_hp()/restore_transient_hp()
+**	MR_save_transient_hp()/MR_restore_transient_hp()
 **	need to be used.
 **
 **	Deep copy does not preserve sharing of subterms.  Each
@@ -61,16 +61,16 @@
 **	stored outside the heap limits. 
 **	XXX For some applications, sharing is useful.  For others we
 **	want a copy that is completely unique.  We should modify
-**	deep_copy to do both.
+**	MR_deep_copy to do both.
 */
 
-MR_Word deep_copy(const MR_Word *data_ptr, MR_TypeInfo type_info, 
+MR_Word MR_deep_copy(const MR_Word *data_ptr, MR_TypeInfo type_info, 
 	const MR_Word *lower_limit, const MR_Word *upper_limit);
 
 /*
-** agc_deep_copy:
+** MR_agc_deep_copy:
 **
-**	Just like deep_copy(), but it will leave forwarding pointers
+**	Just like MR_deep_copy(), but it will leave forwarding pointers
 **	in the old data (destructively).  lower_limit and upper_limit
 **	give the boundaries for copying data, and the boundaries for
 **	leaving forwarding pointers.
@@ -88,10 +88,11 @@
 **	heap (say to a constant data structure in the data segment of
 **	the program).
 **
-**	Note: You cannot pass NULL as the lower_limit to agc_deep_copy
-**	(which is possible with normal deep_copy).
+**	Note: You cannot pass NULL as the lower_limit to MR_agc_deep_copy
+**	(which is possible with normal MR_deep_copy).
 */
-MR_Word agc_deep_copy(MR_Word *data_ptr, MR_TypeInfo type_info, 
+
+MR_Word MR_agc_deep_copy(MR_Word *data_ptr, MR_TypeInfo type_info, 
 	const MR_Word *lower_limit, const MR_Word *upper_limit);
 
 /*
@@ -104,8 +105,8 @@
 **	Note that in conservative GC grades nothing needs to be done, and
 **	hence the term is just returned.
 **
-**	When not using a conservative GC grade, save_transient_hp()
-**	and restore_transient_hp() need to be used around this
+**	When not using a conservative GC grade, MR_save_transient_hp()
+**	and MR_restore_transient_hp() need to be used around this
 **	function.  (When using a conservative GC grade, these macros
 **	are harmless, so they can be used then too.)
 */
@@ -130,7 +131,8 @@
 #ifdef CONSERVATIVE_GC
   #define MR_make_long_lived(term, type_info, lower_limit) (term)
 #else
-  MR_Word MR_make_long_lived(MR_Word term, MR_TypeInfo type_info, MR_Word *lower_limit);
+  extern	MR_Word MR_make_long_lived(MR_Word term, MR_TypeInfo type_info,
+		  MR_Word *lower_limit);
 #endif
 
 #endif /* not MERCURY_DEEP_COPY_H */
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.30
diff -u -b -r1.30 mercury_deep_copy_body.h
--- runtime/mercury_deep_copy_body.h	2000/11/12 02:41:10	1.30
+++ runtime/mercury_deep_copy_body.h	2000/11/13 04:03:06
@@ -15,16 +15,20 @@
 /*
 ** Prototypes.
 */
+
 static  MR_Word        copy_arg(maybeconst MR_Word *parent_data_ptr,
                         maybeconst MR_Word *data_ptr,
                         const MR_DuFunctorDesc *functor_descriptor,
                         const MR_TypeInfoParams type_params,
                         const MR_PseudoTypeInfo arg_pseudotype_info,
-                        const MR_Word *lower_limit, const MR_Word *upper_limit);
+                            const MR_Word *lower_limit,
+                            const MR_Word *upper_limit);
 static  MR_TypeInfo copy_type_info(maybeconst MR_TypeInfo *type_info_ptr,
-                        const MR_Word *lower_limit, const MR_Word *upper_limit);
-static  MR_Word        copy_typeclass_info(maybeconst MR_Word *typeclass_info_ptr,
-                        const MR_Word *lower_limit, const MR_Word *upper_limit);
+                            const MR_Word *lower_limit,
+                            const MR_Word *upper_limit);
+static  MR_Word         copy_typeclass_info(maybeconst MR_Word
+                            *typeclass_info_ptr, const MR_Word *lower_limit,
+                            const MR_Word *upper_limit);
 
 MR_Word
 copy(maybeconst MR_Word *data_ptr, MR_TypeInfo type_info,
@@ -113,7 +117,7 @@
 **                      cell_size += num_ti_plain + num_tci;
 **                  }
 **
-**                  incr_saved_hp(new_data, cell_size);
+**                  MR_incr_saved_hp(new_data, cell_size);
 **
 **                  if (ptag_layout->MR_sectag_locn == MR_SECTAG_NONE) {
 **                      cur_slot = 0;
@@ -241,12 +245,12 @@
                     cell_size = 1 + arity;
                     if (exist_info != NULL) {
                         MR_DC_setup_exist_info
-                        incr_saved_hp(new_data, cell_size);
+                        MR_incr_saved_hp(new_data, cell_size);
                         MR_field(0, new_data, 0) = sectag;
                         cur_slot = 1;
                         MR_DC_copy_exist_info
                     } else {
-                        incr_saved_hp(new_data, cell_size);
+                        MR_incr_saved_hp(new_data, cell_size);
                         MR_field(0, new_data, 0) = sectag;
                         cur_slot = 1;
                     }
@@ -274,11 +278,11 @@
                     cell_size = arity;
                     if (exist_info != NULL) {
                         MR_DC_setup_exist_info
-                        incr_saved_hp(new_data, cell_size);
+                        MR_incr_saved_hp(new_data, cell_size);
                         cur_slot = 0;
                         MR_DC_copy_exist_info
                     } else {
-                        incr_saved_hp(new_data, cell_size);
+                        MR_incr_saved_hp(new_data, cell_size);
                         cur_slot = 0;
                     }
                     MR_DC_copy_plain_args
@@ -348,9 +352,9 @@
                 data_value = (MR_Word *) MR_body(data, MR_mktag(0));
 
                 if (in_range(data_value)) {
-                    restore_transient_hp();
-                    new_data = float_to_word(word_to_float(data));
-                    save_transient_hp();
+                    MR_restore_transient_hp();
+                    new_data = MR_float_to_word(MR_word_to_float(data));
+                    MR_save_transient_hp();
                     leave_forwarding_pointer(data_ptr, new_data);
                 } else {
                     new_data = data;
@@ -371,7 +375,7 @@
             */
 
             if (in_range((MR_Word *) data)) {
-                incr_saved_hp_atomic(new_data,
+                MR_incr_saved_hp_atomic(new_data,
                     (strlen((MR_String) data) + sizeof(MR_Word)) / 
 		    	sizeof(MR_Word));
                 strcpy((MR_String) new_data, (MR_String) data);
@@ -412,7 +416,8 @@
                 args = old_closure->MR_closure_num_hidden_args;
 
                 /* create new closure */
-                incr_saved_hp(LVALUE_CAST(MR_Word, new_closure), args + 3);
+                MR_incr_saved_hp(MR_LVALUE_CAST(MR_Word, new_closure),
+			args + 3);
 
                 /* copy the fixed fields */
                 new_closure->MR_closure_layout = closure_layout;
@@ -441,7 +446,7 @@
                 new_data = (MR_Word) new_closure;
                 leave_forwarding_pointer(data_ptr, new_data);
 	    } else if (in_traverse_range(data_value)) {
-		fatal_error("sorry, unimplemented: traversal of closures");
+		MR_fatal_error("sorry, unimplemented: traversal of closures");
             } else {
                 new_data = data;
                 found_forwarding_pointer(data);
@@ -467,7 +472,7 @@
                         new_data = (MR_Word) NULL;
                 } else {
                         /* allocate space for the new tuple */
-                        incr_saved_hp(new_data, arity);
+                        MR_incr_saved_hp(new_data, arity);
                         new_data_ptr = (MR_Word *) new_data;
 
                         arg_typeinfo_vector =
@@ -499,7 +504,7 @@
                 MR_Word *new_data_ptr;
 
                 /* allocate space for a univ */
-                incr_saved_hp(new_data, 2);
+                MR_incr_saved_hp(new_data, 2);
                 new_data_ptr = (MR_Word *) new_data;
                 /*
                 ** Copy the fields across.
@@ -565,7 +570,7 @@
                 leave_forwarding_pointer(data_ptr, new_data);
             } else if (in_traverse_range(data_value)) {
                 MR_ArrayType *old_array;
-                Integer array_size;
+                MR_Integer array_size;
 
                 old_array = (MR_ArrayType *) data_value;
                 array_size = old_array->size;
@@ -715,14 +720,14 @@
             arity = MR_TYPEINFO_GET_HIGHER_ORDER_ARITY(type_info);
             type_info_args =
                 MR_TYPEINFO_GET_HIGHER_ORDER_ARG_VECTOR(type_info);
-            incr_saved_hp(LVALUE_CAST(MR_Word, new_type_info_arena),
+            MR_incr_saved_hp(MR_LVALUE_CAST(MR_Word, new_type_info_arena),
                 MR_higher_order_type_info_size(arity));
             MR_fill_in_higher_order_type_info(new_type_info_arena,
                 type_ctor_info, arity, new_type_info_args);
         } else {
             arity = type_ctor_info->arity;
             type_info_args = MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
-            incr_saved_hp(LVALUE_CAST(MR_Word, new_type_info_arena),
+            MR_incr_saved_hp(MR_LVALUE_CAST(MR_Word, new_type_info_arena),
                 MR_first_order_type_info_size(arity));
             MR_fill_in_first_order_type_info(new_type_info_arena,
                 type_ctor_info, new_type_info_args);
@@ -769,7 +774,7 @@
 		- num_instance_constraints;
         num_super = MR_typeclass_info_num_superclasses(typeclass_info);
         num_arg_typeinfos = MR_typeclass_info_num_type_infos(typeclass_info);
-        incr_saved_hp(LVALUE_CAST(MR_Word, new_typeclass_info),
+        MR_incr_saved_hp(MR_LVALUE_CAST(MR_Word, new_typeclass_info),
             num_instance_constraints + num_super + num_arg_typeinfos + 1);
 
         new_typeclass_info[0] = (MR_Word) base_typeclass_info;
Index: runtime/mercury_dummy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_dummy.c,v
retrieving revision 1.5
diff -u -b -r1.5 mercury_dummy.c
--- runtime/mercury_dummy.c	1999/12/21 10:13:34	1.5
+++ runtime/mercury_dummy.c	2000/10/25 06:21:04
@@ -12,17 +12,17 @@
 ** that gcc can't inline it. Similarly for the two pointers.
 */
 
-void	*volatile global_pointer;
-void	*volatile global_pointer_2;
+void	*volatile MR_global_pointer;
+void	*volatile MR_global_pointer_2;
 
 void
-dummy_function_call(void)
+MR_dummy_function_call(void)
 {
 	return;
 }
 
 void *
-dummy_identify_function(void *p)
+MR_dummy_identify_function(void *p)
 {
 	return p;
 }
Index: runtime/mercury_dummy.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_dummy.h,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_dummy.h
--- runtime/mercury_dummy.h	1999/12/21 10:13:34	1.4
+++ runtime/mercury_dummy.h	2000/10/25 06:21:26
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1993-1995, 1997, 1999 The University of Melbourne.
+** Copyright (C) 1993-1995, 1997, 1999-2000 The University of Melbourne.
 ** This file may only be copied under the terms of the GNU Library General
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
 */
@@ -15,9 +15,9 @@
 #ifndef	MERCURY_DUMMY_H
 #define	MERCURY_DUMMY_H
 
-extern	void	dummy_function_call(void);
-extern	void	*dummy_identify_function(void *);
-extern	void	*volatile global_pointer;
-extern	void	*volatile global_pointer_2;
+extern	void	MR_dummy_function_call(void);
+extern	void	*MR_dummy_identify_function(void *);
+extern	void	*volatile MR_global_pointer;
+extern	void	*volatile MR_global_pointer_2;
 
 #endif /* not MERCURY_DUMMY_H */
Index: runtime/mercury_engine.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_engine.c,v
retrieving revision 1.28
diff -u -b -r1.28 mercury_engine.c
--- runtime/mercury_engine.c	2000/10/16 01:33:57	1.28
+++ runtime/mercury_engine.c	2000/11/13 04:30:26
@@ -49,20 +49,20 @@
 ** the zone structures and context structures).
 */
 void 
-init_engine(MercuryEngine *eng)
+MR_init_engine(MercuryEngine *eng)
 {
 	/*
 	** First, ensure that the truly global stuff has been initialized
 	** (if it was already initialized, this does nothing).
 	*/
 
-	init_memory();
+	MR_init_memory();
 
 #ifndef USE_GCC_NONLOCAL_GOTOS
 	{
 		static bool made_engine_done_label = FALSE;
 		if (!made_engine_done_label) {
-			make_label("engine_done", LABEL(engine_done),
+			MR_make_label("engine_done", MR_LABEL(engine_done),
 				engine_done);
 			made_engine_done_label = TRUE;
 		}
@@ -100,17 +100,6 @@
 	eng->e_global_hp = eng->global_heap_zone->min;
 #endif
 
-#ifdef MR_LOWLEVEL_DEBUG
-	/*
-	** Create the dumpstack, used for debugging stack traces.
-	** Note that we can just make the dumpstack the same size as
-	** the detstack and we never have to worry about the dumpstack
-	** overflowing.
-	*/
-	dumpstack_zone = create_zone("dumpstack", 1, detstack_size,
-		next_offset(), detstack_zone_size, default_handler);
-#endif
-
 #ifdef	MR_THREAD_SAFE
 	eng->owner_thread = pthread_self();
 	eng->c_depth = 0;
@@ -121,24 +110,24 @@
 	** Finally, allocate an initialize context (Mercury thread)
 	** in the engine and initialize the per-context stuff.
 	*/
-	eng->this_context = create_context();
+	eng->this_context = MR_create_context();
 }
 
 /*---------------------------------------------------------------------------*/
 
-void finalize_engine(MercuryEngine *eng)
+void MR_finalize_engine(MercuryEngine *eng)
 {
 	/*
 	** XXX there are lots of other resources in MercuryEngine that
 	** might need to be finalized.  
 	*/
-	destroy_context(eng->this_context);
+	MR_destroy_context(eng->this_context);
 }
 
 /*---------------------------------------------------------------------------*/
 
 MercuryEngine *
-create_engine(void)
+MR_create_engine(void)
 {
 	MercuryEngine *eng;
 
@@ -149,14 +138,14 @@
 	** not traced by the conservative garbage collector.
 	*/
 	eng = MR_GC_NEW_UNCOLLECTABLE(MercuryEngine);
-	init_engine(eng);
+	MR_init_engine(eng);
 	return eng;
 }
 
 void
-destroy_engine(MercuryEngine *eng)
+MR_destroy_engine(MercuryEngine *eng)
 {
-	finalize_engine(eng);
+	MR_finalize_engine(eng);
 	MR_GC_free(eng);
 }
 
@@ -186,10 +175,10 @@
 **	to MR_call_engine().  Specifically, the non-transient real registers
 **	must have valid values, and the fake_reg copies of the transient
 **	(register window) registers must have valid values; call_engine()
-**	will call restore_transient_registers() and will then assume that
+**	will call MR_restore_transient_registers() and will then assume that
 **	all the registers have been correctly set up.
 **
-**	call_engine() will call save_registers() before returning.
+**	call_engine() will call MR_save_registers() before returning.
 **	That will copy the real registers we use to the fake_reg array.
 **
 **	Beware, however, that if you are planning to return to C code
@@ -230,7 +219,7 @@
 	** will work.
 	*/
 
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	prev_jmp_buf = MR_ENGINE(e_jmp_buf);
 	MR_ENGINE(e_jmp_buf) = &curr_jmp_buf;
@@ -241,7 +230,7 @@
 	*/
 	if (catch_exceptions) {
 		MR_create_exception_handler("call_engine",
-			MR_C_LONGJMP_HANDLER, 0, ENTRY(do_fail));
+			MR_C_LONGJMP_HANDLER, 0, MR_ENTRY(do_fail));
 	}
 
 	/*
@@ -261,7 +250,7 @@
 			prev_jmp_buf, MR_ENGINE(e_jmp_buf));
 #endif
 
-		debugmsg0("...caught longjmp\n");
+		MR_debugmsg0("...caught longjmp\n");
 		/*
 		** On return,
 		** set MR_prof_current_proc to be the caller proc again
@@ -269,8 +258,8 @@
 		** restore the registers (since longjmp may clobber them),
 		** and restore the saved value of MR_ENGINE(e_jmp_buf).
 		*/
-		update_prof_current_proc(prev_proc);
-		restore_registers();
+		MR_update_prof_current_proc(prev_proc);
+		MR_restore_registers();
 		MR_ENGINE(e_jmp_buf) = prev_jmp_buf;
 		if (catch_exceptions) {
 			/*
@@ -313,7 +302,7 @@
 #ifdef PROFILE_CALLS
   #ifdef PROFILE_TIME
 	if (MR_prof_current_proc != NULL) {
-		PROFILE(entry_point, MR_prof_current_proc);
+		MR_PROFILE(entry_point, MR_prof_current_proc);
 	}
   #else
 	/*
@@ -343,7 +332,7 @@
 	*/
 #ifdef PROFILE_TIME
 	prev_proc = MR_prof_current_proc;
-	set_prof_current_proc(entry_point);
+	MR_set_prof_current_proc(entry_point);
 #endif
 
 	call_engine_inner(entry_point);
@@ -389,7 +378,8 @@
 
 	if (!initialized)
 	{
-		make_label("engine_done", LABEL(engine_done), engine_done);
+		MR_make_label("engine_done", MR_LABEL(engine_done),
+			engine_done);
 		initialized = TRUE;
 	}
 }
@@ -400,19 +390,19 @@
 	** call mechanism
 	*/
 
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	/*
 	** We save the address of the locals in a global pointer to make
 	** sure that gcc can't optimize them away.
 	*/
 
-	global_pointer = locals;
+	MR_global_pointer = locals;
 
 #ifdef MR_LOWLEVEL_DEBUG
 	memset((void *)locals, MAGIC_MARKER, LOCALS_SIZE);
 #endif
-	debugmsg1("in `call_engine_inner', locals at %p\n", (void *)locals);
+	MR_debugmsg1("in `call_engine_inner', locals at %p\n", (void *)locals);
 
 	/*
 	** We need to ensure that there is at least one
@@ -429,7 +419,7 @@
 	** Also for gcc versions >= egcs1.1, we need to ensure that
 	** there is at least one jump to an unknown label.
 	*/
-	goto *dummy_identify_function(&&dummy_label);
+	goto *MR_dummy_identify_function(&&dummy_label);
 dummy_label:
 
 	/*
@@ -456,9 +446,9 @@
 	** Now just call the entry point
 	*/
 
-	noprof_call(entry_point, LABEL(engine_done));
+	MR_noprof_call(entry_point, MR_LABEL(engine_done));
 
-Define_label(engine_done);
+MR_define_label(engine_done);
 
 	/*
 	** Decrement the number of times we've entered this
@@ -487,7 +477,7 @@
 }
 #endif
 
-	debugmsg1("in label `engine_done', locals at %p\n", locals);
+	MR_debugmsg1("in label `engine_done', locals at %p\n", locals);
 
 #ifdef MR_LOWLEVEL_DEBUG
 	/*
@@ -495,7 +485,7 @@
 	** was actually used.
 	*/
 
-	if (check_space) {
+	if (MR_check_space) {
 		int	low = 0, high = LOCALS_SIZE;
 		int	used_low, used_high;
 
@@ -524,19 +514,19 @@
 	** save them first.
 	*/
 	MR_ENGINE(e_exception) = NULL;
-	save_registers();
+	MR_save_registers();
 
 #ifdef	MR_DEBUG_JMPBUFS
 	printf("engine longjmp %p\n", MR_ENGINE(e_jmp_buf));
 #endif
 
-	debugmsg0("longjmping out...\n");
+	MR_debugmsg0("longjmping out...\n");
 	longjmp(*(MR_ENGINE(e_jmp_buf)), 1);
 }} /* end call_engine_inner() */
 
 /* with nonlocal gotos, we don't save the previous locations */
 void 
-dump_prev_locations(void) {}
+MR_dump_prev_locations(void) {}
 
 #else /* not USE_GCC_NONLOCAL_GOTOS */
 
@@ -559,15 +549,15 @@
 engine_done(void)
 {
 	MR_ENGINE(e_exception) = NULL;
-	save_registers();
-	debugmsg0("longjmping out...\n");
+	MR_save_registers();
+	MR_debugmsg0("longjmping out...\n");
 	longjmp(*(MR_ENGINE(e_jmp_buf)), 1);
 }
 
 static MR_Code *
 engine_init_registers(void)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 	MR_succip = (MR_Code *) engine_done;
 	return NULL;
 }
@@ -587,7 +577,7 @@
 static int	prev_fp_index = 0;
 
 void 
-dump_prev_locations(void)
+MR_dump_prev_locations(void)
 {
 	int i, pos;
 
@@ -598,7 +588,7 @@
 		printf("previous %d locations:\n", NUM_PREV_FPS);
 		for (i = 0; i < NUM_PREV_FPS; i++) {
 			pos = (i + prev_fp_index) % NUM_PREV_FPS;
-			printlabel(prev_fps[pos]);
+			MR_printlabel(stdout, prev_fps[pos]);
 		}
 	}
 }
@@ -639,8 +629,8 @@
 		if (++prev_fp_index >= NUM_PREV_FPS)
 			prev_fp_index = 0;
 
-		debuggoto(fp);
-		debugsreg();
+		MR_debuggoto(fp);
+		MR_debugsreg();
 		fp = (Func *) (*fp)();
 	}
 } /* end call_engine_inner() */
@@ -649,7 +639,7 @@
 /*---------------------------------------------------------------------------*/
 
 void
-terminate_engine(void)
+MR_terminate_engine(void)
 {
 	/*
 	** we don't bother to deallocate memory...
@@ -659,38 +649,38 @@
 
 /*---------------------------------------------------------------------------*/
 
-Define_extern_entry(do_redo);
-Define_extern_entry(do_fail);
-Define_extern_entry(do_succeed);
-Define_extern_entry(do_last_succeed);
-Define_extern_entry(do_not_reached);
-Define_extern_entry(exception_handler_do_fail);
-
-BEGIN_MODULE(special_labels_module)
-	init_entry_ai(do_redo);
-	init_entry_ai(do_fail);
-	init_entry_ai(do_succeed);
-	init_entry_ai(do_last_succeed);
-	init_entry_ai(do_not_reached);
-	init_entry_ai(exception_handler_do_fail);
-BEGIN_CODE
+MR_define_extern_entry(do_redo);
+MR_define_extern_entry(do_fail);
+MR_define_extern_entry(do_succeed);
+MR_define_extern_entry(do_last_succeed);
+MR_define_extern_entry(do_not_reached);
+MR_define_extern_entry(exception_handler_do_fail);
+
+MR_BEGIN_MODULE(special_labels_module)
+	MR_init_entry_ai(do_redo);
+	MR_init_entry_ai(do_fail);
+	MR_init_entry_ai(do_succeed);
+	MR_init_entry_ai(do_last_succeed);
+	MR_init_entry_ai(do_not_reached);
+	MR_init_entry_ai(exception_handler_do_fail);
+MR_BEGIN_CODE
 
-Define_entry(do_redo);
+MR_define_entry(do_redo);
 	MR_redo();
 
-Define_entry(do_fail);
+MR_define_entry(do_fail);
 	MR_fail();
 
-Define_entry(do_succeed);
+MR_define_entry(do_succeed);
 	MR_succeed();
 
-Define_entry(do_last_succeed);
+MR_define_entry(do_last_succeed);
 	MR_succeed_discard();
 
-Define_entry(do_not_reached);
+MR_define_entry(do_not_reached);
 	MR_fatal_error("reached not_reached\n");
 
-Define_entry(exception_handler_do_fail);
+MR_define_entry(exception_handler_do_fail);
 	/*
 	** `exception_handler_do_fail' is the same as `do_fail':
 	** it just invokes fail().  The reason we don't just use
@@ -700,7 +690,7 @@
 	*/
 	MR_fail();
 
-END_MODULE
+MR_END_MODULE
 
 void mercury_sys_init_engine(void); /* suppress gcc warning */
 void mercury_sys_init_engine(void) {
Index: runtime/mercury_engine.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_engine.h,v
retrieving revision 1.18
diff -u -b -r1.18 mercury_engine.h
--- runtime/mercury_engine.h	2000/08/03 06:18:41	1.18
+++ runtime/mercury_engine.h	2000/11/13 04:05:47
@@ -18,13 +18,13 @@
 	** any function prototypes before the global register
 	** declarations.
 	*/
-#include "mercury_regs.h"		/* for NUM_REAL_REGS */
+#include "mercury_regs.h"		/* for MR_NUM_REAL_REGS */
 
 #include <setjmp.h>
 
 #include "mercury_std.h"		/* for `bool' */
 #include "mercury_types.h"		/* for `MR_Code *' */
-#include "mercury_goto.h"		/* for `Define_entry()' */
+#include "mercury_goto.h"		/* for `MR_define_entry()' */
 #include "mercury_thread.h"		/* for pthread types */
 #include "mercury_context.h"		/* for MR_Context, MR_IF_USE_TRAIL */
 
@@ -92,9 +92,9 @@
 		MR_IF_USE_TRAIL(MR_Unsigned saved_ticket_counter;)
 		MR_IF_USE_TRAIL(MR_Unsigned saved_ticket_high_water;)
 
-#if NUM_REAL_REGS > 0
-		MR_Word regs[NUM_REAL_REGS];
-#endif /* NUM_REAL_REGS > 0 */
+#if MR_NUM_REAL_REGS > 0
+		MR_Word regs[MR_NUM_REAL_REGS];
+#endif /* MR_NUM_REAL_REGS > 0 */
 
 	} MR_jmp_buf;
 
@@ -116,8 +116,8 @@
 	**
 	** Notes:
 	** - The Mercury registers must be valid before the call to MR_setjmp.
-	** - The general-purpose registers r1, r2... are not restored and must
-	** be saved by the caller.
+	** - The general-purpose registers MR_r1, MR_r2... are not restored
+	** and must be saved by the caller.
 	** - In grades without conservative garbage collection, the caller
 	** must save and restore hp, sol_hp, heap_zone 
 	** and solutions_heap_zone.
@@ -125,7 +125,7 @@
 #define MR_setjmp(setjmp_env, longjmp_label)				\
 	    do {							\
 		(setjmp_env)->mercury_env = MR_ENGINE(e_jmp_buf);	\
-		save_regs_to_mem((setjmp_env)->regs);			\
+		MR_save_regs_to_mem((setjmp_env)->regs);		\
 		(setjmp_env)->saved_succip = MR_succip;			\
 		(setjmp_env)->saved_sp = MR_sp;				\
 		(setjmp_env)->saved_curfr = MR_curfr;			\
@@ -138,7 +138,7 @@
 				MR_ticket_high_water);			\
 		if (setjmp((setjmp_env)->env)) {			\
 			MR_ENGINE(e_jmp_buf) = (setjmp_env)->mercury_env; \
-			restore_regs_from_mem((setjmp_env)->regs);	\
+			MR_restore_regs_from_mem((setjmp_env)->regs);	\
 			MR_succip = (setjmp_env)->saved_succip;		\
 			MR_sp = (setjmp_env)->saved_sp;			\
 			MR_curfr = (setjmp_env)->saved_curfr;		\
@@ -175,7 +175,7 @@
 */
 
 typedef struct MR_mercury_engine_struct {
-	MR_Word		fake_reg[MAX_FAKE_REG];
+	MR_Word		fake_reg[MR_MAX_FAKE_REG];
 		/* The fake reg vector for this engine. */
 #ifndef CONSERVATIVE_GC
 	MR_Word		*e_hp;
@@ -221,20 +221,16 @@
 	jmp_buf		*e_jmp_buf;
 	MR_Word		*e_exception;
 #ifndef	CONSERVATIVE_GC
-	MemoryZone	*heap_zone;
-	MemoryZone	*solutions_heap_zone;
-	MemoryZone	*global_heap_zone;
+	MR_MemoryZone	*heap_zone;
+	MR_MemoryZone	*solutions_heap_zone;
+	MR_MemoryZone	*global_heap_zone;
 #endif
 #ifdef	NATIVE_GC
-	MemoryZone	*heap_zone2;
+	MR_MemoryZone	*heap_zone2;
   #ifdef MR_DEBUG_AGC_PRINT_VARS
-	MemoryZone	*debug_heap_zone;
+	MR_MemoryZone	*debug_heap_zone;
   #endif
 #endif
-#ifdef	MR_LOWLEVEL_DEBUG
-	MemoryZone	*dumpstack_zone;
-	int		dumpindex;
-#endif
 } MercuryEngine;
 
 /*
@@ -254,7 +250,7 @@
   #define MR_thread_engine_base \
 	((MercuryEngine *) MR_GETSPECIFIC(MR_engine_base_key))
 
-  #if NUM_REAL_REGS > 0
+  #if MR_NUM_REAL_REGS > 0
     #define	MR_ENGINE_BASE_REGISTER
   	/*
 	** MR_engine_base is defined in machdeps/{arch}.h
@@ -284,14 +280,14 @@
   #define IF_NOT_CONSERVATIVE_GC(x)
 #endif
 
-#define load_engine_regs(eng)						\
+#define MR_load_engine_regs(eng)					\
   	do {								\
 		IF_NOT_CONSERVATIVE_GC(MR_hp = (eng)->e_hp;)		\
 		IF_NOT_CONSERVATIVE_GC(MR_sol_hp = (eng)->e_sol_hp;)	\
 		IF_NOT_CONSERVATIVE_GC(MR_global_hp = (eng)->e_global_hp;) \
 	} while (0)
 
-#define save_engine_regs(eng)						\
+#define MR_save_engine_regs(eng)					\
   	do {								\
 		IF_NOT_CONSERVATIVE_GC((eng)->e_hp = MR_hp;)		\
 		IF_NOT_CONSERVATIVE_GC((eng)->e_sol_hp = MR_sol_hp;)	\
@@ -299,7 +295,7 @@
 	} while (0)
 
 /*
-** Macros for easy access to heap zones
+** Macros for easy access to heap zones.
 */
 #ifndef	CONSERVATIVE_GC
   #define MR_heap_zone			MR_ENGINE(heap_zone)
@@ -310,37 +306,38 @@
 /*
 ** Functions for creating/destroying a MercuryEngine.
 */
-extern	MercuryEngine	*create_engine(void);
-extern	void		destroy_engine(MercuryEngine *engine);
+extern	MercuryEngine	*MR_create_engine(void);
+extern	void		MR_destroy_engine(MercuryEngine *engine);
 
 /*
 ** Functions for initializing/finalizing a MercuryEngine.
 ** These are like create/destroy except that they don't allocate/deallocate
 ** the MercuryEngine structure.
 */
-extern	void	init_engine(MercuryEngine *engine);
-extern	void	finalize_engine(MercuryEngine *engine);
+extern	void		MR_init_engine(MercuryEngine *engine);
+extern	void		MR_finalize_engine(MercuryEngine *engine);
 
 /*
 ** Functions that act on the current Mercury engine.
 ** See the comments in mercury_engine.c for documentation on MR_call_engine().
 */
-extern	MR_Word *	MR_call_engine(MR_Code *entry_point, bool catch_exceptions);
-extern	void	terminate_engine(void);
-extern	void	dump_prev_locations(void);
+extern	MR_Word		*MR_call_engine(MR_Code *entry_point,
+				bool catch_exceptions);
+extern	void		MR_terminate_engine(void);
+extern	void		MR_dump_prev_locations(void);
 
 /*---------------------------------------------------------------------------*/
 
 /*
-** Builtin labels that point to commonly used code fragments
+** Builtin labels that point to commonly used code fragments.
 */
 
-Declare_entry(do_redo);
-Declare_entry(do_fail);
-Declare_entry(do_reset_hp_fail);
-Declare_entry(do_reset_framevar0_fail);
-Declare_entry(do_succeed);
-Declare_entry(do_not_reached);
-Declare_entry(exception_handler_do_fail);
+MR_declare_entry(do_redo);
+MR_declare_entry(do_fail);
+MR_declare_entry(do_reset_hp_fail);
+MR_declare_entry(do_reset_framevar0_fail);
+MR_declare_entry(do_succeed);
+MR_declare_entry(do_not_reached);
+MR_declare_entry(exception_handler_do_fail);
 
 #endif /* not MERCURY_ENGINE_H */
Index: runtime/mercury_float.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_float.c,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_float.c
--- runtime/mercury_float.c	2000/08/03 06:18:42	1.4
+++ runtime/mercury_float.c	2000/10/21 09:12:01
@@ -7,8 +7,8 @@
 #include	"mercury_imp.h"
 
 /*
-** The function `hash_float()' is used by the library predicate `float__hash'
-** and also for hashing floats for `pragma fact_table' indexing.
+** The function `MR_hash_float()' is used by the library predicate
+** `float__hash' and also for hashing floats for `pragma fact_table' indexing.
 ** It computes a non-negative MR_Integer hash value for a MR_Float.
 ** The exact hash function used depend on the relative sizes of MR_Float and
 ** MR_Integer.
@@ -23,7 +23,7 @@
 };
 
 MR_Integer
-hash_float(MR_Float f)
+MR_hash_float(MR_Float f)
 {
 	union MR_Float_Integer fi;
 	size_t i;
Index: runtime/mercury_float.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_float.h,v
retrieving revision 1.10
diff -u -b -r1.10 mercury_float.h
--- runtime/mercury_float.h	2000/08/03 06:18:42	1.10
+++ runtime/mercury_float.h	2000/11/14 04:11:15
@@ -20,32 +20,35 @@
 
 #ifdef BOXED_FLOAT 
 
-#define word_to_float(w) (*(MR_Float *)(w))
+#define MR_word_to_float(w) 	(* (MR_Float *) (w))
 
-#define FLOAT_WORDS ((sizeof(MR_Float) + sizeof(MR_Word) - 1) / sizeof(MR_Word))
+#define MR_FLOAT_WORDS 		((sizeof(MR_Float) + sizeof(MR_Word) - 1) \
+					/ sizeof(MR_Word))
 
 #ifdef CONSERVATIVE_GC
-#define float_to_word(f) ( \
-		hp_alloc_atomic(FLOAT_WORDS), \
-		*(MR_Float *)(void *)(MR_hp - FLOAT_WORDS) = (f), \
-		/* return */ (MR_Word) (MR_hp - FLOAT_WORDS) \
+#define MR_float_to_word(f) ( \
+		MR_hp_alloc_atomic(MR_FLOAT_WORDS), \
+		* (MR_Float *) (void *) (MR_hp - MR_FLOAT_WORDS) = (f), \
+		/* return */ (MR_Word) (MR_hp - MR_FLOAT_WORDS) \
 	)
 #else
-/* we need to ensure that what we allocated on the heap is properly
-   aligned */
-#define float_to_word(f) ( \
-		( (MR_Word)MR_hp & (sizeof(MR_Float) - 1) ? \
-			hp_alloc_atomic(1) : (void)0 ), \
-		hp_alloc_atomic(FLOAT_WORDS), \
-		*(MR_Float *)(void *)(MR_hp - FLOAT_WORDS) = (f), \
-		/* return */ (MR_Word) (MR_hp - FLOAT_WORDS) \
+/*
+** we need to ensure that what we allocated on the heap is properly
+** aligned
+*/
+#define MR_float_to_word(f) ( \
+		( (MR_Word) MR_hp & (sizeof(MR_Float) - 1) ? \
+			MR_hp_alloc_atomic(1) : (void)0 ), \
+		MR_hp_alloc_atomic(MR_FLOAT_WORDS), \
+		* (MR_Float *) (void *)(MR_hp - MR_FLOAT_WORDS) = (f), \
+		/* return */ (MR_Word) (MR_hp - MR_FLOAT_WORDS) \
 	)
 #endif
 
 #ifdef __GNUC__
-#define float_const(f) ({ static const MR_Float d = f; (MR_Word)&d; })
+#define MR_float_const(f) ({ static const MR_Float d = f; (MR_Word) &d; })
 #else
-#define float_const(f) float_to_word(f)	/* inefficient */
+#define MR_float_const(f) MR_float_to_word(f)	/* inefficient */
 #endif
 
 #else /* not BOXED_FLOAT */
@@ -57,25 +60,27 @@
 	MR_Word w;
 };
 
-#define float_const(f) float_to_word(f)
+#define MR_float_const(f) MR_float_to_word(f)
 
 #ifdef __GNUC__
 
 /* GNU C allows you to cast to a union type */
-#define float_to_word(f) (__extension__ ((union MR_Float_Word)(MR_Float)(f)).w)
-#define word_to_float(w) (__extension__ ((union MR_Float_Word)(MR_Word)(w)).f)
+#define MR_float_to_word(f) (__extension__ \
+				((union MR_Float_Word)(MR_Float)(f)).w)
+#define MR_word_to_float(w) (__extension__ \
+				((union MR_Float_Word)(MR_Word)(w)).f)
 
 #else /* not __GNUC__ */
 
-static MR_Word float_to_word(MR_Float f)
+static MR_Word MR_float_to_word(MR_Float f)
 	{ union MR_Float_Word tmp; tmp.f = f; return tmp.w; }
-static MR_Float word_to_float(MR_Word w)
+static MR_Float MR_word_to_float(MR_Word w)
 	{ union MR_Float_Word tmp; tmp.w = w; return tmp.f; }
 
 #endif /* not __GNUC__ */
 
 #endif /* not BOXED_FLOAT */
 
-MR_Integer hash_float(MR_Float);
+MR_Integer MR_hash_float(MR_Float);
 
 #endif /* not MERCURY_FLOAT_H */
Index: runtime/mercury_goto.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_goto.h,v
retrieving revision 1.25
diff -u -b -r1.25 mercury_goto.h
--- runtime/mercury_goto.h	2000/11/13 04:26:02	1.25
+++ runtime/mercury_goto.h	2000/11/14 01:27:41
@@ -11,22 +11,22 @@
 
 #include "mercury_conf.h"
 #include "mercury_types.h"	/* for `MR_Code *' */
-#include "mercury_debug.h"	/* for debuggoto() */
-#include "mercury_label.h"	/* for insert_{entry,internal}_label() */
-#include "mercury_dummy.h"	/* for dummy_identify_function() */
-
-#define paste(a,b) a##b
-#define stringify(string) #string
-#define entry(label) paste(_entry_,label)
-#define skip(label) paste(skip_,label)
-
-#define MR_ENTRY_LAYOUT(label)	  (const MR_Stack_Layout_Entry *) (MR_Word) \
-					&(paste(mercury_data__layout__,label))
-#define MR_INTERNAL_LAYOUT(label) (const MR_Stack_Layout_Label *) (MR_Word) \
-					&(paste(mercury_data__layout__,label))
+#include "mercury_debug.h"	/* for MR_debuggoto() */
+#include "mercury_label.h"	/* for MR_insert_{entry,internal}_label() */
+#include "mercury_dummy.h"	/* for MR_dummy_identify_function() */
+
+#define MR_paste(a,b) a##b
+#define MR_stringify(string) #string
+#define MR_entry(label) MR_paste(_entry_,label)
+#define MR_skip(label) MR_paste(skip_,label)
+
+#define MR_ENTRY_LAYOUT(label)	  	(const MR_Stack_Layout_Entry *)	\
+					(MR_Word) 			\
+				&(MR_paste(mercury_data__layout__,label))
+#define MR_INTERNAL_LAYOUT(label) 	(const MR_Stack_Layout_Label *)	\
+					(MR_Word)			\
+				&(MR_paste(mercury_data__layout__,label))
 
-#define MR_init_entry(label)	init_entry(label)
-
 /*
 ** Passing the name of a label to MR_insert_{internal,entry}_label
 ** causes that name to be included in the executable as static readonly data.
@@ -58,28 +58,28 @@
 ** a layout structure, use the _sl variant.
 */
 
-#define make_label_ai(n, a, l)		MR_insert_internal(n, a, NULL)
-#define make_label_sl(n, a, l)		MR_insert_internal(n, a, \
+#define MR_make_label_ai(n, a, l)		MR_insert_internal(n, a, NULL)
+#define MR_make_label_sl(n, a, l)		MR_insert_internal(n, a, \
 						MR_INTERNAL_LAYOUT(l))
 
-#define make_local_ai(n, a, l)		MR_insert_entry(n, a, NULL)
-#define make_local_sl(n, a, l)		MR_insert_entry(n, a, \
+#define MR_make_local_ai(n, a, l)		MR_insert_entry(n, a, NULL)
+#define MR_make_local_sl(n, a, l)		MR_insert_entry(n, a, \
 						MR_ENTRY_LAYOUT(l))
 
-#define make_entry_ai(n, a, l)		MR_insert_entry(n, a, NULL)
-#define make_entry_sl(n, a, l)		MR_insert_entry(n, a, \
+#define MR_make_entry_ai(n, a, l)		MR_insert_entry(n, a, NULL)
+#define MR_make_entry_sl(n, a, l)		MR_insert_entry(n, a, \
 						MR_ENTRY_LAYOUT(l))
 
 #if defined(MR_INSERT_LABELS)
-  #define make_label(n, a, l)		make_label_ai(n, a, l)
+  #define MR_make_label(n, a, l)		MR_make_label_ai(n, a, l)
 #else
-  #define make_label(n, a, l)		/* nothing */
+  #define MR_make_label(n, a, l)		/* nothing */
 #endif
 
 #if defined(MR_INSERT_LABELS) || defined(PROFILE_CALLS)
-  #define make_local(n, a, l)		make_local_ai(n, a, l)
+  #define MR_make_local(n, a, l)		MR_make_local_ai(n, a, l)
 #else 
-  #define make_local(n, a, l)		/* nothing */
+  #define MR_make_local(n, a, l)		/* nothing */
 #endif
 
 /*
@@ -91,9 +91,9 @@
 ** `need_to_init_entries' predicate in compiler/mlds_to_c.m.
 */
 #if defined(MR_INSERT_LABELS) || defined(PROFILE_CALLS)
-  #define make_entry(n, a, l)		make_entry_ai(n, a, l)
+  #define MR_make_entry(n, a, l)		MR_make_entry_ai(n, a, l)
 #else
-  #define make_entry(n, a, l)		/* nothing */
+  #define MR_make_entry(n, a, l)		/* nothing */
 #endif
 
 #ifdef SPLIT_C_FILES
@@ -115,7 +115,7 @@
   ** to the address we are jumping to, so that we can use an `ldgp'
   ** instruction on entry to the procedure to set up the right gp value.
   */
-  #define ASM_JUMP(address)				\
+  #define MR_ASM_JUMP(address)				\
 	__asm__("bis %0, %0, $27\n\t" 			\
 		: : "r"(address) : "$27");		\
 	goto *(address)
@@ -129,14 +129,14 @@
   ** on entry to a procedure, we need to load the $gp register
   ** with the correct value relative to the current address in $27
   */
-  #define INLINE_ASM_FIXUP_REGS				\
+  #define MR_INLINE_ASM_FIXUP_REGS				\
   	"	ldgp $gp, 0($27)\n" : : : "memory"
 
   /*
   ** on fall-thru, we need to skip the ldgp instruction
   */
-  #define ASM_FALLTHROUGH(label) \
-  	goto skip(label);
+  #define MR_ASM_FALLTHROUGH(label) \
+  	goto MR_skip(label);
 
 #elif defined(__i386__) || defined(__mc68000__)
 
@@ -165,12 +165,12 @@
   ** I know this is awful.  It wasn't _my_ idea to use non-local gotos ;-)
   */
   #if defined(__i386__)
-    #define ASM_JUMP(label)				\
+    #define MR_ASM_JUMP(label)				\
   	{ register int stack_pointer __asm__("esp");	\
   	__asm__("" : : "g"(stack_pointer)); }		\
   	goto *(label)
   #elif defined(__mc68000__)
-    #define ASM_JUMP(label)				\
+    #define MR_ASM_JUMP(label)				\
   	{ register int stack_pointer __asm__("sp");	\
   	__asm__("" : : "g"(stack_pointer)); }		\
   	goto *(label)
@@ -180,7 +180,7 @@
   ** That hack above needs to be done for all non-local jumps,
   ** even if we're not using assembler labels.
   */
-  #define JUMP(label)		ASM_JUMP(label)
+  #define MR_JUMP(label)	MR_ASM_JUMP(label)
 
   /*
   ** If we're using position-independent code on i386, then we need to
@@ -216,7 +216,7 @@
     */
     #if defined(__i386__)
 
-      #define INLINE_ASM_FIXUP_REGS     			\
+      #define MR_INLINE_ASM_FIXUP_REGS     			\
     	"	call 0f\n"     					\
     	"0:\n"       						\
     	"	popl %%ebx\n"     				\
@@ -237,21 +237,21 @@
 	**  <Roman.Hodek at informatik.uni-erlangen.de>
 	*/ 
 
-      #define INLINE_ASM_FIXUP_REGS \
+      #define MR_INLINE_ASM_FIXUP_REGS \
         "       lea (%%pc,_GLOBAL_OFFSET_TABLE_ at GOTPC),%%a5\n" : : : "memory"
 
     #endif
 
     /*
-    ** It is safe to fall through into INLINE_ASM_FIXUP_REGS,
+    ** It is safe to fall through into MR_INLINE_ASM_FIXUP_REGS,
     ** but it might be more efficient to branch past it.
     ** We should really measure both ways and find out which is
     ** better... for the moment, we just fall through, since
     ** that keeps the code smaller.
     */
     #if 0
-      #define ASM_FALLTHROUGH(label) \
-  	goto skip(label);
+      #define MR_ASM_FALLTHROUGH(label) \
+  	goto MR_skip(label);
     #endif
 
   #endif /* PIC */
@@ -262,8 +262,8 @@
   ** Hence the `.type' directive below.
   */
   #ifdef __ELF__
-    #define INLINE_ASM_ENTRY_LABEL_TYPE(label) \
-	"	.type _entry_" stringify(label) ", at function\n"
+    #define MR_INLINE_ASM_ENTRY_LABEL_TYPE(label) \
+	"	.type _entry_" MR_stringify(label) ", at function\n"
   #endif
 
 #elif defined (__sparc)
@@ -293,7 +293,7 @@
     ** instruction, and `0b' means the label `0:' before the current
     ** instruction.
     */
-    #define INLINE_ASM_FIXUP_REGS     				\
+    #define MR_INLINE_ASM_FIXUP_REGS     			\
     	"0:\n"     						\
     	"	call 1f\n"     					\
     	"	nop\n"     					\
@@ -305,15 +305,15 @@
     		: : : "%l7", "%o7", "memory"
 
     /*
-    ** It is safe to fall through into INLINE_ASM_FIXUP_REGS,
+    ** It is safe to fall through into MR_INLINE_ASM_FIXUP_REGS,
     ** but it might be more efficient to branch past it.
     ** We should really measure both ways and find out which is
     ** better... for the moment, we just fall through, since
     ** that keeps the code smaller.
     */
     #if 0
-      #define ASM_FALLTHROUGH(label) \
-  	goto skip(label);
+      #define MR_ASM_FALLTHROUGH(label) \
+  	goto MR_skip(label);
     #endif
 
   #endif /* PIC */
@@ -325,8 +325,8 @@
   ** Hence the `.type' directive below.
   */
   #ifndef MR_CANNOT_GROK_ASM_TYPE_DIRECTIVE
-    #define INLINE_ASM_ENTRY_LABEL_TYPE(label) \
-	"	.type _entry_" stringify(label) ",#function\n"
+    #define MR_INLINE_ASM_ENTRY_LABEL_TYPE(label) \
+	"	.type _entry_" MR_stringify(label) ",#function\n"
   #endif
 
 #endif
@@ -334,67 +334,65 @@
 /* for other architectures, these macros have default definitions */
 
 /*
-** INLINE_ASM_FIXUP_REGS is used to fix up the value of
-** any registers after an ASM_JUMP to an entry point, if necessary.
+** MR_INLINE_ASM_FIXUP_REGS is used to fix up the value of
+** any registers after an MR_ASM_JUMP to an entry point, if necessary.
 ** It is an assembler string, possibly followed by `: : : <clobbers>'
 ** where <clobbers> is an indication to gcc of what gets clobbered.
 */
-#ifdef INLINE_ASM_FIXUP_REGS
-  #define ASM_FIXUP_REGS				\
+#ifdef MR_INLINE_ASM_FIXUP_REGS
+  #define MR_ASM_FIXUP_REGS				\
 	__asm__ __volatile__(				\
-		INLINE_ASM_FIXUP_REGS			\
+		MR_INLINE_ASM_FIXUP_REGS		\
 	);
-  #define NEED_ASM_FIXUP_REGS
 #else
-  #define ASM_FIXUP_REGS
-  #define INLINE_ASM_FIXUP_REGS
-  #undef  NEED_ASM_FIXUP_REGS
+  #define MR_ASM_FIXUP_REGS
+  #define MR_INLINE_ASM_FIXUP_REGS
 #endif
 
 /*
-** ASM_FALLTHROUGH is executed when falling through into an entry point.
-** It may call `goto skip(label)' if it wishes to skip past the
-** label and the INLINE_ASM_FIXUP_REGS code.
+** MR_ASM_FALLTHROUGH is executed when falling through into an entry point.
+** It may call `goto MR_skip(label)' if it wishes to skip past the
+** label and the MR_INLINE_ASM_FIXUP_REGS code.
 */
-#ifndef ASM_FALLTHROUGH
-#define ASM_FALLTHROUGH(label)
+#ifndef MR_ASM_FALLTHROUGH
+#define MR_ASM_FALLTHROUGH(label)
 #endif
 
 /*
-** INLINE_ASM_GLOBALIZE_LABEL is an assembler string to
+** MR_INLINE_ASM_GLOBALIZE_LABEL is an assembler string to
 ** declare an entry label as global.  The following definition
 ** using `.globl' should work with the GNU assembler and
 ** with most Unix assemblers.
 */
-#ifndef INLINE_ASM_GLOBALIZE_LABEL
-#define INLINE_ASM_GLOBALIZE_LABEL(label) \
-	"	.globl _entry_" stringify(label) "\n"
+#ifndef MR_INLINE_ASM_GLOBALIZE_LABEL
+#define MR_INLINE_ASM_GLOBALIZE_LABEL(label) \
+	"	.globl _entry_" MR_stringify(label) "\n"
 #endif
 
 /*
-** INLINE_ASM_ENTRY_LABEL_TYPE is an assembler string to
+** MR_INLINE_ASM_ENTRY_LABEL_TYPE is an assembler string to
 ** declare the "type" of a label as function (i.e. code), not data,
 ** if this is needed.
 */
-#ifndef INLINE_ASM_ENTRY_LABEL_TYPE
-#define INLINE_ASM_ENTRY_LABEL_TYPE(label)
+#ifndef MR_INLINE_ASM_ENTRY_LABEL_TYPE
+#define MR_INLINE_ASM_ENTRY_LABEL_TYPE(label)
 #endif
 
 /*
-** INLINE_ASM_ENTRY_LABEL is an assembler string to
+** MR_INLINE_ASM_ENTRY_LABEL is an assembler string to
 ** define an assembler entry label.
 */
-#ifndef INLINE_ASM_ENTRY_LABEL
-#define INLINE_ASM_ENTRY_LABEL(label)	\
-	"_entry_" stringify(label) ":\n"
+#ifndef MR_INLINE_ASM_ENTRY_LABEL
+#define MR_INLINE_ASM_ENTRY_LABEL(label)	\
+	"_entry_" MR_stringify(label) ":\n"
 #endif
 
 /*
-** ASM_JUMP is used to jump to an entry point defined with
-** ASM_ENTRY, ASM_STATIC_ENTRY, or ASM_LOCAL_ENTRY.
+** MR_ASM_JUMP is used to jump to an entry point defined with
+** MR_ASM_ENTRY, MR_ASM_STATIC_ENTRY, or MR_ASM_LOCAL_ENTRY.
 */
-#ifndef ASM_JUMP
-#define ASM_JUMP(address)	goto *(address)
+#ifndef MR_ASM_JUMP
+#define MR_ASM_JUMP(address)	goto *(address)
 #endif
 
 /*---------------------------------------------------------------------------*/
@@ -404,52 +402,52 @@
 /*---------------------------------------------------------------------------*/
 
 /*
-** ASM_ENTRY is used to declare an external entry point
+** MR_ASM_ENTRY is used to declare an external entry point
 ** using a (global) assembler label.
 */
-#define ASM_ENTRY(label) 				\
-	ASM_FALLTHROUGH(label)				\
-  	entry(label):					\
+#define MR_ASM_ENTRY(label) 				\
+	MR_ASM_FALLTHROUGH(label)			\
+  	MR_entry(label):				\
 	__asm__ __volatile__(				\
-		INLINE_ASM_GLOBALIZE_LABEL(label)	\
-		INLINE_ASM_ENTRY_LABEL_TYPE(label)	\
-		INLINE_ASM_ENTRY_LABEL(label)		\
-		INLINE_ASM_FIXUP_REGS			\
+		MR_INLINE_ASM_GLOBALIZE_LABEL(label)	\
+		MR_INLINE_ASM_ENTRY_LABEL_TYPE(label)	\
+		MR_INLINE_ASM_ENTRY_LABEL(label)	\
+		MR_INLINE_ASM_FIXUP_REGS		\
 	);						\
-	skip(label): ;
+	MR_skip(label): ;
 
 /*
-** ASM_STATIC_ENTRY is the same as ASM_ENTRY,
+** MR_ASM_STATIC_ENTRY is the same as MR_ASM_ENTRY,
 ** except that its scope is local to a C file, rather than global.
-** Note that even static entry points must do INLINE_ASM_FIXUP_REGS,
+** Note that even static entry points must do MR_INLINE_ASM_FIXUP_REGS,
 ** since although there won't be any direct calls to them from another
 ** C file, their address may be taken and so there may be indirect
 ** calls.
 */
-#define ASM_STATIC_ENTRY(label) 			\
-	ASM_FALLTHROUGH(label)				\
-  	entry(label):					\
+#define MR_ASM_STATIC_ENTRY(label) 			\
+	MR_ASM_FALLTHROUGH(label)			\
+  	MR_entry(label):				\
 	__asm__ __volatile__(				\
-		INLINE_ASM_ENTRY_LABEL_TYPE(label)	\
-		INLINE_ASM_ENTRY_LABEL(label)		\
-		INLINE_ASM_FIXUP_REGS			\
+		MR_INLINE_ASM_ENTRY_LABEL_TYPE(label)	\
+		MR_INLINE_ASM_ENTRY_LABEL(label)	\
+		MR_INLINE_ASM_FIXUP_REGS		\
 	);						\
-	skip(label): ;
+	MR_skip(label): ;
 
 /*
-** ASM_LOCAL_ENTRY is the same as ASM_ENTRY,
-** except that its scope is local to a BEGIN_MODULE...END_MODULE
+** MR_ASM_LOCAL_ENTRY is the same as MR_ASM_ENTRY,
+** except that its scope is local to a MR_BEGIN_MODULE...MR_END_MODULE
 ** block, rather than being global.
-** Note that even local entry points must do INLINE_ASM_FIXUP_REGS, since
+** Note that even local entry points must do MR_INLINE_ASM_FIXUP_REGS, since
 ** although there won't be any direct calls to them from another
 ** C file, their address may be taken and so there may be indirect
 ** calls.
 */
-#define ASM_LOCAL_ENTRY(label) 				\
-	ASM_FALLTHROUGH(label)				\
-  	entry(label):					\
-  	ASM_FIXUP_REGS					\
-	skip(label): ;
+#define MR_ASM_LOCAL_ENTRY(label) 			\
+	MR_ASM_FALLTHROUGH(label)			\
+  	MR_entry(label):				\
+  	MR_ASM_FIXUP_REGS				\
+	MR_skip(label): ;
 
 /*---------------------------------------------------------------------------*/
 
@@ -460,7 +458,7 @@
   #endif
 
   /* Define the type of a module initialization function */
-  typedef void ModuleFunc(void);
+  typedef void MR_ModuleFunc(void);
 
   /* The following macro expands to a dummy assembler statement which
   ** contains no code, but which tells gcc that it uses the specified
@@ -470,7 +468,7 @@
   ** address' to suppress optimization, but this way is better because
   ** it doesn't generate any code.)
   */
-  #define PRETEND_ADDRESS_IS_USED(address)		\
+  #define MR_PRETEND_ADDRESS_IS_USED(address)		\
 	__asm__ __volatile__("" : : "g"(address))
   /*
   Explanation:
@@ -493,153 +491,159 @@
   ** analysis for delay slot scheduling may think that global
   ** register variables which are only assigned to in the function
   ** cannot be live, when in fact they really are).
-  ** That is what the two occurrences of the PRETEND_ADDRESS_IS_USED
+  ** That is what the two occurrences of the MR_PRETEND_ADDRESS_IS_USED
   ** macro are for.
   ** For versions of gcc later than egcs 1.1.2 (which corresponds to gcc 2.91,
   ** according to __GNUC_MINOR__), and in particular for gcc 2.95,
   ** we also need to include at least one `goto *' with an unknown
   ** target, so that gcc doesn't optimize away all the labels
   ** because it thinks they are unreachable.
-  ** The dummy_identify_function() function just returns the address
-  ** passed to it, so `goto *dummy_identify_function(&& dummy_label); dummy_label:'
-  ** is the same as `goto dummy_label; label:', i.e. it just falls through.
-  ** For older versions of gcc, we don't do this, since it adds significantly
-  ** to the code size.
+  ** The MR_dummy_identify_function() function just returns the address
+  ** passed to it, so `goto *MR_dummy_identify_function(&& dummy_label);
+  ** dummy_label:' is the same as `goto dummy_label; label:', i.e. it just
+  ** falls through. For older versions of gcc, we don't do this, since it
+  ** adds significantly to the code size.
   */
   #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 91)
     /* gcc version > egcs 1.1.2 */
-    #define BEGIN_MODULE(module_name)					\
+    #define MR_BEGIN_MODULE(module_name)				\
 	MR_MODULE_STATIC_OR_EXTERN void module_name(void);		\
 	MR_MODULE_STATIC_OR_EXTERN void module_name(void) {		\
-		PRETEND_ADDRESS_IS_USED(module_name);			\
-		PRETEND_ADDRESS_IS_USED(&&paste(module_name,_dummy_label)); \
-		goto *dummy_identify_function(				\
-			&&paste(module_name,_dummy_label));		\
-		paste(module_name,_dummy_label):			\
+		MR_PRETEND_ADDRESS_IS_USED(module_name);		\
+		MR_PRETEND_ADDRESS_IS_USED(				\
+			&&MR_paste(module_name,_dummy_label));		\
+		goto *MR_dummy_identify_function(			\
+			&&MR_paste(module_name,_dummy_label));		\
+		MR_paste(module_name,_dummy_label):			\
 		{
   #else /* gcc version <= egcs 1.1.2 */
-    #define BEGIN_MODULE(module_name)					\
+    #define MR_BEGIN_MODULE(module_name)				\
 	MR_MODULE_STATIC_OR_EXTERN void module_name(void);		\
 	MR_MODULE_STATIC_OR_EXTERN void module_name(void) {		\
-		PRETEND_ADDRESS_IS_USED(module_name);			\
-		PRETEND_ADDRESS_IS_USED(&&paste(module_name,_dummy_label)); \
-		paste(module_name,_dummy_label):			\
+		MR_PRETEND_ADDRESS_IS_USED(module_name);		\
+		MR_PRETEND_ADDRESS_IS_USED(				\
+			&&MR_paste(module_name,_dummy_label));		\
+		MR_paste(module_name,_dummy_label):			\
 		{
   #endif /* gcc version <= egcs 1.1.2 */
-  /* initialization code for module goes between BEGIN_MODULE and BEGIN_CODE */
-  #define BEGIN_CODE } return; {
-  /* body of module goes between BEGIN_CODE and END_MODULE */
-  #define END_MODULE } }
+  /* initialization code for module goes between MR_BEGIN_MODULE */
+  /* and MR_BEGIN_CODE */
+  #define MR_BEGIN_CODE } return; {
+  /* body of module goes between MR_BEGIN_CODE and MR_END_MODULE */
+  #define MR_END_MODULE } }
 
 
   #if defined(USE_ASM_LABELS)
-    #define Declare_entry(label)	\
-	extern void label(void) __asm__("_entry_" stringify(label))
-    #define Declare_static(label)	\
-	static void label(void) __asm__("_entry_" stringify(label))
-    #define Define_extern_entry(label)	Declare_entry(label)
-    #define Define_entry(label)		\
-		ASM_ENTRY(label)	\
+    #define MR_declare_entry(label)		\
+	extern void label(void) __asm__("_entry_" MR_stringify(label))
+    #define MR_declare_static(label)		\
+	static void label(void) __asm__("_entry_" MR_stringify(label))
+    #define MR_define_extern_entry(label)	MR_declare_entry(label)
+    #define MR_define_entry(label)		\
+		MR_ASM_ENTRY(label)		\
 	}				\
 	label:				\
-	PRETEND_ADDRESS_IS_USED(&&entry(label));	\
+	MR_PRETEND_ADDRESS_IS_USED(&&MR_entry(label));	\
 	{
-    #define Define_static(label)	\
-		ASM_STATIC_ENTRY(label) \
+    #define MR_define_static(label)		\
+		MR_ASM_STATIC_ENTRY(label) 	\
 	}				\
 	label:				\
-	PRETEND_ADDRESS_IS_USED(&&entry(label));	\
+	MR_PRETEND_ADDRESS_IS_USED(&&MR_entry(label));	\
 	{
     /*
-    ** The PRETEND_ADDRESS_IS_USED macro is necessary to 
+    ** The MR_PRETEND_ADDRESS_IS_USED macro is necessary to 
     ** prevent an over-zealous gcc from optimizing away `label'
     ** and the code that followed. 
     */
-    #define init_entry(label)	\
-	PRETEND_ADDRESS_IS_USED(&&label); \
-	make_entry(stringify(label), label, label)
-    #define init_entry_ai(label)	\
-	PRETEND_ADDRESS_IS_USED(&&label); \
-	make_entry_ai(stringify(label), label, label)
-    #define init_entry_sl(label)	\
-	PRETEND_ADDRESS_IS_USED(&&label); \
-	make_entry_sl(stringify(label), label, label)
+    #define MR_init_entry(label)	\
+	MR_PRETEND_ADDRESS_IS_USED(&&label); \
+	MR_make_entry(MR_stringify(label), label, label)
+    #define MR_init_entry_ai(label)	\
+	MR_PRETEND_ADDRESS_IS_USED(&&label); \
+	MR_make_entry_ai(MR_stringify(label), label, label)
+    #define MR_init_entry_sl(label)	\
+	MR_PRETEND_ADDRESS_IS_USED(&&label); \
+	MR_make_entry_sl(MR_stringify(label), label, label)
 
-    #define ENTRY(label) 	(&label)
-    #define STATIC(label) 	(&label)
+    #define MR_ENTRY(label) 		(&label)
+    #define MR_STATIC(label) 		(&label)
 
-    #ifndef JUMP
-    #define JUMP(label)		ASM_JUMP(label)
+    #ifndef MR_JUMP
+    #define MR_JUMP(label)		MR_ASM_JUMP(label)
     #endif
 
   #else
     /* !defined(USE_ASM_LABELS) */
 
-    #define Declare_entry(label)	extern MR_Code * entry(label)
-    #define Declare_static(label)	static MR_Code * entry(label)
-    #define Define_extern_entry(label)	MR_Code * entry(label)
-    #define Define_entry(label)	\
+    #define MR_declare_entry(label)	extern MR_Code * MR_entry(label)
+    #define MR_declare_static(label)	static MR_Code * MR_entry(label)
+    #define MR_define_extern_entry(label) MR_Code * MR_entry(label)
+    #define MR_define_entry(label)	\
 	}	\
-	entry(label): \
+	MR_entry(label): \
 	label:	\
 	{
-    #define Define_static(label)	\
+    #define MR_define_static(label)	\
 	}	\
-	entry(label): \
+	MR_entry(label): \
 	label:	\
 	{
-    #define init_entry(label)	\
-	make_entry(stringify(label), &&label, label);	\
-	entry(label) = &&label
-    #define init_entry_ai(label)	\
-	make_entry_ai(stringify(label), &&label, label);	\
-	entry(label) = &&label
-    #define init_entry_sl(label)	\
-	make_entry_sl(stringify(label), &&label, label);	\
-	entry(label) = &&label
-    #define ENTRY(label) 	(entry(label))
-    #define STATIC(label) 	(entry(label))
+    #define MR_init_entry(label)	\
+	MR_make_entry(MR_stringify(label), &&label, label);	\
+	MR_entry(label) = &&label
+    #define MR_init_entry_ai(label)	\
+	MR_make_entry_ai(MR_stringify(label), &&label, label);	\
+	MR_entry(label) = &&label
+    #define MR_init_entry_sl(label)	\
+	MR_make_entry_sl(MR_stringify(label), &&label, label);	\
+	MR_entry(label) = &&label
+    #define MR_ENTRY(label) 		(MR_entry(label))
+    #define MR_STATIC(label) 		(MR_entry(label))
 
-    #ifndef JUMP
-    #define JUMP(label)		goto *(label)
+    #ifndef MR_JUMP
+    #define MR_JUMP(label)		goto *(label)
     #endif
 
   #endif /* !defined(USE_ASM_LABELS) */
 
-  #define Declare_local(label)	/* no declaration required */
-  #define Define_local(label)	\
-  		ASM_LOCAL_ENTRY(label)	\
+  #define MR_declare_local(label)	/* no declaration required */
+  #define MR_define_local(label)	\
+  		MR_ASM_LOCAL_ENTRY(label)	\
 	}	\
 	label:	\
 	{
-  #define init_local(label)	\
-  	make_local(stringify(label), &&entry(label), label)
-  #define init_local_ai(label)	\
-  	make_local_ai(stringify(label), &&entry(label), label)
-  #define init_local_sl(label)	\
-  	make_local_sl(stringify(label), &&entry(label), label)
-  #define Define_label(label)	Define_local(label)
-  #define Declare_label(label)	/* no declaration required */
-  #define init_label(label)	\
-	make_label(stringify(label), &&entry(label), label)
-  #define init_label_ai(label)	\
-	make_label_ai(stringify(label), &&entry(label), label)
-  #define init_label_sl(label)	\
-	make_label_sl(stringify(label), &&entry(label), label)
-
-  #define LOCAL(label)		(&&entry(label))
-  #define LABEL(label)		(&&entry(label))
-  #define GOTO(label)		do { debuggoto(label); JUMP(label); } while(0)
-  #define GOTO_ENTRY(label) 	GOTO(ENTRY(label))
-  #define GOTO_STATIC(label) 	GOTO(STATIC(label))
-  #define GOTO_LOCAL(label) 	GOTO_LABEL(label)
-  #define GOTO_LABEL(label) 	do {					\
-  					debuggoto(LABEL(label));	\
+  #define MR_init_local(label)	\
+  	MR_make_local(MR_stringify(label), &&MR_entry(label), label)
+  #define MR_init_local_ai(label)	\
+  	MR_make_local_ai(MR_stringify(label), &&MR_entry(label), label)
+  #define MR_init_local_sl(label)	\
+  	MR_make_local_sl(MR_stringify(label), &&MR_entry(label), label)
+  #define MR_define_label(label)	MR_define_local(label)
+  #define MR_declare_label(label)	/* no declaration required */
+  #define MR_init_label(label)	\
+	MR_make_label(MR_stringify(label), &&MR_entry(label), label)
+  #define MR_init_label_ai(label)	\
+	MR_make_label_ai(MR_stringify(label), &&MR_entry(label), label)
+  #define MR_init_label_sl(label)	\
+	MR_make_label_sl(MR_stringify(label), &&MR_entry(label), label)
+
+  #define MR_LOCAL(label)	(&&MR_entry(label))
+  #define MR_LABEL(label)	(&&MR_entry(label))
+  #define MR_GOTO(label)	do {					\
+	  				MR_debuggoto(label);		\
+					MR_JUMP(label);			\
+  				} while(0)
+  #define MR_GOTO_ENTRY(label) 	MR_GOTO(MR_ENTRY(label))
+  #define MR_GOTO_STATIC(label)	MR_GOTO(MR_STATIC(label))
+  #define MR_GOTO_LOCAL(label) 	MR_GOTO_LABEL(label)
+  #define MR_GOTO_LABEL(label) 	do {					\
+  					MR_debuggoto(MR_LABEL(label));	\
 					goto label;			\
 				} while(0)
 
   /*
-  ** GOTO_LABEL(label) is the same as GOTO(LABEL(label)) except
+  ** MR_GOTO_LABEL(label) is the same as MR_GOTO(MR_LABEL(label)) except
   ** that it may allow gcc to generate slightly better code
   */
 
@@ -647,71 +651,81 @@
   /* !defined(USE_GCC_NONLOCAL_GOTOS) */
 
   /* Define the type of a module initialization function */
-  typedef MR_Code * ModuleFunc(void);
+  typedef MR_Code * MR_ModuleFunc(void);
 
-  #define BEGIN_MODULE(module_name)	\
+  #define MR_BEGIN_MODULE(module_name)	\
 	MR_MODULE_STATIC_OR_EXTERN MR_Code* module_name(void); \
 	MR_MODULE_STATIC_OR_EXTERN MR_Code* module_name(void) {
-  #define BEGIN_CODE			return 0;
-  #define END_MODULE			}
+  #define MR_BEGIN_CODE			return 0;
+  #define MR_END_MODULE			}
 
-  #define Declare_entry(label)		extern MR_Code *label(void)
-  #define Declare_static(label)		static MR_Code *label(void)
-  #define Define_extern_entry(label)	MR_Code *label(void)
-  #define Define_entry(label)		\
-		GOTO_LABEL(label);	\
+  #define MR_declare_entry(label)		extern MR_Code *label(void)
+  #define MR_declare_static(label)		static MR_Code *label(void)
+  #define MR_define_extern_entry(label)		MR_Code *label(void)
+  #define MR_define_entry(label)		\
+		MR_GOTO_LABEL(label);		\
 	}				\
 	MR_Code* label(void) {
-  #define Define_static(label)		\
-		GOTO_LABEL(label);	\
+  #define MR_define_static(label)		\
+		MR_GOTO_LABEL(label);		\
 	}				\
 	static MR_Code* label(void) {
-  #define init_entry(label)	make_entry(stringify(label), label, label)
-  #define init_entry_ai(label)	make_entry_ai(stringify(label), label, label)
-  #define init_entry_sl(label)	make_entry_sl(stringify(label), label, label)
-
-  #define Declare_local(label)	static MR_Code *label(void)
-  #define Define_local(label)		\
-		GOTO_LABEL(label);	\
+  #define MR_init_entry(label)		MR_make_entry(MR_stringify(label),    \
+		  				label, label)
+  #define MR_init_entry_ai(label)	MR_make_entry_ai(MR_stringify(label), \
+		  				label, label)
+  #define MR_init_entry_sl(label)	MR_make_entry_sl(MR_stringify(label), \
+		  				label, label)
+
+  #define MR_declare_local(label)	static MR_Code *label(void)
+  #define MR_define_local(label)	\
+		MR_GOTO_LABEL(label);	\
 	}				\
 	static MR_Code* label(void) {
-  #define init_local(label)	make_local(stringify(label), label, label)
-  #define init_local_ai(label)	make_local_ai(stringify(label), label, label)
-  #define init_local_sl(label)	make_local_sl(stringify(label), label, label)
-
-  #define Declare_label(label)	static MR_Code *label(void)
-  #define Define_label(label)		\
-		GOTO_LABEL(label);	\
+  #define MR_init_local(label)		MR_make_local(MR_stringify(label),    \
+		  				label, label)
+  #define MR_init_local_ai(label)	MR_make_local_ai(MR_stringify(label), \
+		  				label, label)
+  #define MR_init_local_sl(label)	MR_make_local_sl(MR_stringify(label), \
+		  				label, label)
+
+  #define MR_declare_label(label)	static MR_Code *label(void)
+  #define MR_define_label(label)	\
+		MR_GOTO_LABEL(label);	\
 	}				\
 	static MR_Code* label(void) {
-  #define init_label(label)	make_label(stringify(label), label, label)
-  #define init_label_ai(label)	make_label_ai(stringify(label), label, label)
-  #define init_label_sl(label)	make_label_sl(stringify(label), label, label)
-
-  #define ENTRY(label) 		((MR_Code *) (label))
-  #define STATIC(label) 	((MR_Code *) (label))
-  #define LOCAL(label)		((MR_Code *) (label))
-  #define LABEL(label)		((MR_Code *) (label))
-  /*
-  ** The call to debuggoto() is in the driver function in mercury_engine.c,
-  ** which is why the following definitions have no debuggoto().
-  */
-  #define GOTO(label)		return (label)
-  #define GOTO_ENTRY(label) 	GOTO(ENTRY(label))
-  #define GOTO_STATIC(label) 	GOTO(STATIC(label))
-  #define GOTO_LOCAL(label) 	GOTO(LOCAL(label))
-  #define GOTO_LABEL(label) 	GOTO(LABEL(label))
+  #define MR_init_label(label)		MR_make_label(MR_stringify(label),    \
+		  				label, label)
+  #define MR_init_label_ai(label)	MR_make_label_ai(MR_stringify(label), \
+		  				label, label)
+  #define MR_init_label_sl(label)	MR_make_label_sl(MR_stringify(label), \
+		  				label, label)
+
+  #define MR_ENTRY(label) 	((MR_Code *) (label))
+  #define MR_STATIC(label) 	((MR_Code *) (label))
+  #define MR_LOCAL(label)	((MR_Code *) (label))
+  #define MR_LABEL(label)	((MR_Code *) (label))
+  /*
+  ** The call to MR_debuggoto() is in the driver function in mercury_engine.c,
+  ** which is why the following definitions have no MR_debuggoto().
+  */
+  #define MR_GOTO(label)	return (label)
+  #define MR_GOTO_ENTRY(label) 	MR_GOTO(MR_ENTRY(label))
+  #define MR_GOTO_STATIC(label) MR_GOTO(MR_STATIC(label))
+  #define MR_GOTO_LOCAL(label) 	MR_GOTO(MR_LOCAL(label))
+  #define MR_GOTO_LABEL(label) 	MR_GOTO(MR_LABEL(label))
 
 #endif /* !defined(USE_GCC_NONLOCAL_GOTOS) */
 
 /* definitions for computed gotos */
 
-#define COMPUTED_GOTO(val, labels) 			\
-	{ static MR_Code *jump_table[] = {			\
+#define MR_COMPUTED_GOTO(val, labels) 			\
+	{						\
+		static MR_Code *jump_table[] = {	\
 		labels					\
 	  };						\
-	  GOTO(jump_table[val]);			\
+	  	MR_GOTO(jump_table[val]);		\
 	}
-#define AND ,	/* used to separate the labels */
+#define MR_AND ,	/* used to separate the labels */
 
 #endif /* not MERCURY_GOTO_H */
Index: runtime/mercury_heap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_heap.h,v
retrieving revision 1.16
diff -u -b -r1.16 mercury_heap.h
--- runtime/mercury_heap.h	2000/08/03 06:18:43	1.16
+++ runtime/mercury_heap.h	2000/10/22 00:58:28
@@ -21,10 +21,10 @@
 
   #include "gc.h"
 
-  #define tag_incr_hp_n(dest, tag, count) \
+  #define MR_tag_incr_hp_n(dest, tag, count) \
 	((dest) = (MR_Word) MR_mkword((tag), \
 			(MR_Word) GC_MALLOC((count) * sizeof(MR_Word))))
-  #define tag_incr_hp_atomic(dest, tag, count) \
+  #define MR_tag_incr_hp_atomic(dest, tag, count) \
 	((dest) = (MR_Word) MR_mkword((tag), \
 			(MR_Word) GC_MALLOC_ATOMIC((count) * sizeof(MR_Word))))
 
@@ -59,55 +59,56 @@
     #endif
 
     #include "gc_inl.h"
-    #define tag_incr_hp(dest, tag, count) 				\
+    #define MR_tag_incr_hp(dest, tag, count) 				\
 	( __builtin_constant_p(count) && (count) < 16 			\
 	? ({ 	void * temp; 						\
 		/* if size > 1, round up to an even number of words */	\
-		MR_Word num_words = ((count) == 1 ? 1 : 2 * (((count) + 1) / 2));\
+		MR_Word num_words = ((count) == 1 ? 1 :			\
+			2 * (((count) + 1) / 2));			\
 		GC_MALLOC_WORDS(temp, num_words);			\
 		(dest) = (MR_Word) MR_mkword((tag), temp);			\
 	  })								\
-	: tag_incr_hp_n((dest), (tag), (count))				\
+	: MR_tag_incr_hp_n((dest), (tag), (count))			\
 	)
 
   #else /* not INLINE_ALLOC */
 
-    #define tag_incr_hp(dest, tag, count) \
-	tag_incr_hp_n((dest), (tag), (count))
+    #define MR_tag_incr_hp(dest, tag, count) \
+	MR_tag_incr_hp_n((dest), (tag), (count))
 
   #endif /* not INLINE_ALLOC */
 
-  #define mark_hp(dest)		((void)0)
-  #define restore_hp(src)	((void)0)
+  #define MR_mark_hp(dest)		((void)0)
+  #define MR_restore_hp(src)		((void)0)
 
 			/* we use `MR_hp' as a convenient temporary here */
-  #define hp_alloc(count) (						\
-		incr_hp(LVALUE_CAST(MR_Word, MR_hp), (count)),		\
+  #define MR_hp_alloc(count) (						\
+		MR_incr_hp(MR_LVALUE_CAST(MR_Word, MR_hp), (count)),	\
 		MR_hp += (count),					\
-		(void)0							\
+		(void) 0						\
 	)
-  #define hp_alloc_atomic(count) (					\
-		incr_hp_atomic(LVALUE_CAST(MR_Word, MR_hp), (count)), 	\
+  #define MR_hp_alloc_atomic(count) (					\
+		MR_incr_hp_atomic(MR_LVALUE_CAST(MR_Word, MR_hp), (count)),\
 		MR_hp += (count),					\
-		(void)0							\
+		(void) 0						\
 	)
 
   #define MR_free_heap(ptr)	GC_FREE((ptr))
 
 #else /* not CONSERVATIVE_GC */
 
-  #define tag_incr_hp(dest, tag, count) 			\
+  #define	MR_tag_incr_hp(dest, tag, count) 			\
 	(							\
-		(dest) = (MR_Word) MR_mkword(tag, (MR_Word) MR_hp),	\
-		debugincrhp(count, MR_hp),			\
+			(dest) = (MR_Word) MR_mkword(tag, (MR_Word) MR_hp),\
+			MR_debugincrhp(count, MR_hp),			\
 		MR_hp += (count),				\
 		heap_overflow_check(),				\
-		(void)0						\
+			(void) 0					\
 	)
-  #define tag_incr_hp_atomic(dest, tag, count) \
-	tag_incr_hp((dest), (tag), (count))
+  #define MR_tag_incr_hp_atomic(dest, tag, count) 			\
+		MR_tag_incr_hp((dest), (tag), (count))
 
-  #define mark_hp(dest)		((dest) = (MR_Word) MR_hp)
+  #define MR_mark_hp(dest)		((dest) = (MR_Word) MR_hp)
 
   /*
   ** When restoring MR_hp, we must make sure that we don't truncate the heap
@@ -115,91 +116,96 @@
   ** min_heap_reclamation_point. See the comments in mercury_context.h next to
   ** the set_min_heap_reclamation_point() macro.
   */
-  #define	restore_hp(src)	(					\
-  			LVALUE_CAST(MR_Word, MR_hp) = (src),		\
-  			(void)0						\
+  #define	MR_restore_hp(src)	(				\
+  			MR_LVALUE_CAST(MR_Word, MR_hp) = (src),		\
+  			(void) 0					\
   		)
 
   /*
-  #define	restore_hp(src)	(					\
-  			LVALUE_CAST(MR_Word, MR_hp) =			\
+  #define	MR_restore_hp(src)	(				\
+  			MR_LVALUE_CAST(MR_Word, MR_hp) =		\
   			  ( (MR_Word) MR_min_hp_rec < (src) ?		\
   			  (src) : (MR_Word) MR_min_hp_rec ),		\
-  			(void)0						\
+  			(void) 0					\
   		)
   */
   
-  #define hp_alloc(count)  	 incr_hp(LVALUE_CAST(MR_Word, MR_hp), count)
-  #define hp_alloc_atomic(count) incr_hp_atomic(LVALUE_CAST(MR_Word, MR_hp), count)
+  #define MR_hp_alloc(count)  	 	MR_incr_hp(			\
+		  			MR_LVALUE_CAST(MR_Word, MR_hp), count)
+  #define MR_hp_alloc_atomic(count)	MR_incr_hp_atomic(		\
+		  			MR_LVALUE_CAST(MR_Word, MR_hp), count)
 
-  #define MR_free_heap(ptr)	((void)0)
+  #define MR_free_heap(ptr)		((void) 0)
   
 #endif /* not CONSERVATIVE_GC */
   
 #ifdef	PROFILE_MEMORY
   #define MR_maybe_record_allocation(count, proclabel, type)		\
-	MR_record_allocation((count), ENTRY(proclabel), 		\
+	MR_record_allocation((count), MR_ENTRY(proclabel), 		\
 		MR_STRINGIFY(proclabel), (type))
 #else
   #define MR_maybe_record_allocation(count, proclabel, type)		\
   	((void) 0)
 #endif
   	
-#define tag_incr_hp_msg(dest, tag, count, proclabel, type)		\
+#define MR_tag_incr_hp_msg(dest, tag, count, proclabel, type)		\
 	(								\
 		MR_maybe_record_allocation((count), proclabel, (type)),	\
-		tag_incr_hp((dest), (tag), (count))			\
+		MR_tag_incr_hp((dest), (tag), (count))			\
 	)
-#define tag_incr_hp_atomic_msg(dest, tag, count, proclabel, type) 	\
+#define MR_tag_incr_hp_atomic_msg(dest, tag, count, proclabel, type) 	\
 	(								\
 		MR_maybe_record_allocation((count), proclabel, (type)),	\
-		tag_incr_hp_atomic((dest), (tag), (count))		\
+		MR_tag_incr_hp_atomic((dest), (tag), (count))		\
 	)
 
 /*
-** The incr_hp*() macros are defined in terms of the tag_incr_hp*() macros.
-** Note: the `proclabel' argument is not parenthesized, since it must
+** The MR_incr_hp*() macros are defined in terms of the MR_tag_incr_hp*()
+** macros. Note: the `proclabel' argument is not parenthesized, since it must
 ** be a label name; we may need to prefix `_entry_' in front of it,
 ** which wouldn't work if it was parenthesized.
 */
-#define	incr_hp(dest, count) \
-		tag_incr_hp((dest), MR_mktag(0), (count))
-#define	incr_hp_msg(dest, count, proclabel, type) \
-		tag_incr_hp_msg((dest), MR_mktag(0), (count), \
+#define	MR_incr_hp(dest, count) \
+		MR_tag_incr_hp((dest), MR_mktag(0), (count))
+#define	MR_incr_hp_msg(dest, count, proclabel, type) \
+		MR_tag_incr_hp_msg((dest), MR_mktag(0), (count), \
 			proclabel, (type))
-#define	incr_hp_atomic(dest, count) \
-		tag_incr_hp_atomic((dest), MR_mktag(0), (count))
-#define	incr_hp_atomic_msg(dest, count, proclabel, type) \
-		tag_incr_hp_atomic_msg((dest), MR_mktag(0), (count), \
+#define	MR_incr_hp_atomic(dest, count) \
+		MR_tag_incr_hp_atomic((dest), MR_mktag(0), (count))
+#define	MR_incr_hp_atomic_msg(dest, count, proclabel, type) \
+		MR_tag_incr_hp_atomic_msg((dest), MR_mktag(0), (count), \
 			proclabel, (type))
 
 #ifdef MR_HIGHLEVEL_CODE
 
-MR_EXTERN_INLINE MR_Word create1(MR_Word w1);
-MR_EXTERN_INLINE MR_Word create2(MR_Word w1, MR_Word w2);
-MR_EXTERN_INLINE MR_Word create3(MR_Word w1, MR_Word w2, MR_Word w3) ;
+MR_EXTERN_INLINE MR_Word MR_create1(MR_Word w1);
+MR_EXTERN_INLINE MR_Word MR_create2(MR_Word w1, MR_Word w2);
+MR_EXTERN_INLINE MR_Word MR_create3(MR_Word w1, MR_Word w2, MR_Word w3) ;
 
 MR_EXTERN_INLINE MR_Word
-create1(MR_Word w1) 
+MR_create1(MR_Word w1) 
 {
-	MR_Word *p = (MR_Word *) MR_new_object(MR_Word, 1 * sizeof(MR_Word), "create1");
+	MR_Word *p = (MR_Word *) MR_new_object(MR_Word, 1 * sizeof(MR_Word),
+			"create1");
 	p[0] = w1;
 	return (MR_Word) p;
 }
 
 MR_EXTERN_INLINE MR_Word
-create2(MR_Word w1, MR_Word w2) 
+MR_create2(MR_Word w1, MR_Word w2) 
 {
-	MR_Word *p = (MR_Word *) MR_new_object(MR_Word, 2 * sizeof(MR_Word), "create2");
+	MR_Word *p = (MR_Word *) MR_new_object(MR_Word, 2 * sizeof(MR_Word),
+			"create2");
 	p[0] = w1;
 	p[1] = w2;
 	return (MR_Word) p;
 }
 
 MR_EXTERN_INLINE MR_Word
-create3(MR_Word w1, MR_Word w2, MR_Word w3) 
+MR_create3(MR_Word w1, MR_Word w2, MR_Word w3) 
 {
-	MR_Word *p = (MR_Word *) MR_new_object(MR_Word, 3 * sizeof(MR_Word), "create3");
+	MR_Word *p = (MR_Word *) MR_new_object(MR_Word, 3 * sizeof(MR_Word),
+			"create3");
 	p[0] = w1;
 	p[1] = w2;
 	p[2] = w3;
@@ -207,11 +213,11 @@
 }
 
 #define MR_create1_msg(w1, proclabel, type) \
-	create1((w1))
+	MR_create1((w1))
 #define MR_create2_msg(w1, w2, proclabel, type)	\
-	create2((w1), (w2))
+	MR_create2((w1), (w2))
 #define MR_create3_msg(w1, w2, w3, proclabel, type) \
-	create3((w1), (w2), (w3))
+	MR_create3((w1), (w2), (w3))
 
 #else /* ! MR_HIGHLEVEL_CODE */
 
@@ -222,28 +228,28 @@
 */
 
 /* used only by hand-written code not by the automatically generated code */
-#define create1(w1)						\
+#define MR_create1(w1)						\
 	(							\
-		hp_alloc(1),					\
+		MR_hp_alloc(1),					\
 		MR_hp[-1] = (MR_Word) (w1),			\
-		debugcr1(MR_hp[-1], MR_hp),			\
+		MR_debugcr1(MR_hp[-1], MR_hp),			\
 		/* return */ (MR_Word) (MR_hp - 1)			\
 	)
 
 /* used only by hand-written code not by the automatically generated code */
-#define create2(w1, w2)						\
+#define MR_create2(w1, w2)						\
 	(							\
-		hp_alloc(2),					\
+		MR_hp_alloc(2),					\
 		MR_hp[-2] = (MR_Word) (w1),			\
 		MR_hp[-1] = (MR_Word) (w2),			\
-		debugcr2(MR_hp[-2], MR_hp[-1], MR_hp),		\
+		MR_debugcr2(MR_hp[-2], MR_hp[-1], MR_hp),		\
 		/* return */ (MR_Word) (MR_hp - 2)			\
 	)
 
 /* used only by hand-written code not by the automatically generated code */
-#define create3(w1, w2, w3)					\
+#define MR_create3(w1, w2, w3)					\
 	(							\
-		hp_alloc(3),					\
+		MR_hp_alloc(3),					\
 		MR_hp[-3] = (MR_Word) (w1),			\
 		MR_hp[-2] = (MR_Word) (w2),			\
 		MR_hp[-1] = (MR_Word) (w3),			\
@@ -254,9 +260,9 @@
 #define MR_create1_msg(w1,proclabel,type)				\
 	(								\
 		MR_maybe_record_allocation(1, proclabel, (type)),	\
-		hp_alloc(1),						\
+		MR_hp_alloc(1),						\
 		MR_hp[-1] = (MR_Word) (w1),				\
-		debugcr1(MR_hp[-1], MR_hp),				\
+		MR_debugcr1(MR_hp[-1], MR_hp),				\
 		/* return */ (MR_Word) (MR_hp - 1)				\
 	)
 
@@ -264,10 +270,10 @@
 #define MR_create2_msg(w1, w2, proclabel, type)				\
 	(								\
 		MR_maybe_record_allocation(2, proclabel, (type)),	\
-		hp_alloc(2),						\
+		MR_hp_alloc(2),						\
 		MR_hp[-2] = (MR_Word) (w1),				\
 		MR_hp[-1] = (MR_Word) (w2),				\
-		debugcr2(MR_hp[-2], MR_hp[-1], MR_hp),			\
+		MR_debugcr2(MR_hp[-2], MR_hp[-1], MR_hp),		\
 		/* return */ (MR_Word) (MR_hp - 2)				\
 	)
 
@@ -275,7 +281,7 @@
 #define MR_create3_msg(w1, w2, w3, proclabel, type)			\
 	(								\
 		MR_maybe_record_allocation(3, proclabel, (type)),	\
-		hp_alloc(3),						\
+		MR_hp_alloc(3),						\
 		MR_hp[-3] = (MR_Word) (w1),				\
 		MR_hp[-2] = (MR_Word) (w2),				\
 		MR_hp[-1] = (MR_Word) (w3),				\
@@ -288,22 +294,22 @@
 ** Indended for use in handwritten C code where the Mercury registers
 ** may have been clobbered due to C function calls (eg, on the SPARC due
 ** to sliding register windows).
-** Remember to save_transient_hp() before calls to such code, and
-** restore_transient_hp() after.
+** Remember to MR_save_transient_hp() before calls to such code, and
+** MR_restore_transient_hp() after.
 */
 
-#define incr_saved_hp(A, B)					\
+#define MR_incr_saved_hp(A, B)					\
 	do { 							\
-		restore_transient_hp();				\
-		incr_hp((A), (B));				\
-		save_transient_hp();				\
+		MR_restore_transient_hp();			\
+		MR_incr_hp((A), (B));				\
+		MR_save_transient_hp();				\
 	} while (0)
 
-#define incr_saved_hp_atomic(A, B) 				\
+#define MR_incr_saved_hp_atomic(A, B) 				\
 	do { 							\
-		restore_transient_hp();				\
-		incr_hp_atomic((A), (B));			\
-		save_transient_hp();				\
+		MR_restore_transient_hp();			\
+		MR_incr_hp_atomic((A), (B));			\
+		MR_save_transient_hp();				\
 	} while (0)
 
 #endif /* not MERCURY_HEAP_H */
Index: runtime/mercury_ho_call.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ho_call.c,v
retrieving revision 1.39
diff -u -b -r1.39 mercury_ho_call.c
--- runtime/mercury_ho_call.c	2000/11/11 01:09:37	1.39
+++ runtime/mercury_ho_call.c	2000/11/13 00:11:51
@@ -63,29 +63,29 @@
 ** These are the real implementations of higher order calls and method calls.
 */
 
-Define_extern_entry(mercury__do_call_closure);
-Define_extern_entry(mercury__do_call_class_method);
+MR_define_extern_entry(mercury__do_call_closure);
+MR_define_extern_entry(mercury__do_call_class_method);
 
 /*
 ** These are the real implementations of unify and compare.
 */
 
-Define_extern_entry(mercury__unify_2_0);
-Define_extern_entry(mercury__compare_3_0);
-Define_extern_entry(mercury__compare_3_1);
-Define_extern_entry(mercury__compare_3_2);
-Define_extern_entry(mercury__compare_3_3);
-Declare_label(mercury__compare_3_0_i1);
-
-BEGIN_MODULE(call_module)
-	init_entry_ai(mercury__do_call_closure);
-	init_entry_ai(mercury__do_call_class_method);
-	init_entry_ai(mercury__unify_2_0);
-	init_entry_ai(mercury__compare_3_0);
-	init_entry_ai(mercury__compare_3_1);
-	init_entry_ai(mercury__compare_3_2);
-	init_entry_ai(mercury__compare_3_3);
-BEGIN_CODE
+MR_define_extern_entry(mercury__unify_2_0);
+MR_define_extern_entry(mercury__compare_3_0);
+MR_define_extern_entry(mercury__compare_3_1);
+MR_define_extern_entry(mercury__compare_3_2);
+MR_define_extern_entry(mercury__compare_3_3);
+MR_declare_label(mercury__compare_3_0_i1);
+
+MR_BEGIN_MODULE(call_module)
+	MR_init_entry_ai(mercury__do_call_closure);
+	MR_init_entry_ai(mercury__do_call_class_method);
+	MR_init_entry_ai(mercury__unify_2_0);
+	MR_init_entry_ai(mercury__compare_3_0);
+	MR_init_entry_ai(mercury__compare_3_1);
+	MR_init_entry_ai(mercury__compare_3_2);
+	MR_init_entry_ai(mercury__compare_3_3);
+MR_BEGIN_CODE
 
 /*
 ** Note: this routine gets ignored for profiling.
@@ -93,7 +93,7 @@
 ** rather than call().  See comment in output_call in
 ** compiler/llds_out for explanation.
 */
-Define_entry(mercury__do_call_closure);
+MR_define_entry(mercury__do_call_closure);
 {
 	MR_Closure	*closure;
 	int		num_extra_args;	/* # of args provided by our caller */
@@ -104,34 +104,34 @@
 	num_extra_args = r2;
 	num_hidden_args = closure->MR_closure_num_hidden_args;
 
-	save_registers();
+	MR_save_registers();
 
 	if (num_hidden_args < MR_HO_CALL_INPUTS) {
 		/* copy to the left, from the left */
 		for (i = 1; i <= num_extra_args; i++) {
-			virtual_reg(i + num_hidden_args) =
-				virtual_reg(i + MR_HO_CALL_INPUTS);
+			MR_virtual_reg(i + num_hidden_args) =
+				MR_virtual_reg(i + MR_HO_CALL_INPUTS);
 		}
 	} else if (num_hidden_args > MR_HO_CALL_INPUTS) {
 		/* copy to the right, from the right */
 		for (i = num_extra_args; i > 0; i--) {
-			virtual_reg(i + num_hidden_args) =
-				virtual_reg(i + MR_HO_CALL_INPUTS);
+			MR_virtual_reg(i + num_hidden_args) =
+				MR_virtual_reg(i + MR_HO_CALL_INPUTS);
 		}
 	} /* else the new args are in the right place */
 
 	for (i = 1; i <= num_hidden_args; i++) {
-		virtual_reg(i) = closure->MR_closure_hidden_args(i);
+		MR_virtual_reg(i) = closure->MR_closure_hidden_args(i);
 	}
 
-	restore_registers();
+	MR_restore_registers();
 
 	/*
 	** Note that we pass MR_prof_ho_caller_proc rather than
-	** LABEL(do_call_closure), so that the call gets recorded
+	** MR_LABEL(do_call_closure), so that the call gets recorded
 	** as having come from our caller.
 	*/
-	tailcall(closure->MR_closure_code, MR_prof_ho_caller_proc);
+	MR_tailcall(closure->MR_closure_code, MR_prof_ho_caller_proc);
 }
 
 	/*
@@ -148,7 +148,7 @@
 ** rather than call().  See comment in output_call in
 ** compiler/llds_out for explanation.
 */
-Define_entry(mercury__do_call_class_method);
+MR_define_entry(mercury__do_call_class_method);
 {
 	MR_Code 	*destination;
 	int	num_in_args;
@@ -161,35 +161,38 @@
 
 	num_in_args = r3; /* number of input args */
 
-	save_registers();
+	MR_save_registers();
 
 	if (num_extra_instance_args < MR_CLASS_METHOD_CALL_INPUTS) {
 		/* copy to the left, from the left */
 		for (i = 1; i <= num_in_args; i++) {
-			virtual_reg(i + num_extra_instance_args) =
-				virtual_reg(i + MR_CLASS_METHOD_CALL_INPUTS);
+			MR_virtual_reg(i + num_extra_instance_args) =
+				MR_virtual_reg(i +
+					MR_CLASS_METHOD_CALL_INPUTS);
 		}
 	} else if (num_extra_instance_args > MR_CLASS_METHOD_CALL_INPUTS) {
 		/* copy to the right, from the right */
 		for (i = num_in_args; i > 0; i--) {
-			virtual_reg(i + num_extra_instance_args) =
-				virtual_reg(i + MR_CLASS_METHOD_CALL_INPUTS);
+			MR_virtual_reg(i + num_extra_instance_args) =
+				MR_virtual_reg(i +
+					MR_CLASS_METHOD_CALL_INPUTS);
 		}
 	} /* else the new args are in the right place */
 
 	for (i = num_extra_instance_args; i > 0; i--) {
-		virtual_reg(i) = 
-			MR_typeclass_info_arg_typeclass_info(virtual_reg(1),i);
+		MR_virtual_reg(i) = 
+			MR_typeclass_info_arg_typeclass_info(MR_virtual_reg(1),
+				i);
 	}
 
-	restore_registers();
+	MR_restore_registers();
 
 	/*
 	** Note that we pass MR_prof_ho_caller_proc rather than
-	** LABEL(do_call_class_method), so that the call gets recorded
+	** MR_LABEL(do_call_class_method), so that the call gets recorded
 	** as having come from our caller.
 	*/
-	tailcall(destination, MR_prof_ho_caller_proc);
+	MR_tailcall(destination, MR_prof_ho_caller_proc);
 }
 
 /*
@@ -197,7 +200,7 @@
 ** in the mode `unify(in, in, in) is semidet'.
 */
 
-Define_entry(mercury__unify_2_0);
+MR_define_entry(mercury__unify_2_0);
 {
 
 #define	DECLARE_LOCALS							\
@@ -222,7 +225,7 @@
 	} while(0)
 
 #define	tailcall_user_pred()						\
-	tailcall(type_ctor_info->unify_pred, LABEL(mercury__unify_2_0))
+	MR_tailcall(type_ctor_info->unify_pred, MR_LABEL(mercury__unify_2_0))
 
 #define	start_label		unify_start
 #define	call_user_code_label	call_unify_in_proc
@@ -249,25 +252,25 @@
 ** (The additional entry points replace either or both "in"s with "ui"s.)
 */
 
-Define_entry(mercury__compare_3_0);
+MR_define_entry(mercury__compare_3_0);
 #ifdef PROFILE_CALLS
 {
-	tailcall(ENTRY(mercury__compare_3_3), LABEL(mercury__compare_3_0));
+	MR_tailcall(MR_ENTRY(mercury__compare_3_3), MR_LABEL(mercury__compare_3_0));
 }
 #endif
-Define_entry(mercury__compare_3_1);
+MR_define_entry(mercury__compare_3_1);
 #ifdef PROFILE_CALLS
 {
-	tailcall(ENTRY(mercury__compare_3_3), LABEL(mercury__compare_3_1));
+	MR_tailcall(MR_ENTRY(mercury__compare_3_3), MR_LABEL(mercury__compare_3_1));
 }
 #endif
-Define_entry(mercury__compare_3_2);
+MR_define_entry(mercury__compare_3_2);
 #ifdef PROFILE_CALLS
 {
-	tailcall(ENTRY(mercury__compare_3_3), LABEL(mercury__compare_3_2));
+	MR_tailcall(MR_ENTRY(mercury__compare_3_3), MR_LABEL(mercury__compare_3_2));
 }
 #endif
-Define_entry(mercury__compare_3_3);
+MR_define_entry(mercury__compare_3_3);
 {
 
 #define	DECLARE_LOCALS							\
@@ -292,7 +295,8 @@
 	} while(0)
 
 #define	tailcall_user_pred()						\
-	tailcall(type_ctor_info->compare_pred, LABEL(mercury__compare_3_3))
+	MR_tailcall(type_ctor_info->compare_pred,			\
+		MR_LABEL(mercury__compare_3_3))
 
 #define	start_label		compare_start
 #define	call_user_code_label	call_compare_in_proc
@@ -313,7 +317,7 @@
 #undef	select_compare_code
 
 }
-END_MODULE
+MR_END_MODULE
 
 static MR_Word
 MR_generic_unify(MR_TypeInfo type_info, MR_Word x, MR_Word y)
@@ -332,9 +336,9 @@
 
 #define	tailcall_user_pred()						\
 	do {								\
-		save_transient_registers();				\
+		MR_save_transient_registers();				\
 		(void) MR_call_engine(type_ctor_info->unify_pred, FALSE);\
-		restore_transient_registers();				\
+		MR_restore_transient_registers();			\
 		return (r1);						\
 	} while (0)
 
@@ -372,9 +376,9 @@
 
 #define	tailcall_user_pred()						\
 	do {								\
-		save_transient_registers();				\
+		MR_save_transient_registers();				\
 		(void) MR_call_engine(type_ctor_info->compare_pred, FALSE);\
-		restore_transient_registers();				\
+		MR_restore_transient_registers();			\
 		return (r1);						\
 	} while (0)
 
Index: runtime/mercury_init.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_init.h,v
retrieving revision 1.26
diff -u -b -r1.26 mercury_init.h
--- runtime/mercury_init.h	2000/11/05 12:04:17	1.26
+++ runtime/mercury_init.h	2000/11/13 04:20:51
@@ -77,7 +77,7 @@
 */
 
 #include "mercury_regs.h"	/* must come before system headers */
-#include "mercury_goto.h"	/* for Declare_entry */
+#include "mercury_goto.h"	/* for MR_declare_entry */
 #include "mercury_types.h"	/* for `MR_Word' */
 #include "mercury_wrapper.h"	/* for do_init_modules,
 				   mercury_runtime_init(),
@@ -134,13 +134,16 @@
 		/* output_current_nth_var/3 */
 extern	void	ML_DI_output_current_live_var_names(MR_Word, MR_Word, MR_Word);
 		/* output_current_live_var_names/5 */
-extern	void	ML_DI_output_current_slots(MR_Integer, MR_Integer, MR_Integer, MR_Word,
-		MR_String, MR_String, MR_Integer, MR_Integer, MR_Integer, MR_String, MR_Word);
+extern	void	ML_DI_output_current_slots(MR_Integer, MR_Integer, MR_Integer,
+			MR_Word, MR_String, MR_String, MR_Integer, MR_Integer,
+			MR_Integer, MR_String, MR_Word);
 		/* output_current_slots/13 */
-extern	bool	ML_DI_found_match(MR_Integer, MR_Integer, MR_Integer, MR_Word, MR_String,
-		MR_String, MR_Integer, MR_Integer, MR_Integer, MR_Word, MR_String, MR_Word);
+extern	bool	ML_DI_found_match(MR_Integer, MR_Integer, MR_Integer, MR_Word,
+			MR_String, MR_String, MR_Integer, MR_Integer,
+			MR_Integer, MR_Word, MR_String, MR_Word);
 		/* found_match/12 */
-extern	void	ML_DI_read_request_from_socket(MR_Word, MR_Word *, MR_Integer *);
+extern	void	ML_DI_read_request_from_socket(MR_Word, MR_Word *,
+			MR_Integer *);
 extern	MR_Integer	ML_DI_get_var_number(MR_Word);
 
 /* in library/std_util.m  */
Index: runtime/mercury_label.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_label.c,v
retrieving revision 1.16
diff -u -b -r1.16 mercury_label.c
--- runtime/mercury_label.c	2000/08/03 06:18:47	1.16
+++ runtime/mercury_label.c	2000/10/22 00:21:38
@@ -119,7 +119,8 @@
 		entry_array = realloc(entry_array, 
 				entry_array_size * sizeof(MR_Entry));
 		if (entry_array == NULL) {
-			fatal_error("run out of memory for entry label array");
+			MR_fatal_error(
+				"run out of memory for entry label array");
 		}
 	}
 
Index: runtime/mercury_label.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_label.h,v
retrieving revision 1.6
diff -u -b -r1.6 mercury_label.h
--- runtime/mercury_label.h	2000/08/03 06:18:47	1.6
+++ runtime/mercury_label.h	2000/11/13 04:21:07
@@ -69,7 +69,8 @@
   extern MR_Entry	*MR_prev_entry_by_addr(const MR_Code *addr);
 #endif	/* MR_NEED_ENTRY_LABEL_ARRAY */
 
-extern	void		MR_insert_internal_label(const char *name, MR_Code *addr,
+extern	void		MR_insert_internal_label(const char *name,
+				MR_Code *addr,
 				const MR_Stack_Layout_Label *label_layout);
 extern	MR_Internal	*MR_lookup_internal_by_addr(const MR_Code *addr);
 extern	void		MR_process_all_internal_labels(void f(const void *));
Index: runtime/mercury_layout_util.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_layout_util.c,v
retrieving revision 1.20
diff -u -b -r1.20 mercury_layout_util.c
--- runtime/mercury_layout_util.c	2000/11/07 08:58:34	1.20
+++ runtime/mercury_layout_util.c	2000/11/08 06:20:02
@@ -27,16 +27,16 @@
 	**
 	** The call to MR_trace will clobber the transient registers
 	** on architectures that have them. The compiler generated code
-	** will therefore call save_transient_registers to save the transient
-	** registers in the fake_reg array. We here restore them to the
-	** real registers, save them with the other registers back in
+	** will therefore call MR_save_transient_registers to save the
+	** transient registers in the fake_reg array. We here restore them
+	** to the real registers, save them with the other registers back in
 	** fake_reg, and then copy all fake_reg entries to saved_regs.
 	*/
 
 	int i;
 
-	restore_transient_registers();
-	save_registers();
+	MR_restore_transient_registers();
+	MR_save_registers();
 
 	for (i = 0; i <= max_mr_num; i++) {
 		saved_regs[i] = MR_fake_reg[i];
@@ -48,8 +48,8 @@
 {
 	/*
 	** We execute the converse procedure to MR_copy_regs_to_saved_regs.
-	** The save_transient_registers is there so that a call to the
-	** restore_transient_registers macro after MR_trace will do the
+	** The MR_save_transient_registers is there so that a call to the
+	** MR_restore_transient_registers macro after MR_trace will do the
 	** right thing.
 	*/
 
@@ -59,8 +59,8 @@
 		MR_fake_reg[i] = saved_regs[i];
 	}
 
-	restore_registers();
-	save_transient_registers();
+	MR_restore_registers();
+	MR_save_transient_registers();
 }
 
 MR_TypeInfoParams
@@ -158,7 +158,7 @@
 				printf("r%d", locn_num);
 			}
 			if (saved_regs != NULL) {
-				value = saved_reg(saved_regs, locn_num);
+				value = MR_saved_reg(saved_regs, locn_num);
 				*succeeded = TRUE;
 			}
 			break;
@@ -273,7 +273,7 @@
 				printf("r%d", locn_num);
 			}
 			if (saved_regs != NULL) {
-				value = saved_reg(saved_regs, locn_num);
+				value = MR_saved_reg(saved_regs, locn_num);
 				*succeeded = TRUE;
 			}
 			break;
Index: runtime/mercury_layout_util.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_layout_util.h,v
retrieving revision 1.12
diff -u -b -r1.12 mercury_layout_util.h
--- runtime/mercury_layout_util.h	2000/11/07 08:58:34	1.12
+++ runtime/mercury_layout_util.h	2000/11/13 04:21:33
@@ -14,7 +14,7 @@
 
 /*
 ** These two functions copy the register state to and from the provided
-** saved_regs array, which should have room for MAX_FAKE_REG MR_Words.
+** saved_regs array, which should have room for MR_MAX_FAKE_REG MR_Words.
 */
 
 extern	void	MR_copy_regs_to_saved_regs(int max_mr_num, MR_Word *saved_regs);
@@ -80,12 +80,14 @@
 extern	MR_Word	MR_lookup_long_lval(MR_Long_Lval locn,
 			MR_Word *saved_regs, bool *succeeded);
 extern	MR_Word	MR_lookup_long_lval_base(MR_Long_Lval locn,
-			MR_Word *saved_regs, MR_Word *base_sp, MR_Word *base_curfr,
+			MR_Word *saved_regs, MR_Word *base_sp,
+			MR_Word *base_curfr,
 			bool *succeeded);
 extern	MR_Word	MR_lookup_short_lval(MR_Short_Lval locn,
 			MR_Word *saved_regs, bool *succeeded);
 extern	MR_Word	MR_lookup_short_lval_base(MR_Short_Lval locn,
-			MR_Word *saved_regs, MR_Word *base_sp, MR_Word *base_curfr,
+			MR_Word *saved_regs, MR_Word *base_sp,
+			MR_Word *base_curfr,
 			bool *succeeded);
 
 /*
@@ -125,8 +127,9 @@
 			MR_Word *saved_regs, MR_TypeInfo *type_params,
 			MR_TypeInfo *type_info);
 extern	bool	MR_get_type_base(const MR_Stack_Layout_Vars *vars, int var,
-			MR_Word *saved_regs, MR_Word *base_sp, MR_Word *base_curfr,
-			MR_TypeInfo *type_params, MR_TypeInfo *type_info);
+			MR_Word *saved_regs, MR_Word *base_sp,
+			MR_Word *base_curfr, MR_TypeInfo *type_params,
+			MR_TypeInfo *type_info);
 
 /*
 ** MR_write_variable:
Index: runtime/mercury_memory.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory.c,v
retrieving revision 1.22
diff -u -b -r1.22 mercury_memory.c
--- runtime/mercury_memory.c	2000/10/16 01:33:58	1.22
+++ runtime/mercury_memory.c	2000/10/25 06:41:30
@@ -127,32 +127,28 @@
 ** Define the memory zones used by the Mercury runtime.
 ** (The trail zone is declared in mercury_trail.c.)
 */
-MemoryZone *detstack_zone;
-MemoryZone *nondetstack_zone;
+MR_MemoryZone *MR_detstack_zone;
+MR_MemoryZone *MR_nondetstack_zone;
 #ifndef CONSERVATIVE_GC
-  MemoryZone *heap_zone;
-  MemoryZone *solutions_heap_zone;
+  MR_MemoryZone *MR_heap_zone;
+  MR_MemoryZone *MR_solutions_heap_zone;
 #endif
 #ifdef	MR_USE_MINIMAL_MODEL
-  MemoryZone *generatorstack_zone;
-  MemoryZone *cutstack_zone;
+  MR_MemoryZone *MR_generatorstack_zone;
+  MR_MemoryZone *MR_cutstack_zone;
 #endif
 
-#ifdef	MR_LOWLEVEL_DEBUG
-  MemoryZone *dumpstack_zone;
-  int	dumpindex;
-#endif
-
-size_t		unit;
-size_t		page_size;
+size_t		MR_unit;
+size_t		MR_page_size;
 
 void 
-init_memory(void)
+MR_init_memory(void)
 {
 	static bool already_initialized = FALSE;
 
 	if (already_initialized != FALSE)
 		return;
+
 	already_initialized = TRUE;
 
 	/*
@@ -160,47 +156,65 @@
 	** make sure they are multiples of the page and cache sizes.
 	*/
 
-	page_size = getpagesize();
-	unit = max(page_size, pcache_size);
+	MR_page_size = getpagesize();
+	MR_unit = max(MR_page_size, MR_pcache_size);
 
 #ifdef CONSERVATIVE_GC
-	heap_size		 = 0;
-	heap_zone_size		 = 0;
-	solutions_heap_size	 = 0;
-	solutions_heap_zone_size = 0;
-	global_heap_size	 = 0;
-	global_heap_zone_size	 = 0;
-	debug_heap_size		 = 0;
-	debug_heap_zone_size	 = 0;
+	MR_heap_size		 = 0;
+	MR_heap_zone_size	 = 0;
+	MR_solutions_heap_size	 = 0;
+	MR_solutions_heap_zone_size = 0;
+	MR_global_heap_size	 = 0;
+	MR_global_heap_zone_size = 0;
+	MR_debug_heap_size	 = 0;
+	MR_debug_heap_zone_size	 = 0;
 #else
-	heap_size		 = round_up(heap_size * 1024, unit);
-	heap_zone_size		 = round_up(heap_zone_size * 1024, unit);
-	solutions_heap_size	 = round_up(solutions_heap_size * 1024, unit);
-	solutions_heap_zone_size = round_up(solutions_heap_zone_size * 1024, 
-					unit);
-	global_heap_size	 = round_up(global_heap_size * 1024, unit);
-	global_heap_zone_size	 = round_up(global_heap_zone_size * 1024, unit);
-	debug_heap_size		 = round_up(debug_heap_size * 1024, unit);
-	debug_heap_zone_size	 = round_up(debug_heap_zone_size * 1024, unit);
-#endif
-	detstack_size		 = round_up(detstack_size * 1024, unit);
-	detstack_zone_size	 = round_up(detstack_zone_size * 1024, unit);
-	nondstack_size		 = round_up(nondstack_size * 1024, unit);
-	nondstack_zone_size	 = round_up(nondstack_zone_size * 1024, unit);
+	MR_heap_size		 = MR_round_up(MR_heap_size * 1024,
+					MR_unit);
+	MR_heap_zone_size	 = MR_round_up(MR_heap_zone_size * 1024,
+					MR_unit);
+	MR_solutions_heap_size	 = MR_round_up(MR_solutions_heap_size * 1024,
+					MR_unit);
+	MR_solutions_heap_zone_size = MR_round_up(
+					MR_solutions_heap_zone_size * 1024, 
+					MR_unit);
+	MR_global_heap_size	 = MR_round_up(MR_global_heap_size * 1024,
+					MR_unit);
+	MR_global_heap_zone_size = MR_round_up(MR_global_heap_zone_size * 1024,
+					MR_unit);
+	MR_debug_heap_size	 = MR_round_up(MR_debug_heap_size * 1024,
+					MR_unit);
+	MR_debug_heap_zone_size	 = MR_round_up(MR_debug_heap_zone_size * 1024,
+					MR_unit);
+#endif
+	MR_detstack_size	 = MR_round_up(MR_detstack_size * 1024,
+					MR_unit);
+	MR_detstack_zone_size	 = MR_round_up(MR_detstack_zone_size * 1024,
+					MR_unit);
+	MR_nondstack_size	 = MR_round_up(MR_nondstack_size * 1024,
+					MR_unit);
+	MR_nondstack_zone_size	 = MR_round_up(MR_nondstack_zone_size * 1024,
+					MR_unit);
 #ifdef	MR_USE_MINIMAL_MODEL
-	generatorstack_size	 = round_up(generatorstack_size * 1024, unit);
-	generatorstack_zone_size = round_up(generatorstack_zone_size * 1024,
-					unit);
-	cutstack_size		 = round_up(cutstack_size * 1024, unit);
-	cutstack_zone_size	 = round_up(cutstack_zone_size * 1024, unit);
+	MR_generatorstack_size	 = MR_round_up(MR_generatorstack_size * 1024,
+					MR_unit);
+	MR_generatorstack_zone_size = MR_round_up(
+					MR_generatorstack_zone_size * 1024,
+					MR_unit);
+	MR_cutstack_size	 = MR_round_up(MR_cutstack_size * 1024,
+					MR_unit);
+	MR_cutstack_zone_size	 = MR_round_up(MR_cutstack_zone_size * 1024,
+					MR_unit);
 #endif
 
 #ifdef	MR_USE_TRAIL
-	trail_size		 = round_up(trail_size * 1024, unit);
-	trail_zone_size		 = round_up(trail_zone_size * 1024, unit);
+	MR_trail_size		 = MR_round_up(MR_trail_size * 1024,
+					MR_unit);
+	MR_trail_zone_size	 = MR_round_up(MR_trail_zone_size * 1024,
+					MR_unit);
 #else
-	trail_size		 = 0;
-	trail_zone_size		 = 0;
+	MR_trail_size		 = 0;
+	MR_trail_zone_size	 = 0;
 #endif
 
 	/*
@@ -209,36 +223,38 @@
 	*/
 
 #ifndef CONSERVATIVE_GC
-	if (heap_zone_size >= heap_size) {
-		heap_zone_size = unit;
+	if (MR_heap_zone_size >= MR_heap_size) {
+		MR_heap_zone_size = MR_unit;
 	}
-	if (solutions_heap_zone_size >= solutions_heap_size) {
-		solutions_heap_zone_size = unit;
+	if (MR_solutions_heap_zone_size >= MR_solutions_heap_size) {
+		MR_solutions_heap_zone_size = MR_unit;
 	}
-	if (global_heap_zone_size >= global_heap_size) {
-		global_heap_zone_size = unit;
+	if (MR_global_heap_zone_size >= MR_global_heap_size) {
+		global_heap_zone_size = MR_unit;
 	}
 #endif
 
-	if (detstack_zone_size >= detstack_size) {
-		detstack_zone_size = unit;
+	if (MR_detstack_zone_size >= MR_detstack_size) {
+		MR_detstack_zone_size = MR_unit;
 	}
 
-	if (nondstack_zone_size >= nondstack_size) {
-		nondstack_zone_size = unit;
+	if (MR_nondstack_zone_size >= MR_nondstack_size) {
+		MR_nondstack_zone_size = MR_unit;
 	}
 
 #ifdef MR_USE_TRAIL
-	if (trail_zone_size >= trail_size) {
-		trail_zone_size = unit;
+	if (MR_trail_zone_size >= MR_trail_size) {
+		MR_trail_zone_size = MR_unit;
 	}
 #endif
 
-	init_zones();
-	setup_signals();
+	MR_init_zones();
+	MR_setup_signals();
 
-	if (MR_memdebug) debug_memory();
-} /* end init_memory() */
+	if (MR_memdebug) {
+		MR_debug_memory();
+	}
+} /* end MR_init_memory() */
 
 /*---------------------------------------------------------------------------*/
 
Index: runtime/mercury_memory.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory.h,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_memory.h
--- runtime/mercury_memory.h	2000/10/03 09:17:40	1.13
+++ runtime/mercury_memory.h	2000/11/13 04:22:22
@@ -29,25 +29,20 @@
   #include "gc.h"		/* for GC_FREE */
 #endif
 
-#ifdef	MR_LOWLEVEL_DEBUG
-extern	MemoryZone	*dumpstack_zone;
-extern	int		dumpindex;
-#endif
-
 /*
-** round_up(amount, align) returns `amount' rounded up to the nearest
+** MR_round_up(amount, align) returns `amount' rounded up to the nearest
 ** alignment boundary.  `align' must be a power of 2.
 */
 
-#define round_up(amount, align)	((((amount) - 1) | ((align) - 1)) + 1)
+#define MR_round_up(amount, align)	((((amount) - 1) | ((align) - 1)) + 1)
 
 /* 
 ** For these functions, see the comments in mercury_memory.c and 
 ** mercury_engine.c 
 */
 
-extern	void	init_memory(void);
-extern	void	init_heap(void);
+extern	void	MR_init_memory(void);
+extern	void	MR_init_heap(void);
 
 #ifdef CONSERVATIVE_GC
   extern void	MR_init_conservative_GC(void);
@@ -80,9 +75,10 @@
 ** MR_free(ptr):
 **	deallocates the memory.
 */
+
+extern	void	*MR_malloc(size_t n);
+extern	void	*MR_realloc(void *old, size_t n);
 
-void	*MR_malloc(size_t n);
-void	*MR_realloc(void *old, size_t n);
 #define MR_free(ptr) free(ptr)
 
 #define MR_NEW(type) \
@@ -170,12 +166,12 @@
 /*---------------------------------------------------------------------------*/
 
 /*
-** `unit' is the size of the minimum unit of memory we allocate (in bytes).
-** `page_size' is the size of a single page of memory.
+** `MR_unit' is the size of the minimum unit of memory we allocate (in bytes).
+** `MR_page_size' is the size of a single page of memory.
 */
 
-extern	size_t          unit;
-extern	size_t          page_size;
+extern	size_t          MR_unit;
+extern	size_t          MR_page_size;
 
 /*---------------------------------------------------------------------------*/
 
Index: runtime/mercury_memory_handlers.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.c,v
retrieving revision 1.17
diff -u -b -r1.17 mercury_memory_handlers.c
--- runtime/mercury_memory_handlers.c	2000/11/07 08:58:34	1.17
+++ runtime/mercury_memory_handlers.c	2000/11/08 06:20:03
@@ -134,7 +134,6 @@
 
 #define STDERR 2
 
-
 static bool 
 try_munprotect(void *addr, void *context)
 {
@@ -142,11 +141,11 @@
 	return FALSE;
 #else
 	MR_Word *    fault_addr;
-	MemoryZone *zone;
+	MR_MemoryZone *zone;
 
 	fault_addr = (MR_Word *) addr;
 
-	zone = get_used_memory_zones();
+	zone = MR_get_used_memory_zones();
 
 	if (MR_memdebug) {
 		fprintf(stderr, "caught fault at %p\n", (void *)addr);
@@ -180,19 +179,19 @@
 } 
 
 bool 
-null_handler(MR_Word *fault_addr, MemoryZone *zone, void *context)
+MR_null_handler(MR_Word *fault_addr, MR_MemoryZone *zone, void *context)
 {
 	return FALSE;
 }
 
 /*
-** fatal_abort() prints an error message, possibly a stack dump, and then exits.
-** It is like fatal_error(), except that it is safe to call
+** MR_fatal_abort() prints an error message, possibly a stack dump,
+** and then exits. It is like MR_fatal_error(), except that it is safe to call
 ** from a signal handler.
 */
 
 static void 
-fatal_abort(void *context, const char *main_msg, int dump)
+MR_fatal_abort(void *context, const char *main_msg, int dump)
 {
 	char	*context_msg;
 
@@ -209,7 +208,7 @@
 }
 
 bool 
-default_handler(MR_Word *fault_addr, MemoryZone *zone, void *context)
+MR_default_handler(MR_Word *fault_addr, MR_MemoryZone *zone, void *context)
 {
 #ifndef MR_CHECK_OVERFLOW_VIA_MPROTECT
 	return FALSE;
@@ -217,7 +216,8 @@
     MR_Word *new_zone;
     size_t zone_size;
 
-    new_zone = (MR_Word *) round_up((MR_Unsigned) fault_addr + sizeof(MR_Word), unit);
+    new_zone = (MR_Word *) MR_round_up((MR_Unsigned) fault_addr
+		    + sizeof(MR_Word), MR_unit);
 
     if (new_zone <= zone->hardmax) {
 	zone_size = (char *)new_zone - (char *)zone->redzone;
@@ -259,7 +259,7 @@
 	}
 	sprintf(buf, "\nMercury runtime: memory zone %s#%d overflowed\n",
 		zone->name, zone->id);
-	fatal_abort(context, buf, TRUE);
+	MR_fatal_abort(context, buf, TRUE);
     }
 
     return FALSE;
@@ -267,7 +267,7 @@
 } 
 
 void
-setup_signals(void)
+MR_setup_signals(void)
 {
 /*
 ** When using Microsoft Visual C structured exceptions don't set any
@@ -399,7 +399,7 @@
 
 	MR_trace_report(stderr);
 	print_dump_stack();
-	dump_prev_locations();
+	MR_dump_prev_locations();
 	fprintf(stderr, "exiting from signal handler\n");
 	exit(1);
 } /* end complex_sighandler() */
@@ -450,7 +450,7 @@
 
 	MR_trace_report(stderr);
 	print_dump_stack();
-	dump_prev_locations();
+	MR_dump_prev_locations();
 	fprintf(stderr, "exiting from signal handler\n");
 	exit(1);
 } /* end complex_bushandler() */
@@ -524,7 +524,7 @@
 
 	MR_trace_report(stderr);
 	print_dump_stack();
-	dump_prev_locations();
+	MR_dump_prev_locations();
 	fprintf(stderr, "exiting from signal handler\n");
 	exit(1);
 } /* end complex_segvhandler */
@@ -555,7 +555,7 @@
 	}
 
 	print_dump_stack();
-	dump_prev_locations();
+	MR_dump_prev_locations();
 	fprintf(stderr, "exiting from signal handler\n");
 	exit(1);
 }
@@ -651,7 +651,7 @@
 		if (MR_exception_record_is_access_violation(rec,
 					&address, &access_mode))
 		{
-			MemoryZone *zone;
+			MR_MemoryZone *zone;
 
 			/* Display AV address and access mode */
 			fprintf(stderr, "\n***   An access violation occured"
@@ -822,7 +822,7 @@
 
 	printf("\n");
 	print_dump_stack();
-	dump_prev_locations();
+	MR_dump_prev_locations();
 	
 	fprintf(stderr, "\n\n*** Now passing exception to default handler\n\n");
 	fflush(stderr);
@@ -980,52 +980,7 @@
 static void 
 print_dump_stack(void)
 {
-
-#ifndef	MR_LOWLEVEL_DEBUG
-
 	const char *msg =
 		"This may have been caused by a stack overflow, due to unbounded recursion.\n";
 	write(STDERR, msg, strlen(msg));
-
-#else /* MR_LOWLEVEL_DEBUG */
-	int	i;
-	int	start;
-	int	count;
-	char	buf[2560];
-
-	strcpy(buf, "A dump of the det stack follows\n\n");
-	write(STDERR, buf, strlen(buf));
-
-	i = 0;
-	while (i < dumpindex) {
-		start = i;
-		count = 1;
-		i++;
-
-		while (i < dumpindex &&
-			strcmp(((char **)(dumpstack_zone->min))[i],
-				((char **)(dumpstack_zone->min))[start]) == 0)
-		{
-			count++;
-			i++;
-		}
-
-		if (count > 1) {
-			sprintf(buf, "%s * %d\n",
-				((char **)(dumpstack_zone->min))[start], count);
-		} else {
-			sprintf(buf, "%s\n",
-				((char **)(dumpstack_zone->min))[start]);
-		}
-
-		write(STDERR, buf, strlen(buf));
-	} /* end while */
-
-	strcpy(buf, "\nend of stack dump\n");
-	write(STDERR, buf, strlen(buf));
-
-#endif /* MR_LOWLEVEL_DEBUG */
-
-} /* end print_dump_stack() */
-
-
+}
Index: runtime/mercury_memory_handlers.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.h,v
retrieving revision 1.3
diff -u -b -r1.3 mercury_memory_handlers.h
--- runtime/mercury_memory_handlers.h	2000/06/29 09:55:37	1.3
+++ runtime/mercury_memory_handlers.h	2000/10/25 04:03:39
@@ -17,17 +17,19 @@
 #include "mercury_memory_zones.h"
 
 /*
-** default_handler is a function that can be passed to create_zone to
+** MR_default_handler is a function that can be passed to create_zone to
 ** unprotect enough of the redzone to allow the access to succeed, or
 ** fail if there is no space left in the zone.
 */
-ZoneHandler default_handler;
 
+extern	MR_ZoneHandler MR_default_handler;
+
 /*
-** null_handler is a function that can be passed to create_zone which always
-** fails.
+** MR_null_handler is a function that can be passed to create_zone
+** which always fails.
 */
-ZoneHandler null_handler;
+
+extern	MR_ZoneHandler MR_null_handler;
 
 /*
 **
@@ -35,7 +37,7 @@
 **
 */
 
-void	setup_signals(void);
+extern	void	MR_setup_signals(void);
 
 #ifdef MR_MSVC_STRUCTURED_EXCEPTIONS
 /*
Index: runtime/mercury_memory_zones.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_zones.c,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_memory_zones.c
--- runtime/mercury_memory_zones.c	2000/10/16 01:33:59	1.14
+++ runtime/mercury_memory_zones.c	2000/11/13 04:31:47
@@ -5,7 +5,7 @@
 */
 
 /*
-** This module defines the MemoryZone data structure and operations
+** This module defines the MR_MemoryZone data structure and operations
 ** for managing the memory zones.
 **
 ** The offset of each zone can be supplied to allow us to control how
@@ -175,21 +175,21 @@
 
 /*---------------------------------------------------------------------------*/
 
-MR_Word	virtual_reg_map[MAX_REAL_REG] = VIRTUAL_REG_MAP_BODY;
+MR_Word		MR_virtual_reg_map[MR_MAX_REAL_REG] = MR_VIRTUAL_REG_MAP_BODY;
 
-unsigned long	num_uses[MAX_RN];
+unsigned long	MR_num_uses[MR_MAX_RN];
 
 #define MAX_ZONES	16
 
-static MemoryZone *used_memory_zones = NULL;
-static MemoryZone *free_memory_zones = NULL;
+static MR_MemoryZone *used_memory_zones = NULL;
+static MR_MemoryZone *free_memory_zones = NULL;
 #ifdef	MR_THREAD_SAFE
   static MercuryLock *free_memory_zones_lock;
 #endif
 
-static void		init_offsets(void);
-static MemoryZone	*get_zone(void);
-static void		unget_zone(MemoryZone *zone);
+static void		MR_init_offsets(void);
+static MR_MemoryZone	*MR_get_zone(void);
+static void		MR_unget_zone(MR_MemoryZone *zone);
 
 	/*
 	** We manage the handing out of offets through the cache by
@@ -206,7 +206,7 @@
 size_t	next_offset(void);
 
 void
-init_zones()
+MR_init_zones()
 {
 
 #ifdef  MR_THREAD_SAFE
@@ -214,11 +214,11 @@
 	pthread_mutex_init(free_memory_zones_lock, MR_MUTEX_ATTR);
 #endif
 
-	init_offsets();
+	MR_init_offsets();
 }
 
 static void 
-init_offsets()
+MR_init_offsets()
 {
 	int i;
 	size_t fake_reg_offset;
@@ -227,20 +227,20 @@
 
 	offset_vector = MR_GC_NEW_ARRAY(size_t, CACHE_SLICES - 1);
 
-	fake_reg_offset = (MR_Unsigned) MR_fake_reg % pcache_size;
+	fake_reg_offset = (MR_Unsigned) MR_fake_reg % MR_pcache_size;
 
 	for (i = 0; i < CACHE_SLICES - 1; i++) {
 		offset_vector[i] =
-			(fake_reg_offset + pcache_size * i / CACHE_SLICES)
-			% pcache_size;
+			(fake_reg_offset + MR_pcache_size * i / CACHE_SLICES)
+			% MR_pcache_size;
 	}
 } /* end init_offsets() */
 
 
-static MemoryZone *
-get_zone(void)
+static MR_MemoryZone *
+MR_get_zone(void)
 {
-	MemoryZone *zone;
+	MR_MemoryZone *zone;
 
 	/*
 	** unlink the first zone on the free-list,
@@ -248,7 +248,7 @@
 	*/
 	MR_LOCK(free_memory_zones_lock, "get_zone");
 	if (free_memory_zones == NULL) {
-		zone = MR_GC_NEW(MemoryZone);
+		zone = MR_GC_NEW(MR_MemoryZone);
 	} else {
 		zone = free_memory_zones;
 		free_memory_zones = free_memory_zones->next;
@@ -266,9 +266,9 @@
 /* this function is not currently used */
 
 static void 
-unget_zone(MemoryZone *zone)
+MR_unget_zone(MR_MemoryZone *zone)
 {
-	MemoryZone *prev, *tmp;
+	MR_MemoryZone *prev, *tmp;
 
 	/*
 	** Find the zone on the used list, and unlink it from
@@ -307,7 +307,7 @@
 ** allocate more offsets across them.
 */
 size_t	
-next_offset(void)
+MR_next_offset(void)
 {
 	size_t offset;
 
@@ -318,10 +318,10 @@
 	return offset;
 }
 
-MemoryZone *
-create_zone(const char *name, int id, size_t size,
+MR_MemoryZone *
+MR_create_zone(const char *name, int id, size_t size,
 		size_t offset, size_t redsize,
-		bool ((*handler)(MR_Word *addr, MemoryZone *zone, void *context)))
+	bool ((*handler)(MR_Word *addr, MR_MemoryZone *zone, void *context)))
 {
 	MR_Word		*base;
 	size_t		total_size;
@@ -334,34 +334,35 @@
 		**			 mprotect is being used)
 		*/
 #ifdef	MR_PROTECTPAGE
-	total_size = size + 2 * unit;
+	total_size = size + 2 * MR_unit;
 #else
-	total_size = size + unit;
+	total_size = size + MR_unit;
 #endif
 
-	base = (MR_Word *) memalign(unit, total_size);
+	base = (MR_Word *) memalign(MR_unit, total_size);
 	if (base == NULL) {
 		char buf[2560];
 		sprintf(buf, "unable allocate memory zone: %s#%d", name, id);
 		MR_fatal_error(buf);
 	}
 
-	return construct_zone(name, id, base, size, offset, redsize, handler);
-} /* end create_zone() */
+	return MR_construct_zone(name, id, base, size, offset,
+		redsize, handler);
+} /* end MR_create_zone() */
 
-MemoryZone *
-construct_zone(const char *name, int id, MR_Word *base,
+MR_MemoryZone *
+MR_construct_zone(const char *name, int id, MR_Word *base,
 		size_t size, size_t offset, size_t redsize,
-		ZoneHandler handler)
+	MR_ZoneHandler handler)
 {
-	MemoryZone	*zone;
+	MR_MemoryZone	*zone;
 	size_t		total_size;
 
 	if (base == NULL) {
 		MR_fatal_error("construct_zone called with NULL pointer");
 	}
 
-	zone = get_zone();
+	zone = MR_get_zone();
 
 	zone->name = name;
 	zone->id = id;
@@ -373,7 +374,7 @@
 	zone->bottom = base;
 
 #ifdef 	MR_PROTECTPAGE
-	total_size = size + unit;
+	total_size = size + MR_unit;
 #else
 	total_size = size;
 #endif	/* MR_PROTECTPAGE */
@@ -389,9 +390,10 @@
 	*/
 #ifdef MR_CHECK_OVERFLOW_VIA_MPROTECT
 	zone->redzone_base = zone->redzone = (MR_Word *)
-			round_up((MR_Unsigned)base + size - redsize, unit);
+			MR_round_up((MR_Unsigned)base + size - redsize,
+				MR_unit);
 	if (MR_protect_pages((char *)zone->redzone,
-			redsize + unit, MY_PROT) < 0)
+			redsize + MR_unit, MY_PROT) < 0)
 	{
 		char buf[2560];
 		sprintf(buf, "unable to set %s#%d redzone\n"
@@ -405,8 +407,9 @@
 	** setup the hardzone
 	*/
 #if	defined(MR_PROTECTPAGE)
-	zone->hardmax = (MR_Word *) round_up((MR_Unsigned)zone->top - unit, unit);
-	if (MR_protect_pages((char *)zone->hardmax, unit, MY_PROT) < 0) {
+	zone->hardmax = (MR_Word *) MR_round_up(
+			(MR_Unsigned)zone->top - MR_unit, MR_unit);
+	if (MR_protect_pages((char *)zone->hardmax, MR_unit, MY_PROT) < 0) {
 		char buf[2560];
 		sprintf(buf, "unable to set %s#%d hardmax\n"
 			"base=%p, hardmax=%p top=%p",
@@ -418,10 +421,10 @@
 
 
 	return zone;
-} /* end construct_zone() */
+} /* end MR_construct_zone() */
 
 void 
-reset_redzone(MemoryZone *zone)
+MR_reset_redzone(MR_MemoryZone *zone)
 {
 #ifdef	MR_CHECK_OVERFLOW_VIA_MPROTECT
 	zone->redzone = zone->redzone_base;
@@ -437,28 +440,28 @@
 #endif	/* MR_CHECK_OVERFLOW_VIA_MPROTECT */
 }
 
-MemoryZone *
-get_used_memory_zones(void)
+MR_MemoryZone *
+MR_get_used_memory_zones(void)
 {
 	return used_memory_zones;
 }
 
 void
-debug_memory(void)
+MR_debug_memory(void)
 {
-	MemoryZone	*zone;
+	MR_MemoryZone	*zone;
 
 	fprintf(stderr, "\n");
 	fprintf(stderr, "pcache_size  = %lu (0x%lx)\n",
-		(unsigned long) pcache_size, (unsigned long) pcache_size);
+		(unsigned long) MR_pcache_size, (unsigned long) MR_pcache_size);
 	fprintf(stderr, "page_size    = %lu (0x%lx)\n",
-		(unsigned long) page_size, (unsigned long) page_size);
+		(unsigned long) MR_page_size, (unsigned long) MR_page_size);
 	fprintf(stderr, "unit         = %lu (0x%lx)\n",
-		(unsigned long) unit, (unsigned long) unit);
+		(unsigned long) MR_unit, (unsigned long) MR_unit);
 
 	fprintf(stderr, "\n");
 	fprintf(stderr, "fake_reg       = %p (offset %ld)\n",
-		(void *) MR_fake_reg, (long) MR_fake_reg & (unit-1));
+		(void *) MR_fake_reg, (long) MR_fake_reg & (MR_unit-1));
 	fprintf(stderr, "\n");
 
 	for (zone = used_memory_zones; zone; zone = zone->next)
@@ -489,4 +492,3 @@
 		fprintf(stderr, "\n");
 	}
 }
-
Index: runtime/mercury_memory_zones.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_zones.h,v
retrieving revision 1.7
diff -u -b -r1.7 mercury_memory_zones.h
--- runtime/mercury_memory_zones.h	2000/08/03 06:18:50	1.7
+++ runtime/mercury_memory_zones.h	2000/11/13 04:39:22
@@ -18,7 +18,7 @@
 #ifndef	MERCURY_MEMORY_ZONES_H
 #define	MERCURY_MEMORY_ZONES_H
 
-#include "mercury_regs.h"		/* for NUM_REAL_REGS */
+#include "mercury_regs.h"		/* for MR_NUM_REAL_REGS */
 
 #include <stdlib.h>		/* for size_t */
 
@@ -27,23 +27,23 @@
 
 
 /* these cannot be changed without lots of modifications elsewhere */
-#define MAX_REAL_REG 32		/* r1 .. r32 */
+#define MR_MAX_REAL_REG 32		/* MR_r1 .. MR_r32 */
 
 /* this can be changed at will, including by -D options to the C compiler */
-#ifndef MAX_VIRTUAL_REG
-#define MAX_VIRTUAL_REG	1024
+#ifndef MR_MAX_VIRTUAL_REG
+#define MR_MAX_VIRTUAL_REG	1024
 #endif
 
 /* allocate enough fake_regs to hold both the special regs */
 /* and all the virtual registers */
-#define MAX_FAKE_REG	(MR_NUM_SPECIAL_REG + MAX_VIRTUAL_REG)
-				/* mr0 .. mr37, mr(38) ... mr(1000) ... */
+#define MR_MAX_FAKE_REG	(MR_NUM_SPECIAL_REG + MR_MAX_VIRTUAL_REG)
+			/* MR_mr0 .. MR_mr37, MR_mr(38) ... MR_mr(1000) ... */
 
 /* used to lookup the fake_reg for a given real reg */
-extern	MR_Word	virtual_reg_map[MAX_REAL_REG];
+extern	MR_Word		MR_virtual_reg_map[MR_MAX_REAL_REG];
 
 /* used for counting register usage */
-extern	unsigned long 	num_uses[MAX_RN];
+extern	unsigned long 	MR_num_uses[MR_MAX_RN];
 
 /*
 ** The Mercury runtime uses a number of memory areas or *zones*. These
@@ -82,12 +82,14 @@
 **			available with MR_CHECK_OVERFLOW_VIA_MPROTECT.
 */
 
-typedef struct MEMORY_ZONE	MemoryZone;
+typedef struct MR_MemoryZone_Struct	MR_MemoryZone;
 
-typedef bool ZoneHandler(MR_Word *addr, struct MEMORY_ZONE *zone, void *context);
+typedef bool	MR_ZoneHandler(MR_Word *addr, MR_MemoryZone *zone,
+			void *context);
 
-struct MEMORY_ZONE {
-	struct MEMORY_ZONE *next; /* the memory zones are organized as a
+struct MR_MemoryZone_Struct {
+	MR_MemoryZone *next;
+				  /* the memory zones are organized as a
 				  ** linked list of free zones and linked
 				  ** list of used zones. The next field
 				  ** is NULL or a pointer to the next memory
@@ -108,7 +110,7 @@
 #ifdef MR_CHECK_OVERFLOW_VIA_MPROTECT
 	MR_Word	*redzone_base;	/* beginning of the original redzone */
 	MR_Word	*redzone;	/* beginning of the current redzone */
-	ZoneHandler *handler;   /* handler for page faults in the redzone */
+	MR_ZoneHandler *handler;   /* handler for page faults in the redzone */
 #endif /* MR_CHECK_OVERFLOW_VIA_MPROTECT */
 
 	/*
@@ -126,7 +128,7 @@
 };
 
 /*
-** MR_clear_zone_for_GC(MemoryZone *zone, void *start_address):
+** MR_clear_zone_for_GC(MR_MemoryZone *zone, void *start_address):
 **	Zero out the (hopefully unused) portion of the zone
 **	from the specified `start_address' to the end of the zone.
 **	This is used to avoid unwanted memory retition due to 
@@ -158,24 +160,26 @@
 #endif
 
 /*
-** init_memory_arena() allocates (if necessary) the top-level memory pool
+** MR_init_memory_arena() allocates (if necessary) the top-level memory pool
 ** from which all allocations should come. If PARALLEL is defined, then
 ** this pool should be shared memory. In the absence of PARALLEL, it
 ** doesn't need to do anything, since with CONSERVATIVE_GC, the collector
 ** manages the heap, and without GC, we can allocate memory using memalign
 ** or malloc.
 */
-void init_memory_arena(void);
 
+extern	void		MR_init_memory_arena(void);
+
 /*
-** init_zones() initializes the memory zone pool and the offset
+** MR_init_zones() initializes the memory zone pool and the offset
 ** generator.  It should be used before any zones are created or
 ** offsets requested.
 */
-void init_zones(void);
+
+extern	void 		MR_init_zones(void);
 
 /*
-** create_zone(Name, Id, Size, Offset, RedZoneSize, FaultHandler)
+** MR_create_zone(Name, Id, Size, Offset, RedZoneSize, FaultHandler)
 ** allocates a new memory zone with name Name, and number Id, size
 ** Size (in bytes - which gets rounded up to the nearest multiple of
 ** the page size), an offset Offset from the page boundary at which
@@ -188,12 +192,12 @@
 ** arguments are ignored.
 */
 
-MemoryZone	*create_zone(const char *name, int id,
+extern	MR_MemoryZone	*MR_create_zone(const char *name, int id,
 			size_t size, size_t offset, size_t redsize,
-			ZoneHandler *handler);
+				MR_ZoneHandler *handler);
 
 /*
-** construct_zone(Name, Id, Base, Size, Offset, RedZoneSize, FaultHandler)
+** MR_construct_zone(Name, Id, Base, Size, Offset, RedZoneSize, FaultHandler)
 ** has the same behaviour as create_zone, except instread of allocating
 ** the memory, it takes a pointer to a region of memory that must be at
 ** least Size + unit[*] bytes, or if MR_PROTECTPAGE is defined, then it
@@ -205,34 +209,38 @@
 ** [*] unit is a global variable containing the page size in bytes
 */
 
-MemoryZone	*construct_zone(const char *name, int Id, MR_Word *base,
-			size_t size, size_t offset, size_t redsize,
-			ZoneHandler *handler);
+extern	MR_MemoryZone	*MR_construct_zone(const char *name, int Id,
+				MR_Word *base, size_t size, size_t offset,
+				size_t redsize, MR_ZoneHandler *handler);
 
 /*
-** reset_redzone(Zone) resets the redzone on the given MemoryZone to the
+** MR_reset_redzone(Zone) resets the redzone on the given MR_MemoryZone to the
 ** original zone specified in the call to {create,construct}_zone() if
 ** MR_CHECK_OVERFLOW_VIA_MPROTECT is defined.  Otherwise it does
 ** nothing.
 */
-void	reset_redzone(MemoryZone *zone);
+
+extern	void		MR_reset_redzone(MR_MemoryZone *zone);
 
 /*
-** get_used_memory_zones() returns a pointer to the linked list of
+** MR_get_used_memory_zones() returns a pointer to the linked list of
 ** used memory zones.
 */
-MemoryZone	*get_used_memory_zones(void);
 
+extern	MR_MemoryZone	*MR_get_used_memory_zones(void);
+
 /*
-** debug_memory() prints out debugging information about the current
+** MR_debug_memory() prints out debugging information about the current
 ** memory zones.
 */
-void	debug_memory(void);
+
+extern	void		MR_debug_memory(void);
 
 /*
-** next_offset() returns sucessive offsets across the primary cache. Useful
+** MR_next_offset() returns sucessive offsets across the primary cache. Useful
 ** when calling {create,construct}_zone().
 */
-extern	size_t	next_offset(void);
+
+extern	size_t		MR_next_offset(void);
 
 #endif /* not MERCURY_MEMORY_ZONES_H */
Index: runtime/mercury_overflow.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_overflow.h,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_overflow.h
--- runtime/mercury_overflow.h	1998/07/07 08:04:10	1.4
+++ runtime/mercury_overflow.h	2000/10/25 04:16:03
@@ -13,62 +13,62 @@
 
 #ifndef MR_CHECK_FOR_OVERFLOW
 
-#define	heap_overflow_check()		((void)0)
-#define	detstack_overflow_check()	((void)0)
-#define	detstack_underflow_check()	((void)0)
-#define	nondstack_overflow_check()	((void)0)
-#define	nondstack_underflow_check()	((void)0)
+#define	MR_heap_overflow_check()	((void)0)
+#define	MR_detstack_overflow_check()	((void)0)
+#define	MR_detstack_underflow_check()	((void)0)
+#define	MR_nondstack_overflow_check()	((void)0)
+#define	MR_nondstack_underflow_check()	((void)0)
 
 #else /* MR_CHECK_FOR_OVERFLOW */
 
 #include "mercury_regs.h"
-#include "mercury_misc.h"	/* for fatal_error() */
+#include "mercury_misc.h"	/* for MR_fatal_error() */
 
-#define	heap_overflow_check()						\
+#define	MR_heap_overflow_check()					\
 		(							\
-			IF (MR_hp >= MR_ENGINE(heap_zone)->top,(	\
-				fatal_error("heap overflow")		\
+			IF (MR_hp >= MR_ENGINE(MR_heap_zone)->top,(	\
+				MR_fatal_error("heap overflow")		\
 			)),						\
-			IF (MR_hp > MR_ENGINE(heap_zone)->max,(		\
+			IF (MR_hp > MR_ENGINE(MR_heap_zone)->max,(	\
 				MR_ENGINE(heap_zone)->max = MR_hp	\
 			)),						\
 			(void)0						\
 		)
 
-#define	detstack_overflow_check()					\
+#define	MR_detstack_overflow_check()					\
 		(							\
-			IF (MR_sp >= MR_CONTEXT(detstack_zone)->top,(	\
-				fatal_error("stack overflow")		\
+			IF (MR_sp >= MR_CONTEXT(MR_detstack_zone)->top,(\
+				MR_fatal_error("stack overflow")	\
 			)),						\
-			IF (MR_sp > MR_CONTEXT(detstack_zone)->max,(	\
+			IF (MR_sp > MR_CONTEXT(MR_detstack_zone)->max,(	\
 				MR_CONTEXT(detstack_zone)->max = MR_sp	\
 			)),						\
 			(void)0						\
 		)
 
-#define	detstack_underflow_check()					\
+#define	MR_detstack_underflow_check()					\
 		(							\
-			IF (MR_sp < MR_CONTEXT(detstack_zone)->min,(	\
-				fatal_error("stack underflow")		\
+			IF (MR_sp < MR_CONTEXT(MR_detstack_zone)->min,(	\
+				MR_fatal_error("stack underflow")	\
 			)),						\
 			(void)0						\
 		)
 
-#define	nondstack_overflow_check()					\
+#define	MR_nondstack_overflow_check()					\
 		(							\
-			IF (MR_maxfr >= MR_CONTEXT(nondetstack_zone)->top,( \
-				fatal_error("nondetstack overflow")	\
+			IF (MR_maxfr >= MR_CONTEXT(MR_nondetstack_zone)->top,( \
+				MR_fatal_error("nondetstack overflow")	\
 			)),						\
-			IF (MR_maxfr > MR_CONTEXT(nondetstack_zone)->max,( \
+			IF (MR_maxfr > MR_CONTEXT(MR_nondetstack_zone)->max,( \
 				MR_CONTEXT(nondetstack_zone)->max = MR_maxfr \
 			)),						\
 			(void)0						\
 		)
 
-#define	nondstack_underflow_check()					\
+#define	MR_nondstack_underflow_check()					\
 		(							\
-			IF (MR_maxfr < MR_CONTEXT(nondetstack_zone)->min,( \
-				fatal_error("nondetstack underflow")	\
+			IF (MR_maxfr < MR_CONTEXT(MR_nondetstack_zone)->min,( \
+				MR_fatal_error("nondetstack underflow")	\
 			)),						\
 			(void)0						\
 		)
Index: runtime/mercury_prof.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_prof.c,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_prof.c
--- runtime/mercury_prof.c	2000/09/14 04:31:25	1.13
+++ runtime/mercury_prof.c	2000/10/22 00:22:33
@@ -289,7 +289,7 @@
 			break;
 #endif
 		default:
-			fatal_error("invalid time profile method");
+			MR_fatal_error("invalid time profile method");
 	}
 }
 #endif /* PROFILE_TIME */
Index: runtime/mercury_prof.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_prof.h,v
retrieving revision 1.10
diff -u -b -r1.10 mercury_prof.h
--- runtime/mercury_prof.h	2000/09/14 04:31:25	1.10
+++ runtime/mercury_prof.h	2000/11/13 04:29:27
@@ -30,22 +30,21 @@
 ** being executed when a profiling interrupt occurs.
 */
 
-#define MR_set_prof_current_proc(target)	set_prof_current_proc(target)
 #ifdef PROFILE_TIME
-  #define set_prof_current_proc(target)		\
+  #define MR_set_prof_current_proc(target)		\
 		(MR_prof_current_proc = (target))
-  #define update_prof_current_proc(target)	\
+  #define MR_update_prof_current_proc(target)		\
 		(MR_prof_current_proc = (target))	
 #else
-  #define set_prof_current_proc(target)		((void)0)
-  #define update_prof_current_proc(target)	((void)0)
+  #define MR_set_prof_current_proc(target)		((void)0)
+  #define MR_update_prof_current_proc(target)		((void)0)
 #endif
 
-
 /*
 ** This variable holds the address of the calling procedure
 ** for a call to do_call_closure or do_call_class_method.
 */
+
 #ifdef PROFILE_CALLS
   extern MR_Code *	MR_prof_ho_caller_proc;
 #endif
@@ -57,13 +56,13 @@
 #endif
 
 /*
-** The PROFILE() macro is used (by mercury_calls.h) to record each call.
+** The MR_PROFILE() macro is used (by mercury_calls.h) to record each call.
 */
 
 #ifdef	PROFILE_CALLS
-  #define PROFILE(callee, caller) MR_prof_call_profile((callee), (caller))
+  #define MR_PROFILE(callee, caller) MR_prof_call_profile((callee), (caller))
 #else
-  #define PROFILE(callee, caller) ((void)0)
+  #define MR_PROFILE(callee, caller) ((void)0)
 #endif
 
 #ifdef PROFILE_CALLS
Index: runtime/mercury_regorder.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_regorder.h,v
retrieving revision 1.16
diff -u -b -r1.16 mercury_regorder.h
--- runtime/mercury_regorder.h	2000/10/16 02:09:44	1.16
+++ runtime/mercury_regorder.h	2000/11/13 03:41:15
@@ -6,8 +6,8 @@
 
 /*
 ** mercury_regorder.h - defines the mapping from the Mercury abstract machine
-** registers (r1, r2, ..., hp, sp, etc.) to the underlying intermediate-level
-** abstract machine memory (mr0, mr1, ...).
+** registers (MR_r1, MR_r2, ..., MR_hp, MR_sp, etc.) to the underlying
+** intermediate-level abstract machine memory (MR_mr0, MR_mr1, ...).
 **
 ** This file should be #included from "mercury_regs.h" and nowhere else.
 ** The reason this is separate from "mercury_regs.h" is so that it could,
@@ -24,52 +24,53 @@
 
 /*
 ** If we are using an engine base register, then shift all
-** the machine registers across by 1, and allocate mr0 to
+** the machine registers across by 1, and allocate MR_mr0 to
 ** MR_engine_base
 */
-#if defined(MR_THREAD_SAFE) && NUM_REAL_REGS > 0
 
+#if defined(MR_THREAD_SAFE) && MR_NUM_REAL_REGS > 0
 
 /*
-** r1 .. r32: the general-purpose Mercury registers.
+** MR_r1 .. MR_r32: the general-purpose Mercury registers.
 **
-** If you modify the r<N> to mr<N> mapping, make sure that you update
+** If you modify the MR_r<N> to MR_mr<N> mapping, make sure that you update
 ** the definition of MR_VIRTUAL_REG_MAP_BODY below and BOTH copies of
-** the definitions of r1-r32.
+** the definitions of MR_r1-MR_r32.
 */
-#define r1		count_usage(R_RN(1), mr3)
-#define r2		count_usage(R_RN(2), mr4)
-#define r3		count_usage(R_RN(3), mr5)
-#define r4		count_usage(R_RN(4), mr7)
-#define r5		count_usage(R_RN(5), mr8)
-#define r6		count_usage(R_RN(6), mr11)
-#define r7		count_usage(R_RN(7), mr12)
-#define r8		count_usage(R_RN(8), mr13)
-#define r9		count_usage(R_RN(9), mr14)
-#define r10		count_usage(R_RN(10), mr15)
-#define r11		count_usage(R_RN(11), mr16)
-#define r12		count_usage(R_RN(12), mr17)
-#define r13		count_usage(R_RN(13), mr18)
-#define r14		count_usage(R_RN(14), mr19)
-#define r15		count_usage(R_RN(15), mr20)
-#define r16		count_usage(R_RN(16), mr21)
-#define r17		count_usage(R_RN(17), mr22)
-#define r18		count_usage(R_RN(18), mr23)
-#define r19		count_usage(R_RN(19), mr24)
-#define r20		count_usage(R_RN(20), mr25)
-#define r21		count_usage(R_RN(21), mr26)
-#define r22		count_usage(R_RN(22), mr27)
-#define r23		count_usage(R_RN(23), mr28)
-#define r24		count_usage(R_RN(24), mr29)
-#define r25		count_usage(R_RN(25), mr30)
-#define r26		count_usage(R_RN(26), mr31)
-#define r27		count_usage(R_RN(27), mr32)
-#define r28		count_usage(R_RN(28), mr33)
-#define r29		count_usage(R_RN(29), mr34)
-#define r30		count_usage(R_RN(30), mr35)
-#define r31		count_usage(R_RN(31), mr36)
-#define r32		count_usage(R_RN(32), mr37)
 
+#define MR_r1		MR_count_usage(R_RN(1), MR_mr3)
+#define MR_r2		MR_count_usage(R_RN(2), MR_mr4)
+#define MR_r3		MR_count_usage(R_RN(3), MR_mr5)
+#define MR_r4		MR_count_usage(R_RN(4), MR_mr7)
+#define MR_r5		MR_count_usage(R_RN(5), MR_mr8)
+#define MR_r6		MR_count_usage(R_RN(6), MR_mr11)
+#define MR_r7		MR_count_usage(R_RN(7), MR_mr12)
+#define MR_r8		MR_count_usage(R_RN(8), MR_mr13)
+#define MR_r9		MR_count_usage(R_RN(9), MR_mr14)
+#define MR_r10		MR_count_usage(R_RN(10), MR_mr15)
+#define MR_r11		MR_count_usage(R_RN(11), MR_mr16)
+#define MR_r12		MR_count_usage(R_RN(12), MR_mr17)
+#define MR_r13		MR_count_usage(R_RN(13), MR_mr18)
+#define MR_r14		MR_count_usage(R_RN(14), MR_mr19)
+#define MR_r15		MR_count_usage(R_RN(15), MR_mr20)
+#define MR_r16		MR_count_usage(R_RN(16), MR_mr21)
+#define MR_r17		MR_count_usage(R_RN(17), MR_mr22)
+#define MR_r18		MR_count_usage(R_RN(18), MR_mr23)
+#define MR_r19		MR_count_usage(R_RN(19), MR_mr24)
+#define MR_r20		MR_count_usage(R_RN(20), MR_mr25)
+#define MR_r21		MR_count_usage(R_RN(21), MR_mr26)
+#define MR_r22		MR_count_usage(R_RN(22), MR_mr27)
+#define MR_r23		MR_count_usage(R_RN(23), MR_mr28)
+#define MR_r24		MR_count_usage(R_RN(24), MR_mr29)
+#define MR_r25		MR_count_usage(R_RN(25), MR_mr30)
+#define MR_r26		MR_count_usage(R_RN(26), MR_mr31)
+#define MR_r27		MR_count_usage(R_RN(27), MR_mr32)
+#define MR_r28		MR_count_usage(R_RN(28), MR_mr33)
+#define MR_r29		MR_count_usage(R_RN(29), MR_mr34)
+#define MR_r30		MR_count_usage(R_RN(30), MR_mr35)
+#define MR_r31		MR_count_usage(R_RN(31), MR_mr36)
+#define MR_r32		MR_count_usage(R_RN(32), MR_mr37)
+
 	/* Keep this in sync with the actual defintions below */
 #define MR_real_reg_number_sp MR_real_reg_number_mr1
 
@@ -85,48 +86,61 @@
 /*
 ** first, the "very special" registers -- these may go in real machine regs
 */
-#define MR_engine_base	LVALUE_CAST(MR_Word *, count_usage(MR_SP_RN, mr0))
-#define MR_succip	LVALUE_CAST(MR_Code *, count_usage(MR_SI_RN, mr2))
-#define MR_hp		LVALUE_CAST(MR_Word *, count_usage(MR_HP_RN, mr6))
-#define MR_sp		LVALUE_CAST(MR_Word *, count_usage(MR_SP_RN, mr1))
-#define MR_curfr	LVALUE_CAST(MR_Word *, count_usage(MR_CF_RN, mr9))
-#define MR_maxfr	LVALUE_CAST(MR_Word *, count_usage(MR_MF_RN, mr10))
+
+#define MR_engine_base		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_SP_RN, MR_mr0))
+#define MR_succip		MR_LVALUE_CAST(MR_Code *,		\
+				MR_count_usage(MR_SI_RN, MR_mr2))
+#define MR_hp			MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_HP_RN, MR_mr6))
+#define MR_sp			MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_SP_RN, MR_mr1))
+#define MR_curfr		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_CF_RN, MR_mr9))
+#define MR_maxfr		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_MF_RN, MR_mr10))
 /*
 ** next, the remainder of the special registers -- these go in the
 ** fake_reg array, or in some cases in ordinary global variables.
 */
-#define MR_sol_hp	LVALUE_CAST(MR_Word *, count_usage(MR_SOL_HP_RN, mr(38)))
-#define MR_min_hp_rec	LVALUE_CAST(MR_Word *, count_usage(MR_MIN_HP_REC, mr(39)))
-#define MR_min_sol_hp_rec	LVALUE_CAST(MR_Word *,	\
-			count_usage(MR_MIN_HP_REC, mr(40)))
-#define MR_global_hp	LVALUE_CAST(MR_Word *,	\
-			count_usage(MR_GLOBAL_HP_RN, mr(41)))
-#define MR_gen_next	LVALUE_CAST(MR_Integer,	\
-			count_usage(MR_GEN_NEXT_RN, mr(42)))
-#define MR_gen_stack	LVALUE_CAST(struct MR_GeneratorStackFrameStruct *, \
-			count_usage(MR_GEN_STACK_RN, mr(43)))
-#define MR_cut_next	LVALUE_CAST(MR_Integer,	\
-			count_usage(MR_CUT_NEXT_RN, mr(44)))
-#define MR_cut_stack	LVALUE_CAST(struct MR_CutStackFrameStruct *, \
-			count_usage(MR_CUT_STACK_RN, mr(45)))
-
-#define MR_trail_ptr	count_usage(MR_TRAIL_PTR_RN, MR_trail_ptr_var)
-#define MR_ticket_counter	 \
-		count_usage(MR_TICKET_COUNTER_RN, MR_ticket_counter_var)
-#define MR_ticket_high_water	 \
-		count_usage(MR_TICKET_HIGH_WATER_RN, MR_ticket_high_water_var)
 
+#define MR_sol_hp		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_SOL_HP_RN, MR_mr(38)))
+#define MR_min_hp_rec		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_MIN_HP_REC, MR_mr(39)))
+#define MR_min_sol_hp_rec	MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_MIN_HP_REC, MR_mr(40)))
+#define MR_global_hp		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_GLOBAL_HP_RN, MR_mr(41)))
+#define MR_gen_next		MR_LVALUE_CAST(MR_Integer,		\
+				MR_count_usage(MR_GEN_NEXT_RN, MR_mr(42)))
+#define MR_gen_stack		MR_LVALUE_CAST(				\
+				struct MR_GeneratorStackFrameStruct *,	\
+				MR_count_usage(MR_GEN_STACK_RN, MR_mr(43)))
+#define MR_cut_next		MR_LVALUE_CAST(MR_Integer,		\
+				MR_count_usage(MR_CUT_NEXT_RN, MR_mr(44)))
+#define MR_cut_stack		MR_LVALUE_CAST(				\
+				struct MR_CutStackFrameStruct *,	\
+				MR_count_usage(MR_CUT_STACK_RN, MR_mr(45)))
+#define MR_trail_ptr		MR_count_usage(MR_TRAIL_PTR_RN,		\
+				MR_trail_ptr_var)
+#define MR_ticket_counter	MR_count_usage(MR_TICKET_COUNTER_RN,	\
+				MR_ticket_counter_var)
+#define MR_ticket_high_water	MR_count_usage(MR_TICKET_HIGH_WATER_RN,	\
+				MR_ticket_high_water_var)
+
 /*
 ** the number of "very special" registers, i.e. special registers that can
 ** be allocated in real machine registers:
 ** MR_engine_base, MR_succip, MR_hp, MR_sp, MR_curfr, MR_maxfr
 */
+
 #define MR_NUM_VERY_SPECIAL_REG	6
 
 /* the number of special-purpose Mercury registers */
 #define MR_NUM_SPECIAL_REG	16
 
-/* the maximum mrN number of special registers */
+/* the maximum MR_mrN number of special registers */
 #define	MR_MAX_SPECIAL_REG_MR	45
 
 /*
@@ -135,25 +149,36 @@
 ** the real machine register.
 */
 
-#define MR_saved_succip(save_area)	LVALUE_CAST(MR_Code *, save_area[2])
-#define MR_saved_hp(save_area)		LVALUE_CAST(MR_Word *, save_area[6])
-#define MR_saved_sp(save_area)		LVALUE_CAST(MR_Word *, save_area[1])
-#define MR_saved_curfr(save_area)	LVALUE_CAST(MR_Word *, save_area[9])
-#define MR_saved_maxfr(save_area)	LVALUE_CAST(MR_Word *, save_area[10])
-#define MR_saved_sol_hp(save_area)	LVALUE_CAST(MR_Word *, save_area[38])
-#define MR_saved_min_hp_rec(save_area)	LVALUE_CAST(MR_Word *, save_area[39])
-#define MR_saved_min_sol_hp_rec(save_area) LVALUE_CAST(MR_Word *, save_area[40])
-#define MR_saved_global_hp(save_area)	LVALUE_CAST(MR_Word *, save_area[41])
-#define MR_saved_gen_next(save_area)	LVALUE_CAST(MR_Integer, save_area[42])
-#define MR_saved_gen_stack(save_area)	LVALUE_CAST(			      \
-					struct MR_GeneratorStackFrameStruct *,\
+#define MR_saved_succip(save_area)	MR_LVALUE_CAST(MR_Code *, \
+						save_area[2])
+#define MR_saved_hp(save_area)		MR_LVALUE_CAST(MR_Word *, \
+						save_area[6])
+#define MR_saved_sp(save_area)		MR_LVALUE_CAST(MR_Word *, \
+						save_area[1])
+#define MR_saved_curfr(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[9])
+#define MR_saved_maxfr(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[10])
+#define MR_saved_sol_hp(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[38])
+#define MR_saved_min_hp_rec(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[39])
+#define MR_saved_min_sol_hp_rec(save_area) MR_LVALUE_CAST(MR_Word *, \
+						save_area[40])
+#define MR_saved_global_hp(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[41])
+#define MR_saved_gen_next(save_area)	MR_LVALUE_CAST(MR_Integer, \
+						save_area[42])
+#define MR_saved_gen_stack(save_area)	MR_LVALUE_CAST(struct \
+						MR_GeneratorStackFrameStruct *,\
 					save_area[43])
-#define MR_saved_cut_next(save_area)	LVALUE_CAST(MR_Integer, save_area[44])
-#define MR_saved_cut_stack(save_area)	LVALUE_CAST(			      \
-					struct MR_CutStackFrameStruct *,      \
+#define MR_saved_cut_next(save_area)	MR_LVALUE_CAST(MR_Integer, \
+						save_area[44])
+#define MR_saved_cut_stack(save_area)	MR_LVALUE_CAST(struct \
+						MR_CutStackFrameStruct *, \
 					save_area[45])
 
-#define VIRTUAL_REG_MAP_BODY	{ \
+#define MR_VIRTUAL_REG_MAP_BODY	{ \
 	3, \
 	4, \
 	5, \
@@ -188,52 +213,53 @@
 	37, \
 }
 
-#else /* !MR_THREAD_SAFE or NUM_REAL_REGS == 0 */
+#else /* !MR_THREAD_SAFE or MR_NUM_REAL_REGS == 0 */
 
 /*
-** If you modify the r<N> to mr<N> mapping, make sure that you update
+** If you modify the MR_r<N> to MR_mr<N> mapping, make sure that you update
 ** the definition of MR_VIRTUAL_REG_MAP_BODY below and BOTH copies of
-** the definitions of r1-r32.
+** the definitions of MR_r1-MR_r32.
 */
-#define r1		count_usage(R_RN(1), mr2)
-#define r2		count_usage(R_RN(2), mr3)
-#define r3		count_usage(R_RN(3), mr4)
-#define r4		count_usage(R_RN(4), mr6)
-#define r5		count_usage(R_RN(5), mr7)
-#define r6		count_usage(R_RN(6), mr10)
-#define r7		count_usage(R_RN(7), mr11)
-#define r8		count_usage(R_RN(8), mr12)
-#define r9		count_usage(R_RN(9), mr13)
-#define r10		count_usage(R_RN(10), mr14)
-#define r11		count_usage(R_RN(11), mr15)
-#define r12		count_usage(R_RN(12), mr16)
-#define r13		count_usage(R_RN(13), mr17)
-#define r14		count_usage(R_RN(14), mr18)
-#define r15		count_usage(R_RN(15), mr19)
-#define r16		count_usage(R_RN(16), mr20)
-#define r17		count_usage(R_RN(17), mr21)
-#define r18		count_usage(R_RN(18), mr22)
-#define r19		count_usage(R_RN(19), mr23)
-#define r20		count_usage(R_RN(20), mr24)
-#define r21		count_usage(R_RN(21), mr25)
-#define r22		count_usage(R_RN(22), mr26)
-#define r23		count_usage(R_RN(23), mr27)
-#define r24		count_usage(R_RN(24), mr28)
-#define r25		count_usage(R_RN(25), mr29)
-#define r26		count_usage(R_RN(26), mr30)
-#define r27		count_usage(R_RN(27), mr31)
-#define r28		count_usage(R_RN(28), mr32)
-#define r29		count_usage(R_RN(29), mr33)
-#define r30		count_usage(R_RN(30), mr34)
-#define r31		count_usage(R_RN(31), mr35)
-#define r32		count_usage(R_RN(32), mr36)
+
+#define MR_r1		MR_count_usage(R_RN(1), MR_mr2)
+#define MR_r2		MR_count_usage(R_RN(2), MR_mr3)
+#define MR_r3		MR_count_usage(R_RN(3), MR_mr4)
+#define MR_r4		MR_count_usage(R_RN(4), MR_mr6)
+#define MR_r5		MR_count_usage(R_RN(5), MR_mr7)
+#define MR_r6		MR_count_usage(R_RN(6), MR_mr10)
+#define MR_r7		MR_count_usage(R_RN(7), MR_mr11)
+#define MR_r8		MR_count_usage(R_RN(8), MR_mr12)
+#define MR_r9		MR_count_usage(R_RN(9), MR_mr13)
+#define MR_r10		MR_count_usage(R_RN(10), MR_mr14)
+#define MR_r11		MR_count_usage(R_RN(11), MR_mr15)
+#define MR_r12		MR_count_usage(R_RN(12), MR_mr16)
+#define MR_r13		MR_count_usage(R_RN(13), MR_mr17)
+#define MR_r14		MR_count_usage(R_RN(14), MR_mr18)
+#define MR_r15		MR_count_usage(R_RN(15), MR_mr19)
+#define MR_r16		MR_count_usage(R_RN(16), MR_mr20)
+#define MR_r17		MR_count_usage(R_RN(17), MR_mr21)
+#define MR_r18		MR_count_usage(R_RN(18), MR_mr22)
+#define MR_r19		MR_count_usage(R_RN(19), MR_mr23)
+#define MR_r20		MR_count_usage(R_RN(20), MR_mr24)
+#define MR_r21		MR_count_usage(R_RN(21), MR_mr25)
+#define MR_r22		MR_count_usage(R_RN(22), MR_mr26)
+#define MR_r23		MR_count_usage(R_RN(23), MR_mr27)
+#define MR_r24		MR_count_usage(R_RN(24), MR_mr28)
+#define MR_r25		MR_count_usage(R_RN(25), MR_mr29)
+#define MR_r26		MR_count_usage(R_RN(26), MR_mr30)
+#define MR_r27		MR_count_usage(R_RN(27), MR_mr31)
+#define MR_r28		MR_count_usage(R_RN(28), MR_mr32)
+#define MR_r29		MR_count_usage(R_RN(29), MR_mr33)
+#define MR_r30		MR_count_usage(R_RN(30), MR_mr34)
+#define MR_r31		MR_count_usage(R_RN(31), MR_mr35)
+#define MR_r32		MR_count_usage(R_RN(32), MR_mr36)
 
 	/* Keep this in sync with the actual defintions below */
 #define MR_real_reg_number_sp MR_real_reg_number_mr0
 
 /*
 ** The special-purpose Mercury registers:
-**	hp, sp, succip, etc.
+**	MR_hp, MR_sp, MR_succip, etc.
 **
 ** If you modify the following block, make sure that you update
 ** the definitions of MR_NUM_SPECIAL_REG, MR_MAX_SPECIAL_REG_MR,
@@ -243,46 +269,60 @@
 /*
 ** first, the "very special" registers -- these may go in real machine regs
 */
-#define MR_succip	LVALUE_CAST(MR_Code *, count_usage(MR_SI_RN, mr1))
-#define MR_hp		LVALUE_CAST(MR_Word *, count_usage(MR_HP_RN, mr5))
-#define MR_sp		LVALUE_CAST(MR_Word *, count_usage(MR_SP_RN, mr0))
-#define MR_curfr	LVALUE_CAST(MR_Word *, count_usage(MR_CF_RN, mr8))
-#define MR_maxfr	LVALUE_CAST(MR_Word *, count_usage(MR_MF_RN, mr9))
+
+#define MR_succip		MR_LVALUE_CAST(MR_Code *, \
+					MR_count_usage(MR_SI_RN, MR_mr1))
+#define MR_hp			MR_LVALUE_CAST(MR_Word *, \
+					MR_count_usage(MR_HP_RN, MR_mr5))
+#define MR_sp			MR_LVALUE_CAST(MR_Word *, \
+					MR_count_usage(MR_SP_RN, MR_mr0))
+#define MR_curfr		MR_LVALUE_CAST(MR_Word *, \
+					MR_count_usage(MR_CF_RN, MR_mr8))
+#define MR_maxfr		MR_LVALUE_CAST(MR_Word *, \
+					MR_count_usage(MR_MF_RN, MR_mr9))
+
 /*
 ** next, the remainder of the special registers -- these go in the
-** fake_reg array, or in some cases in ordinary global variables.
+** MR_fake_reg array, or in some cases in ordinary global variables.
 */
-#define MR_sol_hp	LVALUE_CAST(MR_Word *, count_usage(MR_SOL_HP_RN, mr(37)))
-#define MR_min_hp_rec	LVALUE_CAST(MR_Word *, count_usage(MR_MIN_HP_REC, mr(38)))
-#define MR_min_sol_hp_rec	LVALUE_CAST(MR_Word *,	\
-			count_usage(MR_MIN_HP_REC, mr(39)))
-#define MR_global_hp	LVALUE_CAST(MR_Word *,	\
-			count_usage(MR_GLOBAL_HP_RN, mr(40)))
-#define MR_trail_ptr	count_usage(MR_TRAIL_PTR_RN, MR_trail_ptr_var)
-#define MR_ticket_counter	 \
-		count_usage(MR_TICKET_COUNTER_RN, MR_ticket_counter_var)
-#define MR_ticket_high_water	 \
-		count_usage(MR_TICKET_HIGH_WATER_RN, MR_ticket_high_water_var)
-#define MR_gen_next	LVALUE_CAST(MR_Integer,	\
-			count_usage(MR_GEN_NEXT_RN, mr(41)))
-#define MR_gen_stack	LVALUE_CAST(struct MR_GeneratorStackFrameStruct *, \
-			count_usage(MR_GEN_STACK_RN, mr(42)))
-#define MR_cut_next	LVALUE_CAST(MR_Integer,	\
-			count_usage(MR_CUT_NEXT_RN, mr(43)))
-#define MR_cut_stack	LVALUE_CAST(struct MR_CutStackFrameStruct *, \
-			count_usage(MR_CUT_STACK_RN, mr(44)))
 
+#define MR_sol_hp		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_SOL_HP_RN, MR_mr(37)))
+#define MR_min_hp_rec		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_MIN_HP_REC, MR_mr(38)))
+#define MR_min_sol_hp_rec	MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_MIN_HP_REC, MR_mr(39)))
+#define MR_global_hp		MR_LVALUE_CAST(MR_Word *,		\
+				MR_count_usage(MR_GLOBAL_HP_RN, MR_mr(40)))
+#define MR_trail_ptr		MR_count_usage(MR_TRAIL_PTR_RN,		\
+				MR_trail_ptr_var)
+#define MR_ticket_counter	MR_count_usage(MR_TICKET_COUNTER_RN,	\
+				MR_ticket_counter_var)
+#define MR_ticket_high_water	MR_count_usage(MR_TICKET_HIGH_WATER_RN,	\
+				MR_ticket_high_water_var)
+#define MR_gen_next		MR_LVALUE_CAST(MR_Integer,		\
+				MR_count_usage(MR_GEN_NEXT_RN, MR_mr(41)))
+#define MR_gen_stack		MR_LVALUE_CAST(				\
+				struct MR_GeneratorStackFrameStruct *,	\
+				MR_count_usage(MR_GEN_STACK_RN, MR_mr(42)))
+#define MR_cut_next		MR_LVALUE_CAST(MR_Integer,		\
+				MR_count_usage(MR_CUT_NEXT_RN, MR_mr(43)))
+#define MR_cut_stack		MR_LVALUE_CAST(				\
+				struct MR_CutStackFrameStruct *,	\
+				MR_count_usage(MR_CUT_STACK_RN, MR_mr(44)))
+
 /*
 ** the number of "very special" registers, i.e. special registers that can
 ** be allocated in real machine registers:
 ** MR_succip, MR_hp, MR_sp, MR_curfr, MR_maxfr
 */
+
 #define MR_NUM_VERY_SPECIAL_REG	5
 
 /* the number of special registers */
 #define MR_NUM_SPECIAL_REG	15
 
-/* the maximum mrN number of special, non rN registers */
+/* the maximum MR_mrN number of special, non rN registers */
 #define	MR_MAX_SPECIAL_REG_MR	44
 
 /*
@@ -291,25 +331,36 @@
 ** the real machine register.
 */
 
-#define MR_saved_succip(save_area)	LVALUE_CAST(MR_Code *, save_area[1])
-#define MR_saved_hp(save_area)		LVALUE_CAST(MR_Word *, save_area[5])
-#define MR_saved_sp(save_area)		LVALUE_CAST(MR_Word *, save_area[0])
-#define MR_saved_curfr(save_area)	LVALUE_CAST(MR_Word *, save_area[8])
-#define MR_saved_maxfr(save_area)	LVALUE_CAST(MR_Word *, save_area[9])
-#define MR_saved_sol_hp(save_area)	LVALUE_CAST(MR_Word *, save_area[37])
-#define MR_saved_min_hp_rec(save_area)	LVALUE_CAST(MR_Word *, save_area[38])
-#define MR_saved_min_sol_hp_rec(save_area) LVALUE_CAST(MR_Word *, save_area[39])
-#define MR_saved_global_hp(save_area)	LVALUE_CAST(MR_Word *, save_area[40])
-#define MR_saved_gen_stack(save_area)	LVALUE_CAST(MR_Integer, save_area[41])
-#define MR_saved_gen_next(save_area)	LVALUE_CAST(			      \
-					struct MR_GeneratorStackFrameStruct *,\
+#define MR_saved_succip(save_area)	MR_LVALUE_CAST(MR_Code *, \
+						save_area[1])
+#define MR_saved_hp(save_area)		MR_LVALUE_CAST(MR_Word *, \
+						save_area[5])
+#define MR_saved_sp(save_area)		MR_LVALUE_CAST(MR_Word *, \
+						save_area[0])
+#define MR_saved_curfr(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[8])
+#define MR_saved_maxfr(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[9])
+#define MR_saved_sol_hp(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[37])
+#define MR_saved_min_hp_rec(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[38])
+#define MR_saved_min_sol_hp_rec(save_area) MR_LVALUE_CAST(MR_Word *, \
+						save_area[39])
+#define MR_saved_global_hp(save_area)	MR_LVALUE_CAST(MR_Word *, \
+						save_area[40])
+#define MR_saved_gen_stack(save_area)	MR_LVALUE_CAST(MR_Integer, \
+						save_area[41])
+#define MR_saved_gen_next(save_area)	MR_LVALUE_CAST(struct \
+						MR_GeneratorStackFrameStruct *,\
 					save_area[42])
-#define MR_saved_cut_stack(save_area)	LVALUE_CAST(MR_Integer, save_area[43])
-#define MR_saved_cut_next(save_area)	LVALUE_CAST(			      \
-					struct MR_CutStackFrameStruct *,      \
+#define MR_saved_cut_stack(save_area)	MR_LVALUE_CAST(MR_Integer, \
+						save_area[43])
+#define MR_saved_cut_next(save_area)	MR_LVALUE_CAST(struct \
+						MR_CutStackFrameStruct *,\
 					save_area[44])
 
-#define VIRTUAL_REG_MAP_BODY	{ \
+#define MR_VIRTUAL_REG_MAP_BODY	{ \
 	2, \
 	3, \
 	4, \
Index: runtime/mercury_regs.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_regs.c,v
retrieving revision 1.3
diff -u -b -r1.3 mercury_regs.c
--- runtime/mercury_regs.c	2000/08/03 06:18:53	1.3
+++ runtime/mercury_regs.c	2000/10/25 06:38:21
@@ -9,11 +9,10 @@
 
 #include <stdio.h>
 
-
 MR_Word 
-get_reg(int num)
+MR_get_reg(int num)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
  	switch (num) {
 
 	case 1:  return r1;
@@ -55,46 +54,46 @@
 	fprintf(stderr, "register %d out of range in get_reg\n", num);
 	abort();
 	return 0;
-} /* end get_reg() */
+} /* end MR_get_reg() */
 
 MR_Word 
-set_reg(int num, MR_Word val)
+MR_set_reg(int num, MR_Word val)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
  	switch (num) {
 
-	case 1:  r1  = val; save_transient_registers(); return val;
-	case 2:  r2  = val; save_transient_registers(); return val;
-	case 3:  r3  = val; save_transient_registers(); return val;
-	case 4:  r4  = val; save_transient_registers(); return val;
-	case 5:  r5  = val; save_transient_registers(); return val;
-	case 6:  r6  = val; save_transient_registers(); return val;
-	case 7:  r7  = val; save_transient_registers(); return val;
-	case 8:  r8  = val; save_transient_registers(); return val;
-	case 9:  r9  = val; save_transient_registers(); return val;
-	case 10: r10 = val; save_transient_registers(); return val;
-	case 11: r11 = val; save_transient_registers(); return val;
-	case 12: r12 = val; save_transient_registers(); return val;
-	case 13: r13 = val; save_transient_registers(); return val;
-	case 14: r14 = val; save_transient_registers(); return val;
-	case 15: r15 = val; save_transient_registers(); return val;
-	case 16: r16 = val; save_transient_registers(); return val;
-	case 17: r17 = val; save_transient_registers(); return val;
-	case 18: r18 = val; save_transient_registers(); return val;
-	case 19: r19 = val; save_transient_registers(); return val;
-	case 20: r20 = val; save_transient_registers(); return val;
-	case 21: r21 = val; save_transient_registers(); return val;
-	case 22: r22 = val; save_transient_registers(); return val;
-	case 23: r23 = val; save_transient_registers(); return val;
-	case 24: r24 = val; save_transient_registers(); return val;
-	case 25: r25 = val; save_transient_registers(); return val;
-	case 26: r26 = val; save_transient_registers(); return val;
-	case 27: r27 = val; save_transient_registers(); return val;
-	case 28: r28 = val; save_transient_registers(); return val;
-	case 29: r29 = val; save_transient_registers(); return val;
-	case 30: r30 = val; save_transient_registers(); return val;
-	case 31: r31 = val; save_transient_registers(); return val;
-	case 32: r32 = val; save_transient_registers(); return val;
+	case 1:  r1  = val; MR_save_transient_registers(); return val;
+	case 2:  r2  = val; MR_save_transient_registers(); return val;
+	case 3:  r3  = val; MR_save_transient_registers(); return val;
+	case 4:  r4  = val; MR_save_transient_registers(); return val;
+	case 5:  r5  = val; MR_save_transient_registers(); return val;
+	case 6:  r6  = val; MR_save_transient_registers(); return val;
+	case 7:  r7  = val; MR_save_transient_registers(); return val;
+	case 8:  r8  = val; MR_save_transient_registers(); return val;
+	case 9:  r9  = val; MR_save_transient_registers(); return val;
+	case 10: r10 = val; MR_save_transient_registers(); return val;
+	case 11: r11 = val; MR_save_transient_registers(); return val;
+	case 12: r12 = val; MR_save_transient_registers(); return val;
+	case 13: r13 = val; MR_save_transient_registers(); return val;
+	case 14: r14 = val; MR_save_transient_registers(); return val;
+	case 15: r15 = val; MR_save_transient_registers(); return val;
+	case 16: r16 = val; MR_save_transient_registers(); return val;
+	case 17: r17 = val; MR_save_transient_registers(); return val;
+	case 18: r18 = val; MR_save_transient_registers(); return val;
+	case 19: r19 = val; MR_save_transient_registers(); return val;
+	case 20: r20 = val; MR_save_transient_registers(); return val;
+	case 21: r21 = val; MR_save_transient_registers(); return val;
+	case 22: r22 = val; MR_save_transient_registers(); return val;
+	case 23: r23 = val; MR_save_transient_registers(); return val;
+	case 24: r24 = val; MR_save_transient_registers(); return val;
+	case 25: r25 = val; MR_save_transient_registers(); return val;
+	case 26: r26 = val; MR_save_transient_registers(); return val;
+	case 27: r27 = val; MR_save_transient_registers(); return val;
+	case 28: r28 = val; MR_save_transient_registers(); return val;
+	case 29: r29 = val; MR_save_transient_registers(); return val;
+	case 30: r30 = val; MR_save_transient_registers(); return val;
+	case 31: r31 = val; MR_save_transient_registers(); return val;
+	case 32: r32 = val; MR_save_transient_registers(); return val;
 
 	}
 
@@ -102,5 +101,4 @@
 	fprintf(stderr, "register %d out of range in set_reg\n", num);
 	abort();
 	return 0;
-} /* end set_reg() */
-
+} /* end MR_set_reg() */
Index: runtime/mercury_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_regs.h,v
retrieving revision 1.16
diff -u -b -r1.16 mercury_regs.h
--- runtime/mercury_regs.h	2000/08/03 06:18:53	1.16
+++ runtime/mercury_regs.h	2000/11/13 04:31:30
@@ -20,13 +20,13 @@
 */
 
 #ifdef __GNUC__
-  #define LVALUE_CAST(type, lval)	((type)(lval))
-  #define LVALUE_SEQ(expr, lval)	((expr),(lval))
-  #define LVALUE_COND(expr, x, y)	((expr)?(x):(y))
+  #define MR_LVALUE_CAST(type, lval)	((type)(lval))
+  #define MR_LVALUE_SEQ(expr, lval)	((expr),(lval))
+  #define MR_LVALUE_COND(expr, x, y)	((expr)?(x):(y))
 #else
-  #define LVALUE_CAST(type, lval)	(*(type*)&(lval))
-  #define LVALUE_SEQ(expr, lval)	(*((expr),&(lval)))
-  #define LVALUE_COND(expr, x, y)	(*((expr)?&(x):&(y)))
+  #define MR_LVALUE_CAST(type, lval)	(*(type*)&(lval))
+  #define MR_LVALUE_SEQ(expr, lval)	(*((expr),&(lval)))
+  #define MR_LVALUE_COND(expr, x, y)	(*((expr)?&(x):&(y)))
 #endif
 
 #define MR_fake_reg	(MR_ENGINE(fake_reg))
@@ -39,39 +39,40 @@
 ** The bottom level is the hardware description layer. 
 ** This layer is defined separately for each architecture,
 ** in the header files in the machdeps subdirectory.
-** The hardware description layer defines the first NUM_REAL_REGS register
-** variables mr0, mr1, etc. as the physical machine registers, and defines an
-** array fake_regs[n] of pseudo registers, with the remaining "registers"
-** mr<NUM_REAL_REGS>, ..., mr36 defined as corresponding slots in
-** this fake_reg array. 
-** This level also provides the macros save_regs_to_mem(),
-** save_transient_regs_to_mem(), restore_regs_from_mem(),
-** and restore_transient_regs_from_mem().
+** The hardware description layer defines the first MR_NUM_REAL_REGS register
+** variables MR_mr0, MR_mr1, etc. as the physical machine registers, and
+** defines an array MR_fake_reg[n] of pseudo registers, with the remaining
+** "registers" MR_mr<MR_NUM_REAL_REGS>, ..., MR_mr36 defined as corresponding
+** slots in this MR_fake_reg array. 
+** This level also provides the macros MR_save_regs_to_mem(),
+** MR_save_transient_regs_to_mem(), MR_restore_regs_from_mem(),
+** and MR_restore_transient_regs_from_mem().
 **
 ** The next level is the hardware abstraction layer.
 ** The hardware abstraction layer is at a similar level to the
 ** hardware description layer, and includes that as a subset,
 ** but in addition it provides a few more conveniences.
-** This layer defines macros mr(n) for n>36, and the macros
-** save_registers(), restore_registers(),
-** save_transient_registers(), restore_transient_registers(),
-** save_transient_hp(), and restore_transient_hp().
+** This layer defines macros MR_mr(n) for n>36, and the macros
+** MR_save_registers(), MR_restore_registers(),
+** MR_save_transient_registers(), MR_restore_transient_registers(),
+** MR_save_transient_hp(), and MR_restore_transient_hp().
 ** This layer is defined here in mercury_regs.h.
 **
 ** The hardware abstraction layer thus provides a very large number
 ** of registers, which may be either real or fake.  The lower the number,
 ** the greater the probability that the storage referred to will be
 ** a real machine register, and not a simulated one. The number of
-** real machine registers is given by the macro NUM_REAL_REGS.
+** real machine registers is given by the macro MR_NUM_REAL_REGS.
 **
 ** The final level is the Mercury abstract machine registers layer.
 ** This layer maps the Mercury virtual machine registers
 **
 **	MR_succip, MR_hp, MR_sp, MR_curfr, MR_maxfr and
-**	r1, ..., r32, r(33), ..., r(MAX_VIRTUAL_REG)
+**	MR_r1, ..., MR_r32, MR_r(33), ..., MR_r(MR_MAX_VIRTUAL_REG)
 **
-** to the set mr0..mr37, mr(38), mr(39), ..., mr(MAX_FAKE_REG-1)
-** which were provided by the hardware abstraction layer.
+** to the set MR_mr0..MR_mr37, MR_mr(38), MR_mr(39), ...,
+** MR_mr(MR_MAX_FAKE_REG-1) which were provided by the hardware abstraction
+** layer.
 ** It also provides MR_virtual_r(), MR_virtual_succip, MR_virtual_hp, etc.,
 ** which are similar to mr<N>, MR_succip, MR_hp, etc. except that they
 ** always map to the underlying fake_reg rather than to the physical register.
@@ -115,76 +116,80 @@
 ** Extra stuff for the hardware abstraction layer
 */
 
-/* The machdeps header defines mr0 .. mr37; now define mr(n) for n > 37 */
+/*
+** The machdeps header defines MR_mr0 .. MR_mr37;
+** now define MR_mr(n) for n > 37
+*/
 
-#define mr(n) LVALUE_SEQ(MR_assert((n) > 37 && \
-				(n) < MAX_FAKE_REG),\
+#define MR_mr(n) MR_LVALUE_SEQ(MR_assert((n) > 37 && (n) < MR_MAX_FAKE_REG),\
 		MR_fake_reg[n])
 
 /* 
-** the save_registers() macro copies the physical machine registers
-** to their corresponding slots in the MR_fake_reg array 
+** The MR_save_registers() macro copies the physical machine registers
+** to their corresponding slots in the MR_fake_reg array.
 */
 
-#define save_registers() 	save_regs_to_mem(MR_fake_reg)
+#define MR_save_registers() 	MR_save_regs_to_mem(MR_fake_reg)
 
 /* 
-** the restore_registers() macro sets the physical machine registers
+** The MR_restore_registers() macro sets the physical machine registers
 ** to the values in their corresponding slots in the fake_reg array 
 ** If we're using a register for the engine base, then we'd better
 ** restore that from the thread specific data area, since the fake_reg
 ** array is accessed via that register.
 */
 
-#if defined(MR_THREAD_SAFE) && NUM_REAL_REGS > 0
-  #define restore_registers()					\
+#if defined(MR_THREAD_SAFE) && MR_NUM_REAL_REGS > 0
+  #define MR_restore_registers()					\
   	do {							\
 		MR_engine_base = MR_thread_engine_base;		\
 		MR_fake_reg[0] = (MR_Word) MR_engine_base;		\
-		restore_regs_from_mem(MR_fake_reg);		\
+		MR_restore_regs_from_mem(MR_fake_reg);		\
 	} while (0)
 #else
-  #define restore_registers() 	restore_regs_from_mem(MR_fake_reg)
+  #define MR_restore_registers() 	MR_restore_regs_from_mem(MR_fake_reg)
 #endif
 
 /* 
-** the save_transient_registers() and restore_transient_registers()
-** macros are similar to save_registers() and restore_registers()
+** The MR_save_transient_registers() and MR_restore_transient_registers()
+** macros are similar to MR_save_registers() and MR_restore_registers()
 ** except that they only save/restore registers which can be
 ** affected by calling or returning from a C function (e.g.
 ** by sliding register windows on SPARCs).
 */
+
+#define MR_save_transient_registers()    				\
+	MR_save_transient_regs_to_mem(MR_fake_reg)
 
-#define save_transient_registers()    save_transient_regs_to_mem(MR_fake_reg)
-#if defined(MR_THREAD_SAFE) && NUM_REAL_REGS > 0
-  #define restore_transient_registers()					\
+#if defined(MR_THREAD_SAFE) && MR_NUM_REAL_REGS > 0
+  #define MR_restore_transient_registers()				\
   	do {								\
 		MR_engine_base = MR_thread_engine_base;			\
 		MR_fake_reg[0] = (MR_Word) MR_engine_base;		\
-		restore_transient_regs_from_mem(MR_fake_reg);		\
+		MR_restore_transient_regs_from_mem(MR_fake_reg);	\
 	} while (0)
 #else
-  #define restore_transient_registers()	\
-		restore_transient_regs_from_mem(MR_fake_reg)
+  #define MR_restore_transient_registers()	\
+		MR_restore_transient_regs_from_mem(MR_fake_reg)
 #endif
 
 /*
-** The save_transient_hp() and restore_transient_hp() macros
-** are similar to save/restore_transient_regs(), except
-** that they only guarantee to save/restore the heap pointer,
+** The MR_save_transient_hp() and MR_restore_transient_hp() macros
+** are similar to MR_save_transient_regs()/MR_restore_transient_regs(),
+** except that they only guarantee to save/restore the heap pointer,
 ** if any.  (They might save/restore other regs too, though.)
 */
 #ifdef CONSERVATIVE_GC
-  #define save_transient_hp() /* nothing */
-  #define restore_transient_hp() /* nothing */
+  #define MR_save_transient_hp()	/* nothing */
+  #define MR_restore_transient_hp()	/* nothing */
 #else
   /*
   ** This code is suboptimal -- it would be more efficient to
   ** save/restore just a single register rather than all the
   ** transient registers.
   */
-  #define save_transient_hp() save_transient_registers()
-  #define restore_transient_hp() restore_transient_registers()
+  #define MR_save_transient_hp()	MR_save_transient_registers()
+  #define MR_restore_transient_hp() 	MR_restore_transient_registers()
 #endif
 
 /*---------------------------------------------------------------------------*/
@@ -193,30 +198,30 @@
 */
 
 #ifdef MEASURE_REGISTER_USAGE
-  #define count_usage(num,reg)		LVALUE_SEQ(num_uses[num]++, reg)
+  #define MR_count_usage(num,reg)	MR_LVALUE_SEQ(MR_num_uses[num]++, reg)
 #else
-  #define count_usage(num,reg)		(reg)
+  #define MR_count_usage(num,reg)	(reg)
 #endif
 
 #include "mercury_regorder.h"
 
-/* mercury_regorder.h defines r1 .. r32; now define r(n) for n > 32 */
+/* mercury_regorder.h defines MR_r1 .. MR_r32; now define MR_r(n) for n > 32 */
 
-#define r(n) mr((n) + MR_NUM_SPECIAL_REG - 1)
+#define MR_r(n) MR_mr((n) + MR_NUM_SPECIAL_REG - 1)
 
 /*
 ** saved_reg(save_area, n) accesses the underlying slot in save_area
 ** for register n
 */
-#define saved_reg(save_area, n)						\
-	LVALUE_COND((n) > MAX_REAL_REG,					\
-		save_area[(n) + MR_NUM_SPECIAL_REG - 1],		\
-		save_area[virtual_reg_map[(n) - 1]])
+#define MR_saved_reg(save_area, n)					\
+	MR_LVALUE_COND((n) > MR_MAX_REAL_REG,				\
+		(save_area)[(n) + MR_NUM_SPECIAL_REG - 1],		\
+		(save_area)[MR_virtual_reg_map[(n) - 1]])
 
-/* virtual_reg(n) accesses the underlying fake_reg for register n */
+/* MR_virtual_reg(n) accesses the underlying fake_reg for register n */
 /* similarly MR_virtual_foo access the underlying fake_reg slot for foo */
 
-#define virtual_reg(n) 			saved_reg(MR_fake_reg, n)
+#define MR_virtual_reg(n) 		MR_saved_reg(MR_fake_reg, n)
 #define MR_virtual_succip 		MR_saved_succip(MR_fake_reg)
 #define MR_virtual_hp 			MR_saved_hp(MR_fake_reg)
 #define MR_virtual_sp 			MR_saved_sp(MR_fake_reg)
@@ -234,30 +239,30 @@
 */
 #define MR_clear_regs_for_GC()						\
 	do {								\
-		save_registers();					\
+		MR_save_registers();					\
 		{ int i;						\
-		  for (i = 1; i <= MAX_VIRTUAL_REG; i++) {		\
-			virtual_reg(i) = 0;				\
+		  for (i = 1; i <= MR_MAX_VIRTUAL_REG; i++) {		\
+			MR_virtual_reg(i) = 0;				\
 		  }							\
 		}							\
-		restore_registers();					\
+		MR_restore_registers();					\
 	} while (0)
 
 /*
-** get_reg() and set_reg() provide a different way of addressing
-** the registers; unlike virtual_reg(), you don't need to wrap them
-** inside save_registers()/restore_regs() to copy the real regs to/from
+** MR_get_reg() and MR_set_reg() provide a different way of addressing
+** the registers; unlike MR_virtual_reg(), you don't need to wrap them
+** inside MR_save_registers()/MR_restore_regs() to copy the real regs to/from
 ** the MR_fake_reg, so they may perhaps be more efficient if you are just
 ** getting or setting one or two registers?
 ** Currently they're buggy for n>32 and are not used except for debugging.
 */
 
-extern	MR_Word	get_reg(int);
-extern	MR_Word	set_reg(int, MR_Word);
+extern	MR_Word	MR_get_reg(int);
+extern	MR_Word	MR_set_reg(int, MR_Word);
 
 /*
 ** the following macros define a mapping from registers to indices into the
-** num_uses array used for counting register usage
+** MR_num_uses array used for counting register usage
 **
 ** any changes to these will also require changes to
 ** print_register_usage_counts() in mercury_wrapper.c.
@@ -265,7 +270,7 @@
 
 #define	MR_SI_RN		0
 #define MR_R_RN(n)		(n)
-#define MR_ORD_RN		MAX_REAL_REG
+#define MR_ORD_RN		MR_MAX_REAL_REG
 #define	MR_HP_RN		(MR_ORD_RN + 1)
 #define	MR_SP_RN		(MR_ORD_RN + 2)
 #define	MR_CF_RN		(MR_ORD_RN + 3)
@@ -281,6 +286,6 @@
 #define	MR_GEN_NEXT_RN		(MR_ORD_RN + 13)
 #define	MR_CUT_STACK_RN		(MR_ORD_RN + 14)
 #define	MR_CUT_NEXT_RN		(MR_ORD_RN + 15)
-#define	MAX_RN			(MR_ORD_RN + 16)
+#define	MR_MAX_RN		(MR_ORD_RN + 16)
 
 #endif /* not MERCURY_REGS_H */
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.43
diff -u -b -r1.43 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	2000/11/10 01:00:58	1.43
+++ runtime/mercury_stack_layout.h	2000/11/13 03:47:23
@@ -82,15 +82,15 @@
 ** the word depends on the location type:
 **
 **  Locn		Tag	Rest
-**  r(Num)		 0	Num (register number)
-**  f(Num)		 1	Num (register number)
-**  stackvar(Num)	 2	Num (stack slot number)
-**  framevar(Num)	 3	Num (stack slot number)
-**  succip		 4
-**  maxfr		 5
-**  curfr		 6
-**  hp			 7
-**  sp			 8
+**  MR_r(Num)		 0	Num (register number)
+**  MR_f(Num)		 1	Num (register number)
+**  MR_stackvar(Num)	 2	Num (stack slot number)
+**  MR_framevar(Num)	 3	Num (stack slot number)
+**  MR_succip		 4
+**  MR_maxfr		 5
+**  MR_curfr		 6
+**  MR_hp		 7
+**  MR_sp		 8
 **  indirect(Base, N)	 9	See below
 **  unknown		10	(The location is not known)
 **
@@ -162,9 +162,9 @@
 ** depends on the location type:
 **
 **  Locn		Tag	Rest
-**  r(Num)		 0	Num (register number)
-**  stackvar(Num)	 1	Num (stack slot number)
-**  framevar(Num)	 2	Num (stack slot number)
+**  MR_r(Num)		 0	Num (register number)
+**  MR_stackvar(Num)	 1	Num (stack slot number)
+**  MR_framevar(Num)	 2	Num (stack slot number)
 **  special reg		 3	MR_Long_Lval_Type
 **
 ** This data is generated in stack_layout__represent_locn_as_byte,
@@ -427,7 +427,7 @@
 #define	MR_ENTRY_NO_SLOT_COUNT		-1
 
 #ifdef	MR_STATIC_CODE_ADDRESSES
- #define	MR_MAKE_PROC_LAYOUT_ADDR(entry)		STATIC(entry)
+ #define	MR_MAKE_PROC_LAYOUT_ADDR(entry)		MR_STATIC(entry)
  #define	MR_INIT_PROC_LAYOUT_ADDR(entry)		do { } while (0)
 #else
  #define	MR_MAKE_PROC_LAYOUT_ADDR(entry)		((MR_Code *) NULL)
@@ -435,7 +435,7 @@
 		do {							\
 			((MR_Stack_Layout_Entry *) &			\
 			mercury_data__layout__##entry)			\
-				->MR_sle_code_addr = ENTRY(entry);	\
+				->MR_sle_code_addr = MR_ENTRY(entry);	\
 		} while (0)
 #endif
 
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.38
diff -u -b -r1.38 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	2000/10/16 01:34:00	1.38
+++ runtime/mercury_stack_trace.c	2000/10/22 01:12:51
@@ -242,7 +242,7 @@
 			MR_print_nondstackptr(fp, base_maxfr);
 			fprintf(fp, ": temp\n");
 			fprintf(fp, " redoip: ");
-			printlabel(MR_redoip_slot(base_maxfr));
+			MR_printlabel(fp, MR_redoip_slot(base_maxfr));
 			fprintf(fp, " redofr: ");
 			MR_print_nondstackptr(fp, MR_redofr_slot(base_maxfr));
 			fprintf(fp, " \n");
@@ -250,7 +250,7 @@
 			MR_print_nondstackptr(fp, base_maxfr);
 			fprintf(fp, ": temp\n");
 			fprintf(fp, " redoip: ");
-			printlabel(MR_redoip_slot(base_maxfr));
+			MR_printlabel(fp, MR_redoip_slot(base_maxfr));
 			fprintf(fp, " redofr: ");
 			MR_print_nondstackptr(fp, MR_redofr_slot(base_maxfr));
 			fprintf(fp, " \n");
@@ -262,12 +262,12 @@
 			fprintf(fp, ": ordinary, %d words\n",
 				frame_size);
 			fprintf(fp, " redoip: ");
-			printlabel(MR_redoip_slot(base_maxfr));
+			MR_printlabel(fp, MR_redoip_slot(base_maxfr));
 			fprintf(fp, " redofr: ");
 			MR_print_nondstackptr(fp, MR_redofr_slot(base_maxfr));
 			fprintf(fp, " \n");
 			fprintf(fp, " succip: ");
-			printlabel(MR_succip_slot(base_maxfr));
+			MR_printlabel(fp, MR_succip_slot(base_maxfr));
 			fprintf(fp, " succfr: ");
 			MR_print_nondstackptr(fp, MR_succfr_slot(base_maxfr));
 			fprintf(fp, " \n");
Index: runtime/mercury_stack_trace.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.h,v
retrieving revision 1.23
diff -u -b -r1.23 mercury_stack_trace.h
--- runtime/mercury_stack_trace.h	2000/10/13 04:06:33	1.23
+++ runtime/mercury_stack_trace.h	2000/11/13 04:40:56
@@ -40,7 +40,8 @@
 ** 	using `:- external'.
 */
 
-extern	void	MR_dump_stack(MR_Code *success_pointer, MR_Word *det_stack_pointer,
+extern	void	MR_dump_stack(MR_Code *success_pointer,
+			MR_Word *det_stack_pointer,
 			MR_Word *current_frame, bool include_trace_data);
 
 /*
@@ -57,7 +58,7 @@
 */
 
 typedef	void		(*MR_Print_Stack_Record)(FILE *fp,
-				const MR_Stack_Layout_Entry * proc_layout,
+				const MR_Stack_Layout_Entry *proc_layout,
 				int count, int level,
 				MR_Word *base_sp, MR_Word * base_curfr,
 				const char *filename, int linenumber,
@@ -65,7 +66,8 @@
 
 extern	const char	*MR_dump_stack_from_layout(FILE *fp,
 				const MR_Stack_Layout_Label *label_layout,
-				MR_Word *det_stack_pointer, MR_Word *current_frame,
+				MR_Word *det_stack_pointer,
+				MR_Word *current_frame,
 				bool include_trace_data,
 				bool include_contexts,
 				MR_Print_Stack_Record print_stack_record);
@@ -77,7 +79,8 @@
 **	The value of maxfr should be in *base_maxfr.
 */
 
-extern	void	MR_dump_nondet_stack_from_layout(FILE *fp, MR_Word *base_maxfr);
+extern	void	MR_dump_nondet_stack_from_layout(FILE *fp,
+			MR_Word *base_maxfr);
 
 /*
 ** MR_find_nth_ancestor:
Index: runtime/mercury_stacks.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stacks.c,v
retrieving revision 1.6
diff -u -b -r1.6 mercury_stacks.c
--- runtime/mercury_stacks.c	2000/08/03 06:18:56	1.6
+++ runtime/mercury_stacks.c	2000/10/22 00:22:36
@@ -107,7 +107,7 @@
 void
 MR_commit_mark(void)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	MR_cut_stack[MR_cut_next].frame = MR_maxfr;
 	MR_cut_stack[MR_cut_next].gen_next = MR_gen_next;
@@ -120,7 +120,7 @@
 	}
 #endif
 
-	save_transient_registers();
+	MR_save_transient_registers();
 }
 
 void
@@ -148,7 +148,7 @@
 					(long) MR_cut_next,
 					(long) MR_cut_stack[MR_cut_next].
 						gen_next);
-				fatal_error("GEN_NEXT ASSERTION FAILURE");
+				MR_fatal_error("GEN_NEXT ASSERTION FAILURE");
 			}
 		}
 	}
Index: runtime/mercury_stacks.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stacks.h,v
retrieving revision 1.22
diff -u -b -r1.22 mercury_stacks.h
--- runtime/mercury_stacks.h	2000/08/03 06:18:57	1.22
+++ runtime/mercury_stacks.h	2000/10/25 04:05:53
@@ -26,33 +26,31 @@
 
 #define	MR_incr_sp_push_msg(n, msg)				\
 			(					\
-				debugincrsp(n, MR_sp),		\
-				dump_push_msg(msg),		\
+				MR_debugincrsp(n, MR_sp),	\
 				MR_sp = MR_sp + (n),		\
-				detstack_overflow_check(),	\
+				MR_detstack_overflow_check(),	\
 				(void)0				\
 			)
 
 #define	MR_decr_sp_pop_msg(n)					\
 			(					\
-				debugdecrsp(n, MR_sp),		\
-				dump_pop_msg(),			\
+				MR_debugdecrsp(n, MR_sp),	\
 				MR_sp = MR_sp - (n),		\
-				detstack_underflow_check(),	\
+				MR_detstack_underflow_check(),	\
 				(void)0				\
 			)
 
 #define	MR_incr_sp(n)	(					\
-				debugincrsp(n, MR_sp),		\
+				MR_debugincrsp(n, MR_sp),	\
 				MR_sp = MR_sp + (n),		\
-				detstack_overflow_check(),	\
+				MR_detstack_overflow_check(),	\
 				(void)0				\
 			)
 
 #define	MR_decr_sp(n)	(					\
-				debugdecrsp(n, MR_sp),		\
+				MR_debugdecrsp(n, MR_sp),	\
 				MR_sp = MR_sp - (n),		\
-				detstack_underflow_check(),	\
+				MR_detstack_underflow_check(),	\
 				(void)0				\
 			)
 
@@ -89,12 +87,18 @@
 #define	MR_based_framevar_addr(fr, n) \
 				(&(((MR_Word *) (fr))[MR_SAVEVAL + 1 - (n)]))
 
-#define	MR_prevfr_slot(fr)	LVALUE_CAST(MR_Word *, ((MR_Word *) (fr))[MR_PREVFR])
-#define	MR_redoip_slot(fr)	LVALUE_CAST(MR_Code *, ((MR_Word *) (fr))[MR_REDOIP])
-#define	MR_redofr_slot(fr)	LVALUE_CAST(MR_Word *, ((MR_Word *) (fr))[MR_REDOFR])
-#define	MR_succip_slot(fr)	LVALUE_CAST(MR_Code *, ((MR_Word *) (fr))[MR_SUCCIP])
-#define	MR_succfr_slot(fr)	LVALUE_CAST(MR_Word *, ((MR_Word *) (fr))[MR_SUCCFR])
-#define	MR_detfr_slot(fr)	LVALUE_CAST(MR_Word *, ((MR_Word *) (fr))[MR_DETFR])
+#define	MR_prevfr_slot(fr)	MR_LVALUE_CAST(MR_Word *,		\
+					((MR_Word *) (fr))[MR_PREVFR])
+#define	MR_redoip_slot(fr)	MR_LVALUE_CAST(MR_Code *,		\
+					((MR_Word *) (fr))[MR_REDOIP])
+#define	MR_redofr_slot(fr)	MR_LVALUE_CAST(MR_Word *,		\
+					((MR_Word *) (fr))[MR_REDOFR])
+#define	MR_succip_slot(fr)	MR_LVALUE_CAST(MR_Code *,		\
+					((MR_Word *) (fr))[MR_SUCCIP])
+#define	MR_succfr_slot(fr)	MR_LVALUE_CAST(MR_Word *,		\
+					((MR_Word *) (fr))[MR_SUCCFR])
+#define	MR_detfr_slot(fr)	MR_LVALUE_CAST(MR_Word *,		\
+					((MR_Word *) (fr))[MR_DETFR])
 #define	MR_based_framevar(fr, n) (((MR_Word *) (fr))[MR_SAVEVAL + 1 - (n)])
 
 #define	MR_framevar(n)		MR_based_framevar(MR_curfr, n)
@@ -117,8 +121,8 @@
 				MR_succip_slot(MR_curfr) = MR_succip;	\
 				MR_succfr_slot(MR_curfr) = succfr;	\
 				MR_redofr_slot(MR_curfr) = MR_curfr;	\
-				debugmkframe(predname);			\
-				nondstack_overflow_check();		\
+				MR_debugmkframe(predname);		\
+				MR_nondstack_overflow_check();		\
 			} while (0)
 
 /* convert a size in bytes to a size in words, rounding up if necessary */
@@ -141,8 +145,8 @@
 		MR_succip_slot(MR_curfr) = MR_succip;			\
 		MR_succfr_slot(MR_curfr) = succfr;			\
 		MR_redofr_slot(MR_curfr) = MR_curfr;			\
-		debugmkframe(predname);					\
-		nondstack_overflow_check();				\
+		MR_debugmkframe(predname);				\
+		MR_nondstack_overflow_check();				\
 	} while (0)
 
 #define	MR_mktempframe(redoip)						\
@@ -156,7 +160,7 @@
 				MR_prevfr_slot(MR_maxfr) = prevfr;	\
 				MR_redoip_slot(MR_maxfr) = redoip;	\
 				MR_redofr_slot(MR_maxfr) = MR_curfr;	\
-				nondstack_overflow_check();		\
+				MR_nondstack_overflow_check();		\
 			} while (0)
 
 #define	MR_mkdettempframe(redoip)					\
@@ -171,43 +175,43 @@
 				MR_redoip_slot(MR_maxfr) = redoip;	\
 				MR_redofr_slot(MR_maxfr) = MR_curfr;	\
 				MR_detfr_slot(MR_maxfr)  = MR_sp;	\
-				nondstack_overflow_check();		\
+				MR_nondstack_overflow_check();		\
 			} while (0)
 
 #define	MR_succeed()	do {						\
 				reg	MR_Word	*childfr;		\
 									\
-				debugsucceed();				\
+				MR_debugsucceed();			\
 				childfr = MR_curfr;			\
 				MR_curfr = MR_succfr_slot(childfr);	\
-				GOTO(MR_succip_slot(childfr));		\
+				MR_GOTO(MR_succip_slot(childfr));	\
 			} while (0)
 
 #define	MR_succeed_discard()						\
 			do {						\
 				reg	MR_Word	*childfr;		\
 									\
-				debugsucceeddiscard();			\
+				MR_debugsucceeddiscard();		\
 				childfr = MR_curfr;			\
 				MR_maxfr = MR_prevfr_slot(childfr);	\
 				MR_curfr = MR_succfr_slot(childfr);	\
-				GOTO(MR_succip_slot(childfr));		\
+				MR_GOTO(MR_succip_slot(childfr));	\
 			} while (0)
 
 
 #define	MR_fail()	do {						\
-				debugfail();				\
+				MR_debugfail();				\
 				MR_maxfr = MR_prevfr_slot(MR_maxfr);	\
-				nondstack_underflow_check();		\
+				MR_nondstack_underflow_check();		\
 				MR_curfr = MR_redofr_slot(MR_maxfr);	\
-				GOTO(MR_redoip_slot(MR_maxfr));		\
+				MR_GOTO(MR_redoip_slot(MR_maxfr));	\
 			} while (0)
 
 
 #define	MR_redo()	do {						\
-				debugredo();				\
+				MR_debugredo();				\
 				MR_curfr = MR_redofr_slot(MR_maxfr);	\
-				GOTO(MR_redoip_slot(MR_maxfr));		\
+				MR_GOTO(MR_redoip_slot(MR_maxfr));	\
 			} while (0)
 
 /*---------------------------------------------------------------------------*/
@@ -291,7 +295,7 @@
 	MR_IF_NOT_CONSERVATIVE_GC(
 		MR_Word *heap_ptr;
 		MR_Word *solns_heap_ptr;
-		MemoryZone *heap_zone;
+		MR_MemoryZone *heap_zone;
 	)
 } MR_Exception_Handler_Frame;
 
@@ -310,7 +314,7 @@
 		*/							      \
 		MR_mkpragmaframe((name), 0,	      		      	      \
 			MR_Exception_Handler_Frame_struct,		      \
-			ENTRY(exception_handler_do_fail));		      \
+			MR_ENTRY(exception_handler_do_fail));		      \
 		/* record the handler's code model */			      \
 		MR_EXCEPTION_FRAMEVARS->code_model = (handler_code_model);    \
 		/* save the handler's closure */			      \
Index: runtime/mercury_std.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_std.h,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_std.h
--- runtime/mercury_std.h	2000/05/08 14:01:01	1.13
+++ runtime/mercury_std.h	2000/11/13 03:55:41
@@ -85,7 +85,7 @@
 ** At the moment, we use variable length arrays that are indexed by
 ** closure argument numbers or by type parameter numbers. We therefore
 ** use a default MR_VARIABLE_SIZED value that is at least as big as
-** both MAX_VIRTUAL_REG and MR_PSEUDOTYPEINFO_MAX_VAR.
+** both MR_MAX_VIRTUAL_REG and MR_PSEUDOTYPEINFO_MAX_VAR.
 */
 
 #if __STDC_VERSION__ >= 199901	/* January 1999 */
Index: runtime/mercury_string.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_string.c,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_string.c
--- runtime/mercury_string.c	2000/09/14 15:24:50	1.9
+++ runtime/mercury_string.c	2000/10/22 00:15:07
@@ -74,10 +74,10 @@
 
 	p = fixed;
 #endif
-	restore_transient_hp();      
+	MR_restore_transient_hp();      
 	MR_allocate_aligned_string_msg(result, strlen(p),
 			proclabel);
-	save_transient_hp();
+	MR_save_transient_hp();
 	strcpy(result, p);
 
 #ifdef HAVE_VSNPRINTF
Index: runtime/mercury_string.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_string.h,v
retrieving revision 1.18
diff -u -b -r1.18 mercury_string.h
--- runtime/mercury_string.h	2000/09/14 15:24:51	1.18
+++ runtime/mercury_string.h	2000/10/22 00:18:44
@@ -56,7 +56,7 @@
 ** BEWARE: this may modify `hp', so it must only be called from
 ** places where `hp' is valid.  If calling it from inside a C function,
 ** rather than inside Mercury code, you may need to call
-** save/restore_transient_hp().
+** MR_{save/restore}_transient_hp().
 **
 ** Algorithm: if the string is aligned, just set ptr equal to it.
 ** Otherwise, allocate space on the heap and copy the C string to
@@ -79,7 +79,7 @@
 ** BEWARE: this may modify `hp', so it must only be called from
 ** places where `hp' is valid.  If calling it from inside a C function,
 ** rather than inside Mercury code, you may need to call
-** save/restore_transient_hp().
+** MR_{save/restore}_transient_hp().
 */
 #define MR_make_aligned_string_copy(ptr, string) 			\
 	do {								\
@@ -104,7 +104,7 @@
 ** BEWARE: this may modify `hp', so it must only be called from
 ** places where `hp' is valid.  If calling it from inside a C function,
 ** rather than inside Mercury code, you may need to call
-** save/restore_transient_hp().
+** MR_{save/restore}_transient_hp().
 */
 #define MR_allocate_aligned_string_msg(ptr, len, proclabel)		\
 	do {								\
@@ -176,7 +176,7 @@
 **
 ** BEWARE: this may modify the saved copy of `hp', so it must only be
 ** called from places where the saved copy of `hp' is valid.
-** You will generally need to call save/restore_transient_hp()
+** You will generally need to call MR_{save/restore}_transient_hp()
 ** before/after calling this function.
 */
 MR_String MR_make_string(MR_Code *proclabel, const char *fmt, ...);
Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.30
diff -u -b -r1.30 mercury_tabling.c
--- runtime/mercury_tabling.c	2000/10/16 01:34:01	1.30
+++ runtime/mercury_tabling.c	2000/11/13 04:28:46
@@ -991,7 +991,7 @@
 	MR_Word *generator_maxfr, MR_Word *generator_sp,
 	const char *who, const char *what)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
   #ifdef MR_HIGHLEVEL_CODE
 	MR_fatal_error("sorry, not implemented: "
@@ -1120,7 +1120,7 @@
 	}
   #endif /* MR_TABLE_DEBUG */
 
-	save_transient_registers();
+	MR_save_transient_registers();
 }
 
 /*
@@ -1130,7 +1130,7 @@
 static void
 restore_state(MR_SavedState *saved_state, const char *who, const char *what)
 {
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
   #ifdef MR_HIGHLEVEL_CODE
 
@@ -1208,7 +1208,7 @@
 	}
   #endif /* MR_table_debug */
 
-	save_transient_registers();
+	MR_save_transient_registers();
 }
 
 static void
@@ -1218,7 +1218,7 @@
 
 	printf("saved state parameters:\n");
 	printf("succip:\t");
-	printlabel(saved_state->succ_ip);
+	MR_printlabel(stdout, saved_state->succ_ip);
 	printf("sp:\t");
 	MR_printdetstackptr(saved_state->s_p);
 	printf("\ncurfr:\t");
@@ -1254,7 +1254,7 @@
 ** the parts of the stacks between the generator of B and the generator of A.
 */
 
-Declare_entry(mercury__table_nondet_resume_1_0);
+MR_declare_entry(mercury__table_nondet_resume_1_0);
 
 static void
 extend_consumer_stacks(MR_Subgoal *leader, MR_Consumer *suspension)
@@ -1364,7 +1364,7 @@
 		if (saved_fr - frame_size
 			> suspension->saved_state.non_stack_block)
 		{
-			*MR_redoip_addr(saved_fr) = (MR_Word) ENTRY(do_fail);
+			*MR_redoip_addr(saved_fr) = (MR_Word) MR_ENTRY(do_fail);
 
 #ifdef	MR_TABLE_DEBUG
 			if (MR_tabledebug) {
@@ -1377,7 +1377,7 @@
 #endif
 		} else {
 			*MR_redoip_addr(saved_fr) = (MR_Word)
-				ENTRY(mercury__table_nondet_resume_1_0);
+				MR_ENTRY(mercury__table_nondet_resume_1_0);
 #ifdef	MR_TABLE_DEBUG
 			if (MR_tabledebug) {
 				printf("resume to redoip at %p (%d)\n",
@@ -1415,7 +1415,7 @@
 	MR_SubgoalList		sub_followers;
 	MR_ConsumerList		suspend_list;
 
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 #ifdef	MR_TABLE_DEBUG
 	if (MR_tabledebug) {
@@ -1430,9 +1430,9 @@
 			suspend_list != NULL;
 			suspend_list = suspend_list->next)
 		{
-			save_transient_registers();
+			MR_save_transient_registers();
 			extend_consumer_stacks(leader, suspend_list->item);
-			restore_transient_registers();
+			MR_restore_transient_registers();
 		}
 	}
 
@@ -1440,7 +1440,7 @@
 	*(leader->followers_tail) = this_follower->followers;
 	this_follower->followers = NULL;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 }
 
 /*
@@ -1459,19 +1459,19 @@
 ** table_nondet_resume.
 */
 
-Declare_entry(mercury__table_nondet_resume_1_0);
-Declare_entry(MR_do_trace_redo_fail);
-Declare_entry(MR_table_nondet_commit);
-Define_extern_entry(mercury__table_nondet_suspend_2_0);
+MR_declare_entry(mercury__table_nondet_resume_1_0);
+MR_declare_entry(MR_do_trace_redo_fail);
+MR_declare_entry(MR_table_nondet_commit);
+MR_define_extern_entry(mercury__table_nondet_suspend_2_0);
 MR_MAKE_PROC_LAYOUT(mercury__table_nondet_suspend_2_0,
 	MR_DETISM_NON, 0, MR_LONG_LVAL_TYPE_UNKNOWN,
 	MR_PREDICATE, "private_builtin", "table_nondet_suspend", 2, 0);
-BEGIN_MODULE(table_nondet_suspend_module)
-	init_entry_sl(mercury__table_nondet_suspend_2_0);
+MR_BEGIN_MODULE(table_nondet_suspend_module)
+	MR_init_entry_sl(mercury__table_nondet_suspend_2_0);
 	MR_INIT_PROC_LAYOUT_ADDR(mercury__table_nondet_suspend_2_0);
-BEGIN_CODE
+MR_BEGIN_CODE
 
-Define_entry(mercury__table_nondet_suspend_2_0);
+MR_define_entry(mercury__table_nondet_suspend_2_0);
 {
 	MR_TrieNode	table;
 	MR_Subgoal	*subgoal;
@@ -1492,18 +1492,18 @@
 	** nondet stack fragment. The framevar slot is for use by
 	** table_nondet_resume.
 	*/
-	MR_mkframe("mercury__table_nondet_suspend", 1, ENTRY(do_fail));
+	MR_mkframe("mercury__table_nondet_suspend", 1, MR_ENTRY(do_fail));
 
 	table = (MR_TrieNode) r1;
 	subgoal = table->MR_subgoal;
 	consumer = table_allocate_bytes(sizeof(MR_Consumer));
 	consumer->remaining_answer_list_ptr = &subgoal->answer_list;
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	save_state(&(consumer->saved_state),
 		subgoal->generator_maxfr, subgoal->generator_sp,
 		"suspension", "consumer");
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	cur_gen = MR_gen_next - 1;
 	cur_cut = MR_cut_next - 1;
@@ -1533,7 +1533,7 @@
 
 				assert(MR_prevfr_slot(fr) == (stop_addr - 1));
 				*clobber_addr = (MR_Word)
-					ENTRY(mercury__table_nondet_resume_1_0);
+					MR_ENTRY(mercury__table_nondet_resume_1_0);
 #ifdef	MR_TABLE_DEBUG
 				if (MR_tablestackdebug) {
 					printf("completing redoip "
@@ -1558,7 +1558,7 @@
 
 				assert(MR_prevfr_slot(fr) != (stop_addr - 1));
 
-				*clobber_addr = (MR_Word) ENTRY(do_fail);
+				*clobber_addr = (MR_Word) MR_ENTRY(do_fail);
 #ifdef	MR_TABLE_DEBUG
 				if (MR_tablestackdebug) {
 					printf("clobbering redoip "
@@ -1568,17 +1568,17 @@
 				}
 #endif
 
-				save_transient_registers();
+				MR_save_transient_registers();
 				make_subgoal_follow_leader(
 					MR_gen_stack[cur_gen].
 						generator_table->MR_subgoal,
 					subgoal);
-				restore_transient_registers();
+				MR_restore_transient_registers();
 			}
 
 			cur_gen--;
 		} else if (cur_cut > 0 && fr == MR_cut_stack[cur_cut].frame) {
-			*clobber_addr = (MR_Word) ENTRY(MR_table_nondet_commit);
+			*clobber_addr = (MR_Word) MR_ENTRY(MR_table_nondet_commit);
 #ifdef	MR_TABLE_DEBUG
 			if (MR_tablestackdebug) {
 				printf("committing redoip of frame at ");
@@ -1589,7 +1589,7 @@
 
 			cur_cut--;
 		} else {
-			*clobber_addr = (MR_Word) ENTRY(do_fail);
+			*clobber_addr = (MR_Word) MR_ENTRY(do_fail);
 #ifdef	MR_TABLE_DEBUG
 			if (MR_tablestackdebug) {
 				printf("clobbering redoip of frame at ");
@@ -1616,7 +1616,7 @@
 	listnode->next = NULL;
 }
 	MR_fail();
-END_MODULE
+MR_END_MODULE
 
 MR_Subgoal	*MR_cur_leader;
 
@@ -1638,12 +1638,12 @@
 ** to it).
 */
 
-Define_extern_entry(mercury__table_nondet_resume_1_0);
-Declare_label(mercury__table_nondet_resume_1_0_ChangeLoop);
-Declare_label(mercury__table_nondet_resume_1_0_ReachedFixpoint);
-Declare_label(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
-Declare_label(mercury__table_nondet_resume_1_0_ReturnAnswer);
-Declare_label(mercury__table_nondet_resume_1_0_RedoPoint);
+MR_define_extern_entry(mercury__table_nondet_resume_1_0);
+MR_declare_label(mercury__table_nondet_resume_1_0_ChangeLoop);
+MR_declare_label(mercury__table_nondet_resume_1_0_ReachedFixpoint);
+MR_declare_label(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
+MR_declare_label(mercury__table_nondet_resume_1_0_ReturnAnswer);
+MR_declare_label(mercury__table_nondet_resume_1_0_RedoPoint);
 
 MR_MAKE_PROC_LAYOUT(mercury__table_nondet_resume_1_0,
 	MR_DETISM_NON, MR_ENTRY_NO_SLOT_COUNT, MR_LONG_LVAL_TYPE_UNKNOWN,
@@ -1671,18 +1671,18 @@
 	mercury__table_nondet_resume_1_0);
 
 BEGIN_MODULE(table_nondet_resume_module)
-	init_entry_sl(mercury__table_nondet_resume_1_0);
+	MR_init_entry_sl(mercury__table_nondet_resume_1_0);
 	MR_INIT_PROC_LAYOUT_ADDR(mercury__table_nondet_resume_1_0);
-	init_label_sl(mercury__table_nondet_resume_1_0_ChangeLoop);
-	init_label_sl(mercury__table_nondet_resume_1_0_ReachedFixpoint);
-	init_label_sl(mercury__table_nondet_resume_1_0_LoopOverSubgoals);
-	init_label_sl(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
-	init_label_sl(mercury__table_nondet_resume_1_0_ReturnAnswer);
-	init_label_sl(mercury__table_nondet_resume_1_0_RedoPoint);
-	init_label_sl(mercury__table_nondet_resume_1_0_RestartPoint);
+	MR_init_label_sl(mercury__table_nondet_resume_1_0_ChangeLoop);
+	MR_init_label_sl(mercury__table_nondet_resume_1_0_ReachedFixpoint);
+	MR_init_label_sl(mercury__table_nondet_resume_1_0_LoopOverSubgoals);
+	MR_init_label_sl(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
+	MR_init_label_sl(mercury__table_nondet_resume_1_0_ReturnAnswer);
+	MR_init_label_sl(mercury__table_nondet_resume_1_0_RedoPoint);
+	MR_init_label_sl(mercury__table_nondet_resume_1_0_RestartPoint);
 BEGIN_CODE
 
-Define_entry(mercury__table_nondet_resume_1_0);
+MR_define_entry(mercury__table_nondet_resume_1_0);
 	MR_cur_leader = MR_top_generator_table();
 
 	if (MR_cur_leader->leader != NULL) {
@@ -1720,12 +1720,12 @@
 	} else {
 		MR_cur_leader->resume_info = MR_TABLE_NEW(MR_ResumeInfo);
 
-		save_transient_registers();
+		MR_save_transient_registers();
 		save_state(&(MR_cur_leader->resume_info->leader_state),
 			MR_cur_leader->generator_maxfr,
 			MR_cur_leader->generator_sp,
 			"resumption", "generator");
-		restore_transient_registers();
+		MR_restore_transient_registers();
 
 #ifdef	MR_TABLE_DEBUG
 		if (MR_tabledebug) {
@@ -1737,7 +1737,7 @@
 
 	MR_cur_leader->resume_info->changed = TRUE;
 
-Define_label(mercury__table_nondet_resume_1_0_ChangeLoop);
+MR_define_label(mercury__table_nondet_resume_1_0_ChangeLoop);
 
 	if (MR_cur_leader->resume_info->changed) {
 #ifdef	MR_TABLE_DEBUG
@@ -1771,13 +1771,14 @@
 			printf("no more changes\n");
 		}
 #endif
-		GOTO_LABEL(mercury__table_nondet_resume_1_0_ReachedFixpoint);
+		MR_GOTO_LABEL(
+			mercury__table_nondet_resume_1_0_ReachedFixpoint);
 	}
 
 	MR_cur_leader->resume_info->subgoal_list = MR_cur_leader->followers;
 
 	/* For each of the subgoals on our list of followers */
-Define_label(mercury__table_nondet_resume_1_0_LoopOverSubgoals);
+MR_define_label(mercury__table_nondet_resume_1_0_LoopOverSubgoals);
 
 	if (MR_cur_leader->resume_info->subgoal_list == NULL) {
 #ifdef	MR_TABLE_DEBUG
@@ -1786,7 +1787,7 @@
 		}
 #endif
 
-		GOTO_LABEL(mercury__table_nondet_resume_1_0_ChangeLoop);
+		MR_GOTO_LABEL(mercury__table_nondet_resume_1_0_ChangeLoop);
 	}
 
 	MR_cur_leader->resume_info->cur_subgoal =
@@ -1802,7 +1803,7 @@
 		MR_cur_leader->resume_info->cur_subgoal->num_ans;
 
 	/* For each of the suspended nodes for cur_subgoal */
-Define_label(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
+MR_define_label(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
 
 	if (MR_cur_leader->resume_info->consumer_list == NULL) {
 #ifdef	MR_TABLE_DEBUG
@@ -1810,7 +1811,8 @@
 			printf("no more suspensions for current subgoal\n");
 		}
 #endif
-		GOTO_LABEL(mercury__table_nondet_resume_1_0_LoopOverSubgoals);
+		MR_GOTO_LABEL(
+			mercury__table_nondet_resume_1_0_LoopOverSubgoals);
 	}
 
 	MR_cur_leader->resume_info->cur_consumer =
@@ -1828,7 +1830,8 @@
 			printf("no first answer for this suspension\n");
 		}
 #endif
-		GOTO_LABEL(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
+		MR_GOTO_LABEL(
+			mercury__table_nondet_resume_1_0_LoopOverSuspensions);
 	}
 
 #ifdef	MR_TABLE_DEBUG
@@ -1839,11 +1842,11 @@
 	}
 #endif
 
-	save_transient_registers();
+	MR_save_transient_registers();
 	restore_state(
 		&(MR_cur_leader->resume_info->cur_consumer->saved_state),
 		"resumption", "consumer");
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	/* check that there is room for exactly one framevar */
 	assert((MR_maxfr - MR_prevfr_slot(MR_maxfr)) ==
@@ -1851,11 +1854,11 @@
 
 	MR_gen_next = MR_cur_leader->resume_info->leader_state.gen_next;
 	MR_redoip_slot(MR_maxfr) =
-		LABEL(mercury__table_nondet_resume_1_0_RedoPoint);
+		MR_LABEL(mercury__table_nondet_resume_1_0_RedoPoint);
 	MR_redofr_slot(MR_maxfr) = MR_maxfr;
 	MR_based_framevar(MR_maxfr, 1) = (MR_Word) MR_cur_leader;
 
-Define_label(mercury__table_nondet_resume_1_0_ReturnAnswer);
+MR_define_label(mercury__table_nondet_resume_1_0_ReturnAnswer);
 
 	/*
 	** Return the next answer in MR_cur_leader->resume_info->
@@ -1883,8 +1886,8 @@
 	*/
 	MR_succeed();
 
-Define_label(mercury__table_nondet_resume_1_0_RedoPoint);
-	update_prof_current_proc(LABEL(mercury__table_nondet_resume_1_0));
+MR_define_label(mercury__table_nondet_resume_1_0_RedoPoint);
+	MR_update_prof_current_proc(MR_LABEL(mercury__table_nondet_resume_1_0));
 
 	/*
 	** This is where the current consumer suspension will go on
@@ -1896,7 +1899,7 @@
 
 	MR_cur_leader = (MR_Subgoal *) MR_based_framevar(MR_maxfr, 1);
 
-Define_label(mercury__table_nondet_resume_1_0_RestartPoint);
+MR_define_label(mercury__table_nondet_resume_1_0_RestartPoint);
 #ifdef	MR_TABLE_DEBUG
 	if (MR_tabledebug) {
 		printf("cur_consumer_answer_list: %p\n",
@@ -1908,7 +1911,7 @@
 #endif
 
 	if (MR_cur_leader->resume_info->cur_consumer_answer_list != NULL) {
-		GOTO_LABEL(mercury__table_nondet_resume_1_0_ReturnAnswer);
+		MR_GOTO_LABEL(mercury__table_nondet_resume_1_0_ReturnAnswer);
 	}
 
 #ifdef	MR_TABLE_DEBUG
@@ -1923,9 +1926,9 @@
 		MR_cur_leader->resume_info->changed = TRUE;
 	}
 
-	GOTO_LABEL(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
+	MR_GOTO_LABEL(mercury__table_nondet_resume_1_0_LoopOverSuspensions);
 
-Define_label(mercury__table_nondet_resume_1_0_ReachedFixpoint);
+MR_define_label(mercury__table_nondet_resume_1_0_ReachedFixpoint);
 	{
 		MR_SubgoalList	table_list;
 
@@ -1945,10 +1948,10 @@
 	}
 
 	/* Restore the state we had when table_nondet_resume was called */
-	save_transient_registers();
-	restore_state(&(MR_cur_leader->resume_info->leader_state),
+	MR_save_transient_registers();
+	MR_restore_state(&(MR_cur_leader->resume_info->leader_state),
 		"resumption", "generator");
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	/* XXX we should free this cell and its components */
 	MR_cur_leader->resume_info = NULL;
@@ -1956,14 +1959,14 @@
 	/* We are done with this generator */
 	(void) MR_pop_generator();
 
-	proceed();
+	MR_proceed();
 END_MODULE
 
-Define_extern_entry(MR_table_nondet_commit);
+MR_define_extern_entry(MR_table_nondet_commit);
 BEGIN_MODULE(table_nondet_commit_module)
-	init_entry_ai(MR_table_nondet_commit);
+	MR_init_entry_ai(MR_table_nondet_commit);
 BEGIN_CODE
-Define_entry(MR_table_nondet_commit);
+MR_define_entry(MR_table_nondet_commit);
 	MR_commit_cut();
 	MR_fail();
 END_MODULE
@@ -1976,9 +1979,9 @@
 */
 
 #ifdef	MR_USE_MINIMAL_MODEL
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc table_nondet_suspend_module;
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc table_nondet_resume_module;
-MR_MODULE_STATIC_OR_EXTERN ModuleFunc table_nondet_commit_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc table_nondet_suspend_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc table_nondet_resume_module;
+MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc table_nondet_commit_module;
 #endif
 
 void mercury_sys_init_table_modules(void);
Index: runtime/mercury_tabling.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.h,v
retrieving revision 1.23
diff -u -b -r1.23 mercury_tabling.h
--- runtime/mercury_tabling.h	2000/10/11 03:00:26	1.23
+++ runtime/mercury_tabling.h	2000/10/22 00:22:47
@@ -370,30 +370,30 @@
 #else /* NATIVE_GC */
 
   #define MR_TABLE_NEW(type)						\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(void *) NULL)
   #define MR_TABLE_NEW_ARRAY(type, count)				\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(void *) NULL)
   #define MR_TABLE_RESIZE_ARRAY(pointer, type, count)			\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(void *) NULL)
   #define table_allocate_bytes(size)					\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(void *) NULL)
   #define table_reallocate_bytes(pointer, size)				\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(void *) NULL)
   #define table_allocate_words(size)					\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(void *) NULL)
   #define table_reallocate_words(pointer, size)				\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(void *) NULL)
   #define table_free(pointer)						\
-	fatal_error("Sorry, not implemented: tabling in native gc grades")
+	MR_fatal_error("Sorry, not implemented: tabling in native gc grades")
   #define MR_table_list_cons(h, t)					\
-	(fatal_error("Sorry, not implemented: tabling in native gc grades"), \
+	(MR_fatal_error("Sorry, not implemented: tabling in native gc grades"), \
 	(MR_Word) 0)
 
 #endif /* NATIVE_GC */
Index: runtime/mercury_tags.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tags.h,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_tags.h
--- runtime/mercury_tags.h	2000/08/03 06:18:59	1.9
+++ runtime/mercury_tags.h	2000/10/22 00:41:41
@@ -91,7 +91,7 @@
 #define	MR_list_tail(list)	MR_field(MR_TAG_CONS, (list), 1)
 #define	MR_list_empty()		((MR_Word) MR_mkword(MR_TAG_NIL, MR_mkbody(0)))
 #define	MR_list_cons(head,tail)	((MR_Word) MR_mkword(MR_TAG_CONS, \
-					create2((head),(tail))))
+					MR_create2((head),(tail))))
 #define	MR_list_empty_msg(proclabel)	\
 				((MR_Word) MR_mkword(MR_TAG_NIL, MR_mkbody(0)))
 #define	MR_list_cons_msg(head,tail,proclabel) \
@@ -106,9 +106,9 @@
 #define	MR_list_head(list)	MR_field(MR_mktag(0), (list), 1)
 #define	MR_list_tail(list)	MR_field(MR_mktag(0), (list), 2)
 #define	MR_list_empty()		((MR_Word) MR_mkword(MR_mktag(0), \
-					create1(MR_RAW_TAG_NIL)))
+					MR_create1(MR_RAW_TAG_NIL)))
 #define	MR_list_cons(head,tail)	((MR_Word) MR_mkword(MR_mktag(0), \
-					create3(MR_RAW_TAG_CONS, \
+					MR_create3(MR_RAW_TAG_CONS, \
 						(head), (tail))))
 #define	MR_list_empty_msg(proclabel) \
 				((MR_Word) MR_mkword(MR_mktag(0), \
Index: runtime/mercury_thread.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_thread.c,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_thread.c
--- runtime/mercury_thread.c	2000/10/16 01:34:03	1.14
+++ runtime/mercury_thread.c	2000/10/25 04:33:58
@@ -24,10 +24,10 @@
 #ifdef MR_THREAD_SAFE
 
 static void *
-create_thread_2(void *goal);
+MR_create_thread_2(void *goal);
 
 MercuryThread *
-create_thread(MR_ThreadGoal *goal)
+MR_create_thread(MR_ThreadGoal *goal)
 {
 	MercuryThread *thread;
 	pthread_attr_t attrs;
@@ -35,7 +35,8 @@
 
 	thread = MR_GC_NEW(MercuryThread);
 	pthread_attr_init(&attrs);
-	err = pthread_create(thread, &attrs, create_thread_2, (void *) goal);
+	err = pthread_create(thread, &attrs, MR_create_thread_2,
+		(void *) goal);
 
 #if 0
 	fprintf(stderr, "pthread_create returned %d (errno = %d)\n",
@@ -49,16 +50,16 @@
 }
 
 static void *
-create_thread_2(void *goal0)
+MR_create_thread_2(void *goal0)
 {
 	MR_ThreadGoal *goal;
 
 	goal = (MR_ThreadGoal *) goal0;
 	if (goal != NULL) {
-		init_thread(MR_use_now);
+		MR_init_thread(MR_use_now);
 		(goal->func)(goal->arg);
 	} else {
-		init_thread(MR_use_later);
+		MR_init_thread(MR_use_later);
 	}
 
 	return NULL;
@@ -67,7 +68,7 @@
 #endif /* MR_THREAD_SAFE */
 
 MR_Bool
-init_thread(MR_when_to_use when_to_use)
+MR_init_thread(MR_when_to_use when_to_use)
 {
 	MercuryEngine *eng;
 
@@ -81,23 +82,23 @@
 		return FALSE;
 	}
 #endif
-	eng = create_engine();
+	eng = MR_create_engine();
 
 #ifdef MR_THREAD_SAFE
 	pthread_setspecific(MR_engine_base_key, eng);
-	restore_registers();
+	MR_restore_registers();
   #ifdef MR_ENGINE_BASE_REGISTER
 	MR_engine_base = eng;
   #endif
 #else
 	MR_memcpy(&MR_engine_base, eng,
 		sizeof(MercuryEngine));
-	restore_registers();
+	MR_restore_registers();
 #endif
-	load_engine_regs(MR_cur_engine());
-	load_context(MR_ENGINE(this_context));
+	MR_load_engine_regs(MR_cur_engine());
+	MR_load_context(MR_ENGINE(this_context));
 
-	save_registers();
+	MR_save_registers();
 
 #ifdef	MR_THREAD_SAFE
 	MR_ENGINE(owner_thread) = pthread_self();
@@ -105,9 +106,9 @@
 
 	switch (when_to_use) {
 		case MR_use_later :
-			(void) MR_call_engine(ENTRY(do_runnext), FALSE);
+			(void) MR_call_engine(MR_ENTRY(do_runnext), FALSE);
 
-			destroy_engine(eng);
+			MR_destroy_engine(eng);
 			return FALSE;
 
 		case MR_use_now :
@@ -122,7 +123,7 @@
 ** Release resources associated with this thread.
 */
 void
-finalize_thread_engine(void)
+MR_finalize_thread_engine(void)
 {
 #ifdef MR_THREAD_SAFE
 	MercuryEngine *eng;
@@ -133,21 +134,24 @@
 	** XXX calling destroy_engine(eng) here appears to segfault.
 	** This should probably be investigated and fixed.
 	*/
-	finalize_engine(eng);
+	MR_finalize_engine(eng);
 #endif
 }
 
 #ifdef	MR_THREAD_SAFE
+
 void
-destroy_thread(void *eng0)
+MR_destroy_thread(void *eng0)
 {
 	MercuryEngine *eng = eng0;
-	destroy_engine(eng);
+	MR_destroy_engine(eng);
 	pthread_exit(0);
 }
+
 #endif
 
 #if defined(MR_THREAD_SAFE) && defined(MR_DEBUG_THREADS)
+
 void
 MR_mutex_lock(MercuryLock *lock, const char *from)
 {
@@ -188,5 +192,5 @@
 	err = pthread_cond_wait(cond, lock);
 	assert(err == 0);
 }
-#endif
 
+#endif
Index: runtime/mercury_thread.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_thread.h,v
retrieving revision 1.8
diff -u -b -r1.8 mercury_thread.h
--- runtime/mercury_thread.h	2000/10/02 07:45:04	1.8
+++ runtime/mercury_thread.h	2000/10/25 04:30:44
@@ -85,8 +85,8 @@
   ** structure containing a function and an argument. The function will
   ** be called with the given argument in the new thread.
   */
-  MercuryThread	*create_thread(MR_ThreadGoal *);
-  void		destroy_thread(void *eng);
+  MercuryThread	*MR_create_thread(MR_ThreadGoal *);
+  void		MR_destroy_thread(void *eng);
   extern bool	MR_exit_now;
 
 	/*
@@ -140,13 +140,16 @@
 ** intended that the caller can store the return value and call
 ** finalize_thread_engine if it is true).
 */
-MR_Bool	init_thread(MR_when_to_use);
+
+extern	MR_Bool	MR_init_thread(MR_when_to_use);
+
 /*
 ** Finalize the thread engine running in the current POSIX thread.
 ** This will release the resources used by this thread -- this is very
 ** important because the memory used for the det stack for each thread
 ** can be re-used by the next init_thread.
 */
-void    finalize_thread_engine(void);
+
+extern	void    MR_finalize_thread_engine(void);
 
 #endif
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.28
diff -u -b -r1.28 mercury_trace_base.c
--- runtime/mercury_trace_base.c	2000/10/16 01:34:03	1.28
+++ runtime/mercury_trace_base.c	2000/10/20 23:16:23
@@ -337,10 +337,10 @@
 Define_extern_entry(MR_do_trace_redo_fail_shallow);
 Define_extern_entry(MR_do_trace_redo_fail_deep);
 
-BEGIN_MODULE(MR_trace_labels_module)
-	init_entry_ai(MR_do_trace_redo_fail_shallow);
-	init_entry_ai(MR_do_trace_redo_fail_deep);
-BEGIN_CODE
+MR_BEGIN_MODULE(MR_trace_labels_module)
+	MR_init_entry_ai(MR_do_trace_redo_fail_shallow);
+	MR_init_entry_ai(MR_do_trace_redo_fail_deep);
+MR_BEGIN_CODE
 
 Define_entry(MR_do_trace_redo_fail_shallow);
 	/*
@@ -350,12 +350,12 @@
 	if (MR_redo_fromfull_framevar(MR_redofr_slot(MR_curfr)))
 	{
 		MR_Code	*MR_jumpaddr;
-		save_transient_registers();
+		MR_save_transient_registers();
 		MR_jumpaddr = MR_trace((const MR_Stack_Layout_Label *)
 			MR_redo_layout_framevar(MR_redofr_slot(MR_curfr)));
-		restore_transient_registers();
+		MR_restore_transient_registers();
 		if (MR_jumpaddr != NULL) {
-			GOTO(MR_jumpaddr);
+			MR_GOTO(MR_jumpaddr);
 		}
 	}
 	MR_fail();
@@ -376,17 +376,17 @@
 	*/
 	{
 		MR_Code	*MR_jumpaddr;
-		save_transient_registers();
+		MR_save_transient_registers();
 		MR_jumpaddr = MR_trace((const MR_Stack_Layout_Label *)
 			MR_redo_layout_framevar(MR_redofr_slot(MR_curfr)));
-		restore_transient_registers();
+		MR_restore_transient_registers();
 		if (MR_jumpaddr != NULL) {
-			GOTO(MR_jumpaddr);
+			MR_GOTO(MR_jumpaddr);
 		}
 	}
 	MR_fail();
 
-END_MODULE
+MR_END_MODULE
 
 void mercury_sys_init_trace(void); /* suppress gcc warning */
 void mercury_sys_init_trace(void) {
Index: runtime/mercury_trail.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trail.c,v
retrieving revision 1.10
diff -u -b -r1.10 mercury_trail.c
--- runtime/mercury_trail.c	2000/08/03 06:19:01	1.10
+++ runtime/mercury_trail.c	2000/10/25 04:06:04
@@ -20,7 +20,7 @@
 
 #ifdef MR_USE_TRAIL
 
-MemoryZone	*MR_trail_zone;
+MR_MR_MemoryZone	*MR_trail_zone;
 MR_TrailEntry	*MR_trail_ptr_var;
 MR_Unsigned	MR_ticket_counter_var = 1;
 MR_Unsigned	MR_ticket_high_water_var = 1;
@@ -30,7 +30,7 @@
 {
     MR_TrailEntry *tr_ptr;
     /* not needed, since MR_trail_ptr is never a real reg: */
-    /* restore_transient_registers(); */
+    /* MR_restore_transient_registers(); */
     tr_ptr = MR_trail_ptr;
 
     switch (reason) {
@@ -70,11 +70,11 @@
 	    }
 	    MR_trail_ptr = tr_ptr;
 	    /* not needed, since MR_trail_ptr is never a real reg: */
-	    /* save_transient_registers(); */
+	    /* MR_save_transient_registers(); */
 	    break;
 	
 	default:
-	    fatal_error("unknown MR_untrail_reason");
+	    MR_fatal_error("unknown MR_untrail_reason");
     }
 }
 
Index: runtime/mercury_trail.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trail.h,v
retrieving revision 1.19
diff -u -b -r1.19 mercury_trail.h
--- runtime/mercury_trail.h	2000/08/03 06:19:01	1.19
+++ runtime/mercury_trail.h	2000/11/13 04:45:11
@@ -112,9 +112,9 @@
 		MR_TrailEntry *old_trail_ptr =  		\
 			(MR_TrailEntry *) (old);		\
 		if (MR_trail_ptr != old_trail_ptr) {		\
-			/* save_transient_registers(); */	\
+			/* MR_save_transient_registers(); */	\
 			MR_untrail_to(old_trail_ptr, (kind));	\
-			/* restore_transient_registers(); */	\
+			/* MR_restore_transient_registers(); */	\
 		}						\
 	} while(0)
 
@@ -244,7 +244,7 @@
   */
   #define MR_get_trail_entry_untrail_func(entry)			\
 	((MR_untrail_func_type *)					\
-	    MR_body((MR_Word) (entry)->MR_union.MR_func.MR_untrail_func,	\
+	    MR_body((MR_Word) (entry)->MR_union.MR_func.MR_untrail_func,\
 		     MR_func_trail_tag))
 
   /*
@@ -317,10 +317,13 @@
 /*---------------------------------------------------------------------------*/
 
 /* The Mercury trail */
-extern MemoryZone *MR_trail_zone;
+extern MR_MemoryZone *MR_trail_zone;
 
 /* Pointer to the current top of the Mercury trail */
-/* N.B. Use `MR_trail_ptr', defined in mercury_regorder.h, not `MR_trail_ptr_var'. */
+/*
+** N.B. Use `MR_trail_ptr', defined in mercury_regorder.h,
+** not `MR_trail_ptr_var'.
+*/
 extern MR_TrailEntry *MR_trail_ptr_var;
 
 /*
Index: runtime/mercury_type_info.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.c,v
retrieving revision 1.41
diff -u -b -r1.41 mercury_type_info.c
--- runtime/mercury_type_info.c	2000/10/11 03:00:28	1.41
+++ runtime/mercury_type_info.c	2000/10/22 00:19:12
@@ -56,8 +56,9 @@
 #define	exist_func_string	"MR_create_type_info_maybe_existq"
 #define	MAYBE_DECLARE_ALLOC_ARG
 #define	MAYBE_PASS_ALLOC_ARG
-#define	ALLOCATE_WORDS(target, size)					      \
-				incr_saved_hp(LVALUE_CAST(MR_Word, (target)), \
+#define	ALLOCATE_WORDS(target, size)	incr_saved_hp(			      \
+						MR_LVALUE_CAST(MR_Word,	      \
+							(target)),	      \
 					(size))
 #include "mercury_make_type_info_body.h"
 #undef	usual_func
@@ -116,7 +117,7 @@
 ** (based on the addresses of the type_ctor_infos, or in
 ** the case of higher order types, the arity).
 **
-** You need to wrap save/restore_transient_hp() around
+** You need to wrap MR_{save/restore}_transient_hp() around
 ** calls to this function.
 */
 
@@ -239,7 +240,7 @@
 	** This only looks past equivalences of the top level type, not
 	** the argument typeinfos.
 	** 
-	** You need to wrap save/restore_transient_hp() around
+	** You need to wrap MR_{save/restore}_transient_hp() around
 	** calls to this function.
 	*/
 
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.58
diff -u -b -r1.58 mercury_type_info.h
--- runtime/mercury_type_info.h	2000/10/16 01:34:03	1.58
+++ runtime/mercury_type_info.h	2000/10/22 00:57:08
@@ -877,15 +877,15 @@
     MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_B(m, n, a, cr, u, c)
 
 #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_A(u, c)                   \
-    Declare_entry(u);                                                   \
-    Declare_entry(c);                                                   \
+    MR_declare_entry(u);                                                \
+    MR_declare_entry(c);                                                \
     MR_STATIC_CODE_CONST struct MR_TypeCtorInfo_Struct                  \
 
 #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_B(m, n, a, cr, u, c)      \
         a,                                                              \
-        MR_MAYBE_STATIC_CODE(ENTRY(u)),                                 \
-        MR_MAYBE_STATIC_CODE(ENTRY(u)),                                 \
-        MR_MAYBE_STATIC_CODE(ENTRY(c)),                                 \
+        MR_MAYBE_STATIC_CODE(MR_ENTRY(u)),                              \
+        MR_MAYBE_STATIC_CODE(MR_ENTRY(u)),                              \
+        MR_MAYBE_STATIC_CODE(MR_ENTRY(c)),                              \
         cr,                                                             \
         NULL,                                                           \
         NULL,                                                           \
@@ -954,23 +954,23 @@
 
   #define   MR_INIT_BUILTIN_TYPE_CTOR_INFO(B, T)            		\
   do {                                                      		\
-    (B).unify_pred = ENTRY(mercury__builtin_unify##T##2_0);		\
-    (B).new_unify_pred = ENTRY(mercury__builtin_unify##T##2_0);		\
-    (B).compare_pred = ENTRY(mercury__builtin_compare##T##3_0);		\
+    (B).unify_pred = MR_ENTRY(mercury__builtin_unify##T##2_0);      \
+    (B).new_unify_pred = MR_ENTRY(mercury__builtin_unify##T##2_0);  \
+    (B).compare_pred = MR_ENTRY(mercury__builtin_compare##T##3_0);  \
   } while (0)
 
   #define   MR_INIT_TYPE_CTOR_INFO_WITH_PRED(B, P)          \
   do {                                                      \
-    (B).unify_pred = ENTRY(P);                              \
-    (B).new_unify_pred = ENTRY(P);                          \
-    (B).compare_pred = ENTRY(P);                            \
+    (B).unify_pred = MR_ENTRY(P);                                   \
+    (B).new_unify_pred = MR_ENTRY(P);                               \
+    (B).compare_pred = MR_ENTRY(P);                                 \
   } while (0)
 
   #define   MR_INIT_TYPE_CTOR_INFO(B, T)                    \
   do {                                                      \
-    (B).unify_pred = ENTRY(mercury____##Unify##___##T);     \
-    (B).new_unify_pred = ENTRY(mercury____##Unify##___##T); \
-    (B).compare_pred = ENTRY(mercury____##Compare##___##T); \
+    (B).unify_pred = MR_ENTRY(mercury____##Unify##___##T);          \
+    (B).new_unify_pred = MR_ENTRY(mercury____##Unify##___##T);      \
+    (B).compare_pred = MR_ENTRY(mercury____##Compare##___##T);      \
   } while (0)
 
 #else   /* MR_STATIC_CODE_ADDRESSES */
@@ -1052,8 +1052,8 @@
 **
 ** The two functions differ in how they allocate memory. MR_create_type_info
 ** allocates memory for a new type_info on the Mercury heap. Since this
-** may modify MR_hp, you need to wrap save_transient_hp() and
-** restore_transient_hp() around calls to MR_create_type_info.
+** may modify MR_hp, you need to wrap MR_save_transient_hp() and
+** MR_restore_transient_hp() around calls to MR_create_type_info.
 ** MR_make_type_info allocates memory using MR_GC_malloc, and inserts
 ** the address of the cells allocated into the list of allocations
 ** represented by its last argument; it is the caller's responsibility
Index: runtime/mercury_type_tables.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_tables.c,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_type_tables.c
--- runtime/mercury_type_tables.c	2000/11/01 13:12:47	1.4
+++ runtime/mercury_type_tables.c	2000/11/03 02:44:24
@@ -21,6 +21,7 @@
 #include "mercury_type_tables.h"
 #include "mercury_tabling.h"
 #include "mercury_misc.h"
+#include <string.h>
 
 static	MR_TableNode	MR_type_ctor_table = { 0 };
 
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.22
diff -u -b -r1.22 mercury_types.h
--- runtime/mercury_types.h	2000/08/03 06:19:04	1.22
+++ runtime/mercury_types.h	2000/11/13 03:49:04
@@ -99,10 +99,10 @@
 #ifndef MR_HIGHLEVEL_CODE
   /*
   ** semidet predicates indicate success or failure by leaving nonzero or zero
-  ** respectively in register r1
+  ** respectively in register MR_r1
   ** (should this #define go in some other header file?)
   */
-  #define SUCCESS_INDICATOR r1
+  #define SUCCESS_INDICATOR MR_r1
 #endif
 
 /*
Index: runtime/mercury_unify_compare_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_unify_compare_body.h,v
retrieving revision 1.5
diff -u -b -r1.5 mercury_unify_compare_body.h
--- runtime/mercury_unify_compare_body.h	2000/10/16 01:34:05	1.5
+++ runtime/mercury_unify_compare_body.h	2000/11/13 04:47:34
@@ -53,11 +53,11 @@
 #ifdef  MR_COMPARE_BY_RTTI
 
         case MR_TYPECTOR_REP_EQUIV:
-            save_transient_hp();
+            MR_save_transient_hp();
             type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
                 type_ctor_info->type_layout.layout_equiv);
-            restore_transient_hp();
+            MR_restore_transient_hp();
             goto start_label;
 
         case MR_TYPECTOR_REP_EQUIV_GROUND:
@@ -68,12 +68,12 @@
             MR_fatal_error("found type_ctor_rep MR_TYPECTOR_REP_EQUIV_VAR");
 
         case MR_TYPECTOR_REP_NOTAG:
-            save_transient_hp();
+            MR_save_transient_hp();
             type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
                 type_ctor_info->type_layout.layout_notag->
                 MR_notag_functor_arg_type);
-            restore_transient_hp();
+            MR_restore_transient_hp();
             goto start_label;
 
         case MR_TYPECTOR_REP_NOTAG_GROUND:
@@ -300,9 +300,9 @@
             ** We call the type-specific compare routine as
             ** `CompPred(...ArgTypeInfos..., Result, X, Y)' is det.
             ** The ArgTypeInfo arguments are input, and are passed
-            ** in r1, r2, ... rN. The X and Y arguments are also
-            ** input, and are passed in rN+1 and rN+2.
-            ** The Result argument is output in r1.
+            ** in MR_r1, MR_r2, ... MR_rN. The X and Y arguments are also
+            ** input, and are passed in MR_rN+1 and MR_rN+2.
+            ** The Result argument is output in MR_r1.
             **
             ** We specialize the case where the type_ctor arity
             ** is zero, since in this case we don't need the loop.
@@ -311,8 +311,8 @@
             */
 
             if (type_ctor_info->arity == 0) {
-                r1 = x;
-                r2 = y;
+                MR_r1 = x;
+                MR_r2 = y;
             }
 #ifdef  MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
             else if (type_ctor_info->arity == 1) {
@@ -320,9 +320,9 @@
 
                 args_base = (MR_Word *)
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
-                r1 = args_base[1];
-                r2 = x;
-                r3 = y;
+                MR_r1 = args_base[1];
+                MR_r2 = x;
+                MR_r3 = y;
             }
 #endif
 #ifdef  MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
@@ -331,10 +331,10 @@
 
                 args_base = (MR_Word *)
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
-                r1 = args_base[1];
-                r2 = args_base[2];
-                r3 = x;
-                r4 = y;
+                MR_r1 = args_base[1];
+                MR_r2 = args_base[2];
+                MR_r3 = x;
+                MR_r4 = y;
             }
 #endif
             else {
@@ -345,16 +345,16 @@
                 type_arity = type_ctor_info->arity;
                 args_base = (MR_Word *)
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
-                save_registers();
+                MR_save_registers();
 
                 /* CompPred(...ArgTypeInfos..., Res, X, Y) * */
                 for (i = 1; i <= type_arity; i++) {
-                    virtual_reg(i) = args_base[i];
+                    MR_virtual_reg(i) = args_base[i];
                 }
-                virtual_reg(type_arity + 1) = x;
-                virtual_reg(type_arity + 2) = y;
+                MR_virtual_reg(type_arity + 1) = x;
+                MR_virtual_reg(type_arity + 2) = y;
 
-                restore_registers();
+                MR_restore_registers();
             }
 
             tailcall_user_pred();
@@ -414,8 +414,8 @@
             {
                 MR_Float   fx, fy;
 
-                fx = word_to_float(x);
-                fy = word_to_float(y);
+                fx = MR_word_to_float(x);
+                fy = MR_word_to_float(y);
 #ifdef  select_compare_code
                 if (fx == fy) {
                     return_answer(MR_COMPARE_EQUAL);
@@ -458,9 +458,9 @@
                         UNIV_OFFSET_FOR_TYPEINFO);
                 type_info_y = (MR_TypeInfo) MR_field(MR_mktag(0), y,
                         UNIV_OFFSET_FOR_TYPEINFO);
-                save_transient_registers();
+                MR_save_transient_registers();
                 result = MR_compare_type_info(type_info_x, type_info_y);
-                restore_transient_registers();
+                MR_restore_transient_registers();
                 if (result != MR_COMPARE_EQUAL) {
 #ifdef  select_compare_code
                     return_answer(result);
@@ -497,10 +497,10 @@
             {
                 int result;
 
-                save_transient_registers();
+                MR_save_transient_registers();
                 result = MR_compare_type_info(
                     (MR_TypeInfo) x, (MR_TypeInfo) y);
-                restore_transient_registers();
+                MR_restore_transient_registers();
 #ifdef	select_compare_code
                 return_answer(result);
 #else
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.77
diff -u -b -r1.77 mercury_wrapper.c
--- runtime/mercury_wrapper.c	2000/11/07 08:58:35	1.77
+++ runtime/mercury_wrapper.c	2000/11/13 06:29:50
@@ -51,33 +51,33 @@
 /* size of data areas (including redzones), in kilobytes */
 /* (but we later multiply by 1024 to convert to bytes) */
 #ifdef MR_DEBUG_AGC_SMALL_HEAP
-  size_t	heap_size =      	   52;
+  size_t	MR_heap_size =			  52;
 #else
-  size_t	heap_size =		 4096;
+  size_t	MR_heap_size =			4096;
 #endif
-size_t		detstack_size =  	 4096;
-size_t		nondstack_size =  	  128;
-size_t		solutions_heap_size =	 1024;
-size_t		global_heap_size =	 1024;
-size_t		trail_size =		  128;
-size_t		debug_heap_size =	 4096;
-size_t		generatorstack_size =  	   32;
-size_t		cutstack_size =  	   32;
+size_t		MR_detstack_size =		4096;
+size_t		MR_nondstack_size = 		 128;
+size_t		MR_solutions_heap_size =	1024;
+size_t		MR_global_heap_size =		1024;
+size_t		MR_trail_size =			 128;
+size_t		MR_debug_heap_size =		4096;
+size_t		MR_generatorstack_size =	  32;
+size_t		MR_cutstack_size =		  32;
 
 /* size of the redzones at the end of data areas, in kilobytes */
 /* (but we later multiply by 1024 to convert to bytes) */
-size_t		heap_zone_size =	   16;
-size_t		detstack_zone_size =	   16;
-size_t		nondstack_zone_size =	   16;
-size_t		solutions_heap_zone_size = 16;
-size_t		global_heap_zone_size =	   16;
-size_t		trail_zone_size =	   16;
-size_t		debug_heap_zone_size =	   16;
-size_t		generatorstack_zone_size = 16;
-size_t		cutstack_zone_size =	   16;
+size_t		MR_heap_zone_size =		  16;
+size_t		MR_detstack_zone_size =		  16;
+size_t		MR_nondstack_zone_size =	  16;
+size_t		MR_solutions_heap_zone_size =	  16;
+size_t		MR_global_heap_zone_size =	  16;
+size_t		MR_trail_zone_size =		  16;
+size_t		MR_debug_heap_zone_size =	  16;
+size_t		MR_generatorstack_zone_size =	  16;
+size_t		MR_cutstack_zone_size =		  16;
 
 /* primary cache size to optimize for, in bytes */
-size_t		pcache_size =	         8192;
+size_t		MR_pcache_size =	        8192;
 
 /* file names for mdb's debugger I/O streams */
 const char	*MR_mdb_in_filename = NULL;
@@ -86,7 +86,7 @@
 
 /* other options */
 
-bool		check_space = FALSE;
+bool		MR_check_space = FALSE;
 
 static	bool	benchmark_all_solns = FALSE;
 static	bool	use_own_timer = FALSE;
@@ -95,15 +95,15 @@
 unsigned	MR_num_threads = 1;
 
 /* timing */
-int		time_at_last_stat;
-int		time_at_start;
-static	int	time_at_finish;
+int		MR_time_at_last_stat;
+int		MR_time_at_start;
+static	int	MR_time_at_finish;
 
 /* time profiling */
 enum MR_TimeProfileMethod
 		MR_time_profile_method = MR_profile_user_plus_system_time;
 
-const char *	progname;
+const char *	MR_progname;
 int		mercury_argc;	/* not counting progname */
 char **		mercury_argv;
 int		mercury_exit_status = 0;
@@ -165,10 +165,10 @@
 ** where `->' means "depends on", i.e. "references a symbol of".
 */
 
-void	(*address_of_mercury_init_io)(void);
-void	(*address_of_init_modules)(void);
-void	(*address_of_init_modules_type_tables)(void);
-void	(*address_of_init_modules_debugger)(void);
+void	(*MR_address_of_mercury_init_io)(void);
+void	(*MR_address_of_init_modules)(void);
+void	(*MR_address_of_init_modules_type_tables)(void);
+void	(*MR_address_of_init_modules_debugger)(void);
 
 int	(*MR_address_of_do_load_aditi_rl_code)(void);
 
@@ -181,14 +181,14 @@
 #endif
 
 #ifdef CONSERVATIVE_GC
-void	(*address_of_init_gc)(void);
+void	(*MR_address_of_init_gc)(void);
 #endif
 
 #ifdef MR_HIGHLEVEL_CODE
-void	(*program_entry_point)(void);
+void	(*MR_program_entry_point)(void);
 		/* normally main_2_p_0 (main/2) */
 #else
-MR_Code	*program_entry_point;
+MR_Code	*MR_program_entry_point;
 		/* normally mercury__main_2_0 (main/2) */
 #endif
 
@@ -203,11 +203,13 @@
 void	(*MR_io_print_to_cur_stream)(MR_Word, MR_Word);
 void	(*MR_io_print_to_stream)(MR_Word, MR_Word, MR_Word);
 
-void	(*MR_DI_output_current_ptr)(MR_Integer, MR_Integer, MR_Integer, MR_Word, MR_String,
-		MR_String, MR_Integer, MR_Integer, MR_Integer, MR_Word, MR_String, MR_Word, MR_Word);
+void	(*MR_DI_output_current_ptr)(MR_Integer, MR_Integer, MR_Integer,
+		MR_Word, MR_String, MR_String, MR_Integer, MR_Integer,
+		MR_Integer, MR_Word, MR_String, MR_Word, MR_Word);
 		/* normally ML_DI_output_current (output_current/13) */
-bool	(*MR_DI_found_match)(MR_Integer, MR_Integer, MR_Integer, MR_Word, MR_String, MR_String,
-		MR_Integer, MR_Integer, MR_Integer, MR_Word, MR_String, MR_Word);
+bool	(*MR_DI_found_match)(MR_Integer, MR_Integer, MR_Integer, MR_Word,
+		MR_String, MR_String, MR_Integer, MR_Integer, MR_Integer,
+		MR_Word, MR_String, MR_Word);
 		/* normally ML_DI_found_match (output_current/12) */
 void	(*MR_DI_read_request_from_socket)(MR_Word, MR_Word *, MR_Integer *);
 
@@ -251,7 +253,7 @@
 #ifdef MR_HIGHLEVEL_CODE
   static void do_interpreter(void);
 #else
-  Declare_entry(do_interpreter);
+  MR_declare_entry(do_interpreter);
 #endif
 
 /*---------------------------------------------------------------------------*/
@@ -261,8 +263,8 @@
 {
 	bool	saved_trace_enabled;
 
-#if NUM_REAL_REGS > 0
-	MR_Word c_regs[NUM_REAL_REGS];
+#if MR_NUM_REAL_REGS > 0
+	MR_Word c_regs[MR_NUM_REAL_REGS];
 #endif
 
 	/*
@@ -271,7 +273,7 @@
 	** and we need to preserve them, because they're callee-save,
 	** and our caller may need them ;-)
 	*/
-	save_regs_to_mem(c_regs);
+	MR_save_regs_to_mem(c_regs);
 
 #if defined(MR_LOWLEVEL_DEBUG) || defined(MR_TABLE_DEBUG)
 	/*
@@ -311,20 +313,20 @@
 	do_init_modules();
 #endif
 
-	(*address_of_mercury_init_io)();
+	(*MR_address_of_mercury_init_io)();
 
 #ifndef MR_HIGHLEVEL_CODE
 	/* start up the Mercury engine */
   #ifndef MR_THREAD_SAFE
-	init_thread(MR_use_now);
+	MR_init_thread(MR_use_now);
   #else
 	{
 		int i;
-		init_thread_stuff();
-		init_thread(MR_use_now);
+		MR_init_thread_stuff();
+		MR_init_thread(MR_use_now);
 		MR_exit_now = FALSE;
 		for (i = 1 ; i < MR_num_threads ; i++)
-			create_thread(NULL);
+			MR_create_thread(NULL);
 	}
   #endif /* ! MR_THREAD_SAFE */
 #endif /* ! MR_HIGHLEVEL_CODE */
@@ -333,14 +335,14 @@
 	if (MR_profiling) MR_prof_init();
 
 	/*
-	** We need to call save_registers(), since we're about to
+	** We need to call MR_save_registers(), since we're about to
 	** call a C->Mercury interface function, and the C->Mercury
 	** interface convention expects them to be saved.  And before we
-	** can do that, we need to call restore_transient_registers(),
+	** can do that, we need to call MR_restore_transient_registers(),
 	** since we've just returned from a C call.
 	*/
-	restore_transient_registers();
-	save_registers();
+	MR_restore_transient_registers();
+	MR_save_registers();
 
 	MR_trace_init();
 
@@ -348,7 +350,7 @@
 	(*MR_library_initializer)();
 
 #ifndef MR_HIGHLEVEL_CODE
-	save_context(&(MR_ENGINE(context)));
+	MR_save_context(&(MR_ENGINE(context)));
 #endif
 
 	/*
@@ -361,7 +363,7 @@
 	** Restore the callee-save registers before returning,
 	** since they may be used by the C code that called us.
 	*/
-	restore_regs_from_mem(c_regs);
+	MR_restore_regs_from_mem(c_regs);
 
 } /* end runtime_mercury_init() */
 
@@ -393,7 +395,7 @@
 	** (This is to work around a Solaris 2.X (X <= 4) linker bug,
 	** and also to support Windows DLLs using gnu-win32.)
 	*/
-	(*address_of_init_gc)();
+	(*MR_address_of_init_gc)();
 
 	/*
 	** Double-check that the garbage collector knows about
@@ -419,7 +421,7 @@
 	static	bool	done = FALSE;
 
 	if (! done) {
-		(*address_of_init_modules)();
+		(*MR_address_of_init_modules)();
 		MR_close_prof_decl_file();
 		done = TRUE;
 	}
@@ -431,7 +433,7 @@
 	static	bool	done = FALSE;
 
 	if (! done) {
-		(*address_of_init_modules_type_tables)();
+		(*MR_address_of_init_modules_type_tables)();
 		done = TRUE;
 
 		/*
@@ -450,7 +452,7 @@
 	static	bool	done = FALSE;
 
 	if (! done) {
-		(*address_of_init_modules_debugger)();
+		(*MR_address_of_init_modules_debugger)();
 		done = TRUE;
 	}
 }
@@ -672,56 +674,56 @@
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			heap_size = size;
+			MR_heap_size = size;
 			break;
 
 		case MR_DETSTACK_SIZE:
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			detstack_size = size;
+			MR_detstack_size = size;
 			break;
 
 		case MR_NONDETSTACK_SIZE:
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			nondstack_size = size;
+			MR_nondstack_size = size;
 			break;
 
 		case MR_TRAIL_SIZE:
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			trail_size = size;
+			MR_trail_size = size;
 			break;
 
 		case MR_HEAP_REDZONE_SIZE:
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			heap_zone_size = size;
+			MR_heap_zone_size = size;
 			break;
 
 		case MR_DETSTACK_REDZONE_SIZE:
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			detstack_zone_size = size;
+			MR_detstack_zone_size = size;
 			break;
 
 		case MR_NONDETSTACK_REDZONE_SIZE:
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			nondstack_zone_size = size;
+			MR_nondstack_zone_size = size;
 			break;
 
 		case MR_TRAIL_REDZONE_SIZE:
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			trail_zone_size = size;
+			MR_trail_zone_size = size;
 			break;
 
 		case 'i':
@@ -751,14 +753,14 @@
 			break;
 
 		case 'c':
-			check_space = TRUE;
+			MR_check_space = TRUE;
 			break;
 
 		case 'C':
 			if (sscanf(MR_optarg, "%lu", &size) != 1)
 				usage();
 
-			pcache_size = size * 1024;
+			MR_pcache_size = size * 1024;
 
 			break;
 
@@ -918,8 +920,8 @@
 void 
 mercury_runtime_main(void)
 {
-#if NUM_REAL_REGS > 0
-	MR_Word c_regs[NUM_REAL_REGS];
+#if MR_NUM_REAL_REGS > 0
+	MR_Word c_regs[MR_NUM_REAL_REGS];
 #endif
 
 #if defined(MR_LOWLEVEL_DEBUG) && defined(USE_GCC_NONLOCAL_GOTOS)
@@ -956,8 +958,8 @@
 	** Save the C callee-save registers
 	** and restore the Mercury registers
 	*/
-	save_regs_to_mem(c_regs);
-	restore_registers();
+	MR_save_regs_to_mem(c_regs);
+	MR_restore_registers();
 
 #if defined(MR_LOWLEVEL_DEBUG) && defined(USE_GCC_NONLOCAL_GOTOS)
 	/*
@@ -967,7 +969,7 @@
 	** that it still contains only this value
 	*/
 
-	global_pointer_2 = safety_buffer;	/* defeat optimization */
+	MR_global_pointer_2 = safety_buffer;	/* defeat optimization */
 	memset(safety_buffer, MAGIC_MARKER_2, SAFETY_BUFFER_SIZE);
 #endif
 
@@ -979,21 +981,21 @@
 	MR_CONTEXT(nondetstack_zone)->max = MR_CONTEXT(nondetstack_zone)->min;
 #endif
 
-	time_at_start = MR_get_user_cpu_miliseconds();
-	time_at_last_stat = time_at_start;
+	MR_time_at_start = MR_get_user_cpu_miliseconds();
+	MR_time_at_last_stat = MR_time_at_start;
 
 	for (repcounter = 0; repcounter < repeats; repcounter++) {
 #ifdef MR_HIGHLEVEL_CODE
 		do_interpreter();
 #else
-		debugmsg0("About to call engine\n");
-		(void) MR_call_engine(ENTRY(do_interpreter), FALSE);
-		debugmsg0("Returning from MR_call_engine()\n");
+		MR_debugmsg0("About to call engine\n");
+		(void) MR_call_engine(MR_ENTRY(do_interpreter), FALSE);
+		MR_debugmsg0("Returning from MR_call_engine()\n");
 #endif
 	}
 
         if (use_own_timer) {
-		time_at_finish = MR_get_user_cpu_miliseconds();
+		MR_time_at_finish = MR_get_user_cpu_miliseconds();
 	}
 
 #if defined(USE_GCC_NONLOCAL_GOTOS) && defined(MR_LOWLEVEL_DEBUG)
@@ -1006,7 +1008,7 @@
 #endif
 
 	if (MR_detaildebug) {
-		debugregs("after final call");
+		MR_debugregs("after final call");
 	}
 
 #ifdef MR_LOWLEVEL_DEBUG
@@ -1033,7 +1035,8 @@
 
         if (use_own_timer) {
 		printf("%8.3fu ",
-			((double) (time_at_finish - time_at_start)) / 1000);
+			((double) (MR_time_at_finish - MR_time_at_start))
+				/ 1000);
 	}
 
 #ifdef	MR_TYPE_CTOR_STATS
@@ -1045,8 +1048,8 @@
 	** restore the C callee-save registers before returning,
 	** since they may be used by the C code that called us.
 	*/
-	save_registers();
-	restore_regs_from_mem(c_regs);
+	MR_save_registers();
+	MR_restore_regs_from_mem(c_regs);
 
 #ifdef MR_MSVC_STRUCTURED_EXCEPTIONS
 	}
@@ -1157,7 +1160,7 @@
 	int	i;
 
 	printf("register usage counts:\n");
-	for (i = 0; i < MAX_RN; i++) {
+	for (i = 0; i < MR_MAX_RN; i++) {
 		if (1 <= i && i <= ORD_RN) {
 			printf("r%d", i);
 		} else {
@@ -1217,14 +1220,14 @@
 			}
 		}
 
-		printf("\t%lu\n", num_uses[i]);
+		printf("\t%lu\n", MR_num_uses[i]);
 	} /* end for */
 } /* end print_register_usage_counts() */
 #endif
 
 #ifdef MR_HIGHLEVEL_CODE
 
-void
+static void
 do_interpreter(void)
 {
   #ifdef  PROFILE_TIME
@@ -1241,71 +1244,77 @@
 
 #else /* ! MR_HIGHLEVEL_CODE */
 
-Define_extern_entry(do_interpreter);
-Declare_label(global_success);
-Declare_label(global_fail);
-Declare_label(all_done);
-
-BEGIN_MODULE(interpreter_module)
-	init_entry_ai(do_interpreter);
-	init_label_ai(global_success);
-	init_label_ai(global_fail);
-	init_label_ai(all_done);
-BEGIN_CODE
+MR_define_extern_entry(do_interpreter);
+MR_declare_label(global_success);
+MR_declare_label(global_fail);
+MR_declare_label(all_done);
+
+MR_BEGIN_MODULE(interpreter_module)
+	MR_init_entry_ai(do_interpreter);
+	MR_init_label_ai(global_success);
+	MR_init_label_ai(global_fail);
+	MR_init_label_ai(all_done);
+MR_BEGIN_CODE
 
-Define_entry(do_interpreter);
+MR_define_entry(do_interpreter);
 	MR_incr_sp(4);
 	MR_stackvar(1) = (MR_Word) MR_hp;
 	MR_stackvar(2) = (MR_Word) MR_succip;
 	MR_stackvar(3) = (MR_Word) MR_maxfr;
 	MR_stackvar(4) = (MR_Word) MR_curfr;
 
-	MR_mkframe("interpreter", 1, LABEL(global_fail));
+	MR_mkframe("interpreter", 1, MR_LABEL(global_fail));
 
 	MR_nondet_stack_trace_bottom = MR_maxfr;
-	MR_stack_trace_bottom = LABEL(global_success);
+	MR_stack_trace_bottom = MR_LABEL(global_success);
 
 	if (program_entry_point == NULL) {
 		MR_fatal_error("no program entry point supplied");
 	}
 
 #ifdef  PROFILE_TIME
-	set_prof_current_proc(program_entry_point);
-	if (MR_profiling) MR_prof_turn_on_time_profiling();
+	MR_set_prof_current_proc(program_entry_point);
+	if (MR_profiling) {
+		MR_prof_turn_on_time_profiling();
+	}
 #endif
 
-	noprof_call(program_entry_point, LABEL(global_success));
+	noprof_call(program_entry_point, MR_LABEL(global_success));
 
-Define_label(global_success);
+MR_define_label(global_success);
 #ifdef	MR_LOWLEVEL_DEBUG
 	if (MR_finaldebug) {
-		save_transient_registers();
-		printregs("global succeeded");
+		MR_save_transient_registers();
+		MR_printregs("global succeeded");
 		if (MR_detaildebug)
-			dumpnondstack();
+			MR_dumpnondstack();
 	}
 #endif
 
-	if (benchmark_all_solns)
+	if (benchmark_all_solns) {
 		MR_redo();
-	else
-		GOTO_LABEL(all_done);
+	} else {
+		MR_GOTO_LABEL(all_done);
+	}
 
-Define_label(global_fail);
+MR_define_label(global_fail);
 #ifdef	MR_LOWLEVEL_DEBUG
 	if (MR_finaldebug) {
-		save_transient_registers();
-		printregs("global failed");
+		MR_save_transient_registers();
+		MR_printregs("global failed");
 
-		if (MR_detaildebug)
-			dumpnondstack();
+		if (MR_detaildebug) {
+			MR_dumpnondstack();
+		}
 	}
 #endif
 
-Define_label(all_done);
+MR_define_label(all_done);
 
 #ifdef  PROFILE_TIME
-	if (MR_profiling) MR_prof_turn_off_time_profiling();
+	if (MR_profiling) {
+		MR_prof_turn_off_time_profiling();
+	}
 #endif
 
 	MR_hp     = (MR_Word *) MR_stackvar(1);
@@ -1316,16 +1325,16 @@
 
 #ifdef MR_LOWLEVEL_DEBUG
 	if (MR_finaldebug && MR_detaildebug) {
-		save_transient_registers();
-		printregs("after popping...");
+		MR_save_transient_registers();
+		MR_printregs("after popping...");
 	}
 #endif
 
-	proceed();
+	MR_proceed();
 #ifndef	USE_GCC_NONLOCAL_GOTOS
 	return 0;
 #endif
-END_MODULE
+MR_END_MODULE
 
 #endif
 
@@ -1334,8 +1343,8 @@
 int
 mercury_runtime_terminate(void)
 {
-#if NUM_REAL_REGS > 0
-	MR_Word c_regs[NUM_REAL_REGS];
+#if MR_NUM_REAL_REGS > 0
+	MR_Word c_regs[MR_NUM_REAL_REGS];
 #endif
 	/*
 	** Save the callee-save registers; we're going to start using them
@@ -1343,7 +1352,7 @@
 	** and we need to preserve them, because they're callee-save,
 	** and our caller may need them.
 	*/
-	save_regs_to_mem(c_regs);
+	MR_save_regs_to_mem(c_regs);
 
 	MR_trace_end();
 
@@ -1353,11 +1362,13 @@
 	** Restore the registers before calling MR_trace_final()  
 	** as MR_trace_final() expect them to be valid.
 	*/
-	restore_registers(); 
+	MR_restore_registers(); 
 
 	MR_trace_final();
 
-	if (MR_profiling) MR_prof_finish();
+	if (MR_profiling) {
+		MR_prof_finish();
+	}
 
 #ifndef MR_HIGHLEVEL_CODE
   #ifdef MR_THREAD_SAFE
@@ -1366,13 +1377,13 @@
   #endif
 #endif
 
-	terminate_engine();
+	MR_terminate_engine();
 
 	/*
 	** Restore the callee-save registers before returning,
 	** since they may be used by the C code that called us.
 	*/
-	restore_regs_from_mem(c_regs);
+	MR_restore_regs_from_mem(c_regs);
 
 	return mercury_exit_status;
 }
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.37
diff -u -b -r1.37 mercury_wrapper.h
--- runtime/mercury_wrapper.h	2000/11/05 12:04:19	1.37
+++ runtime/mercury_wrapper.h	2000/11/06 05:12:14
@@ -65,9 +65,11 @@
 */
 
 #ifdef MR_HIGHLEVEL_CODE
-extern	void		(*program_entry_point)(void); /* normally main_2_p_0 */
+extern	void		(*MR_program_entry_point)(void);
+			/* normally main_2_p_0 */
 #else
-extern	MR_Code 		*program_entry_point; /* normally mercury__main_2_0; */
+extern	MR_Code 	*MR_program_entry_point;
+			/* normally mercury__main_2_0; */
 #endif
 
 extern	void		(*MR_library_initializer)(void);
@@ -79,13 +81,13 @@
 extern	void		(*MR_io_print_to_cur_stream)(MR_Word, MR_Word);
 extern	void		(*MR_io_print_to_stream)(MR_Word, MR_Word, MR_Word);
 
-extern	void		(*address_of_mercury_init_io)(void);
-extern	void		(*address_of_init_modules)(void);
-extern	void		(*address_of_init_modules_type_tables)(void);
-extern	void		(*address_of_init_modules_debugger)(void);
+extern	void		(*MR_address_of_mercury_init_io)(void);
+extern	void		(*MR_address_of_init_modules)(void);
+extern	void		(*MR_address_of_init_modules_type_tables)(void);
+extern	void		(*MR_address_of_init_modules_debugger)(void);
 
 #ifdef CONSERVATIVE_GC
-extern	void		(*address_of_init_gc)(void);
+extern	void		(*MR_address_of_init_gc)(void);
 #endif
 
 extern	int		(*MR_address_of_do_load_aditi_rl_code)(void);
@@ -153,36 +155,36 @@
 */
 extern	void		(*MR_register_module_layout)(const MR_Module_Layout *);
 
-extern	void		do_init_modules(void);
-extern	void		do_init_modules_type_tables(void);
-extern	void		do_init_modules_debugger(void);
+extern	void		MR_do_init_modules(void);
+extern	void		MR_do_init_modules_type_tables(void);
+extern	void		MR_do_init_modules_debugger(void);
 
-extern	const char	*progname;
+extern	const char	*MR_progname;
 extern	int		mercury_argc;
 extern	char		**mercury_argv;
 extern	int		mercury_exit_status;
 
 /* sizes of the data areas, *including* the red zone size */
-extern	size_t		heap_size;
-extern	size_t		detstack_size;
-extern	size_t		nondstack_size;
-extern	size_t		solutions_heap_size;
-extern	size_t		trail_size;
-extern	size_t		global_heap_size;
-extern	size_t		debug_heap_size;
-extern	size_t		generatorstack_size;
-extern	size_t		cutstack_size;
+extern	size_t		MR_heap_size;
+extern	size_t		MR_detstack_size;
+extern	size_t		MR_nondstack_size;
+extern	size_t		MR_solutions_heap_size;
+extern	size_t		MR_trail_size;
+extern	size_t		MR_global_heap_size;
+extern	size_t		MR_debug_heap_size;
+extern	size_t		MR_generatorstack_size;
+extern	size_t		MR_cutstack_size;
 
 /* sizes of the red zones */
-extern	size_t		heap_zone_size;
-extern	size_t		detstack_zone_size;
-extern	size_t		nondstack_zone_size;
-extern	size_t		solutions_heap_zone_size;
-extern	size_t		trail_zone_size;
-extern	size_t		global_heap_zone_size;
-extern	size_t		debug_heap_zone_size;
-extern	size_t		generatorstack_zone_size;
-extern	size_t		cutstack_zone_size;
+extern	size_t		MR_heap_zone_size;
+extern	size_t		MR_detstack_zone_size;
+extern	size_t		MR_nondstack_zone_size;
+extern	size_t		MR_solutions_heap_zone_size;
+extern	size_t		MR_trail_zone_size;
+extern	size_t		MR_global_heap_zone_size;
+extern	size_t		MR_debug_heap_zone_size;
+extern	size_t		MR_generatorstack_zone_size;
+extern	size_t		MR_cutstack_zone_size;
 
 /* file names for the mdb debugging streams */
 extern	const char	*MR_mdb_in_filename;
@@ -190,13 +192,13 @@
 extern	const char	*MR_mdb_err_filename;
 
 /* size of the primary cache */
-extern	size_t		pcache_size;
+extern	size_t		MR_pcache_size;
 
-extern	bool		check_space;
+extern	bool		MR_check_space;
 
 /* timing */
-extern	int		time_at_start;
-extern	int		time_at_last_stat;
+extern	int		MR_time_at_start;
+extern	int		MR_time_at_last_stat;
 
 /* time profiling */
 enum MR_TimeProfileMethod {
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
Index: runtime/machdeps/alpha_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/alpha_regs.h,v
retrieving revision 1.11
diff -u -b -r1.11 alpha_regs.h
--- runtime/machdeps/alpha_regs.h	2000/08/03 06:19:16	1.11
+++ runtime/machdeps/alpha_regs.h	2000/11/13 03:25:29
@@ -8,9 +8,9 @@
 #define ALPHA_REGS_H
 
 /*
-** Machine registers mr0 - mr36 for the Alpha architecture.
+** Machine registers MR_mr0 - MR_mr36 for the Alpha architecture.
 **
-** The first NUM_REAL_REGS of these are real machine registers.
+** The first MR_NUM_REAL_REGS of these are real machine registers.
 ** The others are just slots in a global array.
 **
 ** At the moment we're only using the callee-save registers.
@@ -22,15 +22,15 @@
 ** it gets clobbered.
 */
 
-#define NUM_REAL_REGS 7
+#define MR_NUM_REAL_REGS 7
 
-register 	MR_Word	mr0 __asm__("$9");	/* register s0 */
-register	MR_Word	mr1 __asm__("$10");	/* register s1 */
-register	MR_Word	mr2 __asm__("$11");	/* register s2 */
-register	MR_Word	mr3 __asm__("$12");	/* register s3 */
-register	MR_Word	mr4 __asm__("$13");	/* register s4 */
-register	MR_Word	mr5 __asm__("$14");	/* register s5 */
-register	MR_Word	mr6 __asm__("$15");	/* the frame pointer (fp) */
+register 	MR_Word	MR_mr0 __asm__("$9");	/* register s0 */
+register	MR_Word	MR_mr1 __asm__("$10");	/* register s1 */
+register	MR_Word	MR_mr2 __asm__("$11");	/* register s2 */
+register	MR_Word	MR_mr3 __asm__("$12");	/* register s3 */
+register	MR_Word	MR_mr4 __asm__("$13");	/* register s4 */
+register	MR_Word	MR_mr5 __asm__("$14");	/* register s5 */
+register	MR_Word	MR_mr6 __asm__("$15");	/* the frame pointer (fp) */
 
 #define MR_real_reg_number_mr0	9
 #define MR_real_reg_number_mr1	10
@@ -40,61 +40,61 @@
 #define MR_real_reg_number_mr5	14
 #define MR_real_reg_number_mr6	15
 
-#define save_regs_to_mem(save_area)	(	\
-	save_area[0] = mr0,			\
-	save_area[1] = mr1,			\
-	save_area[2] = mr2,			\
-	save_area[3] = mr3,			\
-	save_area[4] = mr4,			\
-	save_area[5] = mr5,			\
-	save_area[6] = mr6,			\
+#define MR_save_regs_to_mem(save_area)	(	\
+	save_area[0] = MR_mr0,			\
+	save_area[1] = MR_mr1,			\
+	save_area[2] = MR_mr2,			\
+	save_area[3] = MR_mr3,			\
+	save_area[4] = MR_mr4,			\
+	save_area[5] = MR_mr5,			\
+	save_area[6] = MR_mr6,			\
 	(void)0					\
 )
 
-#define restore_regs_from_mem(save_area)	(	\
-	mr0 = save_area[0],			\
-	mr1 = save_area[1],			\
-	mr2 = save_area[2],			\
-	mr3 = save_area[3],			\
-	mr4 = save_area[4],			\
-	mr5 = save_area[5],			\
-	mr6 = save_area[6],			\
+#define MR_restore_regs_from_mem(save_area)	(	\
+	MR_mr0 = save_area[0],			\
+	MR_mr1 = save_area[1],			\
+	MR_mr2 = save_area[2],			\
+	MR_mr3 = save_area[3],			\
+	MR_mr4 = save_area[4],			\
+	MR_mr5 = save_area[5],			\
+	MR_mr6 = save_area[6],			\
 	(void)0					\
 )
 
-#define save_transient_regs_to_mem(save_area)		((void)0)
-#define restore_transient_regs_from_mem(save_area)	((void)0)
+#define MR_save_transient_regs_to_mem(save_area)	((void)0)
+#define MR_restore_transient_regs_from_mem(save_area)	((void)0)
 
-#define	mr7	MR_fake_reg[7]
-#define	mr8	MR_fake_reg[8]
-#define	mr9	MR_fake_reg[9]
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+#define	MR_mr7	MR_fake_reg[7]
+#define	MR_mr8	MR_fake_reg[8]
+#define	MR_mr9	MR_fake_reg[9]
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif /* not ALPHA_REGS_H */
Index: runtime/machdeps/i386_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/i386_regs.h,v
retrieving revision 1.17
diff -u -b -r1.17 i386_regs.h
--- runtime/machdeps/i386_regs.h	2000/08/03 06:19:17	1.17
+++ runtime/machdeps/i386_regs.h	2000/11/13 03:24:55
@@ -7,9 +7,9 @@
 #define I386_REGS_H
 
 /*
-** Machine registers mr0 - mr36 for the Intel 386 architecture.
+** Machine registers MR_mr0 - MR_mr36 for the Intel 386 architecture.
 **
-** The first NUM_REAL_REGS of these are real machine registers.
+** The first MR_NUM_REAL_REGS of these are real machine registers.
 ** The others are just slots in a global array.
 **
 ** At the moment we're only using the callee-save registers
@@ -53,21 +53,21 @@
 #endif
 
 #if PIC_REG
-  #define NUM_REAL_REGS 2
+  #define MR_NUM_REAL_REGS 2
 #else
-  #define NUM_REAL_REGS 3
+  #define MR_NUM_REAL_REGS 3
 #endif
 
-register	MR_Word	mr0 __asm__("esi");	/* sp */
-register	MR_Word	mr1 __asm__("edi");	/* succip */
+register	MR_Word	MR_mr0 __asm__("esi");	/* sp */
+register	MR_Word	MR_mr1 __asm__("edi");	/* succip */
 
 #define MR_real_reg_number_mr0	esi
 #define MR_real_reg_number_mr1	edi
 
 #if PIC_REG
-  #define mr2	MR_fake_reg[2]
+  #define 	MR_mr2	MR_fake_reg[2]
 #else
-  register	MR_Word	mr2 __asm__("ebx");	/* r1 */
+  register	MR_Word	MR_mr2 __asm__("ebx");	/* r1 */
 
   #define MR_real_reg_number_mr2	ebx
 
@@ -75,73 +75,73 @@
 
 #if PIC_REG
 
-#define save_regs_to_mem(save_area) (		\
-	save_area[0] = mr0,			\
-	save_area[1] = mr1,			\
+#define MR_save_regs_to_mem(save_area) (	\
+	save_area[0] = MR_mr0,			\
+	save_area[1] = MR_mr1,			\
 	(void)0					\
 )
 
-#define restore_regs_from_mem(save_area) (	\
-	mr0 = save_area[0],			\
-	mr1 = save_area[1],			\
+#define MR_restore_regs_from_mem(save_area) (	\
+	MR_mr0 = save_area[0],			\
+	MR_mr1 = save_area[1],			\
 	(void)0					\
 )
 
 #else /* ! PIC_REG */
 
-#define save_regs_to_mem(save_area) (		\
-	save_area[0] = mr0,			\
-	save_area[1] = mr1,			\
-	save_area[2] = mr2,			\
+#define MR_save_regs_to_mem(save_area) (	\
+	save_area[0] = MR_mr0,			\
+	save_area[1] = MR_mr1,			\
+	save_area[2] = MR_mr2,			\
 	(void)0					\
 )
 
-#define restore_regs_from_mem(save_area) (	\
-	mr0 = save_area[0],			\
-	mr1 = save_area[1],			\
-	mr2 = save_area[2],			\
+#define MR_restore_regs_from_mem(save_area) (	\
+	MR_mr0 = save_area[0],			\
+	MR_mr1 = save_area[1],			\
+	MR_mr2 = save_area[2],			\
 	(void)0					\
 )
 
 #endif	/* ! PIC_REG */
 
-#define save_transient_regs_to_mem(save_area)		((void)0)
-#define restore_transient_regs_from_mem(save_area)	((void)0)
+#define MR_save_transient_regs_to_mem(save_area)	((void)0)
+#define MR_restore_transient_regs_from_mem(save_area)	((void)0)
 
-#define	mr3	MR_fake_reg[3]
-#define	mr4	MR_fake_reg[4]
-#define	mr5	MR_fake_reg[5]
-#define	mr6	MR_fake_reg[6]
-#define	mr7	MR_fake_reg[7]
-#define	mr8	MR_fake_reg[8]
-#define	mr9	MR_fake_reg[9]
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+#define	MR_mr3	MR_fake_reg[3]
+#define	MR_mr4	MR_fake_reg[4]
+#define	MR_mr5	MR_fake_reg[5]
+#define	MR_mr6	MR_fake_reg[6]
+#define	MR_mr7	MR_fake_reg[7]
+#define	MR_mr8	MR_fake_reg[8]
+#define	MR_mr9	MR_fake_reg[9]
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif /* not I386_REGS_H */
Index: runtime/machdeps/m68k.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/m68k.h,v
retrieving revision 1.3
diff -u -b -r1.3 m68k.h
--- runtime/machdeps/m68k.h	2000/08/03 06:19:17	1.3
+++ runtime/machdeps/m68k.h	2000/11/13 03:24:58
@@ -7,7 +7,7 @@
 #define M68K_REGS_H
 
 /*
-** Machine registers mr0 - mr36 for the Motorola 68000 architecture.
+** Machine registers MR_mr0 - MR_mr36 for the Motorola 68000 architecture.
 */
 
 /*
@@ -33,67 +33,67 @@
 ** see what happens.
 */
 
-#define NUM_REAL_REGS 5
+#define MR_NUM_REAL_REGS 5
 
-register	MR_Word	mr0 __asm__("a2");	/* sp */
-register	MR_Word	mr1 __asm__("a3");	/* succip */
-register	MR_Word	mr2 __asm__("d2");	/* r1 */
-register	MR_Word	mr3 __asm__("d3");	/* r2 */
-register	MR_Word	mr4 __asm__("d4");	/* r3 */
-
-#define save_regs_to_mem(save_area) (		\
-	save_area[0] = mr0,			\
-	save_area[1] = mr1,			\
-	save_area[2] = mr2,			\
-	save_area[3] = mr3,			\
-	save_area[4] = mr4,			\
+register	MR_Word	MR_mr0 __asm__("a2");	/* sp */
+register	MR_Word	MR_mr1 __asm__("a3");	/* succip */
+register	MR_Word	MR_mr2 __asm__("d2");	/* r1 */
+register	MR_Word	MR_mr3 __asm__("d3");	/* r2 */
+register	MR_Word	MR_mr4 __asm__("d4");	/* r3 */
+
+#define MR_save_regs_to_mem(save_area) (	\
+	save_area[0] = MR_mr0,			\
+	save_area[1] = MR_mr1,			\
+	save_area[2] = MR_mr2,			\
+	save_area[3] = MR_mr3,			\
+	save_area[4] = MR_mr4,			\
 	(void)0					\
 )
 
-#define restore_regs_from_mem(save_area) (	\
-	mr0 = save_area[0],			\
-	mr1 = save_area[1],			\
-	mr2 = save_area[2],			\
-	mr3 = save_area[3],			\
-	mr4 = save_area[4],			\
+#define MR_restore_regs_from_mem(save_area) (	\
+	MR_mr0 = save_area[0],			\
+	MR_mr1 = save_area[1],			\
+	MR_mr2 = save_area[2],			\
+	MR_mr3 = save_area[3],			\
+	MR_mr4 = save_area[4],			\
 	(void)0					\
 )
 
-#define save_transient_regs_to_mem(save_area)		((void)0)
-#define restore_transient_regs_from_mem(save_area)	((void)0)
+#define MR_save_transient_regs_to_mem(save_area)	((void)0)
+#define MR_restore_transient_regs_from_mem(save_area)	((void)0)
 
-#define	mr5	MR_fake_reg[5]
-#define	mr6	MR_fake_reg[6]
-#define	mr7	MR_fake_reg[7]
-#define	mr8	MR_fake_reg[8]
-#define	mr9	MR_fake_reg[9]
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+#define	MR_mr5	MR_fake_reg[5]
+#define	MR_mr6	MR_fake_reg[6]
+#define	MR_mr7	MR_fake_reg[7]
+#define	MR_mr8	MR_fake_reg[8]
+#define	MR_mr9	MR_fake_reg[9]
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif /* not M68K_REGS_H */
Index: runtime/machdeps/mips_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/mips_regs.h,v
retrieving revision 1.13
diff -u -b -r1.13 mips_regs.h
--- runtime/machdeps/mips_regs.h	2000/08/03 06:19:17	1.13
+++ runtime/machdeps/mips_regs.h	2000/11/13 03:25:02
@@ -7,82 +7,82 @@
 #define MIPS_REGS_H
 
 /*
-** Machine registers mr0 - mr36 for the MIPS architecture.
+** Machine registers MR_mr0 - MR_mr36 for the MIPS architecture.
 **
-** The first NUM_REAL_REGS of these are real machine registers.
+** The first MR_NUM_REAL_REGS of these are real machine registers.
 ** The others are just slots in a global array.
 **
 ** At the moment we're only using the callee-save registers.
 ** We should modify this to optionally use the caller-save registers.
 */
 
-#define NUM_REAL_REGS 8
+#define MR_NUM_REAL_REGS 8
 
-register	MR_Word	mr0 __asm__("s0");
-register	MR_Word	mr1 __asm__("s1");
-register	MR_Word	mr2 __asm__("s2");
-register	MR_Word	mr3 __asm__("s3");
-register	MR_Word	mr4 __asm__("s4");
-register	MR_Word	mr5 __asm__("s5");
-register	MR_Word	mr6 __asm__("s6");
-register	MR_Word	mr7 __asm__("s7");
-
-#define save_regs_to_mem(save_area)	(	\
-	save_area[0] = mr0,			\
-	save_area[1] = mr1,			\
-	save_area[2] = mr2,			\
-	save_area[3] = mr3,			\
-	save_area[4] = mr4,			\
-	save_area[5] = mr5,			\
-	save_area[6] = mr6,			\
-	save_area[7] = mr7,			\
+register	MR_Word	MR_mr0 __asm__("s0");
+register	MR_Word	MR_mr1 __asm__("s1");
+register	MR_Word	MR_mr2 __asm__("s2");
+register	MR_Word	MR_mr3 __asm__("s3");
+register	MR_Word	MR_mr4 __asm__("s4");
+register	MR_Word	MR_mr5 __asm__("s5");
+register	MR_Word	MR_mr6 __asm__("s6");
+register	MR_Word	MR_mr7 __asm__("s7");
+
+#define MR_save_regs_to_mem(save_area)	(	\
+	save_area[0] = MR_mr0,			\
+	save_area[1] = MR_mr1,			\
+	save_area[2] = MR_mr2,			\
+	save_area[3] = MR_mr3,			\
+	save_area[4] = MR_mr4,			\
+	save_area[5] = MR_mr5,			\
+	save_area[6] = MR_mr6,			\
+	save_area[7] = MR_mr7,			\
 	(void)0					\
 )
 
-#define restore_regs_from_mem(save_area) (	\
-	mr0 = save_area[0],			\
-	mr1 = save_area[1],			\
-	mr2 = save_area[2],			\
-	mr3 = save_area[3],			\
-	mr4 = save_area[4],			\
-	mr5 = save_area[5],			\
-	mr6 = save_area[6],			\
-	mr7 = save_area[7],			\
+#define MR_restore_regs_from_mem(save_area) (	\
+	MR_mr0 = save_area[0],			\
+	MR_mr1 = save_area[1],			\
+	MR_mr2 = save_area[2],			\
+	MR_mr3 = save_area[3],			\
+	MR_mr4 = save_area[4],			\
+	MR_mr5 = save_area[5],			\
+	MR_mr6 = save_area[6],			\
+	MR_mr7 = save_area[7],			\
 	(void)0					\
 )
 
-#define save_transient_regs_to_mem(save_area)		((void)0)
-#define restore_transient_regs_from_mem(save_area)	((void)0)
+#define MR_save_transient_regs_to_mem(save_area)	((void)0)
+#define MR_restore_transient_regs_from_mem(save_area)	((void)0)
 
-#define	mr8	MR_fake_reg[8]
-#define	mr9	MR_fake_reg[9]
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+#define	MR_mr8	MR_fake_reg[8]
+#define	MR_mr9	MR_fake_reg[9]
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif /* not MIPS_REGS_H */
Index: runtime/machdeps/no_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/no_regs.h,v
retrieving revision 1.12
diff -u -b -r1.12 no_regs.h
--- runtime/machdeps/no_regs.h	2000/08/03 06:19:17	1.12
+++ runtime/machdeps/no_regs.h	2000/11/13 03:31:42
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 1994-1997, 2000 The University of Melbourne.
+** Copyright (C) 1994-1998, 2000 The University of Melbourne.
 ** This file may only be copied under the terms of the GNU Library General
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
 */
@@ -17,68 +17,72 @@
 ** Note that when adding a header file for a new machine, you also
 ** need to add code to set NUM_REAL_R_REGS in ../configure.in.
 */
-#define NUM_REAL_REGS 0
+#define MR_NUM_REAL_REGS 0
 
-/* A pair of macros to save/restore all of the physical machine
-   registers.  They should copy/restore the physical machine
-   registers to/from the memory pointed to by the supplied `save_area'
-   parameter (which should be a pointer of type `MR_Word *').
-*/
-#define save_regs_to_mem(save_area)		((void)0)
-#define restore_regs_from_mem(save_area)	((void)0)
-
-/* A pair of macros to save/restore any of the physical machine
-   registers that get clobbered by calling a C function.  This is used
-   for machines with register windows.  They should copy/restore the windowed
-   registers to/from the memory pointed to by the supplied `save_area'
-   parameter (which should be a pointer of type `MR_Word *').
-*/
-
-#define save_transient_regs_to_mem(save_area)		((void)0)
-#define restore_transient_regs_from_mem(save_area)	((void)0)
-
-/* mr0, ..., mr36 are macros that map to either the underlying physical
-   machine register, if there is one, or otherwise to MR_fake_reg[n].
-   For register numbers greater than 36, use mr(n).
-*/
-
-#define	mr0	MR_fake_reg[0]
-#define	mr1	MR_fake_reg[1]
-#define	mr2	MR_fake_reg[2]
-#define	mr3	MR_fake_reg[3]
-#define	mr4	MR_fake_reg[4]
-#define	mr5	MR_fake_reg[5]
-#define	mr6	MR_fake_reg[6]
-#define	mr7	MR_fake_reg[7]
-#define	mr8	MR_fake_reg[8]
-#define	mr9	MR_fake_reg[9]
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+/*
+** A pair of macros to save/restore all of the physical machine
+** registers.  They should copy/restore the physical machine
+** registers to/from the memory pointed to by the supplied `save_area'
+** parameter (which should be a pointer of type `MR_Word *').
+*/
+
+#define MR_save_regs_to_mem(save_area)			((void) 0)
+#define MR_restore_regs_from_mem(save_area)		((void) 0)
+
+/*
+** A pair of macros to save/restore any of the physical machine
+** registers that get clobbered by calling a C function.  This is used
+** for machines with register windows.  They should copy/restore the windowed
+** registers to/from the memory pointed to by the supplied `save_area'
+** parameter (which should be a pointer of type `MR_Word *').
+*/
+
+#define MR_save_transient_regs_to_mem(save_area)	((void) 0)
+#define MR_restore_transient_regs_from_mem(save_area)	((void) 0)
+
+/*
+** MR_mr0, ..., MR_mr36 are macros that map to either the underlying physical
+** machine register, if there is one, or otherwise to MR_fake_reg[n].
+** For register numbers greater than 36, use MR_mr(n).
+*/
+
+#define	MR_mr0	MR_fake_reg[0]
+#define	MR_mr1	MR_fake_reg[1]
+#define	MR_mr2	MR_fake_reg[2]
+#define	MR_mr3	MR_fake_reg[3]
+#define	MR_mr4	MR_fake_reg[4]
+#define	MR_mr5	MR_fake_reg[5]
+#define	MR_mr6	MR_fake_reg[6]
+#define	MR_mr7	MR_fake_reg[7]
+#define	MR_mr8	MR_fake_reg[8]
+#define	MR_mr9	MR_fake_reg[9]
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif /* not NO_REGS_H */
Index: runtime/machdeps/pa_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/pa_regs.h,v
retrieving revision 1.6
diff -u -b -r1.6 pa_regs.h
--- runtime/machdeps/pa_regs.h	2000/08/03 06:19:17	1.6
+++ runtime/machdeps/pa_regs.h	2000/11/13 03:25:07
@@ -8,81 +8,81 @@
 #define PA_REGS_H
 
 /*
-** Machine registers mr0 - mr36 for the HP-PA architecture.
+** Machine registers MR_mr0 - MR_mr36 for the HP-PA architecture.
 **
-** The first NUM_REAL_REGS of these are real machine registers.
+** The first MR_NUM_REAL_REGS of these are real machine registers.
 ** The others are just slots in a global array.
 **
 ** At the moment we're only using 8 of the callee-save registers.
 */
 
-#define NUM_REAL_REGS 8
+#define MR_NUM_REAL_REGS 8
 
-register 	MR_Word	mr0 __asm__("%r6");
-register	MR_Word	mr1 __asm__("%r7");
-register	MR_Word	mr2 __asm__("%r8");
-register	MR_Word	mr3 __asm__("%r9");
-register	MR_Word	mr4 __asm__("%r10");
-register	MR_Word	mr5 __asm__("%r11");
-register	MR_Word	mr6 __asm__("%r12");
-register	MR_Word	mr7 __asm__("%r13");
-
-#define save_regs_to_mem(save_area) (		\
-	save_area[0] = mr0,			\
-	save_area[1] = mr1,			\
-	save_area[2] = mr2,			\
-	save_area[3] = mr3,			\
-	save_area[4] = mr4,			\
-	save_area[5] = mr5,			\
-	save_area[6] = mr6,			\
-	save_area[7] = mr7,			\
+register 	MR_Word	MR_mr0 __asm__("%r6");
+register	MR_Word	MR_mr1 __asm__("%r7");
+register	MR_Word	MR_mr2 __asm__("%r8");
+register	MR_Word	MR_mr3 __asm__("%r9");
+register	MR_Word	MR_mr4 __asm__("%r10");
+register	MR_Word	MR_mr5 __asm__("%r11");
+register	MR_Word	MR_mr6 __asm__("%r12");
+register	MR_Word	MR_mr7 __asm__("%r13");
+
+#define MR_save_regs_to_mem(save_area) (	\
+	save_area[0] = MR_mr0,			\
+	save_area[1] = MR_mr1,			\
+	save_area[2] = MR_mr2,			\
+	save_area[3] = MR_mr3,			\
+	save_area[4] = MR_mr4,			\
+	save_area[5] = MR_mr5,			\
+	save_area[6] = MR_mr6,			\
+	save_area[7] = MR_mr7,			\
 	(void)0					\
 )
 
-#define restore_regs_from_mem(save_area) (	\
-	mr0 = save_area[0],			\
-	mr1 = save_area[1],			\
-	mr2 = save_area[2],			\
-	mr3 = save_area[3],			\
-	mr4 = save_area[4],			\
-	mr5 = save_area[5],			\
-	mr6 = save_area[6],			\
-	mr7 = save_area[7],			\
+#define MR_restore_regs_from_mem(save_area) (	\
+	MR_mr0 = save_area[0],			\
+	MR_mr1 = save_area[1],			\
+	MR_mr2 = save_area[2],			\
+	MR_mr3 = save_area[3],			\
+	MR_mr4 = save_area[4],			\
+	MR_mr5 = save_area[5],			\
+	MR_mr6 = save_area[6],			\
+	MR_mr7 = save_area[7],			\
 	(void)0					\
 )
 
-#define save_transient_regs_to_mem(save_area)		((void)0)
-#define restore_transient_regs_from_mem(save_area)	((void)0)
+#define MR_save_transient_regs_to_mem(save_area)	((void)0)
+#define MR_restore_transient_regs_from_mem(save_area)	((void)0)
 
-#define	mr8	MR_fake_reg[8]
-#define	mr9	MR_fake_reg[9]
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+#define	MR_mr8	MR_fake_reg[8]
+#define	MR_mr9	MR_fake_reg[9]
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif /* not PA_REGS_H */
Index: runtime/machdeps/rs6000_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/rs6000_regs.h,v
retrieving revision 1.9
diff -u -b -r1.9 rs6000_regs.h
--- runtime/machdeps/rs6000_regs.h	2000/08/03 06:19:18	1.9
+++ runtime/machdeps/rs6000_regs.h	2000/11/13 03:25:09
@@ -8,86 +8,86 @@
 #define RS6000_REGS_H
 
 /*
-** Machine registers mr0 - mr36 for the RS/6000 architecture.
+** Machine registers MR_mr0 - MR_mr36 for the RS/6000 architecture.
 **
-** The first NUM_REAL_REGS of these are real machine registers.
+** The first MR_NUM_REAL_REGS of these are real machine registers.
 ** The others are just slots in a global array.
 **
 ** For the RS/6000, registers r13 to r31 are callee-save.
 ** Currently we're just using r13-r22 and leaving r23-r31 for gcc.
 */
 
-#define NUM_REAL_REGS 10
+#define MR_NUM_REAL_REGS 10
 
-register 	MR_Word	mr0 __asm__("r13");
-register	MR_Word	mr1 __asm__("r14");
-register	MR_Word	mr2 __asm__("r15");
-register	MR_Word	mr3 __asm__("r16");
-register	MR_Word	mr4 __asm__("r17");
-register	MR_Word	mr5 __asm__("r18");
-register	MR_Word	mr6 __asm__("r19");
-register	MR_Word	mr7 __asm__("r20");
-register	MR_Word	mr8 __asm__("r21");
-register	MR_Word	mr9 __asm__("r22");
-
-#define save_regs_to_mem(save_area) (		\
-	save_area[0] = mr0,			\
-	save_area[1] = mr1,			\
-	save_area[2] = mr2,			\
-	save_area[3] = mr3,			\
-	save_area[4] = mr4,			\
-	save_area[5] = mr5,			\
-	save_area[6] = mr6,			\
-	save_area[7] = mr7,			\
-	save_area[8] = mr8,			\
-	save_area[9] = mr9,			\
+register 	MR_Word	MR_mr0 __asm__("r13");
+register	MR_Word	MR_mr1 __asm__("r14");
+register	MR_Word	MR_mr2 __asm__("r15");
+register	MR_Word	MR_mr3 __asm__("r16");
+register	MR_Word	MR_mr4 __asm__("r17");
+register	MR_Word	MR_mr5 __asm__("r18");
+register	MR_Word	MR_mr6 __asm__("r19");
+register	MR_Word	MR_mr7 __asm__("r20");
+register	MR_Word	MR_mr8 __asm__("r21");
+register	MR_Word	MR_mr9 __asm__("r22");
+
+#define MR_save_regs_to_mem(save_area) (	\
+	save_area[0] = MR_mr0,			\
+	save_area[1] = MR_mr1,			\
+	save_area[2] = MR_mr2,			\
+	save_area[3] = MR_mr3,			\
+	save_area[4] = MR_mr4,			\
+	save_area[5] = MR_mr5,			\
+	save_area[6] = MR_mr6,			\
+	save_area[7] = MR_mr7,			\
+	save_area[8] = MR_mr8,			\
+	save_area[9] = MR_mr9,			\
 	(void)0					\
 )
 
-#define restore_regs_from_mem(save_area) (	\
-	mr0 = save_area[0],			\
-	mr1 = save_area[1],			\
-	mr2 = save_area[2],			\
-	mr3 = save_area[3],			\
-	mr4 = save_area[4],			\
-	mr5 = save_area[5],			\
-	mr6 = save_area[6],			\
-	mr7 = save_area[7],			\
-	mr8 = save_area[8],			\
-	mr9 = save_area[9],			\
+#define MR_restore_regs_from_mem(save_area) (	\
+	MR_mr0 = save_area[0],			\
+	MR_mr1 = save_area[1],			\
+	MR_mr2 = save_area[2],			\
+	MR_mr3 = save_area[3],			\
+	MR_mr4 = save_area[4],			\
+	MR_mr5 = save_area[5],			\
+	MR_mr6 = save_area[6],			\
+	MR_mr7 = save_area[7],			\
+	MR_mr8 = save_area[8],			\
+	MR_mr9 = save_area[9],			\
 	(void)0					\
 )
 
-#define save_transient_regs_to_mem(save_area)		((void)0)
-#define restore_transient_regs_from_mem(save_area)	((void)0)
+#define MR_save_transient_regs_to_mem(save_area)	((void)0)
+#define MR_restore_transient_regs_from_mem(save_area)	((void)0)
 
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif /* not RS6000_REGS_H */
Index: runtime/machdeps/sparc_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/sparc_regs.h,v
retrieving revision 1.20
diff -u -b -r1.20 sparc_regs.h
--- runtime/machdeps/sparc_regs.h	2000/08/03 06:19:18	1.20
+++ runtime/machdeps/sparc_regs.h	2000/11/13 03:25:12
@@ -8,9 +8,9 @@
 #define SPARC_REGS_H
 
 /*
-** Machine registers mr0 - mr36 for the SPARC architecture.
+** Machine registers MR_mr0 - MR_mr36 for the SPARC architecture.
 **
-** The first NUM_REAL_REGS of these are real machine registers.
+** The first MR_NUM_REAL_REGS of these are real machine registers.
 ** The others are just slots in a global array.
 **
 ** This is a bit tricky on sparcs, because of the sliding register
@@ -27,89 +27,91 @@
   #error "On SPARCs, you must use non-local gotos if you want global registers"
 #else
 
-#define NUM_REAL_REGS 10
+#define MR_NUM_REAL_REGS 10
 
-register 	MR_Word	mr0 __asm__("i0");
-register	MR_Word	mr1 __asm__("i1");	/* potentially non-clobbered */
-register	MR_Word	mr2 __asm__("i2");	/* potentially non-clobbered */
-register	MR_Word	mr3 __asm__("i3");	/* potentially non-clobbered */
-register	MR_Word	mr4 __asm__("i4");	/* potentially non-clobbered */
-register	MR_Word	mr5 __asm__("i5");	/* potentially non-clobbered */
-register	MR_Word	mr6 __asm__("l1");
-register	MR_Word	mr7 __asm__("l2");
-register	MR_Word	mr8 __asm__("l3");
-register	MR_Word	mr9 __asm__("l4");
+register 	MR_Word	MR_mr0 __asm__("i0");
+register	MR_Word	MR_mr1 __asm__("i1");	/* potentially non-clobbered */
+register	MR_Word	MR_mr2 __asm__("i2");	/* potentially non-clobbered */
+register	MR_Word	MR_mr3 __asm__("i3");	/* potentially non-clobbered */
+register	MR_Word	MR_mr4 __asm__("i4");	/* potentially non-clobbered */
+register	MR_Word	MR_mr5 __asm__("i5");	/* potentially non-clobbered */
+register	MR_Word	MR_mr6 __asm__("l1");
+register	MR_Word	MR_mr7 __asm__("l2");
+register	MR_Word	MR_mr8 __asm__("l3");
+register	MR_Word	MR_mr9 __asm__("l4");
 
 /* we could use l5, l6, and l7 as well, */
 /* but for the moment at least I'll leave them for gcc */
 
-#define save_regs_to_mem(save_area)		\
+#define MR_save_regs_to_mem(save_area)		\
 	(					\
-		save_area[0] = mr0,		\
-		save_area[1] = mr1,		\
-		save_area[2] = mr2,		\
-		save_area[3] = mr3,		\
-		save_area[4] = mr4,		\
-		save_area[5] = mr5,		\
-		save_area[6] = mr6,		\
-		save_area[7] = mr7,		\
-		save_area[8] = mr8,		\
-		save_area[9] = mr9,		\
+		save_area[0] = MR_mr0,		\
+		save_area[1] = MR_mr1,		\
+		save_area[2] = MR_mr2,		\
+		save_area[3] = MR_mr3,		\
+		save_area[4] = MR_mr4,		\
+		save_area[5] = MR_mr5,		\
+		save_area[6] = MR_mr6,		\
+		save_area[7] = MR_mr7,		\
+		save_area[8] = MR_mr8,		\
+		save_area[9] = MR_mr9,		\
 		(void)0				\
 	)
 
-#define restore_regs_from_mem(save_area)	\
+#define MR_restore_regs_from_mem(save_area)	\
 	(					\
-		mr0 = save_area[0],		\
-		mr1 = save_area[1],		\
-		mr2 = save_area[2],		\
-		mr3 = save_area[3],		\
-		mr4 = save_area[4],		\
-		mr5 = save_area[5],		\
-		mr6 = save_area[6],		\
-		mr7 = save_area[7],		\
-		mr8 = save_area[8],		\
-		mr9 = save_area[9],		\
+		MR_mr0 = save_area[0],		\
+		MR_mr1 = save_area[1],		\
+		MR_mr2 = save_area[2],		\
+		MR_mr3 = save_area[3],		\
+		MR_mr4 = save_area[4],		\
+		MR_mr5 = save_area[5],		\
+		MR_mr6 = save_area[6],		\
+		MR_mr7 = save_area[7],		\
+		MR_mr8 = save_area[8],		\
+		MR_mr9 = save_area[9],		\
 		(void)0				\
 	)
 
-/* for save_transient_regs_to_mem(), we probably don't have to save
-  the registers marked above as `potentially non-clobbered', but
-  I haven't verified that yet */
-
-#define save_transient_regs_to_mem(save_area) \
-	save_regs_to_mem(save_area)
-#define restore_transient_regs_from_mem(save_area) \
-	restore_regs_from_mem(save_area)
-
-#define	mr10	MR_fake_reg[10]
-#define	mr11	MR_fake_reg[11]
-#define	mr12	MR_fake_reg[12]
-#define	mr13	MR_fake_reg[13]
-#define	mr14	MR_fake_reg[14]
-#define	mr15	MR_fake_reg[15]
-#define	mr16	MR_fake_reg[16]
-#define	mr17	MR_fake_reg[17]
-#define	mr18	MR_fake_reg[18]
-#define	mr19	MR_fake_reg[19]
-#define	mr20	MR_fake_reg[20]
-#define	mr21	MR_fake_reg[21]
-#define	mr22	MR_fake_reg[22]
-#define	mr23	MR_fake_reg[23]
-#define	mr24	MR_fake_reg[24]
-#define	mr25	MR_fake_reg[25]
-#define	mr26	MR_fake_reg[26]
-#define	mr27	MR_fake_reg[27]
-#define	mr28	MR_fake_reg[28]
-#define	mr29	MR_fake_reg[29]
-#define	mr30	MR_fake_reg[30]
-#define	mr31	MR_fake_reg[31]
-#define	mr32	MR_fake_reg[32]
-#define	mr33	MR_fake_reg[33]
-#define	mr34	MR_fake_reg[34]
-#define	mr35	MR_fake_reg[35]
-#define	mr36	MR_fake_reg[36]
-#define	mr37	MR_fake_reg[37]
+/*
+** For MR_save_transient_regs_to_mem(), we probably don't have to save
+** the registers marked above as `potentially non-clobbered', but
+** I haven't verified that yet
+*/
+
+#define MR_save_transient_regs_to_mem(save_area) \
+	MR_save_regs_to_mem(save_area)
+#define MR_restore_transient_regs_from_mem(save_area) \
+	MR_restore_regs_from_mem(save_area)
+
+#define	MR_mr10	MR_fake_reg[10]
+#define	MR_mr11	MR_fake_reg[11]
+#define	MR_mr12	MR_fake_reg[12]
+#define	MR_mr13	MR_fake_reg[13]
+#define	MR_mr14	MR_fake_reg[14]
+#define	MR_mr15	MR_fake_reg[15]
+#define	MR_mr16	MR_fake_reg[16]
+#define	MR_mr17	MR_fake_reg[17]
+#define	MR_mr18	MR_fake_reg[18]
+#define	MR_mr19	MR_fake_reg[19]
+#define	MR_mr20	MR_fake_reg[20]
+#define	MR_mr21	MR_fake_reg[21]
+#define	MR_mr22	MR_fake_reg[22]
+#define	MR_mr23	MR_fake_reg[23]
+#define	MR_mr24	MR_fake_reg[24]
+#define	MR_mr25	MR_fake_reg[25]
+#define	MR_mr26	MR_fake_reg[26]
+#define	MR_mr27	MR_fake_reg[27]
+#define	MR_mr28	MR_fake_reg[28]
+#define	MR_mr29	MR_fake_reg[29]
+#define	MR_mr30	MR_fake_reg[30]
+#define	MR_mr31	MR_fake_reg[31]
+#define	MR_mr32	MR_fake_reg[32]
+#define	MR_mr33	MR_fake_reg[33]
+#define	MR_mr34	MR_fake_reg[34]
+#define	MR_mr35	MR_fake_reg[35]
+#define	MR_mr36	MR_fake_reg[36]
+#define	MR_mr37	MR_fake_reg[37]
 
 #endif
 
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.30
diff -u -b -r1.30 mercury_trace.c
--- trace/mercury_trace.c	2000/10/16 23:56:07	1.30
+++ trace/mercury_trace.c	2000/10/20 23:22:46
@@ -113,7 +113,7 @@
 	MR_Trace_Port	port;
 
 	/* in case MR_sp or MR_curfr is transient */
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	maybe_from_full = layout->MR_sll_entry->MR_sle_maybe_from_full;
 	if (MR_DETISM_DET_STACK(layout->MR_sll_entry->MR_sle_detism)) {
@@ -338,7 +338,7 @@
 	}
 
 	/* in case MR_sp or MR_curfr is transient */
-	restore_transient_registers();
+	MR_restore_transient_registers();
 
 	if (MR_DETISM_DET_STACK(layout->MR_sll_entry->MR_sle_detism)) {
 		seqno = (MR_Unsigned) MR_call_num_stackvar(MR_sp);
@@ -427,7 +427,8 @@
 	** For the treatment of MR_global_hp, see the top of this file.
 	*/
 
-	restore_transient_registers(); /* in case MR_global_hp is transient */
+		/* in case MR_global_hp is transient */
+	MR_restore_transient_registers();
 	MR_saved_global_hp(saved_regs) = MR_global_hp;
 	MR_copy_saved_regs_to_regs(event_info.MR_max_mr_num, saved_regs);
 	return jumpaddr;
@@ -661,7 +662,7 @@
 	}
 
 	for (i = 1; i < arg_max; i++) {
-		saved_reg(saved_regs, i) = args[i];
+		MR_saved_reg(saved_regs, i) = args[i];
 	}
 
 	event_info->MR_max_mr_num = max(event_info->MR_max_mr_num, arg_max);
Index: trace/mercury_trace.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.h,v
retrieving revision 1.17
diff -u -b -r1.17 mercury_trace.h
--- trace/mercury_trace.h	2000/10/16 01:34:09	1.17
+++ trace/mercury_trace.h	2000/11/13 03:57:16
@@ -34,7 +34,7 @@
 	MR_Trace_Port			MR_trace_port;
 	const MR_Stack_Layout_Label	*MR_event_sll;
 	const char 			*MR_event_path;
-	MR_Word				MR_saved_regs[MAX_FAKE_REG];
+	MR_Word				MR_saved_regs[MR_MAX_FAKE_REG];
 	int				MR_max_mr_num;
 } MR_Event_Info;
 
Index: trace/mercury_trace_browse.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_browse.c,v
retrieving revision 1.17
diff -u -b -r1.17 mercury_trace_browse.c
--- trace/mercury_trace_browse.c	2000/10/27 08:38:56	1.17
+++ trace/mercury_trace_browse.c	2000/11/13 06:30:19
@@ -273,7 +273,8 @@
 		for (i = num_imports; i > 0; i--) {
 			MR_ConstString this_import;
 			MR_make_aligned_string(this_import, imports[i - 1]);
-			imports_list = MR_list_cons(this_import, imports_list);
+			imports_list = MR_list_cons((MR_Word) this_import,
+				imports_list);
 		}
 	);
 
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.45
diff -u -b -r1.45 mercury_trace_external.c
--- trace/mercury_trace_external.c	2000/10/27 08:38:56	1.45
+++ trace/mercury_trace_external.c	2000/11/13 06:04:40
@@ -1158,7 +1158,8 @@
 		}
 
 		MR_TRACE_USE_HP(
-			var_names_list = MR_list_cons(name, var_names_list);
+			var_names_list = MR_list_cons((MR_Word) name,
+				var_names_list);
 		);
 	}
 
@@ -1199,7 +1200,8 @@
 			type_info_string = ML_type_name((MR_Word) type_info);
 		);
 	        MR_TRACE_USE_HP(
-			type_list = MR_list_cons(type_info_string, type_list);
+			type_list = MR_list_cons((MR_Word) type_info_string,
+				type_list);
 	        );
 	}
 
Index: trace/mercury_trace_help.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_help.c,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_trace_help.c
--- trace/mercury_trace_help.c	2000/10/16 23:07:47	1.13
+++ trace/mercury_trace_help.c	2000/11/13 06:05:20
@@ -74,7 +74,7 @@
 	MR_TRACE_USE_HP(
 		MR_make_aligned_string_copy(category_on_heap, category);
 		path = MR_list_empty();
-		path = MR_list_cons(category_on_heap, path);
+		path = MR_list_cons((MR_Word) category_on_heap, path);
 	);
 
 	return MR_trace_help_add_node(path, item, slot, text);
@@ -150,8 +150,8 @@
 		MR_make_aligned_string_copy(category_on_heap, category);
 		MR_make_aligned_string_copy(item_on_heap, item);
 		path = MR_list_empty();
-		path = MR_list_cons(item_on_heap, path);
-		path = MR_list_cons(category_on_heap, path);
+		path = MR_list_cons((MR_Word) item_on_heap, path);
+		path = MR_list_cons((MR_Word) category_on_heap, path);
 	);
 
 	MR_TRACE_CALL_MERCURY(
Index: trace/mercury_trace_spy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_spy.c,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_trace_spy.c
--- trace/mercury_trace_spy.c	2000/10/13 04:06:51	1.14
+++ trace/mercury_trace_spy.c	2000/10/20 23:23:16
@@ -195,7 +195,7 @@
 		}
 
 		if (MR_port_is_interface(port)) {
-			restore_transient_registers();
+			MR_restore_transient_registers();
 			base_sp = MR_sp;
 			base_curfr = MR_curfr;
 			parent = MR_find_nth_ancestor(layout, 1,
Index: trace/mercury_trace_util.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_util.c,v
retrieving revision 1.3
diff -u -b -r1.3 mercury_trace_util.c
--- trace/mercury_trace_util.c	2000/10/16 02:09:47	1.3
+++ trace/mercury_trace_util.c	2000/10/21 13:53:02
@@ -80,13 +80,13 @@
 MR_print_r_regs(FILE *fp, MR_Word *saved_regs)
 {
 	fprintf(fp, "r1 = %d (%x)\n",
-			saved_reg(saved_regs, 1), saved_reg(saved_regs, 1));
+		MR_saved_reg(saved_regs, 1), MR_saved_reg(saved_regs, 1));
 	fprintf(fp, "r2 = %d (%x)\n",
-			saved_reg(saved_regs, 2), saved_reg(saved_regs, 2));
+		MR_saved_reg(saved_regs, 2), MR_saved_reg(saved_regs, 2));
 	fprintf(fp, "r3 = %d (%x)\n",
-			saved_reg(saved_regs, 3), saved_reg(saved_regs, 3));
+		MR_saved_reg(saved_regs, 3), MR_saved_reg(saved_regs, 3));
 	fprintf(fp, "r4 = %d (%x)\n",
-			saved_reg(saved_regs, 4), saved_reg(saved_regs, 4));
+		MR_saved_reg(saved_regs, 4), MR_saved_reg(saved_regs, 4));
 	fprintf(fp, "r5 = %d (%x)\n",
-			saved_reg(saved_regs, 5), saved_reg(saved_regs, 5));
+		MR_saved_reg(saved_regs, 5), MR_saved_reg(saved_regs, 5));
 }
Index: trace/mercury_trace_util.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_util.h,v
retrieving revision 1.3
diff -u -b -r1.3 mercury_trace_util.h
--- trace/mercury_trace_util.h	2000/10/13 04:06:52	1.3
+++ trace/mercury_trace_util.h	2000/10/20 23:22:11
@@ -20,9 +20,9 @@
 ** transient.
 */
 #define MR_TRACE_USE_HP(STATEMENTS) do {				\
-		restore_transient_registers();				\
+		MR_restore_transient_registers();			\
 		STATEMENTS;						\
-		save_transient_registers();				\
+		MR_save_transient_registers();				\
 	} while (0)
 
 /*
@@ -33,11 +33,11 @@
 */
 
 #define MR_TRACE_CALL_MERCURY(STATEMENTS) do {				\
-		restore_transient_registers();				\
-		save_registers();					\
+		MR_restore_transient_registers();			\
+		MR_save_registers();					\
 		STATEMENTS;						\
-		restore_registers();					\
-		save_transient_registers();				\
+		MR_restore_registers();					\
+		MR_save_transient_registers();				\
 	} while (0)
 
 /*
cvs diff: Diffing trial
cvs diff: Diffing util
Index: util/mkinit.c
===================================================================
RCS file: /home/mercury1/repository/mercury/util/mkinit.c,v
retrieving revision 1.69
diff -u -b -r1.69 mkinit.c
--- util/mkinit.c	2000/11/06 05:10:01	1.69
+++ util/mkinit.c	2000/11/06 05:14:02
@@ -47,7 +47,7 @@
 
 /* --- global variables --- */
 
-static const char *progname = NULL;
+static const char *MR_progname = NULL;
 
 /* options and arguments, set by parse_options() */
 static const char *entry_point = "mercury__main_2_0";
@@ -119,7 +119,7 @@
 	"#ifdef MR_HIGHLEVEL_CODE\n"
 	"  extern void %s(void);\n"
 	"#else\n"
-	"  Declare_entry(%s);\n"
+	"  MR_declare_entry(%s);\n"
 	"#endif\n"
 	"\n"
 	"#if defined(USE_DLLS)\n"
@@ -163,13 +163,13 @@
 	"  #endif\n"
 	"#endif\n"
 	"\n"
-	"	address_of_mercury_init_io = mercury_init_io;\n"
-	"	address_of_init_modules = init_modules;\n"
-	"	address_of_init_modules_type_tables = init_modules_type_tables;\n"
-	"	address_of_init_modules_debugger = init_modules_debugger;\n"
+	"	MR_address_of_mercury_init_io = mercury_init_io;\n"
+	"	MR_address_of_init_modules = init_modules;\n"
+	"	MR_address_of_init_modules_type_tables = init_modules_type_tables;\n"
+	"	MR_address_of_init_modules_debugger = init_modules_debugger;\n"
 	"	MR_address_of_do_load_aditi_rl_code = %s;\n"
 	"#ifdef CONSERVATIVE_GC\n"
-	"	address_of_init_gc = init_gc;\n"
+	"	MR_address_of_init_gc = init_gc;\n"
 	"#endif\n"
 	"	MR_library_initializer = ML_io_init_state;\n"
 	"	MR_library_finalizer = ML_io_finalize_state;\n"
@@ -204,9 +204,9 @@
 	"	do_init_modules();\n"
 	"#endif\n"
 	"#ifdef MR_HIGHLEVEL_CODE\n"
-	"	program_entry_point = %s;\n"
+	"	MR_program_entry_point = %s;\n"
 	"#else\n"
-	"	program_entry_point = ENTRY(%s);\n"
+	"	MR_program_entry_point = MR_ENTRY(%s);\n"
 	"#endif\n"
 	"\n"
 	"	mercury_runtime_init(argc, argv);\n"
@@ -316,7 +316,7 @@
 main(int argc, char **argv)
 {
 	int	num_bunches;
-	progname = argv[0];
+	MR_progname = argv[0];
 
 	parse_options(argc, argv);
 
@@ -627,7 +627,7 @@
 	} else {
 		fprintf(stderr,
 			"%s: filename `%s' must end in `.c' or `.init'\n",
-			progname, filename);
+			MR_progname, filename);
 		num_errors++;
 	}
 }
@@ -727,7 +727,7 @@
 	cfile = fopen(filename, "r");
 	if (cfile == NULL) {
 		fprintf(stderr, "%s: error opening file `%s': %s\n",
-			progname, filename, strerror(errno));
+			MR_progname, filename, strerror(errno));
 		num_errors++;
 		return;
 	}
--------------------------------------------------------------------------
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