[m-rev.] diff: delete "sorry" clauses in library
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Feb 22 22:17:13 AEDT 2003
Estimated hours taken: 4
Branches: main
library/*.m:
Delete Mercury clauses that just call sorry/1.
I applied this change to all files except the following:
rtti_implementation.m (because in that case, there is no C
implementation) and profiling_builtin.m and table_builtin.m
(because new back-ends needn't support profiling or tabling;
the warnings with `--warn-stubs' for those would be just noise.)
library/array.m:
Provide C# code for the (in, array_uo) mode of array__copy/2,
by copying the code for the (array_ui, array_uo) mode.
library/math.m:
Provide Mercury implementations of some of the math functions.
cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.108
diff -u -d -u -r1.108 Mmakefile
--- Mmakefile 19 Feb 2003 06:31:22 -0000 1.108
+++ Mmakefile 22 Feb 2003 10:38:26 -0000
@@ -83,6 +83,14 @@
MCFLAGS += --strict-sequential --trace minimum --generate-mmc-deps \
$(INTERMODULE_OPTS) $(ENABLE_TERM_OPTS) $(CHECK_TERM_OPTS)
+# The IL and Java implementations of the standard library are not yet complete,
+# so we need to pass `--allow-stubs' to get them to compile.
+# Since the standard library is compiled with `--halt-at-warn',
+# we also need `--no-warn-stubs'.
+ifneq ("","$(findstring il,$(GRADE))$(findstring java, $(GRADE))")
+MCFLAGS += --allow-stubs --no-warn-stubs
+endif
+
#-----------------------------------------------------------------------------#
CFLAGS += $(DLL_CFLAGS) -I$(TRACE_DIR)
Index: array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.118
diff -u -d -u -r1.118 array.m
--- array.m 3 Dec 2002 09:36:33 -0000 1.118
+++ array.m 22 Feb 2003 10:38:38 -0000
@@ -718,11 +718,6 @@
#endif
").
-bounds_checks :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__bounds_checks").
-
%-----------------------------------------------------------------------------%
:- pragma foreign_decl("C", "
@@ -796,16 +791,6 @@
Array = null;
").
-array__init_2(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__init_2").
-
-array__make_empty_array(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__make_empty_array").
-
%-----------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -834,12 +819,6 @@
Min = 0;
").
-:- pragma promise_pure(array__min/2).
-array__min(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__min").
-
:- pragma promise_pure(array__max/2).
:- pragma foreign_proc("C",
array__max(Array::array_ui, Max::out),
@@ -870,11 +849,6 @@
}
").
-array__max(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__max").
-
array__bounds(Array, Min, Max) :-
array__min(Array, Min),
array__max(Array, Max).
@@ -911,12 +885,6 @@
}
").
-:- pragma promise_pure(array__size/2).
-array__size(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__size").
-
%-----------------------------------------------------------------------------%
array__in_bounds(Array, Index) :-
@@ -976,12 +944,6 @@
Item = Array.GetValue(Index);
}").
-:- pragma promise_pure(array__unsafe_lookup/3).
-array__unsafe_lookup(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__unsafe_lookup").
-
%-----------------------------------------------------------------------------%
array__set(Array0, Index, Item, Array) :-
@@ -1011,11 +973,6 @@
Array = Array0;
}").
-array__unsafe_set(_, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__unsafe_set").
-
%-----------------------------------------------------------------------------%
:- pragma foreign_decl("C", "
@@ -1099,11 +1056,6 @@
}
").
-array__resize(_, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__resize").
-
%-----------------------------------------------------------------------------%
:- pragma foreign_decl("C", "
@@ -1167,11 +1119,6 @@
System.Array.Copy(Array0, Array, Size);
").
-array__shrink_2(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__shrink_2").
-
%-----------------------------------------------------------------------------%
:- pragma foreign_decl("C", "
@@ -1230,11 +1177,16 @@
System.Array.Copy(Array0, Array, Array0.Length);
").
-:- pragma promise_pure(array__copy/2).
-array__copy(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("array__copy").
+:- pragma foreign_proc("C#",
+ array__copy(Array0::in, Array::array_uo),
+ [will_not_call_mercury, promise_pure, thread_safe], "
+
+ // XXX we implement the same as ML_copy_array, which doesn't appear
+ // to deep copy the array elements
+ Array = System.Array.CreateInstance(
+ Array0.GetType().GetElementType(), Array0.Length);
+ System.Array.Copy(Array0, Array, Array0.Length);
+").
%-----------------------------------------------------------------------------%
Index: benchmarking.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/benchmarking.m,v
retrieving revision 1.53
diff -u -d -u -r1.53 benchmarking.m
--- benchmarking.m 10 Feb 2003 17:03:50 -0000 1.53
+++ benchmarking.m 21 Feb 2003 02:07:13 -0000
@@ -93,18 +93,6 @@
#endif
").
-report_stats :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("report_stats").
-
-report_full_memory_stats :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("report_full_memory_stats").
-
%-----------------------------------------------------------------------------%
:- pragma foreign_code("C", "
@@ -714,12 +702,6 @@
").
*/
-get_user_cpu_miliseconds(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("get_user_cpu_miliseconds").
-
/*
** To prevent the C compiler from optimizing the benchmark code
** away, we assign the benchmark output to a volatile global variable.
@@ -752,12 +734,6 @@
").
*/
-do_nothing(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("benchmaring__do_nothing").
-
%-----------------------------------------------------------------------------%
% Impure integer references.
@@ -774,11 +750,6 @@
MR_incr_hp(Ref, 1);
* (MR_Integer *) Ref = X;
").
-new_int_reference(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("benchmarking__new_int_reference").
:- impure pred incr_ref(int_reference::in) is det.
incr_ref(Ref) :-
@@ -793,11 +764,6 @@
"
X = * (MR_Integer *) Ref;
").
-ref_value(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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).
@@ -805,10 +771,5 @@
update_ref(Ref::in, X::in), [will_not_call_mercury], "
* (MR_Integer *) Ref = X;
").
-update_ref(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("benchmarking__update_ref").
%-----------------------------------------------------------------------------%
Index: builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.86
diff -u -d -u -r1.86 builtin.m
--- builtin.m 12 Feb 2003 22:58:16 -0000 1.86
+++ builtin.m 21 Feb 2003 02:07:43 -0000
@@ -388,11 +388,6 @@
(Y :: out(pred(out) is semidet)),
[will_not_call_mercury, thread_safe],
"Y = X;").
-cc_cast(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("builtin__cc_cast").
:- pragma promise_pure(promise_only_solution_io/4).
promise_only_solution_io(Pred, X) -->
@@ -416,11 +411,6 @@
(Y :: out(pred(out, di, uo) is det)),
[will_not_call_mercury, thread_safe],
"Y = X;").
-cc_cast_io(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("builtin__cc_cast_io").
%-----------------------------------------------------------------------------%
Index: char.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/char.m,v
retrieving revision 1.40
diff -u -d -u -r1.40 char.m
--- char.m 15 Feb 2003 22:42:10 -0000 1.40
+++ char.m 21 Feb 2003 02:08:09 -0000
@@ -471,13 +471,6 @@
SUCCESS_INDICATOR = (Character == Int);
").
-:- pragma promise_pure(char__to_int/2).
-char__to_int(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("char__to_int").
-
-
% We used unsigned character codes, so the minimum character code
% is always zero.
@@ -500,11 +493,6 @@
Max = 0xffff;
").
-
-char__max_char_value(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("char__max_char_value").
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
Index: construct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/construct.m,v
retrieving revision 1.10
diff -u -d -u -r1.10 construct.m
--- construct.m 24 Dec 2002 11:56:08 -0000 1.10
+++ construct.m 21 Feb 2003 02:08:40 -0000
@@ -188,11 +188,6 @@
SUCCESS_INDICATOR = (S == NULL);
").
-null(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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.
@@ -315,11 +310,6 @@
SUCCESS_INDICATOR = success;
}").
-get_functor_ordinal(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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],
@@ -528,11 +518,6 @@
SUCCESS_INDICATOR = success;
}").
-construct(_, _, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("construct__construct").
-
construct_tuple(Args) =
construct_tuple_2(Args,
list__map(univ_type, Args),
@@ -579,8 +564,3 @@
*/
MR_new_univ_on_hp(Term, type_info, new_data);
}").
-
-construct_tuple_2(_, _, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("construct__construct_tuple_2").
Index: deconstruct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/deconstruct.m,v
retrieving revision 1.23
diff -u -d -u -r1.23 deconstruct.m
--- deconstruct.m 20 Jan 2003 16:34:27 -0000 1.23
+++ deconstruct.m 21 Feb 2003 02:09:42 -0000
@@ -682,20 +682,6 @@
Success = 0
).
-univ_named_arg_dna(_Term::in, _Name::in, _Arg::out) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("deconstruct__univ_named_arg_dna/3").
-univ_named_arg_can(_Term::in, _Name::in, _Arg::out) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("deconstruct__univ_named_arg_can/3").
-univ_named_arg_idcc(_Term::in, _Name::in, _DummyUniv::in, _Argument::out,
- _Success::out) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("deconstruct__univ_named_arg_idcc/3").
-
%-----------------------------------------------------------------------------%
:- pred deconstruct_dna(T::in, string::out, int::out, list(univ)::out) is det.
@@ -976,11 +962,6 @@
}
}").
-get_notag_functor_info(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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
% with the equivalent type. (I.e. this removes one layer of equivalence
@@ -1020,11 +1001,6 @@
}
}").
-get_equiv_functor_info(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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.
:- pred get_enum_functor_info(univ::in, int::out) is semidet.
@@ -1052,11 +1028,6 @@
}
}").
-get_enum_functor_info(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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
% arguments as well as its tag information: an indication of where the
@@ -1155,8 +1126,3 @@
break;
}
}").
-
-get_du_functor_info(_, _, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("get_du_functor_info").
Index: float.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/float.m,v
retrieving revision 1.50
diff -u -d -u -r1.50 float.m
--- float.m 29 Nov 2002 13:50:59 -0000 1.50
+++ float.m 21 Feb 2003 02:11:03 -0000
@@ -258,11 +258,6 @@
#endif
").
-domain_checks :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__domain_checks").
-
%---------------------------------------------------------------------------%
%
% Conversion functions
@@ -283,10 +278,6 @@
"
Ceil = System.Convert.ToInt32(System.Math.Ceiling(X));
").
-float__ceiling_to_int(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__ceiling_to_int").
% float__floor_to_int(X) returns the
% largest integer not greater than X.
@@ -300,10 +291,6 @@
"
Floor = System.Convert.ToInt32(System.Math.Floor(X));
").
-float__floor_to_int(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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.
@@ -317,10 +304,6 @@
"
Round = System.Convert.ToInt32(System.Math.Floor(X + 0.5));
").
-float__round_to_int(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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|.
@@ -334,10 +317,6 @@
"
Trunc = System.Convert.ToInt32(X);
").
-float__truncate_to_int(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__truncate_to_int").
%---------------------------------------------------------------------------%
%
@@ -433,10 +412,6 @@
"
H = F.GetHashCode();
").
-float__hash(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__hash").
%---------------------------------------------------------------------------%
@@ -456,10 +431,6 @@
call bool [mscorlib]System.Double::IsNaN(float64)
stloc 'succeeded'
").
-is_nan(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__is_nan").
:- pragma promise_pure(is_inf/1).
:- pragma foreign_proc(c, is_inf(Flt::in),
@@ -472,10 +443,6 @@
call bool [mscorlib]System.Double::IsInfinity(float64)
stloc 'succeeded'
").
-is_inf(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__is_inf").
%---------------------------------------------------------------------------%
%
@@ -523,10 +490,6 @@
:- pragma foreign_proc("C#", float__max = (Max::out),
[will_not_call_mercury, promise_pure, thread_safe],
"Max = System.Double.MaxValue;").
-float__max = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__max").
% Minimum normalised floating-point number */
:- pragma foreign_proc("C", float__min = (Min::out),
@@ -541,10 +504,6 @@
% glibc header files); this is OK, because the ECMA specification
% nails down the representation of double as 64-bit IEEE.
"Min = 2.2250738585072014e-308;").
-float__min = _ :=
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__min").
% Smallest x such that x \= 1.0 + x
:- pragma foreign_proc("C", float__epsilon = (Eps::out),
@@ -561,10 +520,6 @@
% glibc header files); this is OK, because the ECMA specification
% nails down the representation of double as 64-bit IEEE.
"Eps = 2.2204460492503131e-16;").
-float__epsilon = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__epsilon").
% Radix of the floating-point representation.
:- pragma foreign_proc("C", float__radix = (Radix::out),
@@ -576,10 +531,6 @@
% I think that implies that it must have Radix = 2.
% This is definitely right for x86, anyway.
"Radix = 2;").
-float__radix = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__radix").
% The number of base-radix digits in the mantissa.
:- pragma foreign_proc("C", float__mantissa_digits = (MantDig::out),
@@ -589,10 +540,6 @@
[will_not_call_mercury, promise_pure, thread_safe],
% ECMA specifies that System.Double is 64-bit IEEE float
"MantDig = 53;").
-float__mantissa_digits = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__mantissa_digits").
% Minimum negative integer such that:
% radix ** (min_exponent - 1)
@@ -604,10 +551,6 @@
[will_not_call_mercury, promise_pure, thread_safe],
% ECMA specifies that System.Double is 64-bit IEEE float
"MinExp = -1021;").
-float__min_exponent = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__min_exponent").
% Maximum integer such that:
% radix ** (max_exponent - 1)
@@ -619,10 +562,6 @@
[will_not_call_mercury, promise_pure, thread_safe],
% ECMA specifies that System.Double is 64-bit IEEE float
"MaxExp = 1024;").
-float__max_exponent = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("float__max_exponent").
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
Index: int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.88
diff -u -d -u -r1.88 int.m
--- int.m 28 Jun 2002 01:36:40 -0000 1.88
+++ int.m 21 Feb 2003 02:11:27 -0000
@@ -352,11 +352,6 @@
#endif
").
-domain_checks :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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),
@@ -518,10 +513,6 @@
"
FloatVal = (MR_Float) IntVal;
").
-int__to_float(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("int__to_float").
%-----------------------------------------------------------------------------%
@@ -596,21 +587,6 @@
[will_not_call_mercury, promise_pure, thread_safe], "
Bits = ML_BITS_PER_INT;
").
-
-int__max_int(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("int__max_int").
-
-int__min_int(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("int__min_int").
-
-int__bits_per_int(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("int__bits_per_int").
int__quot_bits_per_int(Int::in) = (Result::out) :-
Result = Int // int__bits_per_int.
Index: io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.291
diff -u -d -u -r1.291 io.m
--- io.m 15 Feb 2003 22:38:43 -0000 1.291
+++ io.m 21 Feb 2003 02:15:35 -0000
@@ -1914,11 +1914,6 @@
MR_update_io(IO0, IO);
}").
-io__clear_err(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { 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.
@@ -1962,11 +1957,6 @@
MR_update_io(IO0, IO);
}").
-ferror(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("ferror") }.
-
% io__make_err_msg(MessagePrefix, Message):
% `Message' is an error message obtained by looking up the
% message for the current value of errno and prepending
@@ -1989,11 +1979,6 @@
Msg = System::String::Concat(Msg0, MR_io_exception->Message);
}").
-make_err_msg(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__make_err_msg") }.
-
%-----------------------------------------------------------------------------%
@@ -2053,12 +2038,6 @@
MR_update_io(IO0, IO);
}").
-io__stream_file_size(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__stream_file_size") }.
-
-
io__file_modification_time(File, Result) -->
io__file_modification_time_2(File, Status, Msg, Time),
{ Status = 1 ->
@@ -3219,16 +3198,6 @@
MR_update_io(IO0, IO);
").
-io__get_stream_names(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__get_stream_names") }.
-
-io__set_stream_names(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { 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.
@@ -3286,16 +3255,6 @@
MR_update_io(IOState0, IOState);
").
-io__set_globals(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_globals") }.
-
-io__get_globals(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__get_globals") }.
-
io__progname_base(DefaultName, PrognameBase) -->
io__progname(DefaultName, Progname),
{ dir__basename(Progname, PrognameBase) }.
@@ -3337,11 +3296,6 @@
Id = mf->id;
").
-io__get_stream_id(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("io__get_stream_id").
-
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -4435,26 +4389,6 @@
MR_update_io(IO0, IO);
}").
-io__read_char_code(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__read_char_code") }.
-
-io__read_byte_val(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__read_byte_val") }.
-
-io__putback_char(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__putback_char") }.
-
-io__putback_byte(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__putback_byte") }.
-
/* output predicates - with output to mercury_current_text_output */
:- pragma foreign_proc("C",
@@ -4618,44 +4552,9 @@
MR_update_io(IO0, IO);
").
-io__write_string(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_string") }.
-
-io__write_char(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_char") }.
-
-io__write_int(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_int") }.
-
io__write_float(Float) -->
io__write_string(string__float_to_string(Float)).
-io__write_byte(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_byte") }.
-
-io__write_bytes(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_bytes") }.
-
-io__flush_output -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__flush_output") }.
-
-io__flush_binary_output -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__flush_binary_output") }.
-
/* moving about binary streams */
:- pred whence_to_int(io__whence::in, int::out) is det.
@@ -4708,16 +4607,6 @@
MR_update_io(IO0, IO);
}").
-io__seek_binary_2(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__seek_binary_2") }.
-
-io__binary_stream_offset(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__binary_stream_offset") }.
-
/* output predicates - with output to the specified stream */
:- pragma foreign_proc("C",
@@ -4899,44 +4788,9 @@
MR_update_io(IO0, IO);
}").
-io__write_string(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_string") }.
-
-io__write_char(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_char") }.
-
-io__write_int(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_int") }.
-
io__write_float(Stream, Float) -->
io__write_string(Stream, string__float_to_string(Float)).
-io__write_byte(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_byte") }.
-
-io__write_bytes(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__write_bytes") }.
-
-io__flush_output(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__flush_output") }.
-
-io__flush_binary_output(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__flush_binary_output") }.
-
/* stream predicates */
:- pragma export(io__stdin_stream(out, di, uo), "ML_io_stdin_stream").
@@ -5350,131 +5204,6 @@
MR_update_io(IO0, IO);
").
-io__stdin_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__stdin_stream") }.
-
-io__stdout_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__stdout_stream") }.
-
-io__stderr_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__stderr_stream") }.
-
-io__stdin_binary_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__stdin_binary_stream") }.
-
-io__stdout_binary_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__stdout_binary_stream") }.
-
-io__input_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__input_stream") }.
-
-io__output_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__output_stream") }.
-
-io__binary_input_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__binary_input_stream") }.
-
-io__binary_output_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__binary_output_stream") }.
-
-io__get_line_number(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__get_line_number") }.
-
-io__get_line_number(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__get_line_number") }.
-
-io__set_line_number(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_line_number") }.
-
-io__set_line_number(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_line_number") }.
-
-io__get_output_line_number(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__get_output_line_number") }.
-
-io__get_output_line_number(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__get_output_line_number") }.
-
-io__set_output_line_number(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_output_line_number") }.
-
-io__set_output_line_number(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_output_line_number") }.
-
-io__current_input_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__current_input_stream") }.
-
-io__current_output_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__current_output_stream") }.
-
-io__current_binary_input_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__current_binary_input_stream") }.
-
-io__current_binary_output_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__current_binary_output_stream") }.
-
-io__set_input_stream(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_input_stream") }.
-
-io__set_output_stream(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_output_stream") }.
-
-io__set_binary_input_stream(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_binary_input_stream") }.
-
-io__set_binary_output_stream(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_binary_output_stream") }.
-
/* stream open/close predicates */
% io__do_open(File, Mode, ResultCode, Stream, IO0, IO1).
@@ -5527,16 +5256,6 @@
MR_update_io(IO0, IO);
").
-io__do_open_text(_, _, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__do_open_text") }.
-
-io__do_open_binary(_, _, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__do_open_binary") }.
-
io__close_input(Stream) -->
io__delete_stream_name(Stream),
io__close_stream(Stream).
@@ -5569,11 +5288,6 @@
MR_update_io(IO0, IO);
").
-io__close_stream(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__close_stream") }.
-
/* miscellaneous predicates */
:- pragma foreign_proc("C",
@@ -5779,26 +5493,6 @@
}
").
-io__command_line_arguments(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__command_line_arguments") }.
-
-io__get_exit_status(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__get_exit_status") }.
-
-io__set_exit_status(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__set_exit_status") }.
-
-io__call_system_code(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__call_system_code") }.
-
/*---------------------------------------------------------------------------*/
/* io__getenv and io__setenv */
@@ -5826,13 +5520,6 @@
SUCCESS_INDICATOR = (Value != null);
}").
-io__getenv(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("io__getenv").
-
-
io__setenv(Var, Value) :-
impure io__putenv(Var ++ "=" ++ Value).
@@ -5873,12 +5560,6 @@
SUCCESS_INDICATOR = (putenv(c_string) == 0);
").
-io__putenv(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("io__putenv").
-
/*---------------------------------------------------------------------------*/
io__tmpnam(Name) -->
@@ -6058,11 +5739,6 @@
}
}").
-io__do_make_temp(_, _, _, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__do_make_temp") }.
-
/*---------------------------------------------------------------------------*/
:- pragma foreign_decl("C", "
@@ -6154,11 +5830,6 @@
}
}").
-io__remove_file_2(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { 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),
( Res \= 0 ->
@@ -6203,11 +5874,6 @@
RetStr = e.Message;
}
}").
-
-io__rename_file_2(_, _, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("io__rename_file_2") }.
/*---------------------------------------------------------------------------*/
Index: library.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/library.m,v
retrieving revision 1.66
diff -u -d -u -r1.66 library.m
--- library.m 19 Feb 2003 05:54:40 -0000 1.66
+++ library.m 21 Feb 2003 02:16:13 -0000
@@ -76,10 +76,5 @@
Version = MR_VERSION "", configured for "" MR_FULLARCH;
").
-library__version(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("library__version").
-
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
Index: math.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/math.m,v
retrieving revision 1.41
diff -u -d -u -r1.41 math.m
--- math.m 14 Jun 2002 10:18:49 -0000 1.41
+++ math.m 22 Feb 2003 10:21:02 -0000
@@ -264,12 +264,6 @@
#endif
").
-domain_checks :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- semidet_succeed,
- private_builtin__sorry("domain_checks").
-
%
% Mathematical constants from math.m
%
@@ -283,10 +277,12 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Pi = System.Math.PI;
").
-math__pi = _ :-
% This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__pi").
+ % matching foreign_proc version. We define this with sufficient
+ % digits that if the underlying implementation's
+ % floating point parsing routines are good, it should
+ % to be accurate enough for 128-bit IEEE float.
+math__pi = 3.1415926535897932384626433832795029.
% Base of natural logarithms
:- pragma foreign_proc("C", math__e = (E::out),
@@ -297,10 +293,12 @@
[will_not_call_mercury, promise_pure, thread_safe],"
E = System.Math.E;
").
-math__e = _ :-
% This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__e").
+ % matching foreign_proc version. We define this with sufficient
+ % digits that if the underlying implementation's
+ % floating point parsing routines are good, it should
+ % to be accurate enough for 128-bit IEEE float.
+math__e = 2.7182818284590452353602874713526625.
%
% math__ceiling(X) = Ceil is true if Ceil is the smallest integer
@@ -316,10 +314,6 @@
"
Ceil = System.Math.Ceiling(Num);
").
-math__ceiling(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__ceiling").
%
% math__floor(X) = Floor is true if Floor is the largest integer
@@ -335,16 +329,13 @@
"
Floor = System.Math.Floor(Num);
").
-math__floor(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__floor").
%
% math__round(X) = Round is true if Round is the integer
% closest to X. If X has a fractional component of 0.5,
% it is rounded up.
%
+% XXX Why do we even both implementing this in C/C#?
:- pragma foreign_proc("C", math__round(Num::in) = (Rounded::out),
[will_not_call_mercury, promise_pure, thread_safe],
"
@@ -357,10 +348,7 @@
// Unfortunately they are better (round to nearest even number).
Rounded = System.Math.Floor(Num+0.5);
").
-math__round(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__round").
+math__round(Num) = math__floor(Num + 0.5).
%
% math__truncate(X) = Trunc is true if Trunc is the integer
@@ -392,10 +380,9 @@
[thread_safe, promise_pure], "
SquareRoot = System.Math.Sqrt(X);
").
-math__sqrt_2(_) = _ :-
% This version is only used for back-ends for which there is no
% matching foreign_proc version.
- private_builtin__sorry("math__sqrt_2").
+math__sqrt_2(X) = math__exp(math__ln(X) / 2.0).
%
% math__solve_quadratic(A, B, C) = Roots is true if Roots are
@@ -472,11 +459,6 @@
[thread_safe, promise_pure], "
Res = System.Math.Pow(X, Y);
").
-math__pow_2(_, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__pow_2").
-
%
% math__exp(X) = Exp is true if Exp is X raised to the
@@ -490,10 +472,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Exp = System.Math.Exp(X);
").
-math__exp(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__exp").
%
% math__ln(X) = Log is true if Log is the natural logarithm
@@ -519,10 +497,6 @@
[thread_safe, promise_pure], "
Log = System.Math.Log(X);
").
-math__ln_2(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__ln_2").
%
% math__log10(X) = Log is true if Log is the logarithm to
@@ -548,10 +522,7 @@
[thread_safe, promise_pure], "
Log10 = System.Math.Log10(X);
").
-math__log10_2(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__log10_2").
+math__log10_2(X) = math__ln_2(X) / math__ln_2(10.0).
%
% math__log2(X) = Log is true if Log is the logarithm to
@@ -577,10 +548,7 @@
[thread_safe, promise_pure], "
Log2 = System.Math.Log(X) / ML_FLOAT_LN2;
").
-math__log2_2(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__log2_2").
+math__log10_2(X) = math__ln_2(X) / math__ln_2(2.0).
%
% math__log(B, X) = Log is true if Log is the logarithm to
@@ -608,17 +576,13 @@
:- pragma foreign_proc("C", math__log_2(B::in, X::in) = (Log::out),
[will_not_call_mercury, promise_pure, thread_safe], "
- Log = log(X)/log(B);
+ Log = log(X) / log(B);
").
:- pragma foreign_proc("C#", math__log_2(B::in, X::in) = (Log::out),
[thread_safe, promise_pure], "
- Log = System.Math.Log(X,B);
+ Log = System.Math.Log(X, B);
").
-math__log_2(_, _) = _ -
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__log_2").
-
+math__log_2(X, B) = math__ln_2(X) / math__log_2(B).
%
% math__sin(X) = Sin is true if Sin is the sine of X.
@@ -631,10 +595,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Sin = System.Math.Sin(X);
").
-math__sin(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__sin").
%
@@ -648,10 +608,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Cos = System.Math.Cos(X);
").
-math__cos(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__cos").
%
% math__tan(X) = Tan is true if Tan is the tangent of X.
@@ -664,10 +620,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Tan = System.Math.Tan(X);
").
-math__tan(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__tan").
%
% math__asin(X) = ASin is true if ASin is the inverse
@@ -698,10 +650,6 @@
[thread_safe, promise_pure], "
ASin = System.Math.Asin(X);
").
-math__asin_2(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__asin_2").
%
% math__acos(X) = ACos is true if ACos is the inverse
@@ -732,10 +680,6 @@
[thread_safe, promise_pure], "
ACos = System.Math.Acos(X);
").
-math__acos_2(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__acos_2").
%
@@ -750,10 +694,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
ATan = System.Math.Atan(X);
").
-math__atan(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__atan").
%
% math__atan2(Y, X) = ATan is true if ATan is the inverse
@@ -767,10 +707,6 @@
[will_not_call_mercury, promise_pure, thread_safe], "
ATan2 = System.Math.Atan2(Y, X);
").
-math__atan2(_, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__atan2").
%
% math__sinh(X) = Sinh is true if Sinh is the hyperbolic
@@ -784,10 +720,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Sinh = System.Math.Sinh(X);
").
-math__sinh(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__sinh").
%
% math__cosh(X) = Cosh is true if Cosh is the hyperbolic
@@ -801,10 +733,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Cosh = System.Math.Cosh(X);
").
-math__cosh(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__cosh").
%
% math__tanh(X) = Tanh is true if Tanh is the hyperbolic
@@ -818,10 +746,6 @@
[will_not_call_mercury, promise_pure, thread_safe],"
Tanh = System.Math.Tanh(X);
").
-math__tanh(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("math__tanh").
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
Index: private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.113
diff -u -d -u -r1.113 private_builtin.m
--- private_builtin.m 21 Feb 2003 01:57:27 -0000 1.113
+++ private_builtin.m 21 Feb 2003 02:30:35 -0000
@@ -170,11 +170,6 @@
Res = System::String::Compare(S1, S2);
").
-builtin_strcmp(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- sorry("builtin_strcmp").
-
builtin_unify_float(F, F).
builtin_compare_float(R, F1, F2) :-
@@ -678,26 +673,6 @@
MR_typeclass_info_arg_typeclass_info(TypeClassInfo0, Index);
").
-type_info_from_typeclass_info(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- sorry("type_info_from_typeclass_info").
-
-unconstrained_type_info_from_typeclass_info(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- sorry("unconstrained_type_info_from_typeclass_info").
-
-superclass_from_typeclass_info(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- sorry("superclass_from_typeclass_info").
-
-instance_constraint_from_typeclass_info(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- sorry("instance_constraint_from_typeclass_info").
-
%-----------------------------------------------------------------------------%
% This section of the module contains predicates that are used
@@ -734,36 +709,6 @@
:- implementation.
-% Default (Mercury) implementations.
-% These should be overridden by the appropriate foreign language implementation.
-store_ticket(_Ticket::out) :-
- impure imp,
- sorry("private_builtin__store_ticket/1").
-reset_ticket_undo(_Ticket::in) :-
- impure imp,
- sorry("private_builtin__reset_ticket_undo/1").
-reset_ticket_commit(_Ticket::in) :-
- impure imp,
- sorry("private_builtin__reset_ticket_commit/1").
-reset_ticket_solve(_Ticket::in) :-
- impure imp,
- sorry("private_builtin__reset_ticket_solve/1").
-mark_ticket_stack(_TicketCounter::out) :-
- impure imp,
- sorry("private_builtin__mark_ticket_stack/1").
-prune_tickets_to(_TicketCounter::in) :-
- impure imp,
- sorry("private_builtin__prune_tickets_to/1").
-/****
-% XXX we can't give default Mercury implementations for these,
-% because you can't write a mode-specific clause for a zero-arity
-% procedure.
-discard_ticket :-
- sorry("private_builtin__discard_ticket/0").
-prune_ticket :-
- sorry("private_builtin__prune_ticket/0").
-****/
-
:- pragma foreign_proc("C", store_ticket(Ticket::out),
[will_not_call_mercury, thread_safe],
"
@@ -997,12 +942,6 @@
#include ""mercury_heap.h"" /* for MR_free_heap() */
").
-% default (Mercury) implementation for gc_trace/1
-% This should be overridden by the appropriate foreign language implementation.
-gc_trace(_::in) :-
- impure imp,
- sorry("private_builtin__gc_trace/1").
-
:- pragma foreign_proc("C", gc_trace(Pointer::in),
[will_not_call_mercury, thread_safe],
"
@@ -1018,24 +957,9 @@
#endif
").
-% default (Mercury) implementation for free_heap/1
-% This should be overridden by the appropriate foreign language implementation.
-free_heap(_::di) :-
- impure imp,
- sorry("private_builtin__free_heap/1").
-
:- pragma foreign_proc("C", free_heap(Val::di),
[will_not_call_mercury, promise_pure, thread_safe],
"MR_free_heap((void *) Val);").
-
-% default (Mercury) implementations for mark_hp/1 and restore_hp/1.
-% This should be overridden by the appropriate foreign language implementation.
-mark_hp(_::out) :-
- impure imp,
- sorry("private_builtin__mark_hp/1").
-restore_hp(_::in) :-
- impure imp,
- sorry("private_builtin__restore_hp/1").
:- pragma foreign_proc("C", mark_hp(SavedHeapPointer::out),
[will_not_call_mercury, thread_safe],
Index: rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.40
diff -u -d -u -r1.40 rtti_implementation.m
--- rtti_implementation.m 4 Feb 2003 07:37:22 -0000 1.40
+++ rtti_implementation.m 21 Feb 2003 07:49:53 -0000
@@ -1191,6 +1191,7 @@
Arity = 0,
Arguments = []
;
+ % XXX FIXME!!!
TypeCtorRep = reserved_addr,
Functor = "some_reserved_addr",
Arity = 0,
Index: std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.280
diff -u -d -u -r1.280 std_util.m
--- std_util.m 10 Feb 2003 17:03:50 -0000 1.280
+++ std_util.m 21 Feb 2003 02:37:19 -0000
@@ -1051,11 +1051,6 @@
#endif
").
-get_registers(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("get_registers").
-
:- impure pred check_for_floundering(trail_ptr::in) is det.
:- pragma foreign_proc("C",
@@ -1077,11 +1072,6 @@
#endif
").
-check_for_floundering(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("check_for_floundering").
-
%
% Discard the topmost trail ticket.
%
@@ -1105,11 +1095,6 @@
#endif
").
-discard_trail_ticket :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("discard_trail_ticket").
-
%
% Swap the heap with the solutions heap
%
@@ -1143,11 +1128,6 @@
*/
").
-swap_heap_and_solutions_heap :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- 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
@@ -1230,11 +1210,6 @@
NewVal = OldVal;
").
-partial_deep_copy(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("partial_deep_copy").
-
%
% reset_solutions_heap(SolutionsHeapPtr):
% Reset the solutions heap pointer to the specified value,
@@ -1262,12 +1237,6 @@
*/
").
-reset_solutions_heap(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- impure private_builtin__imp,
- private_builtin__sorry("reset_solutions_heap").
-
%-----------------------------------------------------------------------------%
%%% :- module mutvar.
@@ -1370,19 +1339,6 @@
"
Ref[0] = X;
").
-
-new_mutvar(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("new_mutvar").
-get_mutvar(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("get_mutvar").
-set_mutvar(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("set_mutvar").
%%% end_module mutvar.
Index: store.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/store.m,v
retrieving revision 1.36
diff -u -d -u -r1.36 store.m
--- store.m 10 Feb 2003 17:03:51 -0000 1.36
+++ store.m 21 Feb 2003 02:38:16 -0000
@@ -267,11 +267,6 @@
:- pragma foreign_proc("C", store__do_init(_S0::uo),
[will_not_call_mercury, promise_pure], "").
-store__do_init(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("store__do_init").
-
/*
Note -- the syntax for the operations on stores
might be nicer if we used some new operators, e.g.
@@ -311,25 +306,10 @@
S = S0;
").
-new_mutvar(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__new_mutvar") }.
-
copy_mutvar(Mutvar, Copy) -->
get_mutvar(Mutvar, Value),
new_mutvar(Value, Copy).
-get_mutvar(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__get_mutvar") }.
-
-set_mutvar(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { 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.
@@ -342,11 +322,6 @@
S = S0;
").
-unsafe_new_uninitialized_mutvar(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("unsafe_new_uninitialized_mutvar") }.
-
store__new_cyclic_mutvar(Func, MutVar) -->
store__unsafe_new_uninitialized_mutvar(MutVar),
{ Value = apply(Func, MutVar) },
@@ -362,11 +337,6 @@
S = S0;
").
-new_ref(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__new_ref") }.
-
copy_ref_value(Ref, Val) -->
/* XXX need to deep-copy non-atomic types */
unsafe_ref_value(Ref, Val).
@@ -384,11 +354,6 @@
S = S0;
").
-store__unsafe_ref_value(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__unsafe_ref_value") }.
-
ref_functor(Ref, Functor, Arity) -->
unsafe_ref_value(Ref, Val),
{ functor(Val, Functor, Arity) }.
@@ -503,31 +468,6 @@
Val = * (MR_Word *) Ref;
").
-arg_ref(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__arg_ref") }.
-
-new_arg_ref(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__new_arg_ref") }.
-
-set_ref(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__set_ref") }.
-
-set_ref_value(_, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__set_ref_value") }.
-
-extract_ref_value(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("store__extract_ref_value").
-
%-----------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -549,14 +489,4 @@
ArgRef = (MR_Word) &Ptr[Arg];
S = S0;
}").
-
-unsafe_arg_ref(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__unsafe_arg_ref") }.
-
-unsafe_new_arg_ref(_, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("store__unsafe_new_arg_ref") }.
Index: string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.194
diff -u -d -u -r1.194 string.m
--- string.m 18 Feb 2003 02:08:11 -0000 1.194
+++ string.m 22 Feb 2003 09:55:10 -0000
@@ -1794,11 +1794,6 @@
[will_not_call_mercury, promise_pure, thread_safe], "
SUCCESS_INDICATOR = MR_FALSE;
").
-using_sprintf :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("string__using_sprintf").
-
% Construct a format string suitable to passing to sprintf.
:- func make_format_sprintf(list(char), maybe(list(char)),
@@ -1865,10 +1860,6 @@
MR_make_aligned_string(LengthModifier,
(MR_String) (MR_Word) MR_INTEGER_LENGTH_MODIFIER);
}").
-int_length_modifer = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("int_length_modifer").
% Create a string from a float using the format string.
@@ -1882,10 +1873,6 @@
Str = MR_make_string(MR_PROC_LABEL, FormatStr, (double) Val);
MR_restore_transient_hp();
}").
-native_format_float(_, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("native_format_float").
% Create a string from a int using the format string.
% Note it is the responsibility of the caller to ensure that the
@@ -1898,10 +1885,6 @@
Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
MR_restore_transient_hp();
}").
-native_format_int(_, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("native_format_int").
% Create a string from a string using the format string.
% Note it is the responsibility of the caller to ensure that the
@@ -1912,10 +1895,6 @@
[will_not_call_mercury, promise_pure, thread_safe], "{
Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
}").
-native_format_string(_, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("native_format_string").
% Create a string from a char using the format string.
% Note it is the responsibility of the caller to ensure that the
@@ -1928,10 +1907,6 @@
Str = MR_make_string(MR_PROC_LABEL, FormatStr, Val);
MR_restore_transient_hp();
}").
-native_format_char(_, _) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("native_format_char").
%-----------------------------------------------------------------------------%
@@ -2907,11 +2882,6 @@
FloatString = FloatVal.ToString(""R"");
").
-string__lowlevel_float_to_string(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("string__lowlevel_float_to_string").
-
:- pragma export(string__to_float(in, out), "ML_string_to_float").
:- pragma foreign_proc("C",
string__to_float(FloatString::in, FloatVal::out),
@@ -2950,11 +2920,6 @@
}
}").
-string__to_float(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("string__to_float").
-
/*-----------------------------------------------------------------------*/
/*
@@ -3191,10 +3156,6 @@
System::Convert::ToString(Ch),
Str0->Substring(Index + 1));
").
-string__unsafe_set_char(_, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("string__unsafe_set_char").
/*
:- pred string__unsafe_set_char(char, int, string, string).
@@ -3479,11 +3440,6 @@
SubString = Str->Substring(Start, Count);
}").
-string__unsafe_substring(_, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("string__unsafe_substring").
-
/*
:- pred string__split(string, int, string, string).
:- mode string__split(in, in, uo, uo) is det.
@@ -3702,12 +3658,6 @@
Str = System::String::Concat(FirstStr, Rest);
}").
-
-:- pragma promise_pure(string__first_char/3).
-string__first_char(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("string__first_char").
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
Index: time.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/time.m,v
retrieving revision 1.32
diff -u -d -u -r1.32 time.m
--- time.m 12 Jan 2003 10:13:03 -0000 1.32
+++ time.m 21 Feb 2003 02:43:23 -0000
@@ -221,10 +221,6 @@
Ret = (MR_Integer) clock();
MR_update_io(IO0, IO);
}").
-time__c_clock(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("time__c_clock") }.
%-----------------------------------------------------------------------------%
@@ -241,10 +237,6 @@
"{
Ret = (MR_Integer) CLOCKS_PER_SEC;
}").
-time__c_clocks_per_sec(_) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_clocks_per_sec").
%-----------------------------------------------------------------------------%
@@ -282,10 +274,6 @@
#endif
MR_update_io(IO0, IO);
}").
-time__c_times(_, _, _, _, _) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("time__c_times") }.
%-----------------------------------------------------------------------------%
@@ -313,10 +301,6 @@
Ret = -1;
#endif
}").
-time__c_clk_tck = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_clk_tck").
%-----------------------------------------------------------------------------%
@@ -341,10 +325,6 @@
Ret = (MR_Integer) time(NULL);
MR_update_io(IO0, IO);
}").
-time__c_time(_) -->
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- { private_builtin__sorry("time__c_time") }.
%-----------------------------------------------------------------------------%
@@ -362,10 +342,6 @@
"{
Diff = (MR_Float) difftime((time_t) T1, (time_t) T0);
}").
-time__c_difftime(_, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_difftime").
%-----------------------------------------------------------------------------%
@@ -403,10 +379,6 @@
YD = (MR_Integer) p->tm_yday;
N = (MR_Integer) p->tm_isdst;
}").
-time__c_localtime(_, _, _, _, _, _, _, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_localtime").
%:- func time__gmtime(time_t) = tm.
@@ -443,10 +415,6 @@
YD = (MR_Integer) p->tm_yday;
N = (MR_Integer) p->tm_isdst;
}").
-time__c_gmtime(_, _, _, _, _, _, _, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_gmtime").
:- func int_to_maybe_dst(int) = maybe(dst).
@@ -490,10 +458,6 @@
Time = (MR_Integer) mktime(&t);
}").
-time__c_mktime(_, _, _, _, _, _, _, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_mktime").
:- func maybe_dst_to_int(maybe(dst)) = int.
@@ -540,10 +504,6 @@
MR_make_aligned_string_copy(Str, s);
}").
-time__c_asctime(_, _, _, _, _, _, _, _, _, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_asctime").
%-----------------------------------------------------------------------------%
@@ -568,10 +528,6 @@
MR_make_aligned_string_copy(Str, s);
}").
-time__c_ctime(_, _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("time__c_ctime").
%-----------------------------------------------------------------------------%
:- end_module time.
Index: type_desc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.16
diff -u -d -u -r1.16 type_desc.m
--- type_desc.m 17 Jan 2003 05:56:50 -0000 1.16
+++ type_desc.m 21 Feb 2003 02:44:16 -0000
@@ -317,11 +317,6 @@
TypeInfo = TypeInfo_for_T;
").
-type_of(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("type_of").
-
:- pragma foreign_proc("C",
has_type(_Arg::unused, TypeInfo::in),
[will_not_call_mercury, thread_safe, promise_pure],
@@ -336,11 +331,6 @@
TypeInfo_for_T = TypeInfo;
").
-has_type("dummy value", _) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("has_type").
-
% Export this function in order to use it in runtime/mercury_trace_external.c
:- pragma export(type_name(in) = out, "ML_type_name").
@@ -450,11 +440,6 @@
TypeCtor = (MR_Word) MR_make_type_ctor_desc(type_info, type_ctor_info);
}").
-type_ctor(_) = _ :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("type_ctor").
-
:- pragma foreign_proc("C",
type_ctor_and_args(TypeDesc::in, TypeCtorDesc::out, ArgTypes::out),
[will_not_call_mercury, thread_safe, promise_pure],
@@ -525,11 +510,6 @@
}
}").
-make_type(_TypeCtorDesc::in, _ArgTypes::in) = (_TypeDesc::out) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("make_type/2 forward mode.").
-
/*
** This is the reverse mode of make_type: given a type,
** split it up into a type constructor and a list of
@@ -551,11 +531,6 @@
MR_restore_transient_registers();
}").
-
-make_type(_TypeCtorDesc::out, _ArgTypes::out) = (_TypeDesc::in) :-
- % This version is only used for back-ends for which there is no
- % matching foreign_proc version.
- private_builtin__sorry("make_type/2 reverse mode").
:- pragma foreign_proc("C",
type_ctor_name_and_arity(TypeCtorDesc::in, TypeCtorModuleName::out,
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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