[m-rev.] diff: mercury versions of library pragma foreign_procs

Peter Ross pro at missioncriticalit.com
Tue Jun 11 21:01:26 AEST 2002


Hi,


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


Estimated hours taken: 16
Branches: main

Define a mercury version of every pragma foreign_proc, and remove any
foreign_procs which just throw an exception that the code is not implemented.

library/array.m:
library/benchmarking.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/deconstruct.m:
library/exception.m:
library/float.m:
library/gc.m:
library/int.m:
library/io.m:
library/library.m:
library/math.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/sparse_bitset.m:
library/std_util.m:
library/store.m:
library/string.m:
library/table_builtin.m:
library/time.m:
library/type_desc.m:
	Define a mercury version of every pragma foreign_proc, and remove any
	foreign_procs which just throw an exception that the code is not
	implemented.


Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.106
diff -u -r1.106 array.m
--- library/array.m	4 Jun 2002 14:28:55 -0000	1.106
+++ library/array.m	11 Jun 2002 10:16:33 -0000
@@ -725,6 +725,9 @@
 #endif
 ").		
 
+bounds_checks :-
+	private_builtin__sorry("array__bounds_checks").
+
 %-----------------------------------------------------------------------------%
 
 :- pragma foreign_decl("C", "
@@ -786,15 +789,15 @@
 	}
 ").
 
-:- pragma foreign_proc("C#",
-		array__make_empty_array(_Array::array_uo),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-        mercury.runtime.Errors.SORRY(""foreign code for this predicate"");
-").
+array__init_2(_, _, _) :-
+	private_builtin__sorry("array__init_2").
 
+array__make_empty_array(_) :-
+	private_builtin__sorry("array__make_empty_array").
 
 %-----------------------------------------------------------------------------%
 
+:- pragma promise_pure(array__min/2).
 :- pragma foreign_proc("C",
 		array__min(Array::array_ui, Min::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "
@@ -821,6 +824,10 @@
 	Min = 0;
 ").
 
+array__min(_, _) :-
+	private_builtin__sorry("array__min").
+
+:- pragma promise_pure(array__max/2).
 :- pragma foreign_proc("C", 
 		array__max(Array::array_ui, Max::out), 
 		[will_not_call_mercury, promise_pure, thread_safe], "
@@ -842,6 +849,8 @@
 	Max = Array.Length - 1;
 ").
 
+array__max(_, _) :-
+	private_builtin__sorry("array__max").
 
 array__bounds(Array, Min, Max) :-
 	array__min(Array, Min),
@@ -849,6 +858,7 @@
 
 %-----------------------------------------------------------------------------%
 
+:- pragma promise_pure(array__size/2).
 :- pragma foreign_proc("C",
 		array__size(Array::array_ui, Max::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "
@@ -871,6 +881,8 @@
 	Max = Array.Length;
 ").
 
+array__size(_, _) :-
+	private_builtin__sorry("array__size").
 
 %-----------------------------------------------------------------------------%
 
@@ -906,6 +918,7 @@
 :- pred array__unsafe_lookup(array(T), int, T).
 :- mode array__unsafe_lookup(array_ui, in, out) is det.
 :- mode array__unsafe_lookup(in, in, out) is det.
+:- pragma promise_pure(array__unsafe_lookup/3).
 
 :- pragma foreign_proc("C",
 		array__unsafe_lookup(Array::array_ui, Index::in, Item::out),
@@ -931,6 +944,8 @@
 	Item = Array.GetValue(Index);
 }").
 
+array__unsafe_lookup(_, _, _) :-
+	private_builtin__sorry("array__unsafe_lookup").
 
 %-----------------------------------------------------------------------------%
 
@@ -961,6 +976,8 @@
 	Array = Array0;
 }").
 
+array__unsafe_set(_, _, _, _) :-
+	private_builtin__sorry("array__unsafe_set").
 
 %-----------------------------------------------------------------------------%
 
@@ -1039,6 +1056,8 @@
 	}
 ").
 
+array__resize(_, _, _, _) :-
+	private_builtin__sorry("array__resize").
 
 %-----------------------------------------------------------------------------%
 
@@ -1103,6 +1122,8 @@
 	System.Array.Copy(Array0, Array, Size);
 ").
 
+array__shrink_2(_, _, _) :-
+	private_builtin__sorry("array__shrink_2").
 
 %-----------------------------------------------------------------------------%
 
@@ -1162,13 +1183,9 @@
 	System.Array.Copy(Array0, Array, Array0.Length); 
 ").
 
-:- pragma foreign_proc("C#",
-		array__copy(Array0::in, Array::array_uo),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-	mercury.runtime.Errors.SORRY(""foreign code for this function"");
-		// XXX need to deep copy it
-	Array = Array0;
-").
+:- pragma promise_pure(array__copy/2).
+array__copy(_, _) :-
+	private_builtin__sorry("array__copy").
 
 %-----------------------------------------------------------------------------%
 
Index: library/benchmarking.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/benchmarking.m,v
retrieving revision 1.47
diff -u -r1.47 benchmarking.m
--- library/benchmarking.m	18 Feb 2002 07:01:02 -0000	1.47
+++ library/benchmarking.m	11 Jun 2002 10:16:33 -0000
@@ -76,30 +76,26 @@
 "). % end pragma foreign_decl
 
 :- pragma foreign_proc("C", report_stats,
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	ML_report_stats();
 ").
 
 :- pragma foreign_proc("C", report_full_memory_stats,
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 #ifdef	MR_MPROF_PROFILE_MEMORY
 	ML_report_full_memory_stats();
 #endif
 ").
 
-:- pragma foreign_proc("MC++", report_stats,
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", report_full_memory_stats,
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+report_stats :-
+	impure private_builtin__imp,
+	private_builtin__sorry("report_stats").
+
+report_full_memory_stats :-
+	impure private_builtin__imp,
+	private_builtin__sorry("report_full_memory_stats").
 
 %-----------------------------------------------------------------------------%
 
@@ -651,11 +647,14 @@
 	( true ; impure repeat(N - 1) ).
 
 :- impure pred get_user_cpu_miliseconds(int::out) is det.
+
 :- pragma foreign_proc("C",
 	get_user_cpu_miliseconds(Time::out), [will_not_call_mercury],
 "
 	Time = MR_get_user_cpu_miliseconds();
 ").
+
+/* XXX for the MC++ implementation
 :- pragma foreign_proc("MC++",
 	get_user_cpu_miliseconds(_Time::out), [will_not_call_mercury],
 "
@@ -668,6 +667,11 @@
 
 	mercury::runtime::Errors::SORRY(""foreign code for this function"");
 ").
+*/
+
+get_user_cpu_miliseconds(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("get_user_cpu_miliseconds").
 
 /*
 ** To prevent the C compiler from optimizing the benchmark code
@@ -682,23 +686,30 @@
 ").
 
 :- impure pred do_nothing(T::in) is det.
+
 :- pragma foreign_proc("C", 
 	do_nothing(X::in), [will_not_call_mercury, thread_safe], "
 	ML_benchmarking_dummy_word = (MR_Word) X;
 ").
+
 /*
 ** To prevent the MC++ compiler from optimizing the benchmark code
 ** away, we assign the benchmark output to a volatile static variable.
 ** XXX at least, we should do this but it doesn't seem to work.
 */
+/*
 :- pragma foreign_proc("MC++", 
 	do_nothing(X::in), [will_not_call_mercury, thread_safe],
 "
 	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-/*	static volatile MR_Word ML_benchmarking_dummy_word;
-	ML_benchmarking_dummy_word = (MR_Word) X;
-*/
+	// static volatile MR_Word ML_benchmarking_dummy_word;
+	// ML_benchmarking_dummy_word = (MR_Word) X;
 ").
+*/
+
+do_nothing(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("benchmaring__do_nothing").
 
 %-----------------------------------------------------------------------------%
 
@@ -715,12 +726,9 @@
 	MR_incr_hp(Ref, 1);
 	* (MR_Integer *) Ref = X;
 ").
-:- pragma foreign_proc("MC++",
-	new_int_reference(_X::in, _Ref::out), [will_not_call_mercury], 
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
+new_int_reference(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("benchmarking__new_int_reference").
 
 :- impure pred incr_ref(int_reference::in) is det.
 incr_ref(Ref) :-
@@ -729,16 +737,15 @@
 
 :- semipure pred ref_value(int_reference::in, int::out) is det.
 :- pragma inline(ref_value/2).
+:- pragma promise_semipure(ref_value/2).
 :- pragma foreign_proc("C", ref_value(Ref::in, X::out),
-		[will_not_call_mercury, promise_semipure],
+		[will_not_call_mercury],
 "
 	X = * (MR_Integer *) Ref;
 ").
-:- pragma foreign_proc("MC++", ref_value(_Ref::in, _X::out),
-		[will_not_call_mercury, promise_semipure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+ref_value(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("benchmarking__ref_value").
 
 :- impure pred update_ref(int_reference::in, T::in) is det.
 :- pragma inline(update_ref/2).
@@ -746,9 +753,8 @@
 	update_ref(Ref::in, X::in), [will_not_call_mercury], "
 	* (MR_Integer *) Ref = X;
 ").
-:- pragma foreign_proc("MC++",
-	update_ref(_Ref::in, _X::in), [will_not_call_mercury], "
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+update_ref(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("benchmarking__update_ref").
 
 %-----------------------------------------------------------------------------%
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.71
diff -u -r1.71 builtin.m
--- library/builtin.m	7 Jun 2002 00:48:50 -0000	1.71
+++ library/builtin.m	11 Jun 2002 10:16:34 -0000
@@ -284,6 +284,9 @@
                         (Y :: out(pred(out) is semidet)),
                 [will_not_call_mercury, thread_safe],
                 "Y = X;").
+cc_cast(_) = _ :-
+	impure private_builtin__imp,
+	private_builtin__sorry("builtin__cc_cast").
 
 :- pragma promise_pure(promise_only_solution_io/4).
 promise_only_solution_io(Pred, X) -->
@@ -307,6 +310,9 @@
 		(Y :: out(pred(out, di, uo) is det)),
                 [will_not_call_mercury, thread_safe],
                 "Y = X;").
+cc_cast_io(_) = _ :-
+	impure private_builtin__imp,
+	private_builtin__sorry("builtin__cc_cast_io").
 
 %-----------------------------------------------------------------------------%
 
Index: library/char.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/char.m,v
retrieving revision 1.35
diff -u -r1.35 char.m
--- library/char.m	20 Jan 2002 07:32:19 -0000	1.35
+++ library/char.m	11 Jun 2002 10:16:34 -0000
@@ -457,6 +457,11 @@
 	SUCCESS_INDICATOR = (Character == Int);
 ").
 
+:- pragma promise_pure(char__to_int/2).
+char__to_int(_, _) :-
+	private_builtin__sorry("char__to_int").
+
+
 % We used unsigned character codes, so the minimum character code
 % is always zero.
 
@@ -469,13 +474,8 @@
 	Max = UCHAR_MAX;
 ").
 
-:- pragma foreign_proc("MC++",
-		char__max_char_value(_Max::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-	mercury::runtime::Errors::SORRY(""c code for this function"");
-").
-
-
+char__max_char_value(_) :-
+	private_builtin__sorry("char__max_char_value").
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: library/construct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/construct.m,v
retrieving revision 1.3
diff -u -r1.3 construct.m
--- library/construct.m	12 Apr 2002 01:24:21 -0000	1.3
+++ library/construct.m	11 Jun 2002 10:16:34 -0000
@@ -102,6 +102,9 @@
 	MR_restore_transient_registers();
 }").
 
+num_functors(_) = _ :-
+	private_builtin__sorry("construct__num_functors").
+
 :- pragma foreign_proc("C",
 	get_functor(TypeDesc::in, FunctorNumber::in, FunctorName::out,
 		Arity::out, TypeInfoList::out),
@@ -155,6 +158,9 @@
     SUCCESS_INDICATOR = success;
 }").
 
+get_functor(_, _, _, _, _) :-
+	private_builtin__sorry("construct__get_functor").
+
 get_functor(TypeDesc, I, Functor, Arity, TypeInfoList, ArgNameList) :-
     get_functor_2(TypeDesc, I, Functor, Arity, TypeInfoList, ArgNameList0),
     ArgNameList = map(null_to_no, ArgNameList0).
@@ -180,6 +186,9 @@
     SUCCESS_INDICATOR = (S == NULL);
 ").
 
+null(_) :-
+	private_builtin__sorry("construct__null").
+
 :- pred get_functor_2(type_desc__type_desc::in, int::in, string::out, int::out,
 	list(type_desc__type_desc)::out, list(string)::out) is semidet.
 
@@ -238,14 +247,8 @@
     SUCCESS_INDICATOR = success;
 }").
 
-:- pragma foreign_proc("MC++",
-	get_functor_2(_TypeDesc::in, _FunctorNumber::in, _FunctorName::out,
-		_Arity::out, _TypeInfoList::out, _ArgNameList::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for get_functor_2"");
-	SUCCESS_INDICATOR = MR_FALSE;
-").
+get_functor_2(_, _, _, _, _, _) :-
+	private_builtin__sorry("construct__get_functor_2").
 
 :- pragma foreign_proc("C", 
 	get_functor_ordinal(TypeDesc::in, FunctorNumber::in, Ordinal::out),
@@ -301,6 +304,9 @@
     SUCCESS_INDICATOR = success;
 }").
 
+get_functor_ordinal(_, _, _) :-
+	private_builtin__sorry("construct__get_functor_ordinal").
+
 :- pragma foreign_proc("C", 
 	construct(TypeDesc::in, FunctorNumber::in, ArgList::in) = (Term::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
@@ -507,40 +513,8 @@
     SUCCESS_INDICATOR = success;
 }").
 
-:- pragma foreign_proc("C#",
-	num_functors(_TypeInfo::in) = (Functors::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"{
-	mercury.runtime.Errors.SORRY(""foreign code for num_functors"");
-	// XXX keep the C# compiler quiet
-	Functors = 0;
-}").
-
-:- pragma foreign_proc("MC++",
-	get_functor(_TypeDesc::in, _FunctorNumber::in, _FunctorName::out,
-		_Arity::out, _TypeInfoList::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for get_functor"");
-").
-
-:- pragma foreign_proc("MC++", 
-	get_functor_ordinal(_TypeDesc::in, _FunctorNumber::in, _Ordinal::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for get_functor_ordinal"");
-").
-
-:- pragma foreign_proc("C#", 
-	construct(_TypeDesc::in, _FunctorNumber::in, _ArgList::in)
-		= (_Term::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"{
-	mercury.runtime.Errors.SORRY(""foreign code for construct"");
-	_Term = null;
-	// XXX this is required to keep the C# compiler quiet
-	SUCCESS_INDICATOR = false;
-}").
+construct(_, _, _) = _ :-
+	private_builtin__sorry("construct__construct").
 
 construct_tuple(Args) =
 	construct_tuple_2(Args,
@@ -589,10 +563,5 @@
 	MR_new_univ_on_hp(Term, type_info, new_data);
 }").
 
-:- pragma foreign_proc("C#", 
-	construct_tuple_2(_Args::in, _ArgTypes::in, _Arity::in) = (_Term::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"{
-	mercury.runtime.Errors.SORRY(""construct_tuple_2"");
-	_Term = null;
-}").
+construct_tuple_2(_, _, _) = _ :-
+	private_builtin__sorry("construct__construct_tuple_2").
Index: library/deconstruct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/deconstruct.m,v
retrieving revision 1.9
diff -u -r1.9 deconstruct.m
--- library/deconstruct.m	12 May 2002 17:47:46 -0000	1.9
+++ library/deconstruct.m	11 Jun 2002 10:16:35 -0000
@@ -816,12 +816,8 @@
     }
 }").
 
-:- pragma foreign_proc("MC++", 
-	get_notag_functor_info(_Univ::in, _ExpUniv::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for get_notag_functor_info"");
-").
+get_notag_functor_info(_, _) :-
+	private_builtin__sorry("deconstruct__get_notag_functor_info").
 
     % Given a value of an arbitrary type, succeed if its type is defined
     % as an equivalence type, and return a univ which bundles up the value
@@ -862,12 +858,8 @@
     }
 }").
 
-:- pragma foreign_proc("MC++",
-	get_equiv_functor_info(_Univ::in, _ExpUniv::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for get_equiv_functor_info"");
-").
+get_equiv_functor_info(_, _) :-
+	private_builtin__sorry("get_equiv_functor_info").
 
     % Given a value of an arbitrary type, succeed if it is an enum type,
     % and return the integer value corresponding to the value.
@@ -896,12 +888,8 @@
     }
 }").
 
-:- pragma foreign_proc("MC++",
-	get_enum_functor_info(_Univ::in, _Enum::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for get_enum_functor_info"");
-}").
+get_enum_functor_info(_, _) :-
+	private_builtin__sorry("deconstruct__get_enum_functor_info").
 
     % Given a value of an arbitrary type, succeed if it is a general du type
     % (i.e. non-enum, non-notag du type), and return the top function symbol's
@@ -1001,10 +989,5 @@
     }
 }").
 
-:- pragma foreign_proc("MC++",
-	get_du_functor_info(_Univ::in, _Where::out, _Ptag::out, _Sectag::out,
-		_Args::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for get_du_functor_info"");
-").
+get_du_functor_info(_, _, _, _, _) :-
+	private_builtin__sorry("get_du_functor_info").
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.63
diff -u -r1.63 exception.m
--- library/exception.m	7 Jun 2002 00:48:51 -0000	1.63
+++ library/exception.m	11 Jun 2002 10:16:36 -0000
@@ -1102,7 +1102,6 @@
 	throw new mercury.runtime.Exception(T);
 ").
 
-
 :- pragma foreign_proc("C#", 
 	catch_impl(Pred::pred(out) is det, Handler::in(handler), T::out),
 		[will_not_call_mercury, promise_pure], "
Index: library/float.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/float.m,v
retrieving revision 1.44
diff -u -r1.44 float.m
--- library/float.m	15 Mar 2002 05:13:53 -0000	1.44
+++ library/float.m	11 Jun 2002 10:16:36 -0000
@@ -245,6 +245,10 @@
 	SUCCESS_INDICATOR = MR_TRUE;
 #endif
 ").
+
+domain_checks :-
+	private_builtin__sorry("float__domain_checks").
+
 %---------------------------------------------------------------------------%
 %
 % Conversion functions
@@ -265,6 +269,8 @@
 "
 	Ceil = System.Convert.ToInt32(System.Math.Ceiling(X));
 ").
+float__ceiling_to_int(_) = _ :-
+	private_builtin__sorry("float__ceiling_to_int").
 
 	% float__floor_to_int(X) returns the
 	% largest integer not greater than X.
@@ -278,6 +284,8 @@
 "
 	Floor = System.Convert.ToInt32(System.Math.Floor(X));
 ").
+float__floor_to_int(_) = _ :-
+	private_builtin__sorry("float__floor_to_int").
 
 	% float__round_to_int(X) returns the integer closest to X.
 	% If X has a fractional value of 0.5, it is rounded up.
@@ -291,6 +299,8 @@
 "
 	Round = System.Convert.ToInt32(System.Math.Floor(X + 0.5));
 ").
+float__round_to_int(_) = _ :-
+	private_builtin__sorry("float__round_to_int").
 
 	% float__truncate_to_int(X) returns the integer closest
 	% to X such that |float__truncate_to_int(X)| =< |X|.
@@ -304,6 +314,8 @@
 "
 	Trunc = System.Convert.ToInt32(X);
 ").
+float__truncate_to_int(_) = _ :-
+	private_builtin__sorry("float__truncate_to_int").
 
 %---------------------------------------------------------------------------%
 %
@@ -399,6 +411,8 @@
 "
 	H = F.GetHashCode();
 ").
+float__hash(_) = _ :-
+	private_builtin__sorry("float__hash").
 
 %---------------------------------------------------------------------------%
 %
@@ -436,7 +450,8 @@
 :- pragma foreign_proc("C#", float__max = (Max::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 	"Max = System.Double.MaxValue;").
-
+float__max = _ :-
+	private_builtin__sorry("float__max").
 
 	% Minimum normalised floating-point number */
 :- pragma foreign_proc("C", float__min = (Min::out),
@@ -445,6 +460,8 @@
 :- pragma foreign_proc("C#", float__min = (Min::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 	"Min = System.Double.MinValue;").
+float__min = _ :=
+	private_builtin__sorry("float__min").
 
 	% Smallest x such that x \= 1.0 + x
 :- pragma foreign_proc("C", float__epsilon = (Eps::out),
@@ -453,26 +470,22 @@
 :- pragma foreign_proc("C#", float__epsilon = (Eps::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 	"Eps = System.Double.Epsilon;").
+float__epsilon = _ :-
+	private_builtin__sorry("float__epsilon").
 
 	% Radix of the floating-point representation.
 :- pragma foreign_proc("C", float__radix = (Radix::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 	"Radix = ML_FLOAT_RADIX;").
-:- pragma foreign_proc("C#", float__radix = (_Radix::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-	mercury.runtime.Errors.SORRY(""foreign code for this function"");
-	_Radix = 0;
-").
+float__radix = _ :-
+	private_builtin__sorry("float__radix").
 
 	% The number of base-radix digits in the mantissa.
 :- pragma foreign_proc("C", float__mantissa_digits = (MantDig::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 	"MantDig = ML_FLOAT_MANT_DIG;").
-:- pragma foreign_proc("C#", float__mantissa_digits = (_MantDig::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-	mercury.runtime.Errors.SORRY(""foreign code for this function"");
-	_MantDig = 0;
-").
+float__mantissa_digits = _ :-
+	private_builtin__sorry("float__mantissa_digits").
 
 	% Minimum negative integer such that:
 	%	radix ** (min_exponent - 1)
@@ -480,11 +493,8 @@
 :- pragma foreign_proc("C", float__min_exponent = (MinExp::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 	"MinExp = ML_FLOAT_MIN_EXP;").
-:- pragma foreign_proc("C#", float__min_exponent = (_MinExp::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "	
-	mercury.runtime.Errors.SORRY(""foreign code for this function"");
-	_MinExp = 0;
-").
+float__min_exponent = _ :-
+	private_builtin__sorry("float__min_exponent").
 
 	% Maximum integer such that:
 	%	radix ** (max_exponent - 1)
@@ -492,13 +502,8 @@
 :- pragma foreign_proc("C", float__max_exponent = (MaxExp::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 	"MaxExp = ML_FLOAT_MAX_EXP;").
-
-:- pragma foreign_proc("C#", float__max_exponent = (_MaxExp::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "	
-	mercury.runtime.Errors.SORRY(""foreign code for this function"");
-	_MaxExp = 0;
-").
-
+float__max_exponent = _ :-
+	private_builtin__sorry("float__max_exponent").
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: library/gc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/gc.m,v
retrieving revision 1.8
diff -u -r1.8 gc.m
--- library/gc.m	6 Jun 2002 16:17:52 -0000	1.8
+++ library/gc.m	11 Jun 2002 10:16:36 -0000
@@ -53,9 +53,9 @@
 	MR_garbage_collect();
 #endif
 ").
-:- pragma foreign_proc("MC++", garbage_collect, [will_not_call_mercury], "
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+garbage_collect :-
+	impure private_builtin__imp,
+	private_builtin__sorry("garbage_collect").
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: library/int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.84
diff -u -r1.84 int.m
--- library/int.m	15 Mar 2002 05:13:53 -0000	1.84
+++ library/int.m	11 Jun 2002 10:16:37 -0000
@@ -343,6 +343,9 @@
 #endif
 ").
 
+domain_checks :-
+	private_builtin__sorry("domain_checks").
+
 :- pragma inline(floor_to_multiple_of_bits_per_int/1).
 floor_to_multiple_of_bits_per_int(X) = Floor :-
 	Trunc = quot_bits_per_int(X),
@@ -504,6 +507,8 @@
 "
 	FloatVal = (MR_Float) IntVal;
 ").
+int__to_float(_, _) :-
+	private_builtin__sorry("int__to_float").
 
 %-----------------------------------------------------------------------------%
 
@@ -558,6 +563,7 @@
 	Result = Int * ML_BITS_PER_INT;
 ").
 
+
 :- pragma foreign_proc("C", int__rem_bits_per_int(Int::in) = (Rem::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "
 	Rem = Int % ML_BITS_PER_INT;
@@ -579,6 +585,15 @@
 	Bits = ML_BITS_PER_INT;
 ").
 
+int__max_int(_) :-
+	private_builtin__sorry("int__max_int").
+
+int__min_int(_) :-
+	private_builtin__sorry("int__min_int").
+
+int__bits_per_int(_) :-
+	private_builtin__sorry("int__bits_per_int").
+
 int__quot_bits_per_int(Int::in) = (Result::out) :-
 	Result = Int // int__bits_per_int.
 
@@ -587,6 +602,7 @@
 
 int__rem_bits_per_int(Int::in) = (Result::out) :-
 	Result = Int rem int__bits_per_int.
+
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.256
diff -u -r1.256 io.m
--- library/io.m	16 May 2002 09:08:57 -0000	1.256
+++ library/io.m	11 Jun 2002 10:16:38 -0000
@@ -1603,14 +1603,8 @@
 	update_io(IO0, IO);
 ").
 
-:- pragma foreign_proc("MC++", 
-	io__read_line_as_string_2(_File::in, _Res :: out, _RetString::out,
-		IO0::di, IO::uo),
-		[will_not_call_mercury, promise_pure,thread_safe],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-	update_io(IO0, IO);
-").
+io__read_line_as_string_2(_, _, _) -->
+	{ private_builtin__sorry("io__read_line_as_string_2") }.
 
 io__read_file(Result) -->
 	io__input_stream(Stream),
@@ -1763,7 +1757,7 @@
 :- mode io__clear_err(in, di, uo) is det.
 % same as ANSI C's clearerr().
 
-:- pragma foreign_proc("C", io__clear_err(Stream::in, _IO0::di, _IO::uo),
+:- pragma foreign_proc("C", io__clear_err(Stream::in, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure,
 			tabled_for_io, thread_safe],
 "{
@@ -1774,6 +1768,7 @@
 	} else {
 		/* Not a file stream so do nothing */
 	}
+	update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", io__clear_err(_Stream::in, IO0::di, IO::uo),
@@ -1785,6 +1780,9 @@
 	update_io(IO0, IO);
 }").
 
+io__clear_err(_) -->
+	{ private_builtin__sorry("io__clear_err") }.
+
 
 :- pred io__check_err(stream, io__res, io__state, io__state).
 :- mode io__check_err(in, out, di, uo) is det.
@@ -1802,7 +1800,7 @@
 % similar to ANSI C's ferror().
 
 :- pragma foreign_proc("C", ferror(Stream::in, RetVal::out, RetStr::out,
-		_IO0::di, _IO::uo),
+		IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure,
 			tabled_for_io, thread_safe],
 "{
@@ -1816,6 +1814,8 @@
 
 	ML_maybe_make_err_msg(RetVal != 0, ""read failed: "",
 		MR_PROC_LABEL, RetStr);
+
+	update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", ferror(_Stream::in, RetVal::out, _RetStr::out,
@@ -1827,6 +1827,9 @@
 	update_io(IO0, IO);
 }").
 
+ferror(_, _, _) -->
+	{ private_builtin__sorry("ferror") }.
+
 
 % io__make_err_msg(MessagePrefix, Message):
 %	`Message' is an error message obtained by looking up the
@@ -1836,19 +1839,24 @@
 :- mode io__make_err_msg(in, out, di, uo) is det.
 
 :- pragma foreign_proc("C",
-	make_err_msg(Msg0::in, Msg::out, _IO0::di, _IO::uo),
+	make_err_msg(Msg0::in, Msg::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "{
 	ML_maybe_make_err_msg(MR_TRUE, Msg0, MR_PROC_LABEL, Msg);
+	update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", 
-	make_err_msg(Msg0::in, Msg::out, _IO0::di, _IO::uo),
+	make_err_msg(Msg0::in, Msg::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure],
 "{
 	Msg = System::String::Concat(Msg0, MR_io_exception->Message);
+	update_io(IO0, IO);
 }").
 
+make_err_msg(_, _) -->
+	{ private_builtin__sorry("io__make_err_msg") }.
+
 
 %-----------------------------------------------------------------------------%
 
@@ -1868,7 +1876,7 @@
 ").
 
 :- pragma foreign_proc("C", io__stream_file_size(Stream::in, Size::out,
-		_IO0::di, _IO::uo),
+		IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "{
@@ -1891,6 +1899,7 @@
 #else
 	Size = -1;
 #endif
+	update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", io__stream_file_size(Stream::in, Size::out,
@@ -1907,6 +1916,10 @@
 	update_io(IO0, IO);
 }").
 
+io__stream_file_size(_, _) -->
+	{ private_builtin__sorry("io__stream_file_size") }.
+	
+
 io__file_modification_time(File, Result) -->
 	io__file_modification_time_2(File, Status, Msg, Time),
 	{ Status = 1 ->
@@ -1944,12 +1957,8 @@
 
 }").
 
-:- pragma foreign_proc("MC++", io__file_modification_time_2(_FileName::in,
-		_Status::out, _Msg::out, _Time::out, _IO0::di, _IO::uo),
-		[will_not_call_mercury, promise_pure, thread_safe],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+io__file_modification_time_2(_, _, _, _) -->
+	{ private_builtin__sorry("io__file_modification_time_2") }.
 
 %-----------------------------------------------------------------------------%
 
@@ -1970,6 +1979,9 @@
 		MR_PROC_LABEL, ""io:buffer/0"");
 }").
 
+io__alloc_buffer(_, _) :-
+	private_builtin__sorry("io__alloc_buffer").
+
 :- pred io__resize_buffer(buffer::di, int::in, int::in, buffer::uo) is det.
 :- pragma foreign_proc("C",
 	io__resize_buffer(Buffer0::di, OldSize::in,
@@ -2009,6 +2021,9 @@
 	Buffer = (MR_Word) buffer;
 }").
 
+io__resize_buffer(_, _, _, _) :-
+	private_builtin__sorry("io__resize_buffer").
+
 :- pred io__buffer_to_string(buffer::di, int::in, string::uo) is det.
 :- pragma foreign_proc("C", 
 	io__buffer_to_string(Buffer::di, Len::in, Str::uo),
@@ -2018,6 +2033,8 @@
 	Str[Len] = '\\0';
 }").
 
+io__buffer_to_string(_, _, _) :-
+	private_builtin__sorry("io__buffer_to_string/3").
 
 :- pred io__buffer_to_string(buffer::di, string::uo) is det.
 :- pragma foreign_proc("C",
@@ -2027,13 +2044,15 @@
 	Str = (MR_String) Buffer;
 }").
 
+io__buffer_to_string(_, _) :-
+	private_builtin__sorry("io__buffer_to_string/2").
 
 :- pred io__read_into_buffer(stream::in, buffer::di, int::in, int::in,
 		    buffer::uo, int::out, io__state::di, io__state::uo) is det.
 
 :- pragma foreign_proc("C",
 	io__read_into_buffer(Stream::in, Buffer0::di, Pos0::in, Size::in,
-		    Buffer::uo, Pos::out, _IO0::di, _IO::uo),
+		    Buffer::uo, Pos::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "{
@@ -2045,49 +2064,12 @@
 
 	Buffer = (MR_Word) buffer;
 	Pos = Pos0 + items_read;
-}").
 
-:- pragma foreign_proc("MC++",
-	io__alloc_buffer(_Size::in, _Buffer::uo),
-		[will_not_call_mercury, promise_pure, thread_safe,
-			tabled_for_io],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
-:- pragma foreign_proc("MC++",
-	io__resize_buffer(_Buffer0::di, _OldSize::in,
-		_NewSize::in, _Buffer::uo),
-	[will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
-:- pragma foreign_proc("MC++", 
-	io__buffer_to_string(_Buffer::di, _Len::in, _Str::uo),
-		[will_not_call_mercury, promise_pure, thread_safe,
-			tabled_for_io],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
-:- pragma foreign_proc("MC++",
-	io__buffer_to_string(_Buffer::di, _Str::uo),
-		[will_not_call_mercury, promise_pure, thread_safe,
-			tabled_for_io],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
-:- pragma foreign_proc("MC++",
-	io__read_into_buffer(_Stream::in, _Buffer0::di, _Pos0::in, _Size::in,
-		    _Buffer::uo, _Pos::out, _IO0::di, _IO::uo),
-		[will_not_call_mercury, promise_pure, thread_safe,
-			tabled_for_io],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	update_io(IO0, IO);
 }").
 
+io__read_into_buffer(_, _, _, _, _, _) -->
+	{ private_builtin__sorry("io__read_into_buffer") }.
 
 %-----------------------------------------------------------------------------%
 
@@ -2995,6 +2977,12 @@
 	update_io(IO0, IO);
 ").
 
+io__get_stream_names(_) -->
+	{ private_builtin__sorry("io__get_stream_names") }.
+
+io__set_stream_names(_) -->
+	{ private_builtin__sorry("io__set_stream_names") }.
+
 :- pred io__delete_stream_name(io__stream, io__state, io__state).
 :- mode io__delete_stream_name(in, di, uo) is det.
 
@@ -3052,6 +3040,12 @@
 	update_io(IOState0, IOState);
 ").
 
+io__set_globals(_) -->
+	{ private_builtin__sorry("io__set_globals") }.
+
+io__get_globals(_) -->
+	{ private_builtin__sorry("io__get_globals") }.
+
 io__progname_base(DefaultName, PrognameBase) -->
 	io__progname(DefaultName, Progname),
 	{ dir__basename(Progname, PrognameBase) }.
@@ -3093,7 +3087,8 @@
 	Id = mf->id;
 ").
 
-
+io__get_stream_id(_, _) :-
+	private_builtin__sorry("io__get_stream_id").
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -3212,22 +3207,28 @@
 	ascii_encoder =	new System::Text::ASCIIEncoding();
 ").
 
+io__gc_init(_, _) -->
+	{ private_builtin__sorry("io__gc_init") }.
+
 :- pred io__stream_init(io__state, io__state).
 :- mode io__stream_init(di, uo) is det.
 
-:- pragma foreign_proc("MC++", 
+:- pragma foreign_proc("C", 
 		io__stream_init(IO0::di, IO::uo), [will_not_call_mercury,
 			promise_pure], "
-	ascii_encoder =	new System::Text::ASCIIEncoding();
 	update_io(IO0, IO);
 ").
 
-:- pragma foreign_proc("C", 
+:- pragma foreign_proc("MC++", 
 		io__stream_init(IO0::di, IO::uo), [will_not_call_mercury,
 			promise_pure], "
+	ascii_encoder =	new System::Text::ASCIIEncoding();
 	update_io(IO0, IO);
 ").
 
+io__stream_init -->
+	{ private_builtin__sorry("io__stream_init") }.
+
 :- pred io__insert_std_stream_names(io__state, io__state).
 :- mode io__insert_std_stream_names(di, uo) is det.
 
@@ -3967,6 +3968,14 @@
 	update_io(IO0, IO);
 }").
 
+io__read_char_code(_, _) -->
+	{ private_builtin__sorry("io__read_char_code") }.
+
+io__putback_char(_, _) -->
+	{ private_builtin__sorry("io__putback_char") }.
+
+io__putback_byte(_, _) -->
+	{ private_builtin__sorry("io__putback_byte") }.
 
 /* output predicates - with output to mercury_current_text_output */
 
@@ -4126,6 +4135,29 @@
 	update_io(IO0, IO);
 ").
 
+io__write_string(_) -->
+	{ private_builtin__sorry("io__write_string") }.
+
+io__write_char(_) -->
+	{ private_builtin__sorry("io__write_char") }.
+
+io__write_int(_) -->
+	{ private_builtin__sorry("io__write_int") }.
+
+io__write_float(_) -->
+	{ private_builtin__sorry("io__write_float") }.
+
+io__write_byte(_) -->
+	{ private_builtin__sorry("io__write_byte") }.
+
+io__write_bytes(_) -->
+	{ private_builtin__sorry("io__write_bytes") }.
+
+io__flush_output -->
+	{ private_builtin__sorry("io__flush_output") }.
+
+io__flush_binary_output -->
+	{ private_builtin__sorry("io__flush_binary_output") }.
 
 /* moving about binary streams */
 
@@ -4158,8 +4190,7 @@
 		mercury_io_error(stream,
 				""io__seek_binary_2: unseekable stream"");
 	}
-
-	IO = IO0;
+	update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4177,29 +4208,14 @@
 		mercury_io_error(stream,
 			""io__binary_stream_offset: untellable stream"");
 	}
-	IO = IO0;
-}").
-
-:- pragma foreign_proc("MC++",
-	io__seek_binary_2(_Stream::in, _Flag::in, _Off::in,
-		IO0::di, IO::uo),
-		[will_not_call_mercury, promise_pure, thread_safe,
-			tabled_for_io],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-	IO = IO0;
+	update_io(IO0, IO);
 }").
 
-:- pragma foreign_proc("MC++",
-	io__binary_stream_offset(_Stream::in, _Offset::out,
-		IO0::di, IO::uo),
-		[will_not_call_mercury, promise_pure, thread_safe,
-			tabled_for_io],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-	IO = IO0;
-}").
+io__seek_binary_2(_, _, _) -->
+	{ private_builtin__sorry("io__seek_binary_2") }.
 
+io__binary_stream_offset(_, _) -->
+	{ private_builtin__sorry("io__binary_stream_offset") }.
 
 /* output predicates - with output to the specified stream */
 
@@ -4385,6 +4401,29 @@
 	update_io(IO0, IO);
 }").
 
+io__write_string(_, _) -->
+	{ private_builtin__sorry("io__write_string") }.
+
+io__write_char(_, _) -->
+	{ private_builtin__sorry("io__write_char") }.
+
+io__write_int(_, _) -->
+	{ private_builtin__sorry("io__write_int") }.
+
+io__write_float(_, _) -->
+	{ private_builtin__sorry("io__write_float") }.
+
+io__write_byte(_, _) -->
+	{ private_builtin__sorry("io__write_byte") }.
+
+io__write_bytes(_, _) -->
+	{ private_builtin__sorry("io__write_bytes") }.
+
+io__flush_output(_) -->
+	{ private_builtin__sorry("io__flush_output") }.
+
+io__flush_binary_output(_) -->
+	{ private_builtin__sorry("io__flush_binary_output") }.
 
 /* stream predicates */
 
@@ -4510,7 +4549,7 @@
 	LineNum = MR_line_number(*mercury_current_text_output);
 	update_io(IO0, IO);
 ").
-	
+
 :- pragma foreign_proc("C",
 	io__get_output_line_number(Stream::in, LineNum::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
@@ -4799,6 +4838,80 @@
 	update_io(IO0, IO);
 ").
 
+io__stdin_stream(_) -->
+	{ private_builtin__sorry("io__stdin_stream") }.
+
+io__stdout_stream(_) -->
+	{ private_builtin__sorry("io__stdout_stream") }.
+
+io__stderr_stream(_) -->
+	{ private_builtin__sorry("io__stderr_stream") }.
+
+io__stdin_binary_stream(_) -->
+	{ private_builtin__sorry("io__stdin_binary_stream") }.
+
+io__stdout_binary_stream(_) -->
+	{ private_builtin__sorry("io__stdout_binary_stream") }.
+
+io__input_stream(_) -->
+	{ private_builtin__sorry("io__input_stream") }.
+
+io__output_stream(_) -->
+	{ private_builtin__sorry("io__output_stream") }.
+
+io__binary_input_stream(_) -->
+	{ private_builtin__sorry("io__binary_input_stream") }.
+
+io__binary_output_stream(_) -->
+	{ private_builtin__sorry("io__binary_output_stream") }.
+
+io__get_line_number(_) -->
+	{ private_builtin__sorry("io__get_line_number") }.
+
+io__get_line_number(_, _) -->
+	{ private_builtin__sorry("io__get_line_number") }.
+
+io__set_line_number(_) -->
+	{ private_builtin__sorry("io__set_line_number") }.
+
+io__set_line_number(_, _) -->
+	{ private_builtin__sorry("io__set_line_number") }.
+
+io__get_output_line_number(_) -->
+	{ private_builtin__sorry("io__get_output_line_number") }.
+	
+io__get_output_line_number(_, _) -->
+	{ private_builtin__sorry("io__get_output_line_number") }.
+	
+io__set_output_line_number(_) -->
+	{ private_builtin__sorry("io__set_output_line_number") }.
+	
+io__set_output_line_number(_, _) -->
+	{ private_builtin__sorry("io__set_output_line_number") }.
+	
+io__current_input_stream(_) -->
+	{ private_builtin__sorry("io__current_input_stream") }.
+
+io__current_output_stream(_) -->
+	{ private_builtin__sorry("io__current_output_stream") }.
+
+io__current_binary_input_stream(_) -->
+	{ private_builtin__sorry(io__current_binary_input_stream) }.
+
+io__current_binary_output_stream(_) -->
+	{ private_builtin__sorry(io__current_binary_output_stream) }.
+
+io__set_input_stream(_, _) -->
+	{ private_builtin__sorry("io__set_input_stream") }.
+
+io__set_output_stream(_, _) -->
+	{ private_builtin__sorry("io__set_output_stream") }.
+
+io__set_binary_input_stream(_, _) -->
+	{ private_builtin__sorry("io__set_binary_input_stream") }.
+
+io__set_binary_output_stream(_, _) -->
+	{ private_builtin__sorry("io__set_binary_output_stream") }.
 
 /* stream open/close predicates */
 
@@ -4828,6 +4941,9 @@
 	update_io(IO0, IO);
 ").
 
+io__do_open(_, _, _, _) -->
+	{ private_builtin__sorry("io__do_open") }.
+
 io__close_input(Stream) -->
 	io__delete_stream_name(Stream),
 	io__close_stream(Stream).
@@ -4860,12 +4976,10 @@
 	update_io(IO0, IO);
 ").
 
-/* miscellaneous predicates */
+io__close_stream(_) -->
+	{ private_builtin__sorry("io__close_stream") }.
 
-io__progname(DefaultProgName::in, ProgName::out, IO::di, IO::uo) :-
-	% This is a fall-back for back-ends which don't support the
-	% C interface.
-	ProgName = DefaultProgName.
+/* miscellaneous predicates */
 
 :- pragma foreign_proc("C",
 	io__progname(DefaultProgname::in, PrognameOut::out, IO0::di, IO::uo),
@@ -4890,6 +5004,62 @@
 	update_io(IO0, IO);
 ").
 
+io__progname(DefaultProgName::in, ProgName::out, IO::di, IO::uo) :-
+	% This is a fall-back for back-ends which don't support the
+	% C interface.
+	ProgName = DefaultProgName.
+
+io__handle_system_command_exit_status(Code0) = Status :-
+	Code = io__handle_system_command_exit_code(Code0),
+	( Code = 127 ->
+		Status = error(
+			io_error("unknown result code from system command"))
+	; Code < 0 ->
+		Status = ok(signalled(-Code))
+	;
+		Status = ok(exited(Code))
+	).
+
+	% Interpret the child process exit status returned by
+	% system() or wait(): return negative for `signalled',
+	% non-negative for `exited', or 127 for anything else
+	% (e.g. an error invoking the command).
+:- func io__handle_system_command_exit_code(int) = int.
+
+:- pragma foreign_proc("C",
+	io__handle_system_command_exit_code(Status0::in) = (Status::out),
+	[will_not_call_mercury, thread_safe, promise_pure],
+"
+	#if defined (WIFEXITED) && defined (WEXITSTATUS) && \
+            defined (WIFSIGNALED) && defined (WTERMSIG)
+		if (WIFEXITED(Status0)) {
+			Status = WEXITSTATUS(Status0);
+		} else if (WIFSIGNALED(Status0)) {
+			Status = -WTERMSIG(Status0);
+		} else {
+			Status = 127;
+		}
+	#else
+		if (Status0 & 0xff != 0) {
+			/* the process was killed by a signal */
+			Status = -(Status0 & 0xff);
+		} else {
+			/* the process terminated normally */
+			Status = (Status0 & 0xff00) >> 8;
+		}
+	#endif
+").
+
+% This is a fall-back for back-ends that don't support the C interface.
+io__handle_system_command_exit_code(Status0::in) = (Status::out) :-
+	( (Status0 /\ 0xff) \= 0 ->
+		/* the process was killed by a signal */
+		Status = -(Status0 /\ 0xff)
+	;
+		/* the process terminated normally */
+		Status = (Status0 /\ 0xff00) >> 8
+	).
+
 :- pragma foreign_proc("C",
 	io__command_line_arguments(Args::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io,
@@ -4944,58 +5114,6 @@
 	update_io(IO0, IO);
 ").
 
-
-io__handle_system_command_exit_status(Code0) = Status :-
-	Code = io__handle_system_command_exit_code(Code0),
-	( Code = 127 ->
-		Status = error(
-			io_error("unknown result code from system command"))
-	; Code < 0 ->
-		Status = ok(signalled(-Code))
-	;
-		Status = ok(exited(Code))
-	).
-
-	% Interpret the child process exit status returned by
-	% system() or wait(): return negative for `signalled',
-	% non-negative for `exited', or 127 for anything else
-	% (e.g. an error invoking the command).
-:- func io__handle_system_command_exit_code(int) = int.
-
-% This is a fall-back for back-ends that don't support the C interface.
-io__handle_system_command_exit_code(Status0::in) = (Status::out) :-
-	( (Status0 /\ 0xff) \= 0 ->
-		/* the process was killed by a signal */
-		Status = -(Status0 /\ 0xff)
-	;
-		/* the process terminated normally */
-		Status = (Status0 /\ 0xff00) >> 8
-	).
-
-:- pragma foreign_proc("C",
-	io__handle_system_command_exit_code(Status0::in) = (Status::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"
-	#if defined (WIFEXITED) && defined (WEXITSTATUS) && \
-            defined (WIFSIGNALED) && defined (WTERMSIG)
-		if (WIFEXITED(Status0)) {
-			Status = WEXITSTATUS(Status0);
-		} else if (WIFSIGNALED(Status0)) {
-			Status = -WTERMSIG(Status0);
-		} else {
-			Status = 127;
-		}
-	#else
-		if (Status0 & 0xff != 0) {
-			/* the process was killed by a signal */
-			Status = -(Status0 & 0xff);
-		} else {
-			/* the process terminated normally */
-			Status = (Status0 & 0xff00) >> 8;
-		}
-	#endif
-").
-
 :- pragma foreign_proc("MC++",
 	io__command_line_arguments(Args::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io,
@@ -5026,6 +5144,7 @@
 	update_io(IO0, IO);
 ").
 
+/*
 :- pragma foreign_proc("MC++",
 	io__call_system_code(Command::in, Status::out, _Msg::out,
 			IO0::di, IO::uo),
@@ -5041,25 +5160,27 @@
 	Status = NULL;
 	update_io(IO0, IO);
 ").
+*/
 
-io__current_input_stream(_::out, _::di, _::uo) :- 
-	private_builtin__sorry("io__current_input_stream/3").
+io__command_line_arguments(_) -->
+	{ private_builtin__sorry("io__command_line_arguments") }.
 
-io__current_output_stream(_::out, _::di, _::uo) :- 
-	private_builtin__sorry("io__current_output_stream/3").
+io__get_exit_status(_) -->
+	{ private_builtin__sorry("io__get_exit_status") }.
 
-io__current_binary_input_stream(_::out, _::di, _::uo) :- 
-	private_builtin__sorry("io__current_binary_input_stream/3").
+io__set_exit_status(_) -->
+	{ private_builtin__sorry("io__set_exit_status") }.
 
-io__current_binary_output_stream(_::out, _::di, _::uo) :- 
-	private_builtin__sorry("io__current_binary_output_stream/3").
+io__call_system_code(_, _, _) -->
+	{ private_builtin__sorry("io__call_system_code") }.
 
 /*---------------------------------------------------------------------------*/
 
 /* io__getenv and io__putenv, from io.m */
 
+:- pragma promise_semipure(io__getenv/2).
 :- pragma foreign_proc("C", io__getenv(Var::in, Value::out),
-		[will_not_call_mercury, promise_semipure, tabled_for_io],
+		[will_not_call_mercury, tabled_for_io],
 "{
 	Value = getenv(Var);
 	SUCCESS_INDICATOR = (Value != 0);
@@ -5072,7 +5193,7 @@
 ").
 
 :- pragma foreign_proc("MC++", io__getenv(Var::in, Value::out),
-		[will_not_call_mercury, promise_semipure, tabled_for_io],
+		[will_not_call_mercury, tabled_for_io],
 "{
 	Value = System::Environment::GetEnvironmentVariable(Var);
 	SUCCESS_INDICATOR = (Value != 0);
@@ -5086,6 +5207,13 @@
 	SUCCESS_INDICATOR = 0;
 ").
 
+io__getenv(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("io__getenv").
+
+io__putenv(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("io__putenv").
 
 /*---------------------------------------------------------------------------*/
 
@@ -5203,15 +5331,8 @@
 	update_io(IO0, IO);
 }").
 
-:- pragma foreign_proc("MC++",
-	io__do_make_temp(_Dir::in, _Prefix::in, _FileName::out,
-		_Error::out, _ErrorMessage::out, IO0::di, IO::uo),
-		[will_not_call_mercury, promise_pure, thread_safe],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-	update_io(IO0, IO);
-}").
-
+io__do_make_temp(_, _, _, _, _) -->
+	{ private_builtin__sorry("io__do_make_temp") }.
 
 /*---------------------------------------------------------------------------*/
 
@@ -5282,6 +5403,7 @@
 	update_io(IO0, IO);
 }").
 
+/*
 :- pragma foreign_proc("MC++",
 	io__remove_file_2(FileName::in, RetVal::out, RetStr::out,
 		IO0::di, IO::uo),
@@ -5294,7 +5416,10 @@
 	RetStr = """";
 	update_io(IO0, IO);
 }").
+*/
 
+io__remove_file_2(_, _, _) -->
+	{ private_builtin__sorry("io__remove_file_2") }.
 
 io__rename_file(OldFileName, NewFileName, Result, IO0, IO) :-
 	io__rename_file_2(OldFileName, NewFileName, Res, ResString, IO0, IO),
@@ -5319,16 +5444,8 @@
 	update_io(IO0, IO);
 }").
 
-:- pragma foreign_proc("MC++",
-		io__rename_file_2(_OldFileName::in, _NewFileName::in,
-			_RetVal::out, _RetStr::out, IO0::di, IO::uo),
-		[will_not_call_mercury, promise_pure, tabled_for_io,
-			thread_safe],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-	update_io(IO0, IO);
-}").
-
+io__rename_file_2(_, _, _, _) -->
+	{ private_builtin__sorry("io__rename_file_2") }.
 
 /*---------------------------------------------------------------------------*/
 
Index: library/library.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/library.m,v
retrieving revision 1.61
diff -u -r1.61 library.m
--- library/library.m	30 Jan 2002 06:02:37 -0000	1.61
+++ library/library.m	11 Jun 2002 10:16:39 -0000
@@ -76,5 +76,8 @@
 	Version = MR_VERSION "", configured for "" MR_FULLARCH;
 ").
 
+library__version(_) :-
+	private_builtin__sorry("library__version").
+
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: library/math.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/math.m,v
retrieving revision 1.38
diff -u -r1.38 math.m
--- library/math.m	18 Feb 2002 07:01:06 -0000	1.38
+++ library/math.m	11 Jun 2002 10:16:40 -0000
@@ -264,6 +264,10 @@
 #endif
 ").
 
+domain_checks :-
+	semidet_succeed,
+	private__builtin__sorry("domain_checks").
+
 %
 % Mathematical constants from math.m
 %
@@ -277,6 +281,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Pi = System.Math.PI;
 ").
+math__pi = _ :-
+	private__builtin__sorry("math__pi").
 
 	% Base of natural logarithms
 :- pragma foreign_proc("C", math__e = (E::out),
@@ -287,6 +293,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	E = System.Math.E;
 ").
+math__e = _ :-
+	private__builtin__sorry("math__e").
 
 %
 % math__ceiling(X) = Ceil is true if Ceil is the smallest integer
@@ -302,6 +310,8 @@
 "
 	Ceil = System.Math.Ceiling(Num);
 ").
+math__ceiling(_) = _ :-
+	private__builtin__sorry("math__ceiling").
 
 %
 % math__floor(X) = Floor is true if Floor is the largest integer
@@ -317,6 +327,8 @@
 "
 	Floor = System.Math.Floor(Num);
 ").
+math__floor(_) = _ :-
+	private__builtin__sorry("math__floor").
 
 %
 % math__round(X) = Round is true if Round is the integer
@@ -335,6 +347,8 @@
 	// Unfortunately they are better (round to nearest even number).
 	Rounded = System.Math.Floor(Num+0.5);
 ").
+math__round(_) = _ :-
+	private__builtin__sorry("math__round").
 
 %
 % math__truncate(X) = Trunc is true if Trunc is the integer
@@ -366,7 +380,8 @@
 		[thread_safe, promise_pure], "
 	SquareRoot = System.Math.Sqrt(X);
 ").
-
+math__sqrt_2(_) = _ :-
+	private__builtin__sorry("math__sqrt_2").
 
 %
 % math__solve_quadratic(A, B, C) = Roots is true if Roots are
@@ -443,6 +458,8 @@
 		[thread_safe, promise_pure], "
 	Res = System.Math.Pow(X, Y);
 ").
+math__pow_2(_, _) = _ :-
+	private__builtin__sorry("math__pow_2").
 
 
 %
@@ -457,6 +474,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Exp = System.Math.Exp(X);
 ").
+math__exp(_) = _ :-
+	private__builtin__sorry("math__exp").
 
 %
 % math__ln(X) = Log is true if Log is the natural logarithm
@@ -482,6 +501,8 @@
 		[thread_safe, promise_pure], "
 	Log = System.Math.Log(X);
 ").
+math__ln_2(_) = _ :-
+	private__builtin__sorry("math__ln_2").
 
 %
 % math__log10(X) = Log is true if Log is the logarithm to
@@ -507,6 +528,8 @@
 		[thread_safe, promise_pure], "
 	Log10 = System.Math.Log10(X);
 ").
+math__log10_2(_) = _ :-
+	private__builtin__sorry("math__log10_2").
 
 %
 % math__log2(X) = Log is true if Log is the logarithm to
@@ -532,6 +555,8 @@
 		[thread_safe, promise_pure], "
 	Log2 = System.Math.Log(X) / ML_FLOAT_LN2;
 ").
+math__log2_2(_) = _ :-
+	private__builtin__sorry("math__log2_2").
 
 %
 % math__log(B, X) = Log is true if Log is the logarithm to
@@ -565,6 +590,8 @@
 		[thread_safe, promise_pure], "
 	Log = System.Math.Log(X,B);
 ").
+math__log_2(_, _) = _ -
+	private_builtin__sorry("math__log_2").
 
 
 %
@@ -578,6 +605,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Sin = System.Math.Sin(X);
 ").
+math__sin(_) = _ :-
+	private__builtin__sorry("math__sin").
 
 
 %
@@ -591,6 +620,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Cos = System.Math.Cos(X);
 ").
+math__cos(_) = _ :-
+	private__builtin__sorry("math__cos").
 
 %
 % math__tan(X) = Tan is true if Tan is the tangent of X.
@@ -603,6 +634,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Tan = System.Math.Tan(X);
 ").
+math__tan(_) = _ :-
+	private__builtin__sorry("math__tan").
 
 %
 % math__asin(X) = ASin is true if ASin is the inverse
@@ -633,6 +666,8 @@
 		[thread_safe, promise_pure], "
 	ASin = System.Math.Asin(X);
 ").
+math__asin_2(_) = _ :-
+	private__builtin__sorry("math__asin_2").
 
 %
 % math__acos(X) = ACos is true if ACos is the inverse
@@ -663,6 +698,8 @@
 		[thread_safe, promise_pure], "
 	ACos = System.Math.Acos(X);
 ").
+math__acos_2(_) = _ :-
+	private__builtin__sorry("math__acos_2").
 
 
 %
@@ -677,6 +714,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	ATan = System.Math.Atan(X);
 ").
+math__atan(_) = _ :-
+	private__builtin__sorry("math__atan").
 
 %
 % math__atan2(Y, X) = ATan is true if ATan is the inverse
@@ -690,6 +729,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "
 	ATan2 = System.Math.Atan2(Y, X);
 ").
+math__atan2(_, _) = _ :-
+	private__builtin__sorry("math__atan2").
 
 %
 % math__sinh(X) = Sinh is true if Sinh is the hyperbolic
@@ -703,6 +744,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Sinh = System.Math.Sinh(X);
 ").
+math__sinh(_) = _ :-
+	private__builtin__sorry("math__sinh").
 
 %
 % math__cosh(X) = Cosh is true if Cosh is the hyperbolic
@@ -716,6 +759,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Cosh = System.Math.Cosh(X);
 ").
+math__cosh(_) = _ :-
+	private__builtin__sorry("math__cosh").
 
 %
 % math__tanh(X) = Tanh is true if Tanh is the hyperbolic
@@ -729,6 +774,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe],"
 	Tanh = System.Math.Tanh(X);
 ").
+math__tanh(_) = _ :-
+	private__builtin__sorry("math__tanh").
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.101
diff -u -r1.101 private_builtin.m
--- library/private_builtin.m	7 Jun 2002 00:48:52 -0000	1.101
+++ library/private_builtin.m	11 Jun 2002 10:16:41 -0000
@@ -169,7 +169,8 @@
 "
 	Res = System::String::Compare(S1, S2);
 ").
-	
+builtin_strcmp(_, _, _) :-
+	sorry("builtin_strcmp").
 
 builtin_unify_float(F, F).
 
@@ -876,6 +877,18 @@
 	TypeClassInfo =
 		MR_typeclass_info_arg_typeclass_info(TypeClassInfo0, Index);
 ").
+
+type_info_from_typeclass_info(_, _, _) :-
+	sorry("type_info_from_typeclass_info").
+
+unconstrained_type_info_from_typeclass_info(_, _, _) :-
+	sorry("unconstrained_type_info_from_typeclass_info").
+
+superclass_from_typeclass_info(_, _, _) :-
+	sorry("superclass_from_typeclass_info").
+
+instance_constraint_from_typeclass_info(_, _, _) :-
+	sorry("instance_constraint_from_typeclass_info").
 
 
 %-----------------------------------------------------------------------------%
Index: library/profiling_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/profiling_builtin.m,v
retrieving revision 1.5
diff -u -r1.5 profiling_builtin.m
--- library/profiling_builtin.m	17 Jul 2001 13:32:05 -0000	1.5
+++ library/profiling_builtin.m	11 Jun 2002 10:16:41 -0000
@@ -1619,292 +1619,179 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("MC++", prepare_for_normal_call(_N::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""prepare_for_normal_call"");
-}").
-:- pragma foreign_proc("MC++", prepare_for_special_call(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""prepare_for_special_call"");
-}").
-:- pragma foreign_proc("MC++", prepare_for_ho_call(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""prepare_for_ho_call"");
-}").
-:- pragma foreign_proc("MC++", prepare_for_method_call(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""prepare_for_method_call"");
-}").
-:- pragma foreign_proc("MC++", prepare_for_callback(_N::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""prepare_for_callback"");
-}").
-:- pragma foreign_proc("MC++", prepare_for_tail_call(_N::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""prepare_for_tail_call"");
-}").
-:- pragma foreign_proc("MC++", det_call_port_code_ac(_A::in, _B::out, _C::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""det_call_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		det_call_port_code_sr(_A::in, _B::out, _C::out, _D::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""det_call_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++", det_exit_port_code_ac(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""det_exit_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		det_exit_port_code_sr(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""det_call_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++", semi_call_port_code_ac(_A::in, _B::out, _C::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX semi_call_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		semi_call_port_code_sr(_A::in, _B::out, _C::out, _D::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX semi_call_port_code_sr"");
-}").
-:- pragma foreign_proc("MC++", semi_exit_port_code_ac(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX semi_exit_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		semi_exit_port_code_sr(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX semi_exit_port_code_sr"");
-}").
-:- pragma foreign_proc("MC++", semi_fail_port_code_ac(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX semi_fail_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		semi_fail_port_code_sr(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX semi_fail_port_code_sr"");
-}").
-:- pragma foreign_proc("MC++", 
-		non_call_port_code_ac(_A::in, _B::out, _C::out, _D::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_call_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		non_call_port_code_sr(_A::in, _B::out, _C::out, _D::out, _E::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_call_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++", non_exit_port_code_ac(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_exit_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		non_exit_port_code_sr(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_call_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++", non_fail_port_code_ac(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_fail_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		non_fail_port_code_sr(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_fail_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++", non_redo_port_code_ac(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_redo_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++", non_redo_port_code_sr(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""non_redo_port_code_ac"");
-}").
-:- pragma foreign_proc("MC++",
-		save_and_zero_activation_info_ac(_A::out, _B::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_and_zero_activation_info_ac"");
-}").
-:- pragma foreign_proc("MC++", save_and_zero_activation_info_sr(_A::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_and_zero_activation_info_sr"");
-}").
-:- pragma foreign_proc("MC++", rezero_activation_info_ac,
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""rezero_activation_info_ac"");
-}").
-:- pragma foreign_proc("MC++", rezero_activation_info_sr,
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""rezero_activation_info_sr"");
-}").
-:- pragma foreign_proc("MC++", reset_activation_info_ac(_A::in, _B::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""reset_activation_info_ac"");
-}").
-:- pragma foreign_proc("MC++", reset_activation_info_sr(_A::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""reset_activation_info_sr"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_1(_A::in, _B::in, _C::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_1"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_2(_A::in, _B::in, _C::out, _D::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_2"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_3(_A::in, _B::in, _C::out, _D::out,
-			_E::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_3"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_4(_A::in, _B::in, _C::out, _D::out,
-			_E::out, _F::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_4"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_5(_A::in, _B::in, _C::out, _D::out,
-			_E::out, _F::out, _G::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_5"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_6(_A::in, _B::in, _C::out, _D::out,
-			_E::out, _F::out, _G::out, _H::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_6"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_7(_A::in, _B::in, _C::out, _D::out,
-			_E::out, _F::out, _G::out, _H::out, _I::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_7"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_8(_A::in, _B::in, _C::out, _D::out,
-			_E::out, _F::out, _G::out, _H::out, _I::out, _J::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_8"");
-}").
-:- pragma foreign_proc("MC++",
-		save_recursion_depth_9(_A::in, _B::in, _C::out, _D::out,
-			_E::out, _F::out, _G::out, _H::out, _I::out, _J::out,
-			_K::out),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""XXX save_recursion_depth_9"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_1(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_1"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_2(_A::in, _B::in, _C::in, _D::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_2"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_3(_A::in, _B::in, _C::in, _D::in,
-			_E::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_3"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_4(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_4"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_5(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_5"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_6(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_6"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_7(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in, _I::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_7"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_8(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in, _I::in, _J::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_8"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_exit_9(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in, _I::in, _J::in,
-			_K::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_exit_9"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_1(_A::in, _B::in, _C::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_1"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_2(_A::in, _B::in, _C::in, _D::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_2"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_3(_A::in, _B::in, _C::in, _D::in,
-			_E::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_3"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_4(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_4"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_5(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_5"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_6(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_6"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_7(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in, _I::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_7"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_8(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in, _I::in, _J::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_8"");
-}").
-:- pragma foreign_proc("MC++",
-		restore_recursion_depth_fail_9(_A::in, _B::in, _C::in, _D::in,
-			_E::in, _F::in, _G::in, _H::in, _I::in, _J::in,
-			_K::in),
-		[thread_safe, will_not_call_mercury], "{
-	mercury::runtime::Errors::SORRY(""restore_recursion_depth_fail_9"");
-}").
+:- import_module std_util.
+
+prepare_for_normal_call(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("prepare_for_normal_call").
+prepare_for_special_call(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("prepare_for_special_call").
+prepare_for_ho_call(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("prepare_for_ho_call").
+prepare_for_method_call(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("prepare_for_method_call").
+prepare_for_callback(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("prepare_for_callback").
+prepare_for_tail_call(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("prepare_for_tail_call").
+
+det_call_port_code_ac(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("det_call_port_code_ac").
+det_call_port_code_sr(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("det_call_port_code_sr").
+det_exit_port_code_ac(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("det_exit_port_code_ac").
+det_exit_port_code_sr(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("det_exit_port_code_sr").
+semi_call_port_code_ac(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("semi_call_port_code_ac").
+semi_call_port_code_sr(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("semi_call_port_code_sr").
+semi_exit_port_code_ac(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("semi_exit_port_code_ac").
+semi_exit_port_code_sr(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("semi_exit_port_code_sr").
+semi_fail_port_code_ac(_, _) :-
+	impure private_builtin__imp,
+	semidet_succeed,
+	private_builtin__sorry("semi_fail_port_code_ac").
+semi_fail_port_code_sr(_, _, _) :-
+	impure private_builtin__imp,
+	semidet_succeed,
+	private_builtin__sorry("semi_fail_port_code_sr").
+non_call_port_code_ac(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_call_port_code_ac").
+non_call_port_code_sr(_, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_call_port_code_sr").
+non_exit_port_code_ac(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_exit_port_code_ac").
+non_exit_port_code_sr(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_exit_port_code_sr").
+non_fail_port_code_ac(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_fail_port_code_ac").
+non_fail_port_code_sr(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_fail_port_code_sr").
+non_redo_port_code_ac(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_redo_port_code_ac").
+non_redo_port_code_sr(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("non_redo_port_code_sr").
+save_and_zero_activation_info_ac(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_and_zero_activation_info_ac").
+save_and_zero_activation_info_sr(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_and_zero_activation_info_sr").
+rezero_activation_info_ac :-
+	impure private_builtin__imp,
+	private_builtin__sorry("rezero_activation_info_ac").
+rezero_activation_info_sr :-
+	impure private_builtin__imp,
+	private_builtin__sorry("rezero_activation_info_sr").
+reset_activation_info_ac(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("reset_activation_info_ac").
+reset_activation_info_sr(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("reset_activation_info_sr").
+save_recursion_depth_1(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_1").
+save_recursion_depth_2(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_2").
+save_recursion_depth_3(_, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_3").
+save_recursion_depth_4(_, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_4").
+save_recursion_depth_5(_, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_5").
+save_recursion_depth_6(_, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_6").
+save_recursion_depth_7(_, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_7").
+save_recursion_depth_8(_, _, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_8").
+save_recursion_depth_9(_, _, _, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("save_recursion_depth_9").
+restore_recursion_depth_exit_1(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_1").
+restore_recursion_depth_exit_2(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_2").
+restore_recursion_depth_exit_3(_, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_3").
+restore_recursion_depth_exit_4(_, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_4").
+restore_recursion_depth_exit_5(_, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_5").
+restore_recursion_depth_exit_6(_, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_6").
+restore_recursion_depth_exit_7(_, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_7").
+restore_recursion_depth_exit_8(_, _, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_8").
+restore_recursion_depth_exit_9(_, _, _, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_exit_9").
+restore_recursion_depth_fail_1(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_1").
+restore_recursion_depth_fail_2(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_2").
+restore_recursion_depth_fail_3(_, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_3").
+restore_recursion_depth_fail_4(_, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_4").
+restore_recursion_depth_fail_5(_, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_5").
+restore_recursion_depth_fail_6(_, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_6").
+restore_recursion_depth_fail_7(_, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_7").
+restore_recursion_depth_fail_8(_, _, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_8").
+restore_recursion_depth_fail_9(_, _, _, _, _, _, _, _, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("restore_recursion_depth_fail_9").
Index: library/rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.16
diff -u -r1.16 rtti_implementation.m
--- library/rtti_implementation.m	24 Apr 2002 07:37:37 -0000	1.16
+++ library/rtti_implementation.m	11 Jun 2002 10:16:42 -0000
@@ -127,19 +127,24 @@
 :- type pseudo_type_info ---> pred_type(c_pointer).
 
 :- pragma foreign_proc("C#",
-	get_type_info(_T::unused) = (TypeInfo::out),
+	get_type_info(T::unused) = (TypeInfo::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
 " 
+	// T
 	TypeInfo = TypeInfo_for_T;
 ").
 
 :- pragma foreign_proc("C",
-	get_type_info(_T::unused) = (TypeInfo::out), 
+	get_type_info(T::unused) = (TypeInfo::out), 
 	[will_not_call_mercury, promise_pure, thread_safe],
 "
+	/* T */
 	TypeInfo = TypeInfo_for_T;
 ").
 
+get_type_info(_) = _ :-
+	private_builtin__sorry("get_type_info").
+
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
@@ -891,7 +896,6 @@
 	System.Array.Copy(OldTypeInfo, NewTypeInfo, OldTypeInfo.Length);
 ").
 
-
 	% Get the pseudo-typeinfo at the given index from the argument types.
 	
 :- some [T] func get_pti_from_arg_types(arg_types, int) = T.
@@ -1088,6 +1092,9 @@
 		(MR_TypeInfo) TypeInfo);
 ").
 
+get_type_ctor_info(_) = _ :-
+	private_builtin__sorry("get_type_ctor_info").
+
 
 :- pred same_pointer_value(T::in, T::in) is semidet.
 :- pred same_pointer_value_untyped(T::in, U::in) is semidet.
@@ -1106,7 +1113,8 @@
 "
 	SUCCESS_INDICATOR = (T1 == T2);
 ").
-
+same_pointer_value_untyped(_, _) :-
+	private_builtin__sorry("same_pointer_value_untyped").
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -1395,6 +1403,8 @@
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
 	Arity = tci->MR_type_ctor_arity;
 ").
+type_ctor_arity(_) = _ :-
+	private_builtin__sorry("type_ctor_arity").
 
 :- some [P] func type_ctor_unify_pred(type_ctor_info) = P.
 :- pragma foreign_proc("C#",
@@ -1411,6 +1421,8 @@
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
 	UnifyPred = (MR_Integer) tci->MR_type_ctor_unify_pred;
 ").
+type_ctor_unify_pred(_) = _ :-
+	private_builtin__sorry("type_ctor_unify_pred").
 
 :- some [P] func type_ctor_compare_pred(type_ctor_info) = P.
 :- pragma foreign_proc("C#",
@@ -1427,6 +1439,8 @@
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
 	UnifyPred = (MR_Integer) tci->MR_type_ctor_compare_pred;
 ").
+type_ctor_compare_pred(_) = _ :-
+	private_builtin__sorry("type_ctor_compare_pred").
 
 
 
@@ -1447,6 +1461,8 @@
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
 	TypeCtorRep = MR_type_ctor_rep(tci);
 ").
+type_ctor_rep(_) = _ :-
+	private_builtin__sorry("type_ctor_rep").
 
 
 :- func type_ctor_module_name(type_ctor_info) = string.
@@ -1468,6 +1484,9 @@
 	Name = (MR_String) MR_type_ctor_module_name(tci);
 ").
 
+type_ctor_module_name(_) = _ :-
+	private_builtin__sorry("type_ctor_module_name").
+
 
 
 :- func type_ctor_name(type_ctor_info) = string.
@@ -1487,6 +1506,8 @@
 	Name = (MR_String) MR_type_ctor_name(tci);
 ").
 
+type_ctor_name(_) = _ :-
+	private_builtin__sorry("type_ctor_name").
 
 :- func type_layout(type_ctor_info) = type_layout.
 
@@ -1505,6 +1526,9 @@
 	TypeLayout = (MR_Word) &(MR_type_ctor_layout(tci));
 ").
 
+type_layout(_) = _ :-
+	private_builtin__sorry("type_layout").
+
 :- pragma foreign_proc("C",
 	unsafe_cast(VarIn::in) = (VarOut::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
@@ -1517,6 +1541,9 @@
 "
 	VarOut = VarIn;
 ").
+
+unsafe_cast(_) = _ :-
+	private_builtin__sorry("unsafe_cast").
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: library/sparse_bitset.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/sparse_bitset.m,v
retrieving revision 1.12
diff -u -r1.12 sparse_bitset.m
--- library/sparse_bitset.m	20 Jan 2002 07:32:23 -0000	1.12
+++ library/sparse_bitset.m	11 Jun 2002 10:16:43 -0000
@@ -792,6 +792,9 @@
 	mercury.runtime.LowLevelData.set_MR_Word_field(Pair, 2, B);
 }").
 
+make_bitset_elem(_, _) = _ :-
+	private_builtin__sorry("make_bitset_elem").
+
 %-----------------------------------------------------------------------------%
 
 init(init).
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.268
diff -u -r1.268 std_util.m
--- library/std_util.m	7 Jun 2002 00:49:57 -0000	1.268
+++ library/std_util.m	11 Jun 2002 10:16:44 -0000
@@ -1064,6 +1064,9 @@
 
 ").
 
+get_registers(_, _, _) :-
+	private_builtin__sorry("get_registers").
+
 :- impure pred check_for_floundering(trail_ptr::in) is det.
 
 :- pragma foreign_proc("C", 
@@ -1085,6 +1088,9 @@
 #endif
 ").
 
+check_for_floundering(_) :-
+	private_builtin__sorry("check_for_floundering").
+
 %
 % Discard the topmost trail ticket.
 %
@@ -1108,6 +1114,9 @@
 #endif
 ").
 
+discard_trail_ticket :-
+	private_builtin__sorry("discard_trail_ticket").
+
 %
 % Swap the heap with the solutions heap
 %
@@ -1141,6 +1150,9 @@
 	*/
 ").
 
+swap_heap_and_solutions_heap :-
+	private_builtin__sorry("swap_heap_and_solutions_heap").
+
 %
 % partial_deep_copy(SolutionsHeapPtr, OldVal, NewVal):
 %	Make a copy of all of the parts of OldVar that occur between
@@ -1223,6 +1235,9 @@
 	NewVal = OldVal;
 ").
 
+partial_deep_copy(_, _, _) :-
+	private_builtin__sorry("partial_deep_copy").
+
 %
 % reset_solutions_heap(SolutionsHeapPtr):
 %	Reset the solutions heap pointer to the specified value,
@@ -1233,7 +1248,7 @@
 
 :- pragma foreign_proc("C", 
 	reset_solutions_heap(SolutionsHeapPtr::in),
-	[will_not_call_mercury, thread_safe, promise_pure],
+	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_RECLAIM_HP_ON_FAILURE
 	MR_sol_hp = (MR_Word *) SolutionsHeapPtr;
@@ -1242,7 +1257,7 @@
 
 :- pragma foreign_proc("MC++", 
 	reset_solutions_heap(_SolutionsHeapPtr::in),
-	[will_not_call_mercury, thread_safe, promise_pure],
+	[will_not_call_mercury, thread_safe],
 "
 	/*
 	** For the IL back-end, we don't have a separate `solutions heap'.
@@ -1250,6 +1265,10 @@
 	*/
 ").
 
+reset_solutions_heap(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("reset_solutions_heap").
+
 %-----------------------------------------------------------------------------%
 
 %%% :- module mutvar.
@@ -1353,6 +1372,13 @@
 	Ref[0] = X;
 ").
 
+new_mutvar(_, _) :-
+	private_builtin__sorry("new_mutvar").
+get_mutvar(_, _) :-
+	private_builtin__sorry("get_mutvar").
+set_mutvar(_, _) :-
+	private_builtin__sorry("set_mutvar").
+
 %%% end_module mutvar.
 
 %-----------------------------------------------------------------------------%
@@ -1434,6 +1460,15 @@
 	cc_multi_equal(X::di, Y::uo),
 	[will_not_call_mercury, thread_safe, promise_pure],
 	"Y = X;").
+
+semidet_succeed :-
+	private_builtin__sorry("semidet_succeed").
+semidet_fail :-
+	private_builtin__sorry("semidet_fail").
+
+:- pragma promise_pure(cc_multi_equal/2).
+cc_multi_equal(_, _) :-
+	private_builtin__sorry("cc_multi_equal").
 
 %-----------------------------------------------------------------------------%
 
Index: library/store.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/store.m,v
retrieving revision 1.31
diff -u -r1.31 store.m
--- library/store.m	4 Feb 2002 05:22:54 -0000	1.31
+++ library/store.m	11 Jun 2002 10:16:44 -0000
@@ -250,8 +250,12 @@
 :- pred store__do_init(store(some_store_type)).
 :- mode store__do_init(uo) is det.
 
-:- pragma foreign_proc("C", store__do_init(_S0::uo),
-	[will_not_call_mercury, promise_pure], "").
+:- pragma foreign_proc("C", store__do_init(S0::uo),
+	[will_not_call_mercury, promise_pure],
+	"/* XXX mention S0 to avoid warning */").
+
+store__do_init(_) :-
+	private_builtin__sorry("store__do_init").
 
 /* 
 Note -- the syntax for the operations on stores
@@ -292,6 +296,15 @@
 	S = S0;
 ").
 
+new_mutvar(_, _) -->
+	{ private_builtin__sorry("store__new_mutvar") }.
+
+get_mutvar(_, _) -->
+	{ private_builtin__sorry("store__get_mutvar") }.
+
+set_mutvar(_, _) -->
+	{ private_builtin__sorry("store__set_mutvar") }.
+
 :- pred store__unsafe_new_uninitialized_mutvar(generic_mutvar(T, S),
 						S, S) <= store(S).
 :- mode store__unsafe_new_uninitialized_mutvar(out, di, uo) is det.
@@ -303,6 +316,9 @@
 	S = S0;
 ").
 
+unsafe_new_uninitialized_mutvar(_) -->
+	{ private_builtin__sorry("unsafe_new_uninitialized_mutvar") }.
+
 store__new_cyclic_mutvar(Func, MutVar) -->
 	store__unsafe_new_uninitialized_mutvar(MutVar),
 	{ Value = apply(Func, MutVar) },
@@ -318,6 +334,9 @@
 	S = S0;
 ").
 
+new_ref(_, _) -->
+	{ private_builtin__sorry("store__new_ref") }.
+
 copy_ref_value(Ref, Val) -->
 	/* XXX need to deep-copy non-atomic types */
 	unsafe_ref_value(Ref, Val).
@@ -335,6 +354,9 @@
 	S = S0;
 ").
 
+store__unsafe_ref_value(_, _) -->
+	{ private_builtin__sorry("store__unsafe_ref_value") }.
+
 ref_functor(Ref, Functor, Arity) -->
 	unsafe_ref_value(Ref, Val),
 	{ functor(Val, Functor, Arity) }.
@@ -443,12 +465,28 @@
 ").
 
 :- pragma foreign_proc("C",
-	extract_ref_value(_S::di, Ref::in, Val::out),
+	extract_ref_value(S::di, Ref::in, Val::out),
 		[will_not_call_mercury, promise_pure],
 "
+	/* XXX mention S to avoid warning. */
 	Val = * (MR_Word *) Ref;
 ").
 
+arg_ref(_, _, _) -->
+	{ private_builtin__sorry("store__arg_ref") }.
+
+new_arg_ref(_, _, _) -->
+	{ private_builtin__sorry("store__new_arg_ref") }.
+
+set_ref(_, _) -->
+	{ private_builtin__sorry("store__set_ref") }.
+
+set_ref_value(_, _) -->
+	{ private_builtin__sorry("store__set_ref_value") }.
+
+extract_ref_value(_, _, _) :-
+	private_builtin__sorry("store__extract_ref_value").
+
 %-----------------------------------------------------------------------------%
 
 :- pragma foreign_proc("C",
@@ -471,96 +509,11 @@
 	S = S0;
 }").
 
-%-----------------------------------------------------------------------------%
-
-:- pragma foreign_proc("MC++", store__do_init(_S0::uo),
-	[will_not_call_mercury, promise_pure], "").
-
-:- pragma foreign_proc("MC++", new_mutvar(_Val::in, _Mutvar::out,
-		_S0::di, _S::uo), [will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", get_mutvar(_Mutvar::in, _Val::out,
-		_S0::di, _S::uo), [will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", set_mutvar(_Mutvar::in, _Val::in,
-		_S0::di, _S::uo), [will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", unsafe_new_uninitialized_mutvar(
-		_Mutvar::out, _S0::di, _S::uo),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", new_ref(_Val::di, _Ref::out, _S0::di, _S::uo),
-		[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", unsafe_ref_value(_Ref::in, _Val::uo,
-		_S0::di, _S::uo), [will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", 
-	arg_ref(_Ref::in, _ArgNum::in, _ArgRef::out, _S0::di, _S::uo),
-		[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
-:- pragma foreign_proc("MC++", 
-	new_arg_ref(_Val::di, _ArgNum::in, _ArgRef::out, _S0::di, _S::uo),
-		[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
-:- pragma foreign_proc("MC++", 
-	set_ref(_Ref::in, _ValRef::in, _S0::di, _S::uo),
-		[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",	
-	set_ref_value(_Ref::in, _Val::di, _S0::di, _S::uo),
-		[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	extract_ref_value(_S::di, _Ref::in, _Val::out),
-		[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	unsafe_arg_ref(_Ref::in, _Arg::in, _ArgRef::out, _S0::di, _S::uo),
-		[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
-:- pragma foreign_proc("MC++",
-	unsafe_new_arg_ref(_Val::di, _Arg::in, _ArgRef::out,
-			_S0::di, _S::uo), [will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
+unsafe_arg_ref(_, _, _) -->
+	{ private_builtin__sorry("store__unsafe_arg_ref") }.
 
+unsafe_new_arg_ref(_, _, _) -->
+	{ private_builtin__sorry("store__unsafe_new_arg_ref") }.
 
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.168
diff -u -r1.168 string.m
--- library/string.m	18 Feb 2002 07:01:10 -0000	1.168
+++ library/string.m	11 Jun 2002 10:16:45 -0000
@@ -696,6 +696,7 @@
 :- mode string__to_char_list(out, in) is det.
 */
 
+:- pragma promise_pure(string__to_char_list/2).
 :- pragma foreign_proc("C", string__to_char_list(Str::in, CharList::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	MR_ConstString p = Str + strlen(Str);
@@ -743,12 +744,50 @@
 	Str[size] = '\\0';
 }").
 
+:- pragma foreign_proc("MC++", string__to_char_list(Str::in, CharList::out),
+		[will_not_call_mercury, promise_pure, thread_safe], "{
+        MR_Integer length, i; 
+        MR_Word tmp;
+        MR_Word prev;
+
+        length = Str->get_Length();
+      
+        MR_list_nil(prev);
+
+        for (i = length - 1; i >= 0; i--) {
+		MR_list_cons(tmp, __box(Str->get_Chars(i)), prev);
+		prev = tmp;
+        }
+        CharList = tmp;
+}").
+
+:- pragma foreign_proc("MC++", string__to_char_list(Str::out, CharList::in),
+		[will_not_call_mercury, promise_pure, thread_safe], "{
+        System::Text::StringBuilder *tmp;
+	MR_Char c;
+       
+        tmp = new System::Text::StringBuilder();
+        while (1) {
+            if (MR_list_is_cons(CharList)) {
+		c = System::Convert::ToChar(MR_list_head(CharList));
+                tmp->Append(c);
+                CharList = MR_list_tail(CharList);
+            } else {
+                break;
+            }
+        }
+        Str = tmp->ToString();
+}").
+
+string__to_char_list(_, _) :-
+	private_builtin__sorry("string__to_char_list").
+
 /*-----------------------------------------------------------------------*/
 
 %
-% We could implement from_rev_char_list using list__reverse and from_char_list,
-% but the optimized implementation in C below is there for efficiency since
-% it improves the overall speed of parsing by about 7%.
+% We implement from_rev_char_list using list__reverse and
+% from_char_list, but the optimized implementation in C below is there
+% for efficiency since it improves the overall speed of parsing by about 7%.
 %
 :- pragma foreign_proc("C", string__from_rev_char_list(Chars::in, Str::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "
@@ -789,41 +828,6 @@
 	}
 }").
 
-:- pragma foreign_proc("MC++", string__to_char_list(Str::in, CharList::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-        MR_Integer length, i; 
-        MR_Word tmp;
-        MR_Word prev;
-
-        length = Str->get_Length();
-      
-        MR_list_nil(prev);
-
-        for (i = length - 1; i >= 0; i--) {
-		MR_list_cons(tmp, __box(Str->get_Chars(i)), prev);
-		prev = tmp;
-        }
-        CharList = tmp;
-}").
-
-:- pragma foreign_proc("MC++", string__to_char_list(Str::out, CharList::in),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-        System::Text::StringBuilder *tmp;
-	MR_Char c;
-       
-        tmp = new System::Text::StringBuilder();
-        while (1) {
-            if (MR_list_is_cons(CharList)) {
-		c = System::Convert::ToChar(MR_list_head(CharList));
-                tmp->Append(c);
-                CharList = MR_list_tail(CharList);
-            } else {
-                break;
-            }
-        }
-        Str = tmp->ToString();
-}").
-
 string__from_rev_char_list(Chars::in, Str::out) :- 
 	Str = string__from_char_list(list__reverse(Chars)).
 
@@ -978,6 +982,27 @@
 	Str[len] = '\\0';
 }").
 
+:- pragma foreign_proc("C#",
+		string__append_list(Strs::in) = (Str::uo),
+		[will_not_call_mercury, promise_pure, thread_safe], "
+{
+        System.Text.StringBuilder tmp = new System.Text.StringBuilder();
+
+	while (mercury.runtime.LowLevelData.list_is_cons(Strs)) {
+		tmp.Append(mercury.runtime.LowLevelData.list_get_head(Strs));
+		Strs = mercury.runtime.LowLevelData.list_get_tail(Strs);
+	}
+	Str = tmp.ToString();
+}
+").
+
+string__append_list(Strs::in) = (Str::uo) :-
+	( Strs = [X | Xs] ->
+		Str = X ++ append_list(Xs)
+	;
+		Str = ""
+	).
+
 	% Implementation of string__join_list that uses C as this
 	% minimises the amount of garbage created.
 :- pragma foreign_proc("C", string__join_list(Sep::in, Strs::in) = (Str::uo),
@@ -1026,27 +1051,6 @@
 }").
 
 :- pragma foreign_proc("C#",
-		string__append_list(Strs::in) = (Str::uo),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-{
-        System.Text.StringBuilder tmp = new System.Text.StringBuilder();
-
-	while (mercury.runtime.LowLevelData.list_is_cons(Strs)) {
-		tmp.Append(mercury.runtime.LowLevelData.list_get_head(Strs));
-		Strs = mercury.runtime.LowLevelData.list_get_tail(Strs);
-	}
-	Str = tmp.ToString();
-}
-").
-
-string__append_list(Strs::in) = (Str::uo) :-
-	( Strs = [X | Xs] ->
-		Str = X ++ append_list(Xs)
-	;
-		Str = ""
-	).
-
-:- pragma foreign_proc("C#",
 		string__join_list(Sep::in, Strs::in) = (Str::uo),
 		[will_not_call_mercury, promise_pure, thread_safe], "
 {	
@@ -1064,6 +1068,15 @@
 	Str = tmpStr.ToString();
 }").
 
+string__join_list(_Sep, []) = "".
+string__join_list(Sep, [S | Ss]) = S ++ string__join_list_2(Sep, Ss).
+
+:- func string__join_list_2(string, list(string)) = string.
+
+string__join_list_2(_Sep, []) = "".
+string__join_list_2(Sep, [S | Ss]) =
+	Sep ++ S ++ string__join_list_2(Sep, Ss).
+
 %-----------------------------------------------------------------------------%
 
 	% Note - string__hash is also defined in code/imp.h
@@ -1116,6 +1129,9 @@
 	Index = WholeString->IndexOf(SubString);
 }").
 
+string__sub_string_search(_, _, _) :-
+	private_builtin__sorry("string__sub_string_search").
+
 %-----------------------------------------------------------------------------%
 
 	% This predicate has been optimised to produce the least memory
@@ -1486,6 +1502,8 @@
 	[will_not_call_mercury, promise_pure, thread_safe], "
 	SUCCESS_INDICATOR = MR_FALSE;
 ").
+using_sprintf :-
+	private_builtin__sorry("string__using_sprintf").
 		
 
 	% Construct a format string suitable to passing to sprintf.
@@ -1560,6 +1578,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	LengthModifier = """";
 }").
+int_length_modifer = _ :-
+	private_builtin__sorry("int_length_modifer").
 
 
 	% Create a string from a float using the format string.
@@ -1578,6 +1598,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	Str = System.String.Format(FormatStr, Val);
 }").
+format_float(_, _) = _ :-
+	private_builtin__sorry("format_float").
 
 	% Create a string from a int using the format string.
 	% Note it is the responsibility of the caller to ensure that the
@@ -1595,6 +1617,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	Str = System.String.Format(FormatStr, Val);
 }").
+format_int(_, _) = _ :-
+	private_builtin__sorry("format_int").
 
 	% Create a string from a string using the format string.
 	% Note it is the responsibility of the caller to ensure that the
@@ -1610,6 +1634,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	Str = System.String.Format(FormatStr, Val);
 }").
+format_string(_, _) = _ :-
+	private_builtin__sorry("format_string").
 
 	% Create a string from a char using the format string.
 	% Note it is the responsibility of the caller to ensure that the
@@ -1627,7 +1653,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	Str = System.String.Format(FormatStr, Val);
 }").
-
+format_char(_, _) = _ :-
+	private_builtin__sorry("format_char").
 
 %-----------------------------------------------------------------------------%
 
@@ -1659,6 +1686,10 @@
 	FloatString = System::Convert::ToString(FloatVal);
 }").
 
+string__float_to_string(_, _) :-
+	private_builtin__sorry("string__float_to_string").
+
+
 	% Beware that the implementation of string__format depends
 	% on the details of what string__float_to_f_string/2 outputs.
 
@@ -1673,6 +1704,15 @@
 	strcpy(FloatString, buf);
 }").
 
+:- pragma foreign_proc("MC++",
+	string__float_to_f_string(FloatVal::in, FloatString::out),
+		[will_not_call_mercury, promise_pure, thread_safe], "{
+	FloatString = System::Convert::ToString(FloatVal);
+}").
+
+string__float_to_f_string(_, _) :-
+	private_builtin__sorry("string__float_to_f_string").
+
 :- pragma foreign_proc("C",
 	string__to_float(FloatString::in, FloatVal::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "{
@@ -1692,12 +1732,6 @@
 }").
 
 :- pragma foreign_proc("MC++",
-	string__float_to_f_string(FloatVal::in, FloatString::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-	FloatString = System::Convert::ToString(FloatVal);
-}").
-
-:- pragma foreign_proc("MC++",
 	string__to_float(FloatString::in, FloatVal::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	SUCCESS_INDICATOR = MR_TRUE;
@@ -1708,6 +1742,9 @@
 	}
 }").
 
+string__to_float(_, _) :-
+	private_builtin__sorry("string__to_float").
+
 /*-----------------------------------------------------------------------*/
 
 /*
@@ -1802,6 +1839,10 @@
         Str = tmp->ToString();
 }").
 
+:- pragma promise_pure(string__to_int_list/2).
+string__to_int_list(_, _) :-
+	private_builtin__sorry("string__to_int_list").
+
 
 /*-----------------------------------------------------------------------*/
 
@@ -1817,6 +1858,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "
 	SUCCESS_INDICATOR = (Str->IndexOf(Ch) != -1);
 ").
+string__contains_char(_, _) :-
+	private_builtin__sorry("string__contains_char").
 
 /*-----------------------------------------------------------------------*/
 
@@ -1853,6 +1896,8 @@
 		Ch = Str->get_Chars(Index);
 	}
 ").
+string__index(_, _, _) :-
+	private_builtin__sorry("string__index").
 
 /*-----------------------------------------------------------------------*/
 
@@ -1866,6 +1911,8 @@
 		[will_not_call_mercury, promise_pure, thread_safe], "
 	Ch = Str->get_Chars(Index);
 ").
+string__unsafe_index(_, _, _) :-
+	private_builtin__sorry("string__unsafe_index").
 
 /*-----------------------------------------------------------------------*/
 
@@ -1916,6 +1963,9 @@
 	}
 ").
 
+string__set_char(_, _, _, _) :-
+	private_builtin__sorry("string__set_char").
+
 /*
 :- pred string__set_char(char, int, string, string).
 :- mode string__set_char(in, in, di, uo) is semidet.
@@ -1968,6 +2018,8 @@
 		System::Convert::ToString(Ch), 
 		Str0->Substring(Index + 1));
 ").
+string__unsafe_set_char(_, _, _, _) :-
+	private_builtin__sorry("string__unsafe_set_char").
 
 /*
 :- pred string__unsafe_set_char(char, int, string, string).
@@ -2021,6 +2073,10 @@
 	Length = Str->get_Length();
 ").
 
+:- pragma promise_pure(string__length/2).
+string__length(_, _) :-
+	private_builtin__sorry("string__length").
+
 /*-----------------------------------------------------------------------*/
 
 :- pragma promise_pure(string__append/3).
@@ -2052,6 +2108,9 @@
 	SUCCESS_INDICATOR = S3->Equals(System::String::Concat(S1, S2));
 }").
 
+string__append_iii(_, _, _) :-
+	private_builtin__sorry("string__append_iii").
+
 :- pred string__append_ioi(string::in, string::out, string::in) is semidet.
 
 :- pragma foreign_proc("C",
@@ -2086,6 +2145,9 @@
 	}
 }").
 
+string__append_ioi(_, _, _) :-
+	private_builtin__sorry("string__append_ioi").
+
 :- pred string__append_iio(string::in, string::in, string::uo) is det.
 
 :- pragma foreign_proc("C",
@@ -2105,6 +2167,9 @@
 	S3 = System::String::Concat(S1, S2);
 }").
 
+string__append_iio(_, _, _) :-
+	private_builtin__sorry("string__append_iio").
+
 :- pred string__append_ooi(string::out, string::out, string::in) is multi.
 
 string__append_ooi(S1, S2, S3) :-
@@ -2148,6 +2213,9 @@
 	S2 = S3->Substring(S1Len);
 ").
 
+string__append_ooi_3(_, _, _, _, _) :-
+	private_builtin__sorry("string__append_ooi_3").
+
 /*-----------------------------------------------------------------------*/
 
 /*
@@ -2214,7 +2282,8 @@
 	SubString = Str->Substring(Start, Count);
 }").
 
-
+string__unsafe_substring(_, _, _, _) :-
+	private_builtin__sorry("string__unsafe_substring").
 
 /*
 :- pred string__split(string, int, string, string).
@@ -2269,6 +2338,8 @@
 	}
 }").
 
+string__split(_, _, _, _) :-
+	private_builtin__sorry("string__split").
 
 /*-----------------------------------------------------------------------*/
 
@@ -2414,6 +2485,10 @@
 	Str = System::String::Concat(FirstStr, Rest);
 }").
 
+
+:- pragma promise_pure(string__first_char/3).
+string__first_char(_, _, _) :-
+	private_builtin__sorry("string__first_char").
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: library/table_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/table_builtin.m,v
retrieving revision 1.14
diff -u -r1.14 table_builtin.m
--- library/table_builtin.m	20 Feb 2002 03:14:36 -0000	1.14
+++ library/table_builtin.m	11 Jun 2002 10:16:45 -0000
@@ -181,7 +181,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_is_complete(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -201,7 +201,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_has_succeeded(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -220,7 +220,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_has_failed(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -239,7 +239,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_is_active(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -258,7 +258,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_is_inactive(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -277,7 +277,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_mark_as_succeeded(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -293,7 +293,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_mark_as_failed(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -309,7 +309,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_mark_as_active(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -325,7 +325,7 @@
 
 :- pragma foreign_proc("C",
 	table_simple_mark_as_inactive(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -340,69 +340,46 @@
 ").
 
 
-
-:- pragma foreign_proc("MC++",
-	table_simple_is_complete(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_has_succeeded(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_has_failed(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_is_active(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_is_inactive(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_mark_as_succeeded(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_mark_as_failed(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_mark_as_active(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_simple_mark_as_inactive(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+:- pragma promise_semipure(table_simple_is_complete/1).
+table_simple_is_complete(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_is_complete").
+
+:- pragma promise_semipure(table_simple_has_succeeded/1).
+table_simple_has_succeeded(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_has_succeeded").
+
+:- pragma promise_semipure(table_simple_has_failed/1).
+table_simple_has_failed(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_has_failed").
+
+:- pragma promise_semipure(table_simple_is_active/1).
+table_simple_is_active(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_is_active").
+
+:- pragma promise_semipure(table_simple_is_inactive/1).
+table_simple_is_inactive(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_is_inactive").
+
+table_simple_mark_as_succeeded(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_mark_as_succeeded").
+
+table_simple_mark_as_failed(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_mark_as_failed").
+
+table_simple_mark_as_active(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_mark_as_active").
+
+table_simple_mark_as_inactive(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_simple_mark_as_inactive").
 
 %-----------------------------------------------------------------------------%
 
@@ -499,7 +476,7 @@
 
 :- pragma foreign_proc("C",
 	table_io_in_range(T::out, Counter::out, Start::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	if (MR_io_tabling_enabled) {
 		MR_Unsigned	old_counter;
@@ -530,7 +507,7 @@
 ").
 
 :- pragma foreign_proc("C", table_io_has_occurred(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -551,24 +528,16 @@
 	S = S0;
 ").
 
-:- pragma foreign_proc("MC++", 
-	table_io_in_range(_T::out, _Counter::out, _Start::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+table_io_in_range(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_io_in_range").
+
+table_io_has_occurred(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_io_has_occurred").
 
-:- pragma foreign_proc("MC++", table_io_has_occurred(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", table_io_copy_io_state(_S0::di, _S::uo),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+table_io_copy_io_state(_, _) :-
+	private_builtin__sorry("table_io_copy_io_state").
 
 %-----------------------------------------------------------------------------%
 
@@ -639,7 +608,7 @@
 
 :- pragma foreign_proc("C",
 	table_nondet_setup(T0::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 #ifndef	MR_USE_MINIMAL_MODEL
 	MR_fatal_error(""minimal model code entered when not enabled"");
@@ -701,12 +670,9 @@
 #endif /* MR_USE_MINIMAL_MODEL */
 ").
 
-:- pragma foreign_proc("MC++",
-	table_nondet_setup(_T0::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+table_nondet_setup(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_nondet_setup").
 
 	% The definitions of these two predicates are in the runtime system,
 	% in runtime/mercury_tabling.c.
@@ -736,7 +702,7 @@
 */
 
 :- pragma foreign_proc("C",
-	table_nondet_is_complete(T::in), [will_not_call_mercury, promise_pure], "
+	table_nondet_is_complete(T::in), [will_not_call_mercury], "
 #ifdef	MR_USE_MINIMAL_MODEL
 	MR_TrieNode	table;
 
@@ -750,7 +716,7 @@
 
 :- pragma foreign_proc("C",
 	table_nondet_is_active(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 #ifdef	MR_USE_MINIMAL_MODEL
 	MR_TrieNode	table;
@@ -765,7 +731,7 @@
 
 :- pragma foreign_proc("C",
 	table_nondet_mark_as_active(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 #ifdef	MR_USE_MINIMAL_MODEL
 	MR_TrieNode	table;
@@ -782,7 +748,7 @@
 
 :- pragma foreign_proc("C",
 	table_nondet_get_ans_table(T::in, AT::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 #ifdef	MR_USE_MINIMAL_MODEL
 	MR_TrieNode	table;
@@ -797,7 +763,7 @@
 
 :- pragma foreign_proc("C",
 	table_nondet_answer_is_not_duplicate(T::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 #ifndef	MR_USE_MINIMAL_MODEL
 	MR_fatal_error(""minimal model code entered when not enabled"");
@@ -822,7 +788,7 @@
 
 :- pragma foreign_proc("C",
 	table_nondet_new_ans_slot(T::in, Slot::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 #ifndef	MR_USE_MINIMAL_MODEL
 	MR_fatal_error(""minimal model code entered when not enabled"");
@@ -894,7 +860,7 @@
 	is det.
 
 :- pragma foreign_proc("C", pickup_answer_list(T::in, CurNode::out),
-	[will_not_call_mercury, promise_pure], "
+	[will_not_call_mercury], "
 #ifdef MR_USE_MINIMAL_MODEL
 		MR_TrieNode	table;
 
@@ -915,7 +881,7 @@
 
 :- pragma foreign_proc("C",
 	return_next_answer(CurNode0::in, AnswerBlock::out, CurNode::out),
-	[will_not_call_mercury, promise_pure], "
+	[will_not_call_mercury], "
 #ifdef MR_USE_MINIMAL_MODEL
 	MR_AnswerList	cur_node0;
 
@@ -932,59 +898,41 @@
 #endif
 ").
 
-:- pragma foreign_proc("MC++",
-	table_nondet_is_complete(_T::in), [will_not_call_mercury, promise_pure], "
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_nondet_is_active(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_nondet_mark_as_active(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_nondet_get_ans_table(_T::in, _AT::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_nondet_answer_is_not_duplicate(_T::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_nondet_new_ans_slot(_T::in, _Slot::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	pickup_answer_list(_T::in, _CurNode::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	return_next_answer(_CurNode0::in, _AnswerBlock::out, _CurNode::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+:- pragma promise_semipure(table_nondet_is_complete/1).
+table_nondet_is_complete(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_nondet_is_complete").
+
+:- pragma promise_semipure(table_nondet_is_active/1).
+table_nondet_is_active(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_nondet_is_active").
+	
+table_nondet_mark_as_active(_) :-
+	impure private_builtin__imp,
+	private_builtin__imp("table_nondet_mark_as_active").
+
+table_nondet_get_ans_table(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_nondet_get_ans_table").
+
+table_nondet_answer_is_not_duplicate(_) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_nondet_answer_is_not_duplicate").
+
+table_nondet_new_ans_slot(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_nondet_new_ans_slot").
+
+:- pragma promise_semipure(pickup_answer_list/2).
+pickup_answer_list(_, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("pickup_answer_list").
+
+:- pragma promise_semipure(return_next_answer/3).
+return_next_answer(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("return_next_answer").
 
 %-----------------------------------------------------------------------------%
 
@@ -1141,7 +1089,7 @@
 ").
 
 :- pragma foreign_proc("C", table_lookup_insert_int(T0::in, I::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1152,7 +1100,7 @@
 
 :- pragma foreign_proc("C",
 	table_lookup_insert_start_int(T0::in, S::in, I::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1164,7 +1112,7 @@
 
 :- pragma foreign_proc("C",
 	table_lookup_insert_char(T0::in, C::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1175,7 +1123,7 @@
 
 :- pragma foreign_proc("C",
 	table_lookup_insert_string(T0::in, S::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1186,7 +1134,7 @@
 
 :- pragma foreign_proc("C",
 	table_lookup_insert_float(T0::in, F::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1197,7 +1145,7 @@
 
 :- pragma foreign_proc("C", 
 	table_lookup_insert_enum(T0::in, R::in, V::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1208,7 +1156,7 @@
 
 :- pragma foreign_proc("C",
 	table_lookup_insert_user(T0::in, V::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1219,7 +1167,7 @@
 
 :- pragma foreign_proc("C",
 	table_lookup_insert_poly(T0::in, V::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0, table;
 
@@ -1230,7 +1178,7 @@
 
 :- pragma foreign_proc("C",
 	table_save_int_ans(T::in, Offset::in, I::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1240,7 +1188,7 @@
 
 :- pragma foreign_proc("C",
 	table_save_char_ans(T::in, Offset::in, C::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1250,7 +1198,7 @@
 
 :- pragma foreign_proc("C",
 	table_save_string_ans(T::in, Offset::in, S::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1261,7 +1209,7 @@
 
 :- pragma foreign_proc("C",
 	table_save_float_ans(T::in, Offset::in, F::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1277,7 +1225,7 @@
 
 :- pragma foreign_proc("C",
 	table_save_io_state_ans(T::in, Offset::in, S::ui),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1288,7 +1236,7 @@
 
 :- pragma foreign_proc("C", 
 	table_save_any_ans(T::in, Offset::in, V::in),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1296,9 +1244,10 @@
 	MR_TABLE_SAVE_ANSWER(table, Offset, V, TypeInfo_for_T);
 ").
 
+:- pragma promise_semipure(table_restore_int_ans/3).
 :- pragma foreign_proc("C",
 	table_restore_int_ans(T::in, Offset::in, I::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1306,9 +1255,10 @@
 	I = (MR_Integer) MR_TABLE_GET_ANSWER(table, Offset);
 ").
 
+:- pragma promise_semipure(table_restore_char_ans/3).
 :- pragma foreign_proc("C",
 	table_restore_char_ans(T::in, Offset::in, C::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1316,9 +1266,10 @@
 	C = (MR_Char) MR_TABLE_GET_ANSWER(table, Offset);
 ").
 
+:- pragma promise_semipure(table_restore_string_ans/3).
 :- pragma foreign_proc("C",
 	table_restore_string_ans(T::in, Offset::in, S::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1326,9 +1277,10 @@
 	S = (MR_String) MR_TABLE_GET_ANSWER(table, Offset);
 ").
 
+:- pragma promise_semipure(table_restore_float_ans/3).
 :- pragma foreign_proc("C",
 	table_restore_float_ans(T::in, Offset::in, F::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1340,9 +1292,10 @@
 #endif
 ").
 
+:- pragma promise_semipure(table_restore_io_state_ans/3).
 :- pragma foreign_proc("C",
 	table_restore_io_state_ans(T::in, Offset::in, V::uo),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1350,9 +1303,10 @@
 	V = (MR_Word) MR_TABLE_GET_ANSWER(table, Offset);
 ").
 
+:- pragma promise_semipure(table_restore_any_ans/3).
 :- pragma foreign_proc("C",
 	table_restore_any_ans(T::in, Offset::in, V::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table;
 
@@ -1362,7 +1316,7 @@
 
 :- pragma foreign_proc("C",
 	table_create_ans_block(T0::in, Size::in, T::out),
-	[will_not_call_mercury, promise_pure],
+	[will_not_call_mercury],
 "
 	MR_TrieNode	table0;
 
@@ -1375,165 +1329,98 @@
 	error(Message).
 
 :- pragma foreign_proc("C",
-	table_report_statistics, [will_not_call_mercury, promise_pure], "
+	table_report_statistics, [will_not_call_mercury], "
 	MR_table_report_statistics(stderr);
 ").
 
 
-:- pragma foreign_proc("MC++",
-	table_lookup_insert_int(_T0::in, _I::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_lookup_insert_start_int(_T0::in, _S::in, _I::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_lookup_insert_char(_T0::in, _C::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_lookup_insert_string(_T0::in, _S::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_lookup_insert_float(_T0::in, _F::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++", 
-	table_lookup_insert_enum(_T0::in, _R::in, _V::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_lookup_insert_user(_T0::in, _V::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_lookup_insert_poly(_T0::in, _V::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_save_int_ans(_T::in, _Offset::in, _I::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_save_char_ans(_T::in, _Offset::in, _C::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_save_string_ans(_T::in, _Offset::in, _S::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_save_float_ans(_T::in, _Offset::in, _F::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_save_io_state_ans(_T::in, _Offset::in, _S::ui),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-
-:- pragma foreign_proc("MC++",
-	table_save_any_ans(_T::in, _Offset::in, _V::in),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_restore_int_ans(_T::in, _Offset::in, _I::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_restore_char_ans(_T::in, _Offset::in, _C::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_restore_string_ans(_T::in, _Offset::in, _S::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_restore_float_ans(_T::in, _Offset::in, _F::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_restore_io_state_ans(_T::in, _Offset::in, _V::uo),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_restore_any_ans(_T::in, _Offset::in, _V::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_create_ans_block(_T0::in, _Size::in, _T::out),
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
-
-:- pragma foreign_proc("MC++",
-	table_report_statistics,
-	[will_not_call_mercury, promise_pure],
-"
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-").
+table_lookup_insert_int(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_int").
+
+table_lookup_insert_start_int(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_start_int").
+
+table_lookup_insert_char(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_char").
+
+table_lookup_insert_string(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_string").
+
+table_lookup_insert_float(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_float").
+
+table_lookup_insert_enum(_, _, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_enum").
+
+table_lookup_insert_user(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_user").
+
+table_lookup_insert_poly(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_lookup_insert_poly").
+
+table_save_int_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_save_int_ans").
+
+table_save_char_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_save_char_ans").
+
+table_save_string_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_save_string_ans").
+
+table_save_float_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_save_float_ans").
+
+table_save_io_state_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_save_io_state_ans").
+
+table_save_any_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_save_any_ans").
+
+table_restore_int_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_restore_int_ans").
+
+table_restore_char_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_restore_char_ans").
+
+table_restore_string_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_restore_string_ans").
+
+table_restore_float_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_restore_float_ans").
+
+table_restore_io_state_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_restore_io_state_ans").
+
+table_restore_any_ans(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_restore_any_ans").
+
+table_create_ans_block(_, _, _) :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_create_ans_block").
+
+table_report_statistics :-
+	impure private_builtin__imp,
+	private_builtin__sorry("table_report_statistics").
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: library/time.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/time.m,v
retrieving revision 1.24
diff -u -r1.24 time.m
--- library/time.m	13 Feb 2002 09:56:36 -0000	1.24
+++ library/time.m	11 Jun 2002 10:16:48 -0000
@@ -194,12 +194,8 @@
 	Ret = (MR_Integer) clock();
 	update_io(IO0, IO);
 }").
-:- pragma foreign_proc("MC++", time__c_clock(_Ret::out, _IO0::di, _IO::uo),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
-
+time__c_clock(_) -->
+	{ private_builtin__sorry("time__c_clock") }.
 
 %-----------------------------------------------------------------------------%
 
@@ -216,11 +212,8 @@
 "{
 	Ret = (MR_Integer) CLOCKS_PER_SEC;
 }").
-:- pragma foreign_proc("MC++", time__c_clocks_per_sec(_Ret::out),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_clocks_per_sec(_) :-
+	private_builtin__sorry("time__c_clocks_per_sec").
 
 %-----------------------------------------------------------------------------%
 
@@ -258,13 +251,8 @@
 #endif
 	update_io(IO0, IO);
 }").
-:- pragma foreign_proc("MC++",
-	time__c_times(_Ret::out, _Ut::out, _St::out, _CUt::out,
-                               _CSt::out, _IO0::di, _IO::uo),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_times(_, _, _, _, _) -->
+	{ private_builtin__sorry("time__c_times") }.
 
 
 %-----------------------------------------------------------------------------%
@@ -290,12 +278,8 @@
 	Ret = (MR_Integer) time(NULL);
 	update_io(IO0, IO);
 }").
-:- pragma foreign_proc("MC++",
-	time__c_time(_Ret::out, _IO0::di, _IO::uo),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_time(_) -->
+	{ private_builtin__sorry("time__c_time") }.
 
 %-----------------------------------------------------------------------------%
 
@@ -313,12 +297,8 @@
 "{
 	Diff = (MR_Float) difftime((time_t) T1, (time_t) T0);
 }").
-:- pragma foreign_proc("MC++",
-	time__c_difftime(_T1::in, _T0::in, _Diff::out),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_difftime(_, _, _) :-
+	private_builtin__sorry("time__c_difftime").
 
 %-----------------------------------------------------------------------------%
 
@@ -356,14 +336,8 @@
 	YD = (MR_Integer) p->tm_yday;
 	N = (MR_Integer) p->tm_isdst;
 }").
-
-:- pragma foreign_proc("MC++",
-	time__c_localtime(_Time::in, _Yr::out, _Mnt::out, _MD::out, _Hrs::out,
-		_Min::out, _Sec::out, _YD::out, _WD::out, _N::out),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_localtime(_, _, _, _, _, _, _, _, _, _) :-
+	private_builtin__sorry("time__c_localtime").
 
 
 %:- func time__gmtime(time_t) = tm.
@@ -400,14 +374,8 @@
 	YD = (MR_Integer) p->tm_yday;
 	N = (MR_Integer) p->tm_isdst;
 }").
-
-:- pragma foreign_proc("MC++",
-	time__c_gmtime(_Time::in, _Yr::out, _Mnt::out, _MD::out, _Hrs::out,
-		_Min::out, _Sec::out, _YD::out, _WD::out, _N::out),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_gmtime(_, _, _, _, _, _, _, _, _, _) :-
+	private_builtin__sorry("time__c_gmtime").
 
 :- func int_to_maybe_dst(int) = maybe(dst).
 
@@ -451,14 +419,8 @@
 
 	Time = (MR_Integer) mktime(&t);
 }").
-
-:- pragma foreign_proc("MC++",
-	time__c_mktime(_Yr::in, _Mnt::in, _MD::in, _Hrs::in,
-		_Min::in, _Sec::in, _YD::in, _WD::in, _N::in, _Time::out),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_mktime(_, _, _, _, _, _, _, _, _, _) :-
+	private_builtin__sorry("time__c_mktime").
 
 :- func maybe_dst_to_int(maybe(dst)) = int.
 
@@ -505,14 +467,8 @@
 
 	MR_make_aligned_string_copy(Str, s);
 }").
-
-:- pragma foreign_proc("MC++",
-	time__c_asctime(_Yr::in, _Mnt::in, _MD::in, _Hrs::in,
-		_Min::in, _Sec::in, _YD::in, _WD::in, _N::in, _Str::out),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_asctime(_, _, _, _, _, _, _, _, _, _) :-
+	private_builtin__sorry("time__c_asctime").
 
 %-----------------------------------------------------------------------------%
 
@@ -537,13 +493,8 @@
 
 	MR_make_aligned_string_copy(Str, s);
 }").
-
-:- pragma foreign_proc("MC++",
-	time__c_ctime(_Time::in, _Str::out),
-	[will_not_call_mercury, promise_pure],
-"{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
-}").
+time__c_ctime(_, _) :-
+	private_builtin__sorry("time__c_ctime").
 
 %-----------------------------------------------------------------------------%
 :- end_module time.
Index: library/type_desc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.9
diff -u -r1.9 type_desc.m
--- library/type_desc.m	21 May 2002 08:09:58 -0000	1.9
+++ library/type_desc.m	11 Jun 2002 10:16:48 -0000
@@ -477,9 +477,10 @@
 	% Prototypes and type definitions.
 
 :- pragma foreign_proc("C",
-	type_of(_Value::unused) = (TypeInfo::out),
+	type_of(Value::unused) = (TypeInfo::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
 "{
+	/* Value */
 	TypeInfo = TypeInfo_for_T;
 
 	/*
@@ -498,26 +499,35 @@
 }").
 
 :- pragma foreign_proc("C#",
-	type_of(_Value::unused) = (TypeInfo::out),
+	type_of(Value::unused) = (TypeInfo::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
 "
+	// Value
 	TypeInfo = TypeInfo_for_T;
 ").
 
+type_of(_) = _ :-
+	private_builtin__sorry("type_of").
+
 :- pragma foreign_proc("C", 
-	has_type(_Arg::unused, TypeInfo::in),
+	has_type(Arg::unused, TypeInfo::in),
 	[will_not_call_mercury, thread_safe, promise_pure],
 "
+	/* Arg */
 	TypeInfo_for_T = TypeInfo;
 ").
 
 :- pragma foreign_proc("C#", 
-	has_type(_Arg::unused, TypeInfo::in),
+	has_type(Arg::unused, TypeInfo::in),
 	[will_not_call_mercury, thread_safe, promise_pure],
 "
+	// Arg
 	TypeInfo_for_T = TypeInfo;
 ").
 
+has_type(_, _) :-
+	private_builtin__sorry("has_type").
+
 % Export this function in order to use it in runtime/mercury_trace_external.c
 :- pragma export(type_name(in) = out, "ML_type_name").
 
@@ -627,13 +637,8 @@
 	TypeCtor = (MR_Word) MR_make_type_ctor_desc(type_info, type_ctor_info);
 }").
 
-:- pragma foreign_proc("C#",
-	type_ctor(_TypeInfo::in) = (_TypeCtor::out),
-	[will_not_call_mercury, thread_safe, promise_pure],
-"{
-	mercury.runtime.Errors.SORRY(""foreign code for type_ctor"");
-	_TypeCtor = null;
-}").
+type_ctor(_) = _ :-
+	private_builtin__sorry("type_ctor").
 
 :- pragma foreign_proc("C",
 	type_ctor_and_args(TypeDesc::in, TypeCtorDesc::out, ArgTypes::out),
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list