[m-rev.] for review: Delete Erlang code from library/mdbcomp/browser directories.
Peter Wang
novalazy at gmail.com
Tue Oct 27 14:51:17 AEDT 2020
library/*.m:
Delete Erlang foreign code and foreign types.
Delete documentation specific to Erlang targets.
library/deconstruct.m:
Add pragma no_determinism_warning to allow functor_number_cc/3
to compile for now.
library/Mercury.options:
Delete workaround only needed when targetting Erlang.
browser/listing.m:
mdbcomp/rtti_access.m:
Delete Erlang foreign code and foreign types.
diff --git a/browser/listing.m b/browser/listing.m
index 5a6a475d8..23c1dbe5a 100644
--- a/browser/listing.m
+++ b/browser/listing.m
@@ -122,7 +122,6 @@
% stub.
:- pragma foreign_type("C#", c_file_ptr, "object").
:- pragma foreign_type("Java", c_file_ptr, "java.lang.Object").
-:- pragma foreign_type("Erlang", c_file_ptr, "").
% These predicates are called from trace/mercury_trace_internal.c.
%
diff --git a/library/Mercury.options b/library/Mercury.options
index fed83309e..41b8b6576 100644
--- a/library/Mercury.options
+++ b/library/Mercury.options
@@ -73,9 +73,6 @@ MCFLAGS-uint64 += --no-warn-unused-imports
MCFLAGS-thread += --no-local-thread-engine-base
MCFLAGS-thread.semaphore += --no-local-thread-engine-base
-# Work around a problem in the HiPE compiler (as of Erlang R11B5).
-MCFLAGS-bitmap += --no-erlang-native-code
-
# Work around a warning for termination analysis of the user defined equality
# and comparison code for lazy values.
MCFLAGS-lazy += --no-warn-non-term-special-preds
diff --git a/library/array.m b/library/array.m
index d676debc5..0663c4108 100644
--- a/library/array.m
+++ b/library/array.m
@@ -865,10 +865,6 @@
where equality is array.array_equal,
comparison is array.array_compare.
-:- pragma foreign_type("Erlang", array(T), "")
- where equality is array.array_equal,
- comparison is array.array_compare.
-
% unify/2 for arrays
%
:- pred array_equal(array(T)::in, array(T)::in) is semidet.
@@ -978,13 +974,6 @@ compare_elements(N, Size, Array1, Array2, Result) :-
SUCCESS_INDICATOR = false;
").
-:- pragma foreign_proc("Erlang",
- bounds_checks,
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SUCCESS_INDICATOR = true
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_decl("C", "
@@ -1528,12 +1517,6 @@ init(Size, Item, Array) :-
"
Array = array.ML_new_array(Size, Item, true);
").
-:- pragma foreign_proc("Erlang",
- init_2(Size::in, Item::in, Array::array_uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Array = erlang:make_tuple(Size, Item)
-").
make_empty_array = A :-
array.make_empty_array(A).
@@ -1566,12 +1549,6 @@ make_empty_array = A :-
// XXX as per C#
Array = null;
").
-:- pragma foreign_proc("Erlang",
- make_empty_array(Array::array_uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Array = {}
-").
%---------------------------------------------------------------------------%
@@ -1621,12 +1598,6 @@ generate(Size, GenFunc) = Array :-
"
Array = array.ML_unsafe_new_array(Size, FirstElem, IndexToSet);
").
-:- pragma foreign_proc("Erlang",
- unsafe_init(Size::in, FirstElem::in, _IndexToSet::in) = (Array::array_uo),
- [promise_pure, will_not_call_mercury, thread_safe],
-"
- Array = erlang:make_tuple(Size, FirstElem)
-").
:- func generate_2(int::in, int::in, (func(int) = T)::in, array(T)::array_di)
= (array(T)::array_uo) is det.
@@ -1701,13 +1672,6 @@ min(A) = N :-
Min = 0;
").
-:- pragma foreign_proc("Erlang",
- min(Array::in, Min::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % Array not used
- Min = 0
-").
:- pragma foreign_proc("Java",
min(_Array::in, Min::out),
@@ -1737,12 +1701,6 @@ max(A) = N :-
Max = -1;
}
").
-:- pragma foreign_proc("Erlang",
- max(Array::in, Max::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Max = size(Array) - 1
-").
:- pragma foreign_proc("Java",
max(Array::in, Max::out),
@@ -1783,13 +1741,6 @@ size(A) = N :-
}
").
-:- pragma foreign_proc("Erlang",
- size(Array::in, Max::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Max = size(Array)
-").
-
:- pragma foreign_proc("Java",
size(Array::in, Max::out),
[will_not_call_mercury, promise_pure, thread_safe],
@@ -1873,13 +1824,6 @@ semidet_lookup(Array, Index, Item) :-
Item = Array.GetValue(Index);
}").
-:- pragma foreign_proc("Erlang",
- unsafe_lookup(Array::in, Index::in, Item::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Item = element(Index + 1, Array)
-").
-
:- pragma foreign_proc("Java",
unsafe_lookup(Array::in, Index::in, Item::out),
[will_not_call_mercury, promise_pure, thread_safe],
@@ -1947,13 +1891,6 @@ set(Index, Item, !Array) :-
Array = Array0;
}").
-:- pragma foreign_proc("Erlang",
- unsafe_set(Index::in, Item::in, Array0::array_di, Array::array_uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Array = setelement(Index + 1, Array0, Item)
-").
-
:- pragma foreign_proc("Java",
unsafe_set(Index::in, Item::in, Array0::array_di, Array::array_uo),
[will_not_call_mercury, promise_pure, thread_safe],
@@ -2066,23 +2003,6 @@ resize(N, X, !Array) :-
Array = array.ML_array_resize(Array0, Size, Item);
").
-:- pragma foreign_proc("Erlang",
- do_resize(Size::in, Item::in, Array0::array_di, Array::array_uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- InitialSize = size(Array0),
- List = tuple_to_list(Array0),
- if
- Size < InitialSize ->
- Array = list_to_tuple(lists:sublist(List, Size));
- Size > InitialSize ->
- Array = list_to_tuple(lists:append(List,
- lists:duplicate(Size - InitialSize, Item)));
- true ->
- Array = Array0
- end
-").
-
:- pragma foreign_proc("Java",
do_resize(Size::in, Item::in, Array0::array_di, Array::array_uo),
[will_not_call_mercury, promise_pure, thread_safe],
@@ -2158,13 +2078,6 @@ shrink(Size, !Array) :-
Array = array.ML_shrink_array(Array0, Size);
").
-:- pragma foreign_proc("Erlang",
- shrink_2(Size::in, Array0::array_di, Array::array_uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Array = list_to_tuple(lists:sublist(tuple_to_list(Array0), Size))
-").
-
:- pragma foreign_proc("Java",
shrink_2(Size::in, Array0::array_di, Array::array_uo),
[will_not_call_mercury, promise_pure, thread_safe],
@@ -2285,13 +2198,6 @@ copy(A1) = A2 :-
Array = (System.Array) Array0.Clone();
").
-:- pragma foreign_proc("Erlang",
- copy(Array0::in, Array::array_uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Array = Array0
-").
-
:- pragma foreign_proc("Java",
copy(Array0::in, Array::array_uo),
[will_not_call_mercury, promise_pure, thread_safe],
diff --git a/library/backjump.m b/library/backjump.m
index a33544fd7..e9057fb93 100644
--- a/library/backjump.m
+++ b/library/backjump.m
@@ -447,17 +447,6 @@ mercury_sys_init_backjumps_write_out_proc_statics(FILE *deep_fp,
%---------------------------------------------------------------------------%
-:- pragma foreign_code("Erlang", "
-
- builtin_choice_id_1_p_0(_) ->
- throw(""builtin_choice_id/1 NYI for Erlang backend"").
-
- builtin_backjump_1_p_0(_) ->
- throw(""builtin_backjump/1 NYI for Erlang backend"").
-").
-
-%---------------------------------------------------------------------------%
-
:- pragma foreign_export("C", report_invalid_backjump(in, di, uo),
"ML_report_invalid_backjump").
diff --git a/library/benchmarking.m b/library/benchmarking.m
index c6e2a34e7..7ab774a31 100644
--- a/library/benchmarking.m
+++ b/library/benchmarking.m
@@ -32,9 +32,6 @@
% nonsensical results if the previous call to `report_stats' was from a
% different thread.
%
- % Note: in Erlang, the benchmark_* procedures will change the apparent time
- % of the last call to report_stats.
- %
:- impure pred report_stats is det.
% `report_full_memory_stats' is a non-logical procedure intended for use
@@ -197,13 +194,6 @@ extern void ML_report_full_memory_stats(void);
ML_report_stats();
").
-:- pragma foreign_proc("Erlang",
- report_stats,
- [may_call_mercury, terminates],
-"
- 'ML_report_stats'()
-").
-
:- pragma foreign_proc("C",
report_full_memory_stats,
[will_not_call_mercury],
@@ -827,20 +817,6 @@ ML_report_full_memory_stats()
}
").
-:- pragma foreign_code("Erlang",
-"
-'ML_report_stats'() ->
- {Time, TimeSinceLastCall} = statistics(runtime),
- TimeSecs = Time / 1000.0,
- TimeSinceLastCallSecs = TimeSinceLastCall / 1000.0,
-
- Bytes = erlang:memory(total),
- KBytes = Bytes / 1024.0,
-
- io:format(""[Time: ~.3fs, +~.3fs, Total used: ~.3fk]~n"",
- [TimeSecs, TimeSinceLastCallSecs, KBytes]).
-").
-
%---------------------------------------------------------------------------%
:- pragma promise_pure(benchmark_det/5).
@@ -995,13 +971,6 @@ repeat(N) :-
}
").
-:- pragma foreign_proc("Erlang",
- get_user_cpu_milliseconds(Time::out),
- [will_not_call_mercury, thread_safe],
-"
- {Time, _TimeSinceLastCall} = statistics(runtime)
-").
-
% To prevent the C compiler from optimizing the benchmark code away,
% we assign the benchmark output to a volatile global variable.
@@ -1037,13 +1006,6 @@ repeat(N) :-
ML_benchmarking_dummy_word = X;
").
-:- pragma foreign_proc("Erlang",
- do_nothing(_X::in),
- [will_not_call_mercury, thread_safe],
-"
- void
-").
-
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
diff --git a/library/bitmap.m b/library/bitmap.m
index fc6254e89..bcaace318 100644
--- a/library/bitmap.m
+++ b/library/bitmap.m
@@ -557,13 +557,6 @@ num_bits(_) = _ :-
NumBits = BM.num_bits;
").
-:- pragma foreign_proc("Erlang",
- num_bits(BM::in) = (NumBits::out),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
-"
- {_, NumBits} = BM
-").
-
%---------------------------------------------------------------------------%
num_bytes(BM) = Bytes :-
@@ -765,14 +758,6 @@ _ ^ unsafe_byte(_) = _ :-
Byte = BM.elements[N];
").
-:- pragma foreign_proc("Erlang",
- unsafe_byte(N::in, BM::in) = (Byte::out),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
-"
- {Bin, _} = BM,
- <<_:N/binary, Byte/integer, _/binary>> = Bin
-").
-
%---------------------------------------------------------------------------%
(!.BM ^ byte(N) := Byte) = !:BM :-
@@ -809,16 +794,6 @@ _ ^ unsafe_byte(_) = _ :-
BM.elements[N] = (byte) Byte;
").
-:- pragma foreign_proc("Erlang",
- 'unsafe_byte :='(N::in, BM0::bitmap_di, Byte::in) = (BM::bitmap_uo),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
-"
- {Bin0, NumBits} = BM0,
- <<Left:N/binary, _/integer, Right/binary>> = Bin0,
- Bin = <<Left/binary, Byte/integer, Right/binary>>,
- BM = {Bin, NumBits}
-").
-
%---------------------------------------------------------------------------%
get_uint8(BM, N) = U8 :-
@@ -849,14 +824,6 @@ get_uint8(BM, N) = U8 :-
U8 = BM.elements[N];
").
-:- pragma foreign_proc("Erlang",
- unsafe_get_uint8(BM::in, N::in) = (U8::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- {Bin, _} = BM,
- <<_:N/binary, U8/integer, _/binary>> = Bin
-").
-
%---------------------------------------------------------------------------%
set_uint8(N, U8, !BM) :-
@@ -890,16 +857,6 @@ set_uint8(N, U8, !BM) :-
BM.elements[N] = (byte) U8;
").
-:- pragma foreign_proc("Erlang",
- unsafe_set_uint8(N::in, U8::in, BM0::bitmap_di, BM::bitmap_uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- {Bin0, NumBits} = BM0,
- <<Left:N/binary, _/integer, Right/binary>> = Bin0,
- Bin = <<Left/binary, U8/integer, Right/binary>>,
- BM = {Bin, NumBits}
-").
-
%---------------------------------------------------------------------------%
flip(!.BM, I) = !:BM :-
@@ -1004,13 +961,6 @@ unsafe_is_clear(BM, I) :-
System.arraycopy(BM0.elements, 0, BM.elements, 0, BM0.elements.length);
").
-:- pragma foreign_proc("Erlang",
- copy(BM0::in) = (BM::bitmap_uo),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
-"
- BM = BM0
-").
-
copy(BM0) = BM :-
NumBits = BM0 ^ num_bits,
BM = clear_filler_bits(
@@ -1081,14 +1031,6 @@ shrink_without_copying(!.BM, NewSize) = !:BM :-
BM.num_bits = NumBits;
").
-:- pragma foreign_proc("Erlang",
- 'num_bits :='(BM0::bitmap_di, NumBits::in) = (BM::bitmap_uo),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
-"
- {Bin, _} = BM0,
- BM = {Bin, NumBits}
-").
-
%---------------------------------------------------------------------------%
:- type bitmap.slice
@@ -1845,8 +1787,6 @@ import jmercury.runtime.MercuryBitmap;
where equality is bitmap_equal, comparison is bitmap_compare.
:- pragma foreign_type("C#", bitmap, "mercury.runtime.MercuryBitmap")
where equality is bitmap_equal, comparison is bitmap_compare.
-:- pragma foreign_type("Erlang", bitmap, "")
- where equality is bitmap_equal, comparison is bitmap_compare.
:- pred bitmap_equal(bitmap::in, bitmap::in) is semidet.
:- pragma terminates(bitmap_equal/2).
@@ -1872,13 +1812,6 @@ import jmercury.runtime.MercuryBitmap;
SUCCESS_INDICATOR = BM1.equals(BM2);
").
-:- pragma foreign_proc("Erlang",
- bitmap_equal(BM1::in, BM2::in),
- [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail],
-"
- SUCCESS_INDICATOR = (BM1 =:= BM2)
-").
-
bitmap_equal(BM1, BM2) :-
BM1 ^ num_bits = (BM2 ^ num_bits) @ NumBits,
bytes_equal(0, byte_index_for_bit(NumBits), BM1, BM2).
@@ -1963,20 +1896,6 @@ bytes_equal(Index, MaxIndex, BM1, BM2) :-
}
").
-:- pragma foreign_proc("Erlang",
- bitmap_compare(Result::uo, BM1::in, BM2::in),
- [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail],
-"
- if
- BM1 =:= BM2 ->
- Result = {'='};
- BM1 < BM2 ->
- Result = {'<'};
- true ->
- Result = {'>'}
- end
-").
-
bitmap_compare(Result, BM1, BM2) :-
NumBits1 = BM1 ^ num_bits,
NumBits2 = BM2 ^ num_bits,
@@ -2040,15 +1959,6 @@ bytes_compare(Result, Index, MaxIndex, BM1, BM2) :-
BM = new mercury.runtime.MercuryBitmap(N);
").
-:- pragma foreign_proc("Erlang",
- allocate_bitmap(N::in) = (BM::bitmap_uo),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
-"
- Roundup = 8 * ((N + 7) div 8),
- Bin = <<0:Roundup>>,
- BM = {Bin, N}
-").
-
:- func resize_bitmap(bitmap, num_bits) = bitmap.
:- mode resize_bitmap(bitmap_di, in) = bitmap_uo is det.
diff --git a/library/builtin.m b/library/builtin.m
index e1cfc55d2..9a964c265 100644
--- a/library/builtin.m
+++ b/library/builtin.m
@@ -909,55 +909,6 @@ __Compare____tuple_0_0(object x, object y)
}
").
-:- pragma foreign_code("Erlang", "
-
- '__Compare____c_pointer_0_0'(_, _) ->
- throw(""called compare/3 for type `c_pointer'"").
-
- '__Unify____c_pointer_0_0'(_, _) ->
- throw(""called unify for type `c_pointer'"").
-
- compare_3_p_0(TypeInfo, X, Y) ->
- mercury__erlang_rtti_implementation:generic_compare_3_p_0(
- TypeInfo, X, Y).
-
- compare_3_p_1(TypeInfo, X, Y) ->
- compare_3_p_0(TypeInfo, X, Y).
-
- compare_3_p_2(TypeInfo, X, Y) ->
- compare_3_p_0(TypeInfo, X, Y).
-
- compare_3_p_3(TypeInfo, X, Y) ->
- compare_3_p_0(TypeInfo, X, Y).
-
- % XXX what is this supposed to do?
- compare_representation_3_p_0(TypeInfo, X, Y) ->
- compare_3_p_0(TypeInfo, X, Y).
-
- unify_2_p_0(TypeInfo, X, Y) ->
- mercury__erlang_rtti_implementation:generic_unify_2_p_0(
- TypeInfo, X, Y).
-
- '__Unify____tuple_0_0'(X, Y) ->
- mercury__require:error_1_p_0(""call to unify for tuple/0"").
-
- '__Compare____tuple_0_0'(X, Y) ->
- mercury__require:error_1_p_0(""call to compare for tuple/0"").
-
- '__Unify____void_0_0'(X, Y) ->
- mercury__require:error_1_p_0(""call to unify for void/0"").
-
- '__Compare____void_0_0'(X, Y) ->
- mercury__require:error_1_p_0(""call to compare for void/0"").
-
- '__Unify____func_0_0'(X, Y) ->
- mercury__require:error_1_p_0(""call to unify for func/0"").
-
- '__Compare____func_0_0'(X, Y) ->
- mercury__require:error_1_p_0(""call to compare for func/0"").
-").
-
-
%---------------------------------------------------------------------------%
% unsafe_promise_unique is a compiler builtin.
@@ -1024,20 +975,6 @@ __Compare____tuple_0_0(object x, object y)
}
").
-:- pragma foreign_proc("Erlang",
- copy(X::ui, Y::uo),
- [may_call_mercury, thread_safe, promise_pure, terminates],
-"
- Y = X
-").
-
-:- pragma foreign_proc("Erlang",
- copy(X::in, Y::uo),
- [may_call_mercury, thread_safe, promise_pure, terminates],
-"
- Y = X
-").
-
%---------------------------------------------------------------------------%
%
@@ -1239,12 +1176,6 @@ __Compare____tuple_0_0(object x, object y)
"
SUCCESS_INDICATOR = true;
").
-:- pragma foreign_proc("Erlang",
- semidet_succeed,
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- SUCCESS_INDICATOR = true
-").
semidet_succeed :-
0 + 0 = 0.
@@ -1262,12 +1193,6 @@ semidet_succeed :-
"
SUCCESS_INDICATOR = false;
").
-:- pragma foreign_proc("Erlang",
- semidet_fail,
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- SUCCESS_INDICATOR = false
-").
semidet_fail :-
0 + 0 \= 0.
@@ -1329,19 +1254,6 @@ semidet_false :-
Y = X;
").
-:- pragma foreign_proc("Erlang",
- cc_multi_equal(X::in, Y::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- Y = X
-").
-:- pragma foreign_proc("Erlang",
- cc_multi_equal(X::di, Y::uo),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- Y = X
-").
-
%---------------------------------------------------------------------------%
impure_true :-
@@ -1381,13 +1293,6 @@ dynamic_cast(X, Y) :-
Y = X;
").
-:- pragma foreign_proc("Erlang",
- unsafe_cast_any_to_ground(X::ia) = (Y::out),
- [promise_pure, will_not_call_mercury, thread_safe, will_not_modify_trail],
-"
- Y = X
-").
-
%---------------------------------------------------------------------------%
get_one_solution(CCPred) = OutVal :-
diff --git a/library/char.m b/library/char.m
index 174b1dc7d..30b0896a3 100644
--- a/library/char.m
+++ b/library/char.m
@@ -463,28 +463,6 @@ to_int(C) = N :-
SUCCESS_INDICATOR = (Int >= 0 && Int <= 0x10ffff);
").
-:- pragma foreign_proc("Erlang",
- to_int(Character::in, Int::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Int = Character
-").
-
-:- pragma foreign_proc("Erlang",
- to_int(Character::in, Int::in),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SUCCESS_INDICATOR = (Character =:= Int)
-").
-
-:- pragma foreign_proc("Erlang",
- to_int(Character::out, Int::in),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Character = Int,
- SUCCESS_INDICATOR = (Int >= 0 andalso Int =< 16#10ffff)
-").
-
from_int(Int, Char) :-
to_int(Char, Int).
@@ -529,12 +507,6 @@ max_char_value = N :-
"
Max = 0x10ffff;
").
-:- pragma foreign_proc("Erlang",
- max_char_value(Max::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Max = 16#10ffff
-").
%---------------------------------------------------------------------------%
diff --git a/library/construct.m b/library/construct.m
index f95452bea..242b9d520 100644
--- a/library/construct.m
+++ b/library/construct.m
@@ -332,16 +332,6 @@ null_to_no(S) = ( if null(S) then no else yes(S) ).
SUCCESS_INDICATOR = (S == null);
").
-:- pragma foreign_proc("Erlang",
- null(S::in),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- % Erlang doesn't have null pointers, but in erlang_rtti_implementation we
- % return empty strings (binaries) for the cases where functor arguments
- % have no names.
- SUCCESS_INDICATOR = (S =:= <<>>)
-").
-
get_functor_ordinal(TypeDesc, FunctorNumber) = Ordinal :-
get_functor_ordinal(TypeDesc, FunctorNumber, Ordinal).
diff --git a/library/deconstruct.m b/library/deconstruct.m
index 069eef60a..d8192874f 100644
--- a/library/deconstruct.m
+++ b/library/deconstruct.m
@@ -419,6 +419,11 @@ SUCCESS_INDICATOR = (FunctorNumber >= 0);
functor_number(_Term, _FunctorNumber, _Arity) :-
private_builtin.sorry("deconstruct.functor_number").
+ % This is needed because rtti_implementation.functor_number_cc
+ % is currently declared semidet instead of cc_nondet.
+ %
+:- pragma no_determinism_warning(functor_number_cc/3).
+
:- pragma foreign_proc("C",
functor_number_cc(Term::in, FunctorNumber::out, Arity::out),
[will_not_call_mercury, thread_safe, promise_pure],
diff --git a/library/dir.m b/library/dir.m
index f7c073894..dc93d3fe6 100644
--- a/library/dir.m
+++ b/library/dir.m
@@ -930,20 +930,6 @@ current_directory(Res, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- current_directory_2(CurDir::out, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- case file:get_cwd() of
- {ok, Cwd} ->
- CurDir = list_to_binary(Cwd),
- Error = ok;
- {error, Reason} ->
- CurDir = <<>>,
- Error = {error, Reason}
- end
-").
-
%---------------------------------------------------------------------------%
make_directory(PathName, Result, !IO) :-
@@ -1268,26 +1254,6 @@ make_single_directory(DirName, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- make_single_directory_2(DirName::in, Status::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- may_not_duplicate],
-"
- DirNameStr = binary_to_list(DirName),
- case file:make_dir(DirNameStr) of
- ok ->
- Status = {ok},
- Error = ok;
- {error, eexist} ->
- Status = {name_exists},
- Error = {error, eexist};
- {error, Reason} ->
- Status = {error},
- Error = {error, Reason}
- end
-").
-
%---------------------------------------------------------------------------%
foldl2(P, DirName, Data0, Res, !IO) :-
@@ -1563,7 +1529,6 @@ check_for_symlink_loop(SymLinkParent, DirName, LoopRes, !ParentIds, !IO) :-
:- pragma foreign_type("C", dir.stream, "ML_DIR_STREAM").
:- pragma foreign_type("C#", dir.stream, "System.Collections.IEnumerator").
:- pragma foreign_type("Java", dir.stream, "java.util.Iterator").
-:- pragma foreign_type("Erlang", dir.stream, "").
:- pred open(string::in, io.result(dir.stream)::out, io::di, io::uo) is det.
@@ -1685,23 +1650,6 @@ open_2(DirName, DirPattern, Res, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- open_3(DirName::in, _DirPattern::in, Dir::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- DirNameStr = binary_to_list(DirName),
- case file:list_dir(DirNameStr) of
- {ok, FileNames} ->
- Dir = ets:new(mutvar, [set, private]),
- ets:insert(Dir, {value, lists:sort(FileNames)}),
- Error = ok;
- {error, Reason} ->
- Dir = null,
- Error = {error, Reason}
- end
-").
-
:- pred check_dir_readable(string::in, io.res::out, io::di, io::uo) is det.
check_dir_readable(DirName, Res, !IO) :-
@@ -1789,14 +1737,6 @@ close(Dir, Res, !IO) :-
Error = null;
").
-:- pragma foreign_proc("Erlang",
- close_2(Dir::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- ets:delete(Dir, value),
- Error = ok
-").
-
:- pred read_entry(dir.stream::in, io.result(string)::out, io::di, io::uo)
is det.
@@ -1933,24 +1873,6 @@ read_entry(Dir, Res, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- read_entry_2(Dir::in, Error::out, HaveFileName::out,
- FileName::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- [{value, FileNames0}] = ets:lookup(Dir, value),
- case FileNames0 of
- [] ->
- HaveFileName = {no},
- FileName = <<>>;
- [Head | Tail] ->
- HaveFileName = {yes},
- FileName = list_to_binary(Head),
- ets:insert(Dir, {value, Tail})
- end,
- Error = ok
-").
-
%---------------------------------------------------------------------------%
expand_braces(ArgStr) = ExpandStrs :-
diff --git a/library/exception.m b/library/exception.m
index 50050fd53..269f328c0 100644
--- a/library/exception.m
+++ b/library/exception.m
@@ -546,10 +546,6 @@ finally_2(P, Cleanup, PRes, CleanupRes, !IO) :-
use(_T::in),
[will_not_call_mercury, thread_safe],
";").
-:- pragma foreign_proc("Erlang",
- use(_T::in),
- [will_not_call_mercury, thread_safe],
- "void").
%---------------------------------------------------------------------------%
@@ -711,13 +707,6 @@ throw_impl(Univ::in) :-
throw new jmercury.runtime.Exception(T);
").
-:- pragma foreign_proc("Erlang",
- throw_impl(T::in),
- [will_not_call_mercury, promise_pure],
-"
- throw({'ML_exception', T})
-").
-
%---------------------%
:- type handler(T) == pred(univ, T).
@@ -1456,60 +1445,6 @@ public static SsdbHooks ssdb_hooks = new SsdbHooks();
%---------------------------------------------------------------------------%
-:- pragma foreign_code("Erlang", "
- % det ==> model_det
- builtin_catch_3_p_0(TypeInfo, WrappedGoal, Handler) ->
- T = try
- WrappedGoal()
- catch
- throw: {'ML_exception', Excp} ->
- Handler(Excp)
- end.
-
- % semidet ==> model_semi
- builtin_catch_3_p_1(_TypeInfo, _WrappedGoal, _Handler) ->
- % This function is not called anywhere in this module.
- mercury__private_builtin:sorry_1_p_0(
- ""builtin_catch_3_p_1 not implemented"").
-
- % cc_multi ==> model_det
- builtin_catch_3_p_2(TypeInfo, WrappedGoal, Handler) ->
- try
- WrappedGoal()
- catch
- throw: {'ML_exception', Excp} ->
- Handler(Excp)
- end.
-
- % cc_nondet ==> model_semi
- builtin_catch_3_p_3(_TypeInfo, _Pred, _Handler) ->
- % This function is not called anywhere in this module.
- mercury__private_builtin:sorry_1_p_0(
- ""builtin_catch_3_p_3 not implemented"").
-
- % multi ==> model_non
- builtin_catch_3_p_4(_TypeInfo_for_T, Pred, Handler, Succeed) ->
- try
- Pred(Succeed)
- catch
- throw: {'ML_exception', Excp} ->
- Result = Handler(Excp),
- Succeed(Result)
- end.
-
- % multi ==> model_non
- builtin_catch_3_p_5(_TypeInfo_for_T, Pred, Handler, Succeed) ->
- try
- Pred(Succeed)
- catch
- throw: {'ML_exception', Excp} ->
- Result = Handler(Excp),
- Succeed(Result)
- end.
-").
-
-%---------------------------------------------------------------------------%
-
:- pred call_goal(pred(T), T).
:- mode call_goal(pred(out) is det, out) is det.
:- mode call_goal(pred(out) is semidet, out) is semidet.
@@ -2536,8 +2471,6 @@ mercury_sys_init_exceptions_write_out_proc_statics(FILE *deep_fp,
"ML_report_uncaught_exception").
:- pragma foreign_export("Java", report_uncaught_exception(in, di, uo),
"ML_report_uncaught_exception").
-:- pragma foreign_export("Erlang", report_uncaught_exception(in, di, uo),
- "ML_report_uncaught_exception").
:- pred report_uncaught_exception(univ::in, io::di, io::uo) is cc_multi.
diff --git a/library/float.m b/library/float.m
index bd4ba6657..3d59afed6 100644
--- a/library/float.m
+++ b/library/float.m
@@ -412,13 +412,6 @@ X / Y = Z :-
SUCCESS_INDICATOR = true;
").
-:- pragma foreign_proc("Erlang",
- float_domain_checks,
- [thread_safe, promise_pure],
-"
- SUCCESS_INDICATOR = true
-").
-
%---------------------------------------------------------------------------%
%
% Conversion from integer types.
@@ -450,13 +443,6 @@ X / Y = Z :-
FloatVal = (double) IntVal;
").
-:- pragma foreign_proc("Erlang",
- float(IntVal::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(IntVal)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -481,13 +467,6 @@ X / Y = Z :-
FloatVal = (double) Int8Val;
").
-:- pragma foreign_proc("Erlang",
- from_int8(Int8Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(Int8Val)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -512,13 +491,6 @@ X / Y = Z :-
FloatVal = (double) (UInt8Val & 0xff);
").
-:- pragma foreign_proc("Erlang",
- from_uint8(UInt8Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(UInt8Val)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -543,13 +515,6 @@ X / Y = Z :-
FloatVal = (double) Int16Val;
").
-:- pragma foreign_proc("Erlang",
- from_int16(Int16Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(Int16Val)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -574,13 +539,6 @@ X / Y = Z :-
FloatVal = (double) (UInt16Val & 0xffff);
").
-:- pragma foreign_proc("Erlang",
- from_uint16(UInt16Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(UInt16Val)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -605,13 +563,6 @@ X / Y = Z :-
FloatVal = (double) Int32Val;
").
-:- pragma foreign_proc("Erlang",
- cast_from_int32(Int32Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(Int32Val)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -636,13 +587,6 @@ X / Y = Z :-
FloatVal = (double) (UInt32Val & 0xffffffff);
").
-:- pragma foreign_proc("Erlang",
- cast_from_uint32(UInt32Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(UInt32Val)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -667,13 +611,6 @@ X / Y = Z :-
FloatVal = (double) Int64Val;
").
-:- pragma foreign_proc("Erlang",
- cast_from_int64(Int64Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(Int64Val)
-").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -698,13 +635,6 @@ X / Y = Z :-
FloatVal = (double) UInt64Val;
").
-:- pragma foreign_proc("Erlang",
- cast_from_uint64(UInt64Val::in) = (FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- FloatVal = float(UInt64Val)
-").
-
%---------------------------------------------------------------------------%
%
% Conversion to ints.
@@ -736,18 +666,6 @@ X / Y = Z :-
Ceil = (int) java.lang.Math.ceil(X);
}
").
-:- pragma foreign_proc("Erlang",
- ceiling_to_int(X::in) = (Ceil::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- T = erlang:trunc(X),
- case (X - T) > 0 of
- true ->
- Ceil = T + 1;
- false ->
- Ceil = T
- end
-").
:- pragma foreign_proc("C",
floor_to_int(X::in) = (Floor::out),
@@ -775,18 +693,6 @@ X / Y = Z :-
Floor = (int) java.lang.Math.floor(X);
}
").
-:- pragma foreign_proc("Erlang",
- floor_to_int(X::in) = (Floor::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- T = erlang:trunc(X),
- case (X - T) < 0 of
- true ->
- Floor = T - 1;
- false ->
- Floor = T
- end
-").
:- pragma foreign_proc("C",
round_to_int(X::in) = (Round::out),
@@ -814,14 +720,6 @@ X / Y = Z :-
Round = (int) java.lang.Math.round(X);
}
").
-:- pragma foreign_proc("Erlang",
- round_to_int(X::in) = (Round::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX erlang:round returns the closest integer to x, rounding to even when
- % x is halfway between two integers.
- Round = erlang:round(X)
-").
:- pragma foreign_proc("C",
truncate_to_int(X::in) = (Trunc::out),
@@ -849,12 +747,6 @@ X / Y = Z :-
Trunc = (int) X;
}
").
-:- pragma foreign_proc("Erlang",
- truncate_to_int(X::in) = (Trunc::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Trunc = erlang:trunc(X)
-").
%---------------------------------------------------------------------------%
%
@@ -966,12 +858,6 @@ multiply_by_pow(Scale0, Base, Exp) = Result :-
H = Code;
}
").
-:- pragma foreign_proc("Erlang",
- hash(F::in) = (H::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- H = erlang:phash2(F)
-").
hash(F, H) :-
H = hash(F).
@@ -1008,13 +894,6 @@ is_nan_or_inf(Float) :-
"
SUCCESS_INDICATOR = java.lang.Double.isNaN(Flt);
").
-:- pragma foreign_proc("Erlang",
- is_nan(_Flt::in),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX NYI
- SUCCESS_INDICATOR = false
-").
:- pragma foreign_proc("C",
is_inf(Flt::in),
@@ -1035,13 +914,6 @@ is_nan_or_inf(Float) :-
"
SUCCESS_INDICATOR = java.lang.Double.isInfinite(Flt);
").
-:- pragma foreign_proc("Erlang",
- is_inf(_Flt::in),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX NYI
- SUCCESS_INDICATOR = false
-").
:- pragma foreign_proc("C",
is_finite(Flt::in),
@@ -1123,12 +995,6 @@ is_zero(0.0).
"
Max = java.lang.Double.MAX_VALUE;
").
-:- pragma foreign_proc("Erlang",
- max = (Max::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Max = 1.797693E+308
-").
:- pragma foreign_proc("C",
min = (Min::out),
@@ -1333,14 +1199,6 @@ float_to_doc(X) = str(string.float_to_string(X)).
Str = i.ToString();
").
-:- pragma foreign_proc("Erlang",
- float32_bits_string(Flt::in) = (Str::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- <<Int:32/signed-integer>> = <<Flt:32/float>>,
- Str = integer_to_list(Int)
-").
-
:- pragma foreign_proc("C",
float64_bits_string(Flt::in) = (Str::uo),
[will_not_call_mercury, promise_pure, thread_safe],
@@ -1389,13 +1247,5 @@ float_to_doc(X) = str(string.float_to_string(X)).
Str = i.ToString();
").
-:- pragma foreign_proc("Erlang",
- float64_bits_string(Flt::in) = (Str::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- <<Int:64/signed-integer>> = <<Flt:64/float>>,
- Str = integer_to_list(Int)
-").
-
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
diff --git a/library/int.m b/library/int.m
index 677c79687..314a7e4c6 100644
--- a/library/int.m
+++ b/library/int.m
@@ -573,12 +573,6 @@
"
SUCCESS_INDICATOR = true;
").
-:- pragma foreign_proc("Erlang",
- int_domain_checks,
- [thread_safe, promise_pure],
-"
- SUCCESS_INDICATOR = true
-").
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
@@ -782,14 +776,6 @@ X >> Y = Z :-
Max = java.lang.Integer.MAX_VALUE;
").
-:- pragma foreign_proc("Erlang",
- max_int(Max::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX Erlang ints are actually arbitrary precision.
- Max = (1 bsl 31) - 1
-").
-
max_int = X :-
max_int(X).
@@ -827,14 +813,6 @@ max_int = X :-
Min = java.lang.Integer.MIN_VALUE;
").
-:- pragma foreign_proc("Erlang",
- min_int(Min::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX Erlang ints are actually arbitrary precision.
- Min = -(1 bsl 31)
-").
-
min_int = X :-
min_int(X).
@@ -865,14 +843,6 @@ min_int = X :-
Bits = 32;
").
-:- pragma foreign_proc("Erlang",
- bits_per_int(Bits::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX Erlang ints are actually arbitrary precision.
- Bits = 32
-").
-
bits_per_int = X :-
bits_per_int(X).
diff --git a/library/int16.m b/library/int16.m
index 2b7c96e6a..153e4b989 100644
--- a/library/int16.m
+++ b/library/int16.m
@@ -380,8 +380,6 @@ det_from_int(I) = I16 :-
error($pred, "cannot convert int to int16")
).
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (I16::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -404,13 +402,8 @@ det_from_int(I) = I16 :-
I16 = (short) I;
").
-cast_from_int(_) = _ :-
- sorry($module, "int16.cast_from_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(to_int/1).
-
:- pragma foreign_proc("C",
to_int(I16::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -432,11 +425,6 @@ cast_from_int(_) = _ :-
I = I16;
").
-to_int(_) = _ :-
- sorry($module, "int16.to_int/1 NYI for Erlang").
-
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(I16::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -458,13 +446,8 @@ to_int(_) = _ :-
I = I16;
").
-cast_to_int(_) = _ :-
- sorry($module, "int16.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_uint16/1).
-
:- pragma foreign_proc("C",
cast_from_uint16(U16::in) = (I16::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -487,9 +470,6 @@ cast_to_int(_) = _ :-
I16 = U16;
").
-cast_from_uint16(_) = _ :-
- sorry($module, "int16.cast_from_uint16/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -520,9 +500,6 @@ cast_from_uint16(_) = _ :-
I16 = (short) (MSB << 8 | (LSB & 0x00ff));
").
-from_bytes_le(_, _) = _ :-
- sorry($module, "int16.from_bytes_le/2 NYI for Erlang").
-
from_bytes_be(MSB, LSB) =
from_bytes_le(LSB, MSB).
@@ -644,8 +621,6 @@ num_trailing_zeros(I16) = N :-
%---------------------%
-:- pragma no_determinism_warning(reverse_bytes/1).
-
:- pragma foreign_proc("C",
reverse_bytes(A::in) = (B::out),
[will_not_call_mercury, promise_pure, thread_safe],
@@ -667,9 +642,6 @@ num_trailing_zeros(I16) = N :-
B = java.lang.Short.reverseBytes(A);
").
-reverse_bytes(_) = _ :-
- sorry($module, "int16.reverse_bytes/1 NYI for Erlang").
-
%---------------------%
reverse_bits(I16) = RevI16 :-
diff --git a/library/int32.m b/library/int32.m
index 32021dc08..367bcf3bc 100644
--- a/library/int32.m
+++ b/library/int32.m
@@ -371,8 +371,6 @@
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(from_int/2).
-
:- pragma foreign_proc("C",
from_int(I::in, I32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -403,9 +401,6 @@
SUCCESS_INDICATOR = true;
").
-from_int(_, _) :-
- sorry($module, "int32.from_int/1 NYI for Erlang").
-
det_from_int(I) = I32 :-
( if from_int(I, I32Prime) then
I32 = I32Prime
@@ -413,8 +408,6 @@ det_from_int(I) = I32 :-
error($pred, "cannot convert int to int32")
).
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (I32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -437,13 +430,8 @@ det_from_int(I) = I32 :-
I32 = I;
").
-cast_from_int(_) = _ :-
- sorry($module, "int32.cast_from_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(to_int/1).
-
:- pragma foreign_proc("C",
to_int(I32::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -465,11 +453,6 @@ cast_from_int(_) = _ :-
I = I32;
").
-to_int(_) = _ :-
- sorry($module, "int32.to_int/1 NYI for Erlang").
-
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(I32::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -491,13 +474,8 @@ to_int(_) = _ :-
I = I32;
").
-cast_to_int(_) = _ :-
- sorry($module, "int32.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_uint32/1).
-
:- pragma foreign_proc("C",
cast_from_uint32(U32::in) = (I32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -520,9 +498,6 @@ cast_to_int(_) = _ :-
I32 = U32;
").
-cast_from_uint32(_) = _ :-
- sorry($module, "int32.cast_from_uint32/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -561,9 +536,6 @@ cast_from_uint32(_) = _ :-
I32 = (Byte3 << 24 | Byte2 << 16 | Byte1 << 8 | Byte0);
").
-from_bytes_le(_, _, _, _) = _ :-
- sorry($module, "int32.from_bytes_le/4 NYI for Erlang").
-
from_bytes_be(Byte3, Byte2, Byte1, Byte0) =
from_bytes_le(Byte0, Byte1, Byte2, Byte3).
@@ -709,8 +681,6 @@ num_trailing_zeros(I32) = N :-
%---------------------%
-:- pragma no_determinism_warning(reverse_bytes/1).
-
:- pragma foreign_proc("C",
reverse_bytes(A::in) = (B::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -738,9 +708,6 @@ num_trailing_zeros(I32) = N :-
B = java.lang.Integer.reverseBytes(A);
").
-reverse_bytes(_) = _ :-
- sorry($module, "int32.reverse_bytes/1 NYI for Erlang").
-
%---------------------%
:- pragma foreign_proc("Java",
diff --git a/library/int64.m b/library/int64.m
index 5ff3b9a04..5b3d2fec4 100644
--- a/library/int64.m
+++ b/library/int64.m
@@ -384,8 +384,6 @@
from_int(I) = cast_from_int(I).
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (I64::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -407,9 +405,6 @@ from_int(I) = cast_from_int(I).
I64 = (long) I; // Mercury's 'int' type in the Java grade is 32-bits.
").
-cast_from_int(_) = _ :-
- sorry($module, "NYI int64.cast_from_int for Erlang").
-
%---------------------------------------------------------------------------%
to_int(I64, I) :-
@@ -426,8 +421,6 @@ det_to_int(I64) = I :-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(I64::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -449,13 +442,8 @@ det_to_int(I64) = I :-
I = (int) I64;
").
-cast_to_int(_) = _ :-
- sorry($module, "NYI int64.cast_to_int for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_uint64/1).
-
:- pragma foreign_proc("C",
cast_from_uint64(U64::in) = (I64::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -477,9 +465,6 @@ cast_to_int(_) = _ :-
I64 = (long) U64;
").
-cast_from_uint64(_) = _ :-
- sorry($module, "NYI int64.cast_from_uint64 for Erlang").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -541,9 +526,6 @@ cast_from_uint64(_) = _ :-
(ulong) Byte0);
").
-from_bytes_le(_, _, _, _, _, _, _, _) = _ :-
- sorry($module, "int64.from_bytes_le/8 NYI for Erlang").
-
from_bytes_be(Byte7, Byte6, Byte5,Byte4, Byte3, Byte2, Byte1, Byte0) =
from_bytes_le(Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7).
diff --git a/library/int8.m b/library/int8.m
index 659774032..9f8ab67ed 100644
--- a/library/int8.m
+++ b/library/int8.m
@@ -352,8 +352,6 @@ det_from_int(I) = I8 :-
error($pred, "cannot convert int to int8")
).
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (I8::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -376,13 +374,8 @@ det_from_int(I) = I8 :-
I8 = (byte) I;
").
-cast_from_int(_) = _ :-
- sorry($module, "int8.cast_from_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(to_int/1).
-
:- pragma foreign_proc("C",
to_int(I8::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -404,11 +397,6 @@ cast_from_int(_) = _ :-
I = I8;
").
-to_int(_) = _ :-
- sorry($module, "int8.to_int/1 NYI for Erlang").
-
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(I8::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -430,13 +418,8 @@ to_int(_) = _ :-
I = I8;
").
-cast_to_int(_) = _ :-
- sorry($module, "int8.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_uint8/1).
-
:- pragma foreign_proc("C",
cast_from_uint8(U8::in) = (I8::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -459,9 +442,6 @@ cast_to_int(_) = _ :-
I8 = U8;
").
-cast_from_uint8(_) = _ :-
- sorry($module, "int8.cast_from_uint8/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
% The comparison operations <, >, =< and >= are builtins.
diff --git a/library/io.m b/library/io.m
index 37c797fb8..135fea028 100644
--- a/library/io.m
+++ b/library/io.m
@@ -1599,8 +1599,6 @@
% in `AccessTypes' on `FileName'.
% XXX When using the .NET CLI, this predicate will sometimes report
% that a directory is writable when in fact it is not.
- % XXX On the Erlang backend, or on Windows with some compilers, `execute'
- % access is not checked.
%
:- pred check_file_accessibility(string::in, list(access_type)::in,
io.res::out, io::di, io::uo) is det.
@@ -1642,7 +1640,7 @@
%
% The file is placed in the directory returned by get_temp_directory/3.
%
- % On the Erlang and Java backends, this does not attempt to create the file
+ % On the Java backend, this does not attempt to create the file
% with restrictive permissions (600 on Unix-like systems) and therefore
% should not be used when security is required.
%
@@ -1668,9 +1666,7 @@
% - Prefix is ignored.
% - Suffix is ignored.
%
- % On the Erlang backend Suffix is ignored.
- %
- % On the Erlang and Java backends, this does not attempt to create the file
+ % On the Java backend, this does not attempt to create the file
% with restrictive permissions (600 on Unix-like systems) and therefore
% should not be used when security is required.
%
@@ -1682,8 +1678,6 @@
%
% On the Java backend this is insecure as the file permissions are not set.
%
- % This is unimplemented on the Erlang backend.
- %
:- pred make_temp_directory(io.res(string)::out, io::di, io::uo) is det.
% make_temp_directory(Dir, Prefix, Suffix, Result, !IO) creates an empty
@@ -1703,14 +1697,11 @@
%
% On the Java backend this is insecure as the file permissions are not set.
%
- % This is unimplemented on the Erlang backend.
- %
:- pred make_temp_directory(string::in, string::in, string::in,
io.res(string)::out, io::di, io::uo) is det.
- % Test if the make_temp_directory predicates are available. This is false
- % for the Erlang backends and either C backend without support for
- % mkdtemp(3).
+ % Test if the make_temp_directory predicates are available.
+ % This is false for C backends without support for mkdtemp(3).
%
:- pred have_make_temp_directory is semidet.
@@ -2005,13 +1996,11 @@
% (In a few cases, we pass a Win32 error as a system_error.)
% For Java, this is null for success or an exception object.
% For C#, this is null for success or an exception object.
- % For Erlang, this is `ok' for success or `{error, Reason}'.
%
:- type system_error.
:- pragma foreign_type(c, system_error, "MR_Integer").
:- pragma foreign_type("C#", system_error, "System.Exception").
:- pragma foreign_type(java, system_error, "java.lang.Exception").
-:- pragma foreign_type(erlang, system_error, "").
% is_error(Error, MessagePrefix, MaybeIOError, !IO):
% Returns `yes(IOError)' if `Error' indicates an error (not success).
@@ -2206,8 +2195,6 @@
[can_pass_as_mercury_type]).
:- pragma foreign_type("Java", io.state, "java.lang.Object",
[can_pass_as_mercury_type]).
-:- pragma foreign_type("Erlang", io.state, "",
- [can_pass_as_mercury_type]).
:- type input_stream
---> input_stream(stream).
@@ -2225,7 +2212,6 @@
[can_pass_as_mercury_type]).
:- pragma foreign_type("C#", stream, "io.MR_MercuryFileStruct").
:- pragma foreign_type("Java", stream, "io.MR_MercuryFileStruct").
-:- pragma foreign_type("Erlang", stream, "").
% A unique identifier for an I/O stream.
%
@@ -4015,409 +4001,6 @@ mercury_close(MR_MercuryFileStruct mf)
").
-%---------------------%
-
-:- pragma foreign_decl("Erlang", local, "
--include_lib(""kernel/include/file.hrl"").
-").
-
-:- pragma foreign_decl("Erlang", local, "
- % These need to be exported because code in foreign_procs may be inlined
- % into other modules. Hence, calls to these functions must be module
- % qualified as well.
- %
--export([
- mercury_open_stream/2,
- mercury_close_stream/1,
- mercury_getc/1,
- mercury_read_string_to_eof/1,
- mercury_putback/2,
- mercury_write_string/2,
- mercury_write_char/2,
- mercury_write_int/2,
- mercury_write_binary/2,
- mercury_sync/1,
- mercury_get_line_number/1,
- mercury_set_line_number/2,
- mercury_get_pos/1,
- mercury_set_pos/2,
- mercury_get_file_size/1,
-
- % We may want to inline the following by hand to avoid inter-module calls.
- mercury_set_current_text_input/1,
- mercury_set_current_text_output/1,
- mercury_set_current_binary_input/1,
- mercury_set_current_binary_output/1
-]).
-").
-
-:- pragma foreign_decl("Erlang", "
- % Avoid an intermodule function call every time we want to get the current
- % stream.
- %
--define(ML_get_current_text_input, get('ML_io_current_text_input')).
--define(ML_get_current_text_output, get('ML_io_current_text_output')).
--define(ML_get_current_binary_input, get('ML_io_current_binary_input')).
--define(ML_get_current_binary_output, get('ML_io_current_binary_output')).
-").
-
-:- pragma foreign_code("Erlang", "
- % For each open file we have a process running in the background.
- % This is necessary so we can layer pushback support and line number
- % tracking on top of what the Erlang runtime provides.
- %
- % Note that we send back acknowledgements for all messages. This is to
- % ensure that two operations from the same process are done in order.
- %
-mercury_start_file_server(ParentPid, FileName, Mode) ->
- % XXX This is wrong for binary streams.
- Encoding = {encoding, utf8},
- case Mode of
- [$r | _] ->
- ModeList = [read, read_ahead, binary, Encoding];
- [$w | _] ->
- ModeList = [write, delayed_write, binary, Encoding];
- [$a | _] ->
- ModeList = [append, delayed_write, binary, Encoding]
- end,
- case file:open(FileName, ModeList) of
- {ok, IoDevice} ->
- StreamId = make_ref(),
- Stream = {'ML_stream', StreamId, self()},
- ParentPid ! {self(), open_ack, {ok, Stream}},
- mercury_file_server(IoDevice, 1, [])
- ;
- {error, Reason} ->
- ParentPid ! {self(), open_ack, {error, Reason}}
- end.
-
-mercury_stdio_file_server(IoDevice) ->
- % XXX This is wrong for binary streams.
- io:setopts(IoDevice, [binary, {encoding, utf8}]),
- mercury_file_server(IoDevice, 1, []).
-
-mercury_file_server(IoDevice, LineNr0, PutBack0) ->
- receive
- {From, close} ->
- Result = file:close(IoDevice),
- From ! {self(), close_ack, Result}
- ;
- {From, read_char} ->
- case PutBack0 of
- [] ->
- Prompt = '',
- GetChars = io:get_chars(IoDevice, Prompt, 1),
- case GetChars of
- <<Char/utf8>> ->
- Ret = Char,
- LineNr = LineNr0 + one_if_nl(Char);
- EofOrError ->
- Ret = EofOrError,
- LineNr = LineNr0
- end,
- PutBack = PutBack0;
- [Char | PutBack] ->
- Ret = Char,
- LineNr = LineNr0 + one_if_nl(Char)
- end,
- From ! {self(), read_char_ack, Ret},
- mercury_file_server(IoDevice, LineNr, PutBack)
- ;
- {From, read_string_to_eof} ->
- % Grab everything from the putback buffer.
- Pre = list_to_binary(lists:reverse(PutBack0)),
- PutBack = [],
-
- % Read everything to EOF.
- case mercury_read_file_to_eof_2(IoDevice, []) of
- {ok, Chunks} ->
- Binary = list_to_binary([Pre | Chunks]),
- Ret = {ok, Binary},
- LineNr = LineNr0 + count_nls(Binary, 0);
- {error, Chunks, Reason} ->
- Binary = list_to_binary([Pre | Chunks]),
- Ret = {error, list_to_binary(Chunks), Reason},
- LineNr = LineNr0 + count_nls(Binary, 0)
- end,
-
- From ! {self(), read_string_to_eof_ack, Ret},
- mercury_file_server(IoDevice, LineNr, PutBack)
- ;
- {From, putback, Char} ->
- From ! {self(), putback_ack},
- PutBack = [Char | PutBack0],
- LineNr = LineNr0 - one_if_nl(Char),
- mercury_file_server(IoDevice, LineNr, PutBack)
- ;
- {From, write_char, Char} ->
- From ! {self(), write_char_ack},
- % XXX return error code
- io:put_chars(IoDevice, [Char]),
- LineNr = LineNr0 + one_if_nl(Char),
- mercury_file_server(IoDevice, LineNr, PutBack0)
- ;
- {From, write_string, Chars} ->
- From ! {self(), write_string_ack},
- % XXX return error code
- io:put_chars(IoDevice, Chars),
- LineNr = LineNr0 + count_nls(Chars, 0),
- mercury_file_server(IoDevice, LineNr, PutBack0)
- ;
- {From, write_int, Val} ->
- From ! {self(), write_int_ack},
- % XXX return error code
- io:put_chars(IoDevice, integer_to_list(Val)),
- mercury_file_server(IoDevice, LineNr0, PutBack0)
- ;
- {From, write_binary, Binary} ->
- From ! {self(), write_binary_ack},
- % XXX return error code
- io:put_chars(IoDevice, Binary),
- mercury_file_server(IoDevice, LineNr0, PutBack0)
- ;
- {From, sync} ->
- % XXX file:sync seems to hang if run on a pid, e.g. standard I/O
- if
- is_pid(IoDevice) ->
- Result = ok;
- true ->
- Result = file:sync(IoDevice)
- end,
- From ! {self(), sync_ack, Result},
- mercury_file_server(IoDevice, LineNr0, PutBack0)
- ;
- {From, get_line_number} ->
- From ! {self(), get_line_number_ack, LineNr0},
- mercury_file_server(IoDevice, LineNr0, PutBack0)
- ;
- {From, set_line_number, N} ->
- From ! {self(), set_line_number_ack},
- mercury_file_server(IoDevice, N, PutBack0)
- ;
- {From, get_pos} ->
- case file:position(IoDevice, cur) of
- {ok, N} ->
- Pos = {ok, N - length(PutBack0)};
- Other ->
- Pos = Other
- end,
- From ! {self(), get_pos_ack, Pos},
- mercury_file_server(IoDevice, LineNr0, PutBack0)
- ;
- {From, set_pos, Loc} ->
- case Loc of
- {cur, N} ->
- AdjLoc = {cur, N - length(PutBack0)};
- _ ->
- AdjLoc = Loc
- end,
- SeekResult = file:position(IoDevice, AdjLoc),
- From ! {self(), set_pos_ack, SeekResult},
- PutBack = [],
- mercury_file_server(IoDevice, LineNr0, PutBack)
- ;
- {From, get_file_size} ->
- case file:pid2name(IoDevice) of
- {ok, FileName} ->
- case file:read_file_info(FileName) of
- {ok, FileInfo} ->
- #file_info{size = Size} = FileInfo;
- _ ->
- Size = -1
- end;
- _ ->
- Size = -1
- end,
- From ! {self(), get_file_size_ack, Size},
- mercury_file_server(IoDevice, LineNr0, PutBack0)
- ;
- Other ->
- io:format(""** io.m: unrecognised message ~p~n"", [Other]),
- mercury_file_server(IoDevice, LineNr0, PutBack0)
- end.
-
-mercury_read_file_to_eof_2(IoDevice, Acc) ->
- ChunkSize = 65536,
- case io:get_chars(IoDevice, '', ChunkSize) of
- eof ->
- {ok, lists:reverse(Acc)};
- {error, Reason} ->
- {error, lists:reverse(Acc), Reason};
- Chunk ->
- mercury_read_file_to_eof_2(IoDevice, [Chunk | Acc])
- end.
-
-one_if_nl($\\n) -> 1;
-one_if_nl(_) -> 0.
-
-count_nls(Bin, N) ->
- count_nls_2(Bin, size(Bin) - 1, N).
-
-count_nls_2(_, -1, N) -> N;
-count_nls_2(Bin, I, N) ->
- case Bin of
- <<_:I/binary, $\\n, _/binary>> ->
- count_nls_2(Bin, I - 1, N + 1);
- _ ->
- count_nls_2(Bin, I - 1, N)
- end.
-
-% Client side.
-
- % Returns {ok, Stream} | {error, Reason}
- %
-mercury_open_stream(FileName, Mode) ->
- ParentPid = self(),
- Pid = spawn(fun() ->
- % Raw streams can only be used by the process which opened it.
- mercury_start_file_server(ParentPid, FileName, Mode)
- end),
- receive
- {Pid, open_ack, Result} ->
- Result
- end.
-
- % Returns ok | {error, Reason}
- %
-mercury_close_stream(Stream) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), close},
- receive
- {Pid, close_ack, Result} ->
- Result
- end.
-
- % Returns <integer> | eof | {error, Reason}
- %
-mercury_getc(Stream) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), read_char},
- receive
- {Pid, read_char_ack, Result} ->
- Result
- end.
-
- % Returns {ok, Binary} | {error, Partial, Reason}
- %
-mercury_read_string_to_eof(Stream) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), read_string_to_eof},
- receive
- {Pid, read_string_to_eof_ack, Result} ->
- Result
- end.
-
-mercury_putback(Stream, Character) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), putback, Character},
- receive
- {Pid, putback_ack} ->
- % Putbacks always succeed so there is no data.
- void
- end.
-
-mercury_write_string(Stream, Characters) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), write_string, Characters},
- receive
- {Pid, write_string_ack} ->
- void
- end.
-
-mercury_write_char(Stream, Character) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), write_char, Character},
- receive
- {Pid, write_char_ack} ->
- void
- end.
-
-mercury_write_int(Stream, Value) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), write_int, Value},
- receive
- {Pid, write_int_ack} ->
- void
- end.
-
-mercury_write_binary(Stream, Binary) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), write_binary, Binary},
- receive
- {Pid, write_binary_ack} ->
- void
- end.
-
- % Returns ok | {error, Reason}
- %
-mercury_sync(Stream) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), sync},
- receive
- {Pid, sync_ack, Result} ->
- Result
- end.
-
-mercury_get_line_number(Stream) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), get_line_number},
- receive
- {Pid, get_line_number_ack, LineNum} ->
- LineNum
- end.
-
-mercury_set_line_number(Stream, LineNum) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), set_line_number, LineNum},
- receive
- {Pid, set_line_number_ack} ->
- void
- end.
-
- % Returns {ok, NewPosition} | {error, Reason}
- %
-mercury_get_pos(Stream) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), get_pos},
- receive
- {Pid, get_pos_ack, Result} ->
- Result
- end.
-
- % Returns {ok, NewPosition} | {error, Reason}
- %
-mercury_set_pos(Stream, Loc) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), set_pos, Loc},
- receive
- {Pid, set_pos_ack, Result} ->
- Result
- end.
-
- % Returns Size or -1
- %
-mercury_get_file_size(Stream) ->
- {'ML_stream', _Id, Pid} = Stream,
- Pid ! {self(), get_file_size},
- receive
- {Pid, get_file_size_ack, Result} ->
- Result
- end.
-
-mercury_set_current_text_input(Stream) ->
- put('ML_io_current_text_input', Stream).
-
-mercury_set_current_text_output(Stream) ->
- put('ML_io_current_text_output', Stream).
-
-mercury_set_current_binary_input(Stream) ->
- put('ML_io_current_binary_input', Stream).
-
-mercury_set_current_binary_output(Stream) ->
- put('ML_io_current_binary_output', Stream).
-
-").
-
%---------------------------------------------------------------------------%
%
% Opening and closing streams, both text and binary.
@@ -4583,25 +4166,6 @@ open_binary_append(FileName, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_open_text(FileName::in, Mode::in, StreamId::out, Stream::out,
- Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- FileNameStr = binary_to_list(FileName),
- ModeStr = binary_to_list(Mode),
- % XXX This should probably pass encoding 'utf8'.
- case mercury__io:mercury_open_stream(FileNameStr, ModeStr) of
- {ok, Stream} ->
- {'ML_stream', StreamId, _Pid} = Stream,
- Error = ok;
- {error, Reason} ->
- StreamId = -1,
- Stream = null,
- Error = {error, Reason}
- end
-").
-
%---------------------%
:- pred do_open_binary(string::in, string::in, int::out, stream::out,
@@ -4673,25 +4237,6 @@ open_binary_append(FileName, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_open_binary(FileName::in, Mode::in, StreamId::out, Stream::out,
- Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- FileNameStr = binary_to_list(FileName),
- ModeStr = binary_to_list(Mode),
- % XXX This should probably pass encoding 'latin1'.
- case mercury__io:mercury_open_stream(FileNameStr, ModeStr) of
- {ok, Stream} ->
- {'ML_stream', StreamId, _Pid} = Stream,
- Error = ok;
- {error, Reason} ->
- StreamId = -1,
- Stream = null,
- Error = {error, Reason}
- end
-").
-
%---------------------%
close_input(input_stream(Stream), !IO) :-
@@ -4757,13 +4302,6 @@ close_binary_output(binary_output_stream(Stream), !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- close_stream(Stream::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- Error = mercury__io:mercury_close_stream(Stream)
-").
-
%---------------------------------------------------------------------------%
%
% Switching streams.
@@ -4801,14 +4339,6 @@ set_input_stream(input_stream(NewStream), input_stream(OutStream), !IO) :-
io.mercury_current_text_input.set((io.MR_TextInputFile) NewStream);
").
-:- pragma foreign_proc("Erlang",
- set_input_stream_2(NewStream::in, OutStream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- OutStream = ?ML_get_current_text_input,
- mercury__io:mercury_set_current_text_input(NewStream)
-").
-
%---------------------%
set_binary_input_stream(binary_input_stream(NewStream),
@@ -4848,15 +4378,6 @@ set_binary_input_stream(binary_input_stream(NewStream),
io.mercury_current_binary_input.set((io.MR_BinaryInputFile) NewStream);
").
-:- pragma foreign_proc("Erlang",
- set_binary_input_stream_2(NewStream::in, OutStream::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- OutStream = ?ML_get_current_binary_input,
- mercury__io:mercury_set_current_binary_input(NewStream)
-").
-
%---------------------%
set_output_stream(output_stream(NewStream), output_stream(OutStream), !IO) :-
@@ -4891,14 +4412,6 @@ set_output_stream(output_stream(NewStream), output_stream(OutStream), !IO) :-
io.mercury_current_text_output.set((io.MR_TextOutputFile) NewStream);
").
-:- pragma foreign_proc("Erlang",
- set_output_stream_2(NewStream::in, OutStream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- OutStream = ?ML_get_current_text_output,
- mercury__io:mercury_set_current_text_output(NewStream)
-").
-
%---------------------%
set_binary_output_stream(binary_output_stream(NewStream),
@@ -4938,15 +4451,6 @@ set_binary_output_stream(binary_output_stream(NewStream),
io.mercury_current_binary_output.set((io.MR_BinaryOutputFile) NewStream);
").
-:- pragma foreign_proc("Erlang",
- set_binary_output_stream_2(NewStream::in, OutStream::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- OutStream = ?ML_get_current_binary_output,
- mercury__io:mercury_set_current_binary_output(NewStream)
-").
-
%---------------------------------------------------------------------------%
%
% Prolog style predicates for opening and switching streams.
@@ -5095,25 +4599,6 @@ whence_to_int(end, 2).
}
").
-:- pragma foreign_proc("Erlang",
- seek_binary_2(Stream::in, Flag::in, Off::in, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- % Constants from whence_to_int.
- case Flag of
- 0 -> Loc = {bof, Off};
- 1 -> Loc = {cur, Off};
- 2 -> Loc = {eof, Off}
- end,
- case mercury__io:mercury_set_pos(Stream, Loc) of
- {ok, _NewPosition} ->
- Error = ok;
- {error, Reason} ->
- Error = {error, Reason}
- end
-").
-
%---------------------%
binary_input_stream_offset(binary_input_stream(Stream), Offset, !IO) :-
@@ -5184,20 +4669,6 @@ binary_output_stream_offset64(binary_output_stream(Stream), Offset, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- binary_stream_offset_2(Stream::in, Offset::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- case mercury__io:mercury_get_pos(Stream) of
- {ok, Offset} ->
- Error = ok;
- {error, Reason} ->
- Offset = -1,
- Error = {error, Reason}
- end
-").
-
%---------------------------------------------------------------------------%
%
% Standard stream id predicates.
@@ -5241,13 +4712,6 @@ stdin_stream = input_stream(stdin_stream_2).
Stream = io.mercury_stdin;
").
-:- pragma foreign_proc("Erlang",
- stdin_stream_2 = (Stream::out),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stdin_stream')
-").
-
%---------------------%
stdin_stream(input_stream(Stream), !IO) :-
@@ -5278,13 +4742,6 @@ stdin_stream(input_stream(Stream), !IO) :-
Stream = io.mercury_stdin;
").
-:- pragma foreign_proc("Erlang",
- stdin_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stdin_stream')
-").
-
%---------------------%
stdin_binary_stream(binary_input_stream(Stream), !IO) :-
@@ -5317,13 +4774,6 @@ stdin_binary_stream(binary_input_stream(Stream), !IO) :-
Stream = io.mercury_stdin_binary;
").
-:- pragma foreign_proc("Erlang",
- stdin_binary_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stdin_binary_stream')
-").
-
%---------------------%
stdout_stream = output_stream(io.stdout_stream_2).
@@ -5355,13 +4805,6 @@ stdout_stream = output_stream(io.stdout_stream_2).
Stream = io.mercury_stdout;
").
-:- pragma foreign_proc("Erlang",
- stdout_stream_2 = (Stream::out),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stdout_stream')
-").
-
%---------------------%
stdout_stream(output_stream(Stream), !IO) :-
@@ -5392,13 +4835,6 @@ stdout_stream(output_stream(Stream), !IO) :-
Stream = io.mercury_stdout;
").
-:- pragma foreign_proc("Erlang",
- stdout_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stdout_stream')
-").
-
%---------------------%
stdout_binary_stream(binary_output_stream(Stream), !IO) :-
@@ -5431,13 +4867,6 @@ stdout_binary_stream(binary_output_stream(Stream), !IO) :-
Stream = io.mercury_stdout_binary;
").
-:- pragma foreign_proc("Erlang",
- stdout_binary_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stdout_binary_stream')
-").
-
%---------------------%
stderr_stream = output_stream(stderr_stream_2).
@@ -5469,13 +4898,6 @@ stderr_stream = output_stream(stderr_stream_2).
Stream = io.mercury_stderr;
").
-:- pragma foreign_proc("Erlang",
- stderr_stream_2 = (Stream::out),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stderr_stream')
-").
-
%---------------------%
stderr_stream(output_stream(Stream), !IO) :-
@@ -5506,13 +4928,6 @@ stderr_stream(output_stream(Stream), !IO) :-
Stream = io.mercury_stderr;
").
-:- pragma foreign_proc("Erlang",
- stderr_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Stream = get('ML_stderr_stream')
-").
-
%---------------------------------------------------------------------------%
%
% Current stream id predicates.
@@ -5547,13 +4962,6 @@ input_stream(input_stream(Stream), !IO) :-
Stream = io.mercury_current_text_input.get();
").
-:- pragma foreign_proc("Erlang",
- input_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_text_input
-").
-
%---------------------%
binary_input_stream(binary_input_stream(Stream), !IO) :-
@@ -5585,13 +4993,6 @@ binary_input_stream(binary_input_stream(Stream), !IO) :-
Stream = io.mercury_current_binary_input.get();
").
-:- pragma foreign_proc("Erlang",
- binary_input_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_binary_input
-").
-
%---------------------%
output_stream(output_stream(Stream), !IO) :-
@@ -5623,13 +5024,6 @@ output_stream(output_stream(Stream), !IO) :-
Stream = io.mercury_current_text_output.get();
").
-:- pragma foreign_proc("Erlang",
- output_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_text_output
-").
-
%---------------------%
binary_output_stream(binary_output_stream(Stream), !IO) :-
@@ -5661,13 +5055,6 @@ binary_output_stream(binary_output_stream(Stream), !IO) :-
Stream = io.mercury_current_binary_output.get();
").
-:- pragma foreign_proc("Erlang",
- binary_output_stream_2(Stream::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_binary_output
-").
-
%---------------------------------------------------------------------------%
%
% Getting and setting stream properties.
@@ -5773,14 +5160,6 @@ may_delete_stream_info(1, !IO).
LineNum = io.mercury_current_text_input.get().line_number;
").
-:- pragma foreign_proc("Erlang",
- get_line_number(LineNum::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_text_input,
- LineNum = mercury__io:mercury_get_line_number(Stream)
-").
-
%---------------------%
get_line_number(input_stream(Stream), LineNum, !IO) :-
@@ -5809,13 +5188,6 @@ get_line_number(input_stream(Stream), LineNum, !IO) :-
LineNum = ((io.MR_TextInputFile) Stream).line_number;
").
-:- pragma foreign_proc("Erlang",
- get_line_number_2(Stream::in, LineNum::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- LineNum = mercury__io:mercury_get_line_number(Stream)
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -5840,14 +5212,6 @@ get_line_number(input_stream(Stream), LineNum, !IO) :-
io.mercury_current_text_input.get().line_number = LineNum;
").
-:- pragma foreign_proc("Erlang",
- set_line_number(LineNum::in, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_text_input,
- mercury__io:mercury_set_line_number(Stream, LineNum)
-").
-
%---------------------%
set_line_number(input_stream(Stream), LineNum, !IO) :-
@@ -5877,13 +5241,6 @@ set_line_number(input_stream(Stream), LineNum, !IO) :-
((io.MR_TextInputFile) Stream).line_number = LineNum;
").
-:- pragma foreign_proc("Erlang",
- set_line_number_2(Stream::in, LineNum::in, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- mercury__io:mercury_set_line_number(Stream, LineNum)
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -5908,14 +5265,6 @@ set_line_number(input_stream(Stream), LineNum, !IO) :-
LineNum = io.mercury_current_text_output.get().line_number;
").
-:- pragma foreign_proc("Erlang",
- get_output_line_number(LineNum::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_text_output,
- LineNum = mercury__io:mercury_get_line_number(Stream)
-").
-
%---------------------%
get_output_line_number(output_stream(Stream), LineNum, !IO) :-
@@ -5945,13 +5294,6 @@ get_output_line_number(output_stream(Stream), LineNum, !IO) :-
LineNum = ((io.MR_TextOutputFile) Stream).line_number;
").
-:- pragma foreign_proc("Erlang",
- get_output_line_number_2(Stream::in, LineNum::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- LineNum = mercury__io:mercury_get_line_number(Stream)
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -5975,14 +5317,6 @@ get_output_line_number(output_stream(Stream), LineNum, !IO) :-
io.mercury_current_text_output.get().line_number = LineNum;
").
-:- pragma foreign_proc("Erlang",
- set_output_line_number(LineNum::in, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Stream = ?ML_get_current_text_output,
- mercury__io:mercury_set_line_number(Stream, LineNum)
-").
-
%---------------------%
set_output_line_number(output_stream(Stream), LineNum, !IO) :-
@@ -6012,13 +5346,6 @@ set_output_line_number(output_stream(Stream), LineNum, !IO) :-
((io.MR_TextOutputFile) Stream).line_number = LineNum;
").
-:- pragma foreign_proc("Erlang",
- set_output_line_number_2(Stream::in, LineNum::in, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- mercury__io:mercury_set_line_number(Stream, LineNum)
-").
-
%---------------------------------------------------------------------------%
%
% Reading values of primitive types.
@@ -6199,28 +5526,6 @@ read_char_code(input_stream(Stream), ResultCode, Char, Error, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- read_char_code_2(Stream::in, ResultCode::out, Char::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io,
- does_not_affect_liveness],
-"
- case mercury__io:mercury_getc(Stream) of
- C when is_integer(C) ->
- ResultCode = {ok},
- Char = C,
- Error = ok;
- eof ->
- ResultCode = {eof},
- Char = 0,
- Error = ok;
- {error, Reason} ->
- ResultCode = {error},
- Char = 0,
- Error = {error, Reason}
- end
-").
-
%---------------------%
putback_char(Char, !IO) :-
@@ -6292,14 +5597,6 @@ putback_char(input_stream(Stream), Character, !IO) :-
Ok = bool.YES;
").
-:- pragma foreign_proc("Erlang",
- putback_char_2(File::in, Character::in, Ok::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- mercury__io:mercury_putback(File, Character),
- Ok = {yes}
-").
-
%---------------------%
:- pragma inline(read_byte/3). % Inline to allow deforestation.
@@ -6453,28 +5750,6 @@ read_byte_val(input_stream(Stream), Result, ByteVal, Error, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- read_byte_val_2(Stream::in, ResultCode::out, ByteVal::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io,
- does_not_affect_liveness],
-"
- case mercury__io:mercury_getc(Stream) of
- B when is_integer(B) ->
- ResultCode = {ok},
- ByteVal = B,
- Error = ok;
- eof ->
- ResultCode = {eof},
- ByteVal = 0,
- Error = ok;
- {error, Reason} ->
- ResultCode = {error},
- ByteVal = 0,
- Error = {error, Reason}
- end
-").
-
%---------------------%
putback_byte(Char, !IO) :-
@@ -6526,14 +5801,6 @@ putback_byte(binary_input_stream(Stream), Character, !IO) :-
Ok = bool.YES;
").
-:- pragma foreign_proc("Erlang",
- putback_byte_2(File::in, Byte::in, Ok::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- mercury__io:mercury_putback(File, Byte),
- Ok = {yes}
-").
-
%---------------------%
putback_int8(Int8, !IO) :-
@@ -6602,14 +5869,6 @@ putback_uint8(binary_input_stream(Stream), UInt8, !IO) :-
Ok = bool.YES;
").
-:- pragma foreign_proc("Erlang",
- putback_uint8_2(File::in, UInt8::in, Ok::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- mercury__io:mercury_putback(File, UInt8),
- Ok = {yes}
-").
-
%---------------------%
read_binary_int16(Result, !IO) :-
@@ -6838,9 +6097,6 @@ read_binary_uint16_be(binary_input_stream(Stream), Result, !IO) :-
}
").
-do_read_binary_uint16(_, _, _, _, _, _, _, _) :-
- sorry($module, "do_read_binary_uint16 NYI for Erlang").
-
%---------------------%
read_binary_int32(Result, !IO) :-
@@ -7090,9 +6346,6 @@ read_binary_uint32_be(binary_input_stream(Stream), Result, !IO) :-
}
").
-do_read_binary_uint32(_, _, _, _, _, _, _, _) :-
- sorry($module, "do_read_binary_uint32 NYI for Erlang").
-
%---------------------%
read_binary_int64(Result, !IO) :-
@@ -7358,9 +6611,6 @@ read_binary_uint64_be(binary_input_stream(Stream), Result, !IO) :-
}
").
-do_read_binary_uint64(_, _, _, _, _, _, _, _) :-
- sorry($module, "do_read_binary_uint64_le NYI for Erlang").
-
%---------------------%
:- type byte_order
@@ -7402,9 +6652,6 @@ do_read_binary_uint64(_, _, _, _, _, _, _, _) :-
(java.nio.ByteOrder.nativeOrder() == java.nio.ByteOrder.BIG_ENDIAN);
").
-native_byte_order_is_big_endian :-
- sorry($module, "native_byte_order_is_big_endian/0 NYI for Erlang").
-
%---------------------%
%
% C implementation of reading multibyte integers from binary streams.
@@ -7599,15 +6846,6 @@ write_char(output_stream(Stream), Character, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_char(Stream::in, Character::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- mercury__io:mercury_write_char(Stream, Character),
- % mercury_write_char does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_int(Val, !IO) :-
@@ -7657,15 +6895,6 @@ write_int(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_int(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_uint(Val, !IO) :-
@@ -7716,15 +6945,6 @@ write_uint(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_uint(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_int8(Val, !IO) :-
@@ -7774,15 +6994,6 @@ write_int8(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_int8(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_uint8(Val, !IO) :-
@@ -7833,15 +7044,6 @@ write_uint8(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_uint8(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_int16(Val, !IO) :-
@@ -7891,15 +7093,6 @@ write_int16(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_int16(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_uint16(Val, !IO) :-
@@ -7950,15 +7143,6 @@ write_uint16(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_uint16(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_int32(Val, !IO) :-
@@ -8008,15 +7192,6 @@ write_int32(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_int32(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_uint32(Val, !IO) :-
@@ -8067,15 +7242,6 @@ write_uint32(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_uint32(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_int64(Val, !IO) :-
@@ -8125,15 +7291,6 @@ write_int64(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_int64(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_uint64(Val, !IO) :-
@@ -8184,15 +7341,6 @@ write_uint64(output_stream(Stream), Val, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_uint64(Stream::in, Val::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- mercury__io:mercury_write_int(Stream, Val),
- % mercury_write_int does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_float(Val, !IO) :-
@@ -8246,8 +7394,6 @@ write_float(output_stream(Stream), Val, !IO) :-
}
").
-% XXX MISSING Erlang do_write_float
-
do_write_float(Stream, Float, Error, !IO) :-
do_write_string(Stream, string.float_to_string(Float), Error, !IO).
@@ -8306,15 +7452,6 @@ write_string(output_stream(Stream), Message, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_string(Stream::in, Message::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- mercury__io:mercury_write_string(Stream, Message),
- % mercury_write_string does not return errors yet.
- Error = ok
-").
-
%---------------------%
nl(!IO) :-
@@ -8394,15 +7531,6 @@ write_binary_uint8(binary_output_stream(Stream), UInt8, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_byte(Stream::in, Byte::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- mercury__io:mercury_write_char(Stream, Byte),
- % mercury_write_char does not return errors yet.
- Error = ok
-").
-
%---------------------%
write_binary_int16(Int16, !IO) :-
@@ -8465,8 +7593,6 @@ write_binary_uint16(binary_output_stream(Stream), UInt16, !IO) :-
}
").
-% MISSING ERLANG do_write_binary_uint16
-
%---------------------%
write_binary_int16_le(Int16, !IO) :-
@@ -8539,8 +7665,6 @@ write_binary_uint16_le(binary_output_stream(Stream), UInt16, !IO) :-
}
").
-% XXX MISSING ERLANG do_write_binary_uint16_le
-
%---------------------%
write_binary_int16_be(Int16, !IO) :-
@@ -8612,7 +7736,6 @@ write_binary_uint16_be(binary_output_stream(Stream), UInt16, !IO) :-
Error = e;
}
").
-% XXX MISSING ERLANG do_write_binary_uint16_be
%---------------------%
@@ -8678,8 +7801,6 @@ write_binary_uint32(binary_output_stream(Stream), UInt32, !IO) :-
}
").
-% XXX MISSING ERLANG do_write_binary_uint32
-
%---------------------%
write_binary_int32_le(Int32, !IO) :-
@@ -8752,8 +7873,6 @@ write_binary_uint32_le(binary_output_stream(Stream), UInt32, !IO) :-
}
").
-% XXX MISSING ERLANG do_write_binary_uint32_le
-
%---------------------%
write_binary_int32_be(Int32, !IO) :-
@@ -8826,8 +7945,6 @@ write_binary_uint32_be(binary_output_stream(Stream), UInt32, !IO) :-
}
").
-% XXX MISSING ERLANG do_write_binary_uint32_be
-
%---------------------%
write_binary_int64(Int64, !IO) :-
@@ -8892,8 +8009,6 @@ write_binary_uint64(binary_output_stream(Stream), UInt64, !IO) :-
}
").
-% XXX MISSING ERLANG do_write_binary_uint64
-
%---------------------%
write_binary_int64_le(Int64, !IO) :-
@@ -8966,8 +8081,6 @@ write_binary_uint64_le(binary_output_stream(Stream), UInt64, !IO) :-
}
").
-% XXX MISSING ERLANG do_write_binary_uint64_le
-
%---------------------%
write_binary_int64_be(Int64, !IO) :-
@@ -9040,8 +8153,6 @@ write_binary_uint64_be(binary_output_stream(Stream), UInt64, !IO) :-
}
").
-% XXX MISSING ERLANG do_write_binary_uint64_be
-
%---------------------------------------------------------------------------%
%
% Text input predicates.
@@ -9439,7 +8550,8 @@ read_bitmap(binary_input_stream(Stream), Start, NumBytes, !Bitmap,
}
").
- % Default implementation for Erlang.
+ % Default implementation.
+ %
do_read_bitmap(Stream, Start, NumBytes, !Bitmap, !BytesRead, Error, !IO) :-
( if NumBytes > 0 then
read_byte_val(input_stream(Stream), ResultCode, Byte, Error0, !IO),
@@ -9540,19 +8652,6 @@ write_bitmap(binary_output_stream(Stream), Bitmap, Start, NumBytes, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_write_bitmap(Stream::in, Bitmap::in, Start::in, Length::in, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- no_sharing],
-"
- {Binary, _NumBits} = Bitmap,
- <<_:Start/binary, Mid:Length/binary, _/binary>> = Binary,
- mercury__io:mercury_write_binary(Stream, Mid),
- % mercury_write_binary does not return errors yet.
- Error = ok
-").
-
%---------------------------------------------------------------------------%
%
% Reading values of arbitrary types.
@@ -9915,13 +9014,6 @@ flush_output(output_stream(Stream), !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- flush_output_2(Stream::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Error = mercury__io:mercury_sync(Stream)
-").
-
%---------------------%
flush_binary_output(!IO) :-
@@ -9971,13 +9063,6 @@ flush_binary_output(binary_output_stream(Stream), !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- flush_binary_output_2(Stream::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
-"
- Error = mercury__io:mercury_sync(Stream)
-").
-
%---------------------------------------------------------------------------%
%
% Whole file input predicates.
@@ -10070,21 +9155,6 @@ read_file_as_string_and_num_code_units(input_stream(Stream), Result, !IO) :-
NullCharError = bool.NO;
").
-:- pragma foreign_proc("Erlang",
- read_file_as_string_2(Stream::in, String::out, NumCUs::out,
- Error::out, NullCharError::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- case mercury__io:mercury_read_string_to_eof(Stream) of
- {ok, String} ->
- Error = ok;
- {error, String, Reason} ->
- Error = {error, Reason}
- end,
- NumCUs = size(String),
- NullCharError = {no}
-").
-
read_file_as_string_2(Stream, String, NumCUs, Error, NullCharError, !IO) :-
% Check if the stream is a regular file; if so, allocate a buffer
% according to the size of the file. Otherwise, just use a default buffer
@@ -10313,13 +9383,6 @@ binary_input_stream_file_size(binary_input_stream(Stream), Size, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- stream_file_size(Stream::in, Size::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Size = mercury__io:mercury_get_file_size(Stream)
-").
-
%---------------------%
% A `buffer' is an array of chars.
@@ -10979,20 +10042,6 @@ remove_file(FileName, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- remove_file_2(FileName::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- does_not_affect_liveness],
-"
- FileNameStr = binary_to_list(FileName),
- case file:delete(FileNameStr) of
- ok ->
- Error = ok;
- {error, Reason} ->
- Error = {error, Reason}
- end
-").
-
%---------------------%
remove_file_recursively(FileName, Res, !IO) :-
@@ -11130,21 +10179,6 @@ rename_file(OldFileName, NewFileName, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- rename_file_2(OldFileName::in, NewFileName::in, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- OldFileNameStr = binary_to_list(OldFileName),
- NewFileNameStr = binary_to_list(NewFileName),
- case file:rename(OldFileNameStr, NewFileNameStr) of
- ok ->
- Error = ok;
- {error, Reason} ->
- Error = {error, Reason}
- end
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -11159,15 +10193,6 @@ rename_file(OldFileName, NewFileName, Result, !IO) :-
#endif
").
-:- pragma foreign_proc("Erlang",
- have_symlinks,
- [will_not_call_mercury, promise_pure, thread_safe,
- does_not_affect_liveness],
-"
- % XXX how do we check without actually trying to make one?
- SUCCESS_INDICATOR = true
-").
-
have_symlinks :-
semidet_fail.
@@ -11224,22 +10249,6 @@ make_symlink(FileName, LinkFileName, Result, !IO) :-
""io.make_symlink_2 not implemented"");
").
-:- pragma foreign_proc("Erlang",
- make_symlink_2(FileName::in, LinkFileName::in, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- does_not_affect_liveness],
-"
- FileNameStr = binary_to_list(FileName),
- LinkFileNameStr = binary_to_list(LinkFileName),
- case file:make_symlink(FileNameStr, LinkFileNameStr) of
- ok ->
- Error = ok;
- {error, Reason} ->
- Error = {error, Reason}
- end
-").
-
%---------------------%
read_symlink(FileName, Result, !IO) :-
@@ -11328,22 +10337,6 @@ read_symlink(FileName, Result, !IO) :-
""io.read_symlink_2 not implemented"");
").
-:- pragma foreign_proc("Erlang",
- read_symlink_2(FileName::in, TargetFileName::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- does_not_affect_liveness],
-"
- case file:read_link(binary_to_list(FileName)) of
- {ok, TargetFileNameStr} ->
- TargetFileName = list_to_binary(TargetFileNameStr),
- Error = ok;
- {error, Reason} ->
- TargetFileName = <<>>,
- Error = {error, Reason}
- end
-").
-
%---------------------%
check_file_accessibility(FileName, AccessTypes, Result, !IO) :-
@@ -11462,46 +10455,6 @@ check_file_accessibility(FileName, AccessTypes, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- check_file_accessibility_2(FileName::in, CheckRead::in, CheckWrite::in,
- _CheckExecute::in, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- does_not_affect_liveness, may_not_duplicate],
-"
- FileNameStr = binary_to_list(FileName),
- case file:read_file_info(FileNameStr) of
- {ok, FileInfo} ->
- Access = FileInfo#file_info.access,
- case CheckRead of
- {yes} ->
- Ok0 = lists:member(Access, [read, read_write]);
- {no} ->
- Ok0 = true
- end,
- case Ok0 of
- true ->
- case CheckWrite of
- {yes} ->
- Ok = lists:member(Access, [write, read_write]);
- {no} ->
- Ok = true
- end;
- false ->
- Ok = Ok0
- end,
- % XXX test execute access somehow
- case Ok of
- true ->
- Error = ok;
- false ->
- Error = {error, eacces}
- end
- ;
- {error, Reason} ->
- Error = {error, Reason}
- end
-").
-
% XXX why not write this as check_file_accessibility_2?
%
:- pred check_file_accessibility_dotnet(string::in, list(access_type)::in,
@@ -11896,41 +10849,6 @@ file_type(FollowSymLinks, FileName, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- file_type_2(FollowSymLinks::in, FileName::in, FileType::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- may_not_duplicate],
-"
- FileNameStr = binary_to_list(FileName),
- case FollowSymLinks of
- 0 -> Read = fun file:read_link_info/1;
- 1 -> Read = fun file:read_file_info/1
- end,
- case Read(FileNameStr) of
- {ok, FileInfo} ->
- #file_info{type = Type} = FileInfo,
- case Type of
- device ->
- % XXX It may be a block device, but Erlang doesn't
- % distinguish between character and block devices.
- FileType = {character_device};
- directory ->
- FileType = {directory};
- regular ->
- FileType = {regular_file};
- symlink ->
- FileType = {symbolic_link};
- other ->
- FileType = {unknown}
- end,
- Error = ok;
- {error, Reason} ->
- FileType = {unknown},
- Error = {error, Reason}
- end
-").
-
%---------------------%
file_modification_time(File, Result, !IO) :-
@@ -12019,23 +10937,6 @@ file_modification_time(File, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- file_modification_time_2(FileName::in, Time::out, Error::out,
- _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- FileNameStr = binary_to_list(FileName),
- case filelib:last_modified(FileNameStr) of
- {YMD, HMS} ->
- % time_t in Erlang is in UTC.
- Time = {time_t, erlang:localtime_to_universaltime({YMD, HMS})},
- Error = ok;
- 0 ->
- Error = {error, enoent},
- Time = {time_t, erlang:localtime()}
- end
-").
-
%---------------------------------------------------------------------------%
%
% Predicates for handling temporary files.
@@ -12181,48 +11082,6 @@ make_temp_file(Dir, Prefix, Suffix, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- do_make_temp(Dir::in, Prefix::in, Suffix::in, Sep::in, FileName::out,
- Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io,
- does_not_affect_liveness],
-"
- DirStr = binary_to_list(Dir),
- PrefixStr = binary_to_list(Prefix),
- SuffixStr = binary_to_list(Suffix),
- SepStr = binary_to_list(Sep),
-
- % Constructs a temporary name by concatenating Dir, Sep, Prefix
- % three hex digits, '.', and 3 more hex digits.
-
- % XXX we should try to mix in the Erlang process id in case two Erlang
- % processes from the same Unix process are trying to create temporary files
- % at the same time (it's not as far-fetched as it sounds, e.g. mmc --make)
-
- MaxTries = 24,
-
- {A1, A2, A3} = now(),
- case string:to_integer(os:getpid()) of
- {Pid, []} ->
- void;
- _ ->
- Pid = 0
- end,
- Seed = {A1 + Pid, A2, A3},
-
- case
- mercury__io:'ML_do_make_temp_2'(DirStr, PrefixStr, SuffixStr, SepStr,
- MaxTries, Seed, eio)
- of
- {ok, FileName0} ->
- FileName = list_to_binary(FileName0),
- Error = ok;
- {error, Reason} ->
- FileName = <<>>,
- Error = {error, Reason}
- end
-").
-
%---------------------%
make_temp_directory(Result, !IO) :-
@@ -12385,13 +11244,6 @@ make_temp_directory(Dir, Prefix, Suffix, Result, !IO) :-
SUCCESS_INDICATOR = true;
").
-:- pragma foreign_proc("Erlang",
- have_make_temp_directory,
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SUCCESS_INDICATOR = false
-").
-
%---------------------%
:- pragma foreign_decl("C", "
@@ -12445,38 +11297,6 @@ import java.util.Random;
}
").
-:- pragma foreign_decl("Erlang", local, "
- -export(['ML_do_make_temp_2'/7]).
-").
-
-:- pragma foreign_code("Erlang", "
- 'ML_do_make_temp_2'(_Dir, _Prefix, _Suffix, _Sep, 0, _Seed, LastError) ->
- {error, LastError};
- 'ML_do_make_temp_2'(Dir, Prefix, Suffix, Sep, Tries, Seed0, LastError) ->
- {R1, Seed1} = random:uniform_s(16#1000, Seed0),
- {R2, Seed} = random:uniform_s(16#1000, Seed1),
- FileName = lists:flatten(io_lib:format(""~s~s~s~3.16.0B.~3.16.0B~s"",
- [Dir, Sep, Prefix, R1, R2, Suffix])),
- case filelib:is_file(FileName) of
- true ->
- 'ML_do_make_temp_2'(Dir, Prefix, Suffix, Sep, Tries - 1, Seed,
- eexist);
- false ->
- case file:open(FileName, [write, {encoding, utf8}]) of
- {ok, IoDevice} ->
- case file:close(IoDevice) of
- ok ->
- {ok, FileName};
- {error, Reason} ->
- {error, Reason}
- end;
- {error, Reason} ->
- 'ML_do_make_temp_2'(Dir, Prefix, Suffix, Sep,
- Tries - 1, Seed, Reason)
- end
- end.
-").
-
%---------------------%
get_temp_directory(Dir, !IO) :-
@@ -12622,14 +11442,6 @@ progname_base(DefaultName, PrognameBase, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- command_line_arguments(Args::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"
- ArgStrings = init:get_plain_arguments(),
- Args = lists:map(fun list_to_binary/1, ArgStrings)
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -12655,17 +11467,6 @@ progname_base(DefaultName, PrognameBase, !IO) :-
ExitStatus = jmercury.runtime.JavaInternal.exit_status;
").
-:- pragma foreign_proc("Erlang",
- get_exit_status(ExitStatus::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- 'ML_erlang_global_server' ! {get_exit_status, self()},
- receive
- {get_exit_status_ack, ExitStatus} ->
- void
- end
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -12691,13 +11492,6 @@ progname_base(DefaultName, PrognameBase, !IO) :-
jmercury.runtime.JavaInternal.exit_status = ExitStatus;
").
-:- pragma foreign_proc("Erlang",
- set_exit_status(ExitStatus::in, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- 'ML_erlang_global_server' ! {set_exit_status, ExitStatus}
-").
-
%---------------------%
:- pragma promise_pure(get_environment_var/4).
@@ -12755,13 +11549,6 @@ set_environment_var(Var, Value, IO0, IO) :-
SUCCESS_INDICATOR = true;
").
-:- pragma foreign_proc("Erlang",
- have_set_environment_var,
- [promise_pure, will_not_call_mercury, thread_safe],
-"
- SUCCESS_INDICATOR = true
-").
-
%---------------------%
:- pragma foreign_decl("C", "
@@ -12842,20 +11629,6 @@ set_environment_var(Var, Value, IO0, IO) :-
SUCCESS_INDICATOR = (Value != null);
").
-:- pragma foreign_proc("Erlang",
- getenv(Var::in, Value::out),
- [promise_semipure, will_not_call_mercury, tabled_for_io],
-"
- case os:getenv(binary_to_list(Var)) of
- false ->
- SUCCESS_INDICATOR = false,
- Value = <<>>;
- ValueStr ->
- SUCCESS_INDICATOR = true,
- Value = list_to_binary(ValueStr)
- end
-").
-
% setenv(NameString, ValueString):
%
% Sets the named environment variable to the specified value.
@@ -12899,16 +11672,6 @@ set_environment_var(Var, Value, IO0, IO) :-
SUCCESS_INDICATOR = false;
").
-:- pragma foreign_proc("Erlang",
- setenv(Var::in, Value::in),
- [will_not_call_mercury, tabled_for_io],
-"
- VarStr = binary_to_list(Var),
- ValueStr = binary_to_list(Value),
- os:putenv(VarStr, ValueStr),
- SUCCESS_INDICATOR = true
-").
-
%---------------------------------------------------------------------------%
%
% System access predicates.
@@ -13117,32 +11880,6 @@ call_system_return_signal(Command, Result, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- call_system_code(Command::in, Status::out, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- does_not_affect_liveness],
-"
- % XXX this is just a hack
- % 0. assumes unix shell
- % 1. the command cannot receive input
- % 2. output doesn't come out until process finishes
- % 3. the error code is returned in an inefficient way
- % 4. standard output and standard error are always tied together
- % 5. the command should be bracketed/sanitised
- %
- CommandStr = binary_to_list(Command),
- OutputAndCode = os:cmd(CommandStr ++ ""; printf '\\n%d' $?""),
- case string:rchr(OutputAndCode, $\\n) of
- 0 ->
- Code = OutputAndCode;
- NL ->
- {Output, [$\\n | Code]} = lists:split(NL - 1, OutputAndCode),
- io:put_chars(Output)
- end,
- {Status, []} = string:to_integer(Code),
- Error = ok
-").
-
%---------------------------------------------------------------------------%
%
% Managing the globals structure that Mercury attaches to the I/O state.
@@ -13257,14 +11994,6 @@ unlock_globals :-
Globals = io.ML_io_user_globals;
").
-:- pragma foreign_proc("Erlang",
- unsafe_get_globals(Globals::out, _IOState0::di, _IOState::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- % XXX This Erlang implementation doesn't work with multiple threads.
- Globals = get('ML_io_user_globals')
-").
-
%---------------------%
:- pred unsafe_set_globals(univ::in, io::di, io::uo) is det.
@@ -13292,14 +12021,6 @@ unlock_globals :-
io.ML_io_user_globals = Globals;
").
-:- pragma foreign_proc("Erlang",
- unsafe_set_globals(Globals::in, _IOState0::di, _IOState::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- % XXX This Erlang implementation doesn't work with multiple threads.
- put('ML_io_user_globals', Globals)
-").
-
%---------------------------------------------------------------------------%
%
% Predicates that report statistics about the current program execution.
@@ -13362,37 +12083,6 @@ init_state(!IO) :-
init_std_streams(!IO).
-:- pragma foreign_proc("Erlang",
- init_std_streams(_IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure],
-"
- F = (fun() -> mercury_stdio_file_server(group_leader()) end),
- StdinPid = spawn(F),
- StdoutPid = spawn(F),
- StderrPid = spawn(F),
- StdinBinaryPid = spawn(F),
- StdoutBinaryPid = spawn(F),
-
- Stdin = {'ML_stream', make_ref(), StdinPid},
- Stdout = {'ML_stream', make_ref(), StdoutPid},
- Stderr = {'ML_stream', make_ref(), StderrPid},
- StdinBinary = {'ML_stream', make_ref(), StdinBinaryPid},
- StdoutBinary = {'ML_stream', make_ref(), StdoutBinaryPid},
-
- % Initialise the process dictionary.
- put('ML_stdin_stream', Stdin),
- put('ML_stdout_stream', Stdout),
- put('ML_stderr_stream', Stderr),
- put('ML_stdin_binary_stream', StdinBinary),
- put('ML_stdout_binary_stream', StdoutBinary),
-
- % Save the standard streams to the global server. When we spawn a new
- % Mercury thread later we will need to look it up in order to initialise
- % the new process's process dictionary.
- StdStreams = {Stdin, Stdout, Stderr, StdinBinary, StdoutBinary},
- 'ML_erlang_global_server' ! {init_std_streams, StdStreams}
-").
-
:- pred init_current_streams(io::di, io::uo) is det.
init_current_streams(!IO) :-
@@ -13597,13 +12287,6 @@ have_dotnet :-
Error = null;
").
-:- pragma foreign_proc("Erlang",
- no_error = (Error::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Error = ok
-").
-
:- pred is_success(system_error::in) is semidet.
:- pragma foreign_proc("C",
@@ -13628,13 +12311,6 @@ have_dotnet :-
SUCCESS_INDICATOR = (Error == null);
").
-:- pragma foreign_proc("Erlang",
- is_success(Error::in),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SUCCESS_INDICATOR = (Error =:= ok)
-").
-
is_error(Error, Prefix, MaybeError, !IO) :-
( if is_success(Error) then
MaybeError = no
@@ -13679,18 +12355,6 @@ is_maybe_win32_error(Error, Prefix, MaybeError, !IO) :-
}
").
-:- pragma foreign_proc("Erlang",
- make_err_msg(Error::in, Msg0::in, Msg::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- case Error of
- {error, Reason} ->
- Msg = list_to_binary([Msg0, file:format_error(Reason)]);
- _ ->
- Msg = Msg0
- end
-").
-
make_maybe_win32_err_msg(Error, Msg0, Msg, !IO) :-
( if have_win32 then
make_win32_err_msg(Error, Msg0, Msg, !IO)
@@ -13750,8 +12414,6 @@ throw_on_close_error(Error, !IO) :-
:- pragma foreign_type("C", file_id, "ML_File_Id")
where comparison is compare_file_id.
-:- pragma foreign_type("Erlang", file_id, "")
- where comparison is compare_file_id.
:- pragma foreign_decl("C", "
#ifdef MR_HAVE_DEV_T
@@ -13823,21 +12485,6 @@ compare_file_id(Result, FileId1, FileId2) :-
compare_file_id_2(_, _, _) :-
unexpected($pred, "File IDs are not supported by Java").
-:- pragma foreign_proc("Erlang",
- compare_file_id_2(Res::out, FileId1::in, FileId2::in),
- [will_not_call_mercury, promise_pure, thread_safe,
- does_not_affect_liveness],
-"
- if
- FileId1 =:= FileId2 ->
- Res = 0;
- FileId1 < FileId2 ->
- Res = -1;
- true ->
- Res = 1
- end
-").
-
file_id(FileName, Result, !IO) :-
file_id_2(FileName, FileId, Error, !IO),
is_error(Error, "cannot get file id: ", MaybeIOError, !IO),
@@ -13890,24 +12537,6 @@ file_id(FileName, Result, !IO) :-
""io.file_id not supported on this platform"");
").
-:- pragma foreign_proc("Erlang",
- file_id_2(FileName::in, FileId::out, Error::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
- may_not_duplicate],
-"
- FileNameStr = binary_to_list(FileName),
- case file:read_file_info(FileNameStr) of
- {ok, FileInfo} ->
- MajorDevice = FileInfo#file_info.major_device,
- Inode = FileInfo#file_info.inode,
- FileId = {MajorDevice, Inode},
- Error = ok;
- {error, Reason} ->
- FileId = null,
- Error = {error, Reason}
- end
-").
-
%---------------------------------------------------------------------------%
%
% For use by term_io.m.
@@ -13948,14 +12577,6 @@ set_op_table(_OpTable, !IO).
StreamDb = io.ML_io_stream_db;
").
-:- pragma foreign_proc("Erlang",
- get_stream_db(StreamDb::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- % XXX This Erlang implementation doesn't work with multiple threads.
- StreamDb = get('ML_io_stream_db')
-").
-
%---------------------%
% Caller must NOT hold the stream_db lock.
@@ -13983,14 +12604,6 @@ set_op_table(_OpTable, !IO).
StreamDb = io.ML_io_stream_db;
").
-:- pragma foreign_proc("Erlang",
- get_stream_db_with_locking(StreamDb::out),
- [will_not_call_mercury, tabled_for_io],
-"
- % XXX This Erlang implementation doesn't work with multiple threads.
- StreamDb = get('ML_io_stream_db')
-").
-
%---------------------%
% Caller must hold the stream_db lock.
@@ -14019,14 +12632,6 @@ set_op_table(_OpTable, !IO).
io.ML_io_stream_db = StreamDb;
").
-:- pragma foreign_proc("Erlang",
- set_stream_db(StreamDb::in, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- % XXX This Erlang implementation doesn't work with multiple threads.
- put('ML_io_stream_db', StreamDb)
-").
-
%---------------------%
:- pred lock_stream_db(io::di, io::uo) is det.
@@ -14167,13 +12772,6 @@ source_name(stderr) = "<standard error>".
Id = Stream.id;
").
-:- pragma foreign_proc("Erlang",
- get_stream_id(Stream::in) = (Id::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- {'ML_stream', Id, _IoDevice} = Stream
-").
-
%---------------------------------------------------------------------------%
%
% For use by compiler/process_util.m.
diff --git a/library/lexer.m b/library/lexer.m
index 7db09a6b2..13db8f7fa 100644
--- a/library/lexer.m
+++ b/library/lexer.m
@@ -499,7 +499,7 @@ linestr_grab_float_string(String, LinePosn0, LinePosn, FloatString) :-
FloatStr = Str.substring(Start, End).replace(\"_\", \"\");
").
- % For use by the Erlang backend.
+ % Default implementation.
%
unsafe_get_float_between(Str, Start, End, FloatStr) :-
string.unsafe_between(Str, Start, End, FloatStr0),
diff --git a/library/library.m b/library/library.m
index 947a6c53a..66561052e 100644
--- a/library/library.m
+++ b/library/library.m
@@ -227,14 +227,6 @@
Fullarch = jmercury.runtime.Constants.MR_FULLARCH;
").
-:- pragma foreign_proc("Erlang",
- library.version(Version::out, Fullarch::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Version = << ?MR_VERSION >>,
- Fullarch = << ?MR_FULLARCH >>
-").
-
%---------------------------------------------------------------------------%
mercury_std_library_module("array").
@@ -381,8 +373,6 @@ mercury_std_library_module("version_store").
"ML_std_library_init").
:- pragma foreign_export("Java", std_library_init(di, uo),
"ML_std_library_init").
-:- pragma foreign_export("Erlang", std_library_init(di, uo),
- "ML_std_library_init").
std_library_init(!IO) :-
promise_pure (
@@ -396,8 +386,6 @@ std_library_init(!IO) :-
:- pragma foreign_export("C", std_library_finalize(di, uo),
"ML_std_library_finalize").
-:- pragma foreign_export("Erlang", std_library_finalize(di, uo),
- "ML_std_library_finalize").
std_library_finalize(!IO) :-
io.finalize_state(!IO).
diff --git a/library/list.m b/library/list.m
index 55eba7f01..1a13eda4b 100644
--- a/library/list.m
+++ b/library/list.m
@@ -2109,13 +2109,6 @@ det_index1_of_first_occurrence(Xs, SearchX) = N :-
% reverse(A, B) <=> reverse(B, A).
:- pragma promise_equivalent_clauses(list.reverse/2).
-:- pragma foreign_proc("Erlang",
- list.reverse(L0::in, L::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- L = lists:reverse(L0)
-").
-
reverse(L0::in, L::out) :-
list.reverse_prepend(L0, [], L).
reverse(L::out, L0::in) :-
diff --git a/library/math.m b/library/math.m
index 07492d115..a2eda5343 100644
--- a/library/math.m
+++ b/library/math.m
@@ -339,14 +339,6 @@
SUCCESS_INDICATOR = true;
").
-:- pragma foreign_proc("Erlang",
- math_domain_checks,
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
- does_not_affect_liveness],
-"
- SUCCESS_INDICATOR = true
-").
-
%
% Mathematical constants from math.m
%
@@ -369,12 +361,6 @@
[will_not_call_mercury, promise_pure, thread_safe],
"
Pi = java.lang.Math.PI;
-").
-:- pragma foreign_proc("Erlang",
- pi = (Pi::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Pi = math:pi()
").
% This version is only used for back-ends for which there is no
% matching foreign_proc version. We define this with sufficient
@@ -429,18 +415,6 @@ e = 2.7182818284590452353602874713526625.
"
Ceil = java.lang.Math.ceil(Num);
").
-:- pragma foreign_proc("Erlang",
- ceiling(Num::in) = (Ceil::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- T = erlang:trunc(Num),
- case (Num - T) > 0 of
- true ->
- Ceil = float(T + 1);
- false ->
- Ceil = float(T)
- end
-").
:- pragma foreign_proc("C",
floor(Num::in) = (Floor::out),
@@ -461,18 +435,6 @@ e = 2.7182818284590452353602874713526625.
"
Floor = java.lang.Math.floor(Num);
").
-:- pragma foreign_proc("Erlang",
- floor(Num::in) = (Floor::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- T = erlang:trunc(Num),
- case (Num - T) < 0 of
- true ->
- Floor = float(T - 1);
- false ->
- Floor = float(T)
- end
-").
:- pragma foreign_proc("C",
round(Num::in) = (Rounded::out),
@@ -502,12 +464,6 @@ e = 2.7182818284590452353602874713526625.
Rounded = java.lang.Math.round(Num);
}
").
-:- pragma foreign_proc("Erlang",
- round(Num::in) = (Rounded::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Rounded = float(round(Num))
-").
round(Num) = math.floor(Num + 0.5).
truncate(X) = ( if X < 0.0 then math.ceiling(X) else math.floor(X)).
@@ -537,12 +493,6 @@ sqrt(X) = SquareRoot :-
[will_not_call_mercury, thread_safe, promise_pure],
"
SquareRoot = java.lang.Math.sqrt(X);
-").
-:- pragma foreign_proc("Erlang",
- unchecked_sqrt(X::in) = (SquareRoot::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- SquareRoot = math:sqrt(X)
").
% This version is only used for back-ends for which there is no
% matching foreign_proc version.
@@ -617,13 +567,6 @@ pow(X, Y) = Res :-
Res = java.lang.Math.pow(X, Y);
").
-:- pragma foreign_proc("Erlang",
- unchecked_pow(X::in, Y::in) = (Res::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- Res = math:pow(X, Y)
-").
-
:- pragma foreign_proc("C",
exp(X::in) = (Exp::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -643,12 +586,6 @@ pow(X, Y) = Res :-
"
Exp = java.lang.Math.exp(X);
").
-:- pragma foreign_proc("Erlang",
- exp(X::in) = (Exp::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Exp = math:exp(X)
-").
ln(X) = Log :-
( if math_domain_checks, X =< 0.0 then
@@ -676,12 +613,6 @@ ln(X) = Log :-
"
Log = java.lang.Math.log(X);
").
-:- pragma foreign_proc("Erlang",
- unchecked_ln(X::in) = (Log::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- Log = math:log(X)
-").
log10(X) = Log :-
( if math_domain_checks, X =< 0.0 then
@@ -709,12 +640,6 @@ log10(X) = Log :-
"
Log10 = java.lang.Math.log10(X);
").
-:- pragma foreign_proc("Erlang",
- unchecked_log10(X::in) = (Log10::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- Log10 = math:log10(X)
-").
log2(X) = Log :-
( if math_domain_checks, X =< 0.0 then
@@ -771,7 +696,6 @@ log(B, X) = Log :-
Log = System.Math.Log(X, B);
").
% Java implementation will default to mercury here.
-% Erlang implementation will default to mercury here.
unchecked_log(B, X) = math.unchecked_ln(X) / math.unchecked_ln(B).
:- pragma foreign_proc("C",
@@ -793,12 +717,6 @@ unchecked_log(B, X) = math.unchecked_ln(X) / math.unchecked_ln(B).
"
Sin = java.lang.Math.sin(X);
").
-:- pragma foreign_proc("Erlang",
- sin(X::in) = (Sin::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Sin = math:sin(X)
-").
:- pragma foreign_proc("C",
cos(X::in) = (Cos::out),
@@ -819,12 +737,6 @@ unchecked_log(B, X) = math.unchecked_ln(X) / math.unchecked_ln(B).
"
Cos = java.lang.Math.cos(X);
").
-:- pragma foreign_proc("Erlang",
- cos(X::in) = (Cos::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Cos = math:cos(X)
-").
:- pragma foreign_proc("C",
tan(X::in) = (Tan::out),
@@ -845,12 +757,6 @@ unchecked_log(B, X) = math.unchecked_ln(X) / math.unchecked_ln(B).
"
Tan = java.lang.Math.tan(X);
").
-:- pragma foreign_proc("Erlang",
- math.tan(X::in) = (Tan::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Tan = math:tan(X)
-").
asin(X) = ASin :-
( if
@@ -883,12 +789,6 @@ asin(X) = ASin :-
"
ASin = java.lang.Math.asin(X);
").
-:- pragma foreign_proc("Erlang",
- unchecked_asin(X::in) = (ASin::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- ASin = math:asin(X)
-").
acos(X) = ACos :-
( if
@@ -921,12 +821,6 @@ acos(X) = ACos :-
"
ACos = java.lang.Math.acos(X);
").
-:- pragma foreign_proc("Erlang",
- unchecked_acos(X::in) = (ACos::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- ACos = math:acos(X)
-").
:- pragma foreign_proc("C",
math.atan(X::in) = (ATan::out),
@@ -947,12 +841,6 @@ acos(X) = ACos :-
"
ATan = java.lang.Math.atan(X);
").
-:- pragma foreign_proc("Erlang",
- atan(X::in) = (ATan::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- ATan = math:atan(X)
-").
:- pragma foreign_proc("C",
atan2(Y::in, X::in) = (ATan2::out),
@@ -973,12 +861,6 @@ acos(X) = ACos :-
"
ATan2 = java.lang.Math.atan2(Y, X);
").
-:- pragma foreign_proc("Erlang",
- atan2(Y::in, X::in) = (ATan2::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- ATan2 = math:atan2(Y, X)
-").
:- pragma foreign_proc("C",
sinh(X::in) = (Sinh::out),
@@ -999,12 +881,6 @@ acos(X) = ACos :-
"
Sinh = System.Math.Sinh(X);
").
-:- pragma foreign_proc("Erlang",
- sinh(X::in) = (Sinh::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Sinh = math:sinh(X)
-").
% Version for back-ends that do not have a foreign_proc version.
sinh(X) = Sinh :-
Sinh = (exp(X)-exp(-X)) / 2.0.
@@ -1028,12 +904,6 @@ sinh(X) = Sinh :-
"
Cosh = System.Math.Cosh(X);
").
-:- pragma foreign_proc("Erlang",
- cosh(X::in) = (Cosh::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Cosh = math:cosh(X)
-").
% Version for back-ends that do not have a foreign_proc version.
cosh(X) = Cosh :-
Cosh = (exp(X)+exp(-X)) / 2.0.
@@ -1057,12 +927,6 @@ cosh(X) = Cosh :-
"
Tanh = System.Math.Tanh(X);
").
-:- pragma foreign_proc("Erlang",
- tanh(X::in) = (Tanh::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Tanh = math:tanh(X)
-").
% Version for back-ends that do not have a foreign_proc version.
tanh(X) = Tanh :-
Tanh = (exp(X)-exp(-X)) / (exp(X)+exp(-X)).
diff --git a/library/mutvar.m b/library/mutvar.m
index b3957bce2..56c289e9b 100644
--- a/library/mutvar.m
+++ b/library/mutvar.m
@@ -107,9 +107,6 @@ new_mutvar(X, Ref) :-
:- pragma foreign_type("C#", mutvar(T), "object[]").
:- pragma foreign_type("Java", mutvar(T), "mutvar.Mutvar").
-:- pragma foreign_type("Erlang", mutvar(T), "").
-% Erlang implementation:
-% XXX ets are not garbage collected but shareable between processes
%---------------------%
@@ -133,12 +130,6 @@ new_mutvar(X, Ref) :-
"
Ref = new mutvar.Mutvar();
").
-:- pragma foreign_proc("Erlang",
- new_mutvar0(Ref::uo),
- [will_not_call_mercury, thread_safe],
-"
- Ref = ets:new(mutvar, [set, public])
-").
%---------------------%
@@ -160,12 +151,6 @@ new_mutvar(X, Ref) :-
"
X = Ref.object;
").
-:- pragma foreign_proc("Erlang",
- get_mutvar(Ref::in, X::uo),
- [will_not_call_mercury, thread_safe],
-"
- [{value, X}] = ets:lookup(Ref, value)
-").
%---------------------%
@@ -187,12 +172,6 @@ new_mutvar(X, Ref) :-
"
Ref.object = X;
").
-:- pragma foreign_proc("Erlang",
- set_mutvar(Ref::in, X::in),
- [will_not_call_mercury, thread_safe],
-"
- ets:insert(Ref, {value, X})
-").
%---------------------%
@@ -214,12 +193,6 @@ new_mutvar(X, Ref) :-
"
Ref.object = null;
").
-:- pragma foreign_proc("Erlang",
- clear_mutvar(Ref::in),
- [will_not_call_mercury, thread_safe],
-"
- ets:delete(Ref, value)
-").
%---------------------------------------------------------------------------%
:- end_module mutvar.
diff --git a/library/par_builtin.m b/library/par_builtin.m
index fe6162985..cefea0ed2 100644
--- a/library/par_builtin.m
+++ b/library/par_builtin.m
@@ -141,7 +141,6 @@
[can_pass_as_mercury_type]).
% Placeholders only.
-:- pragma foreign_type("Erlang", future(T), "").
:- pragma foreign_type("C#", future(T), "object").
:- pragma foreign_type("Java", future(T), "java.lang.Object").
@@ -268,7 +267,6 @@ INIT mercury_sys_init_par_builtin_modules
[can_pass_as_mercury_type]).
% Placeholders only.
-:- pragma foreign_type("Erlang", loop_control, "").
:- pragma foreign_type("C#", loop_control, "object").
:- pragma foreign_type("Java", loop_control, "java.lang.Object").
@@ -500,16 +498,5 @@ mercury_sys_init_lc_write_out_proc_statics(FILE *deep_fp,
#endif
").
-%---------------------------------------------------------------------------%
-
-:- pragma foreign_code("Erlang",
-"
-lc_finish_1_p_0(_) ->
- throw(""lc_finish is unavailable in this grade"").
-
-lc_wait_free_slot_2_p_0(_) ->
- throw(""lc_wait_free_slot is unavailable in this grade"").
-").
-
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
diff --git a/library/parsing_utils.m b/library/parsing_utils.m
index 128faae77..939ac88e4 100644
--- a/library/parsing_utils.m
+++ b/library/parsing_utils.m
@@ -482,13 +482,6 @@ get_skip_whitespace_pred(Src, SkipWS) :-
SkipWS = SkipWS0;
").
-:- pragma foreign_proc("Erlang",
- unsafe_skip_ws_pred_cast(SkipWS0::in, SkipWS::out(parser)),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SkipWS = SkipWS0
-").
-
%---------------------------------------------------------------------------%
input_substring(Src, Start, EndPlusOne, Substring) :-
diff --git a/library/pretty_printer.m b/library/pretty_printer.m
index 5812a42ae..a192d95e3 100644
--- a/library/pretty_printer.m
+++ b/library/pretty_printer.m
@@ -1013,18 +1013,6 @@ set_default_formatter(ModuleName, TypeName, TypeArity, Formatter, !IO) :-
Okay = pretty_printer.isInitialised;
").
-:- pragma foreign_proc("Erlang",
- pretty_printer_is_initialised(Okay::out, _IO0::di, _IO::uo),
- [promise_pure, will_not_call_mercury, thread_safe, may_not_duplicate],
-"
- 'ML_erlang_global_server' !
- {get_mutable, pretty_printer_is_initialised, self()},
- receive
- {get_mutable_ack, undefined} -> Okay = {no};
- {get_mutable_ack, Okay} -> void
- end
-").
-
%---------------------%
% This predicate must not be called unless pretty_printer_is_initialised ==
@@ -1055,17 +1043,6 @@ set_default_formatter(ModuleName, TypeName, TypeArity, Formatter, !IO) :-
FMap = pretty_printer.defaultFormatterMap;
").
-:- pragma foreign_proc("Erlang",
- unsafe_get_default_formatter_map(FMap::out, _IO0::di, _IO::uo),
- [promise_pure, will_not_call_mercury, thread_safe, may_not_duplicate],
-"
- 'ML_erlang_global_server' !
- {get_mutable, pretty_printer_default_formatter_map, self()},
- receive
- {get_mutable_ack, FMap} -> FMap
- end
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -1092,16 +1069,6 @@ set_default_formatter(ModuleName, TypeName, TypeArity, Formatter, !IO) :-
pretty_printer.defaultFormatterMap = FMap;
").
-:- pragma foreign_proc("Erlang",
- set_default_formatter_map(FMap::in, _IO0::di, _IO::uo),
- [promise_pure, will_not_call_mercury, thread_safe, may_not_duplicate],
-"
- 'ML_erlang_global_server' !
- {set_mutable, pretty_printer_is_initialised, {yes}},
- 'ML_erlang_global_server' !
- {set_mutable, pretty_printer_default_formatter_map, FMap}
-").
-
%---------------------------------------------------------------------------%
% Construct the initial default formatter map. This function
diff --git a/library/private_builtin.m b/library/private_builtin.m
index f46923461..726226bfb 100644
--- a/library/private_builtin.m
+++ b/library/private_builtin.m
@@ -368,20 +368,6 @@ builtin_compare_string(R, S1, S2) :-
"
Res = S1.compareTo(S2);
").
-:- pragma foreign_proc("Erlang",
- builtin_strcmp(Res::out, S1::in, S2::in),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX is there a more efficient three-way compare?
- if
- S1 =:= S2 ->
- Res = 0;
- S1 < S2 ->
- Res = -1;
- true ->
- Res = 1
- end
-").
builtin_unify_float(F, F).
@@ -831,33 +817,6 @@ __Compare____base_typeclass_info_1_0(
").
-:- pragma foreign_code("Erlang", "
-
-'__Unify____type_info_0_0'(X, Y) ->
- throw(""unify for type_info"").
-
-'__Unify____typeclass_info_0_0'(X, Y) ->
- throw(""unify for typeclass_info"").
-
-'__Unify____base_typeclass_info_0_0'(X, Y) ->
- throw(""unify for base_typeclass_info"").
-
-'__Unify____type_ctor_info_0_0'(X, Y) ->
- throw(""unify for type_ctor_info"").
-
-'__Compare____type_ctor_info_0_0'(X, Y) ->
- throw(""compare for type_ctor_info"").
-
-'__Compare____type_info_0_0'(X, Y) ->
- throw(""compare for type_info"").
-
-'__Compare____typeclass_info_0_0'(X, Y) ->
- throw(""compare for typeclass_info"").
-
-'__Compare____base_typeclass_info_0_0'(X, Y) ->
- throw(""compare for base_typeclass_info"").
-").
-
%---------------------%
:- pragma foreign_proc("C",
@@ -884,17 +843,6 @@ __Compare____base_typeclass_info_1_0(
TypeInfo = jmercury.private_builtin.
MR_typeclass_info_param_type_info(TypeClassInfo, Index);
").
-:- pragma foreign_proc("Erlang",
- type_info_from_typeclass_info(TypeClassInfo::in, Index::in,
- TypeInfo::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- BaseTypeClassInfo = element(1, TypeClassInfo),
- ExtraArgs = element(1, BaseTypeClassInfo),
- % Indexes start at 1 in Erlang,
- % while in C they start at 0
- TypeInfo = element(ExtraArgs + Index + 1, TypeClassInfo)
-").
%---------------------%
@@ -922,15 +870,6 @@ __Compare____base_typeclass_info_1_0(
TypeInfo = jmercury.private_builtin.
MR_typeclass_info_instance_tvar_type_info(TypeClassInfo, Index);
").
-:- pragma foreign_proc("Erlang",
- unconstrained_type_info_from_typeclass_info(TypeClassInfo::in,
- Index::in, TypeInfo::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % Indexes start at 1 in Erlang,
- % while in C they start at 0
- TypeInfo = element(Index + 1, TypeClassInfo)
-").
%---------------------%
@@ -959,17 +898,6 @@ __Compare____base_typeclass_info_1_0(
TypeClassInfo = jmercury.private_builtin.
MR_typeclass_info_superclass_info(TypeClassInfo0, Index);
").
-:- pragma foreign_proc("Erlang",
- superclass_from_typeclass_info(TypeClassInfo0::in, Index::in,
- TypeClassInfo::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- BaseTypeClassInfo = element(1, TypeClassInfo0),
- ExtraArgs = element(1, BaseTypeClassInfo),
- % Indexes start at 1 in Erlang,
- % while in C they start at 0
- TypeClassInfo = element(ExtraArgs + Index + 1, TypeClassInfo0)
-").
%---------------------%
@@ -998,15 +926,6 @@ __Compare____base_typeclass_info_1_0(
TypeClassInfo = jmercury.private_builtin.
MR_typeclass_info_arg_typeclass_info(TypeClassInfo0, Index);
").
-:- pragma foreign_proc("Erlang",
- instance_constraint_from_typeclass_info(TypeClassInfo0::in,
- Index::in, TypeClassInfo::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % Indexes start at 1 in Erlang,
- % while in C they start at 0
- TypeClassInfo = element(Index + 1, TypeClassInfo0)
-").
%---------------------------------------------------------------------------%
%
@@ -1079,13 +998,6 @@ __Compare____base_typeclass_info_1_0(
// XXX No trailing for the Java back-end, so take no action.
Ticket = null;
").
-:- pragma foreign_proc("Erlang",
- store_ticket(Ticket::out),
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- Ticket = null
-").
%---------------------%
@@ -1112,13 +1024,6 @@ __Compare____base_typeclass_info_1_0(
"
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- reset_ticket_undo(_Ticket::in),
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
%---------------------%
@@ -1145,13 +1050,6 @@ __Compare____base_typeclass_info_1_0(
"
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- reset_ticket_commit(_Ticket::in),
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
%---------------------%
@@ -1178,13 +1076,6 @@ __Compare____base_typeclass_info_1_0(
"
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- reset_ticket_solve(_Ticket::in),
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
%---------------------%
@@ -1211,13 +1102,6 @@ __Compare____base_typeclass_info_1_0(
"
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- discard_ticket,
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
%---------------------%
@@ -1244,13 +1128,6 @@ __Compare____base_typeclass_info_1_0(
"
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- prune_ticket,
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
%---------------------%
@@ -1282,13 +1159,6 @@ __Compare____base_typeclass_info_1_0(
// XXX No trailing for the Java back-end, so take no action.
TicketCounter = null;
").
-:- pragma foreign_proc("Erlang",
- mark_ticket_stack(TicketCounter::out),
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- TicketCounter = null
-").
%---------------------%
@@ -1316,14 +1186,6 @@ __Compare____base_typeclass_info_1_0(
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- prune_tickets_to(_TicketCounter::in),
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
-
%---------------------------------------------------------------------------%
%
% This section of the module contains predicates and types that are used
@@ -1416,14 +1278,6 @@ __Compare____base_typeclass_info_1_0(
// For the Java back-end, we use the Java garbage collector,
// so we take no action here.
").
-:- pragma foreign_proc("Erlang",
- gc_trace(_Pointer::in),
- [will_not_call_mercury, thread_safe],
-"
- % For the Erlang back-end, we use the Erlang garbage collector, so we
- % take no action here.
- void
-").
%---------------------%
@@ -1440,14 +1294,6 @@ __Compare____base_typeclass_info_1_0(
// For the Java back-end, we don't define our own heaps.
// So take no action here.
").
-:- pragma foreign_proc("Erlang",
- free_heap(_Val::di),
- [will_not_call_mercury, thread_safe],
-"
- % For the Erlang back-end, as for the .NET back-end, we don't define
- % our own heaps. So take no action here.
- void
-").
%---------------------%
@@ -1477,13 +1323,6 @@ __Compare____base_typeclass_info_1_0(
// We can't do heap reclamation on failure in the Java back-end.
SavedHeapPointer = null;
").
-:- pragma foreign_proc("Erlang",
- mark_hp(SavedHeapPointer::out),
- [will_not_call_mercury, thread_safe],
-"
- % We can't do heap reclamation on failure in the Erlang back-end.
- SavedHeapPointer = null
-").
%---------------------%
@@ -1509,14 +1348,6 @@ __Compare____base_typeclass_info_1_0(
// We can't do heap reclamation on failure in the Java back-end.
").
-:- pragma foreign_proc("Erlang",
- restore_hp(_SavedHeapPointer::in),
- [will_not_call_mercury, thread_safe],
-"
- % We can't do heap reclamation on failure in the Erlang back-end.
- void
-").
-
%---------------------------------------------------------------------------%
% Code to define the `heap_pointer' and `ref' types for the .NET back-end.
@@ -1708,15 +1539,6 @@ nyi_foreign_type_compare(Result, _, _) :-
/* All uses of this predicate should override the body. */
MR_fatal_error(""trace_evaluate_runtime_condition called"");
").
-:- pragma foreign_proc("Erlang",
- trace_evaluate_runtime_condition,
- [will_not_call_mercury, thread_safe, promise_semipure,
- does_not_affect_liveness],
-"
- % All uses of this predicate should override the body.
- throw(""trace_evaluate_runtime_condition called""),
- SUCCESS_INDICATOR = false
-").
:- pragma foreign_proc("C#",
trace_evaluate_runtime_condition,
[will_not_call_mercury, thread_safe, promise_semipure,
@@ -2166,10 +1988,6 @@ sorry(PredName) :-
imp,
[will_not_call_mercury, thread_safe],
"").
-:- pragma foreign_proc("Erlang",
- imp,
- [will_not_call_mercury, thread_safe],
-"void").
:- pragma foreign_proc("C",
semip,
@@ -2184,10 +2002,6 @@ sorry(PredName) :-
semip,
[will_not_call_mercury, thread_safe, promise_semipure],
"").
-:- pragma foreign_proc("Erlang",
- semip,
- [will_not_call_mercury, thread_safe, promise_semipure],
-"void").
%---------------------------------------------------------------------------%
%
@@ -2487,22 +2301,5 @@ const MR_FA_TypeInfo_Struct1 ML_type_info_for_list_of_pseudo_type_info = {
").
-:- pragma foreign_code("Erlang", "
- '__Compare____heap_pointer_0_0'(_, _) ->
- throw(""called compare/2 for type `private_builtin.heap_pointer'"").
-
- '__Unify____heap_pointer_0_0'(_, _) ->
- throw(""called unify/2 for type `private_builtin.heap_pointer'"").
-
- '__Compare____ref_1_0'(_, _, _) ->
- throw(""called compare/3 for type `private_builtin.ref'"").
-
- '__Unify____ref_1_0'(TypeInfo, X, Y) ->
- case X =:= Y of
- true -> {};
- false -> fail
- end.
-").
-
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
diff --git a/library/profiling_builtin.m b/library/profiling_builtin.m
index cc3b48af1..6098e30b6 100644
--- a/library/profiling_builtin.m
+++ b/library/profiling_builtin.m
@@ -1774,65 +1774,3 @@ restore_recursion_depth_fail_9(_, _, _, _, _, _, _, _, _, _, _) :-
private_builtin.sorry("restore_recursion_depth_fail_9").
%---------------------------------------------------------------------------%
-
-:- pragma foreign_code("Erlang", "
- % These stubs are needed so that the Erlang compiler doesn't complain
- % about missing definitions for exported functions.
-
- det_call_port_code_ac_3_p_0(_) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- det_call_port_code_sr_4_p_0(_) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- det_exit_port_code_ac_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- det_exit_port_code_sr_3_p_0(_, _, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_call_port_code_ac_4_p_0(_) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_call_port_code_sr_5_p_0(_) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_exit_port_code_ac_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_exit_port_code_sr_3_p_0(_, _, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_fail_port_code_ac_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_fail_port_code_sr_3_p_0(_, _, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_redo_port_code_ac_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- non_redo_port_code_sr_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- semi_call_port_code_ac_3_p_0(_) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- semi_call_port_code_sr_4_p_0(_) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- semi_exit_port_code_ac_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- semi_exit_port_code_sr_3_p_0(_, _, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- semi_fail_port_code_ac_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
- semi_fail_port_code_sr_3_p_0(_, _, _) ->
- mercury__private_builtin:sorry_1_p_0(
- ""deep profiling in Erlang backend"").
-").
-
-%---------------------------------------------------------------------------%
diff --git a/library/region_builtin.m b/library/region_builtin.m
index 907f57109..a904a590a 100644
--- a/library/region_builtin.m
+++ b/library/region_builtin.m
@@ -56,8 +56,6 @@
:- pragma foreign_type("Java", region, "java.lang.Object"). % dummy
-:- pragma foreign_type("Erlang", region, ""). % dummy
-
:- pragma foreign_proc("C",
create_region(Region::out),
[will_not_call_mercury],
diff --git a/library/solutions.m b/library/solutions.m
index 3afe6f2c9..9fed99815 100644
--- a/library/solutions.m
+++ b/library/solutions.m
@@ -603,17 +603,6 @@ do_while(GeneratorPred, CollectorPred, !Acc) :-
TrailPtr = null;
").
-:- pragma foreign_proc("Erlang",
- get_registers(HeapPtr::out, SolutionsHeapPtr::out, TrailPtr::out),
- [will_not_call_mercury, thread_safe],
-"
- % Erlang has a builtin garbage collector,
- % so we don't have to worry here about heap reclamation on failure.
- HeapPtr = null,
- SolutionsHeapPtr = null,
- TrailPtr = null
-").
-
:- impure pred check_for_floundering(trail_ptr::in) is det.
:- pragma foreign_proc("C",
@@ -642,14 +631,6 @@ do_while(GeneratorPred, CollectorPred, !Acc) :-
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- check_for_floundering(_TrailPtr::in),
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
-
% Discard the topmost trail ticket.
%
:- impure pred discard_trail_ticket is det.
@@ -679,14 +660,6 @@ do_while(GeneratorPred, CollectorPred, !Acc) :-
// XXX No trailing for the Java back-end, so take no action.
").
-:- pragma foreign_proc("Erlang",
- discard_trail_ticket,
- [will_not_call_mercury, thread_safe],
-"
- % XXX No trailing for the Erlang back-end, so take no action.
- void
-").
-
% Swap the heap with the solutions heap
%
:- impure pred swap_heap_and_solutions_heap is det.
@@ -725,15 +698,6 @@ do_while(GeneratorPred, CollectorPred, !Acc) :-
// So take no action here.
").
-:- pragma foreign_proc("Erlang",
- swap_heap_and_solutions_heap,
- [will_not_call_mercury, thread_safe],
-"
- % For the Erlang back-end, as for the .NET back-end, we don't define
- % our own heaps. So take no action here.
- void
-").
-
% partial_deep_copy(SolutionsHeapPtr, OldVal, NewVal):
%
% Make a copy of all of the parts of OldVar that occur between
@@ -836,29 +800,6 @@ do_while(GeneratorPred, CollectorPred, !Acc) :-
NewVal = OldVal;
").
-:- pragma foreign_proc("Erlang",
- partial_deep_copy(_SolutionsHeapPtr::in, OldVal::in, NewVal::out),
- [will_not_call_mercury, thread_safe],
-"
- % For the Erlang back-end, as for the .NET implementation,
- % we don't do heap reclamation on failure,
- % so we don't need to worry about making deep copies here.
- % Shallow copies will suffice.
- NewVal = OldVal
-").
-:- pragma foreign_proc("Erlang",
- partial_deep_copy(_SolutionsHeapPtr::in, OldVal::mdi, NewVal::muo),
- [will_not_call_mercury, thread_safe],
-"
- NewVal = OldVal
-").
-:- pragma foreign_proc("Erlang",
- partial_deep_copy(_SolutionsHeapPtr::in, OldVal::di, NewVal::uo),
- [will_not_call_mercury, thread_safe],
-"
- NewVal = OldVal
-").
-
% reset_solutions_heap(SolutionsHeapPtr):
%
% Reset the solutions heap pointer to the specified value,
@@ -891,14 +832,6 @@ do_while(GeneratorPred, CollectorPred, !Acc) :-
// As above, we take no action.
").
-:- pragma foreign_proc("Erlang",
- reset_solutions_heap(_SolutionsHeapPtr::in),
- [will_not_call_mercury, thread_safe],
-"
- % As above, we take no action.
- void
-").
-
:- impure pred start_all_soln_neg_context is det.
:- pragma foreign_proc("C",
diff --git a/library/store.m b/library/store.m
index 3c9d28cc4..5850733e6 100644
--- a/library/store.m
+++ b/library/store.m
@@ -260,8 +260,6 @@
where equality is store_equal, comparison is store_compare.
:- pragma foreign_type("Java", store(S), "int", [can_pass_as_mercury_type])
where equality is store_equal, comparison is store_compare.
-:- pragma foreign_type("Erlang", store(S), "", [can_pass_as_mercury_type])
- where equality is store_equal, comparison is store_compare.
:- pred store_equal(store(S)::in, store(S)::in) is semidet.
@@ -306,12 +304,6 @@ init(S) :-
"
TypeInfo_for_S = null;
").
-:- pragma foreign_proc("Erlang",
- do_init(_S0::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- TypeInfo_for_S = 'XXX'
-").
% Note -- the syntax for the operations on stores
% might be nicer if we used some new operators, e.g.
@@ -330,10 +322,6 @@ init(S) :-
:- pragma foreign_type("C#", generic_mutvar(T, S), "object[]").
:- pragma foreign_type("Java", generic_mutvar(T, S), "mutvar.Mutvar").
-% XXX ets are not garbage collected
-% but shareable between processes
-
-:- pragma foreign_type("Erlang", generic_mutvar(T, S), "").
:- pragma foreign_proc("C",
new_mutvar(Val::in, Mutvar::out, S0::di, S::uo),
@@ -357,14 +345,6 @@ init(S) :-
"
Mutvar = new mutvar.Mutvar(Val);
").
-:- pragma foreign_proc("Erlang",
- new_mutvar(Val::in, Mutvar::out, S0::di, S::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Mutvar = ets:new(mutvar, [set, public]),
- ets:insert(Mutvar, {value, Val}),
- S = S0
-").
:- pragma foreign_proc("C",
get_mutvar(Mutvar::in, Val::out, S0::di, S::uo),
@@ -385,13 +365,6 @@ init(S) :-
"
Val = Mutvar.object;
").
-:- pragma foreign_proc("Erlang",
- get_mutvar(Mutvar::in, Val::out, S0::di, S::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- [{value, Val}] = ets:lookup(Mutvar, value),
- S = S0
-").
:- pragma foreign_proc("C",
set_mutvar(Mutvar::in, Val::in, S0::di, S::uo),
@@ -412,13 +385,6 @@ init(S) :-
"
Mutvar.object = Val;
").
-:- pragma foreign_proc("Erlang",
- set_mutvar(Mutvar::in, Val::in, S0::di, S::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- ets:insert(Mutvar, {value, Val}),
- S = S0
-").
copy_mutvar(Mutvar, Copy, !S) :-
get_mutvar(Mutvar, Value, !S),
@@ -609,15 +575,6 @@ new_cyclic_mutvar(Func, MutVar, !Store) :-
Ref = new store.Ref(Val);
").
-:- pragma foreign_proc("Erlang",
- new_ref(Val::di, Ref::out, S0::di, S::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Ref = ets:new(mutvar, [set, public]),
- ets:insert(Ref, {value, Val}),
- S = S0
-").
-
ref_functor(Ref, Functor, Arity, !Store) :-
unsafe_ref_value(Ref, Val, !Store),
functor(Val, canonicalize, Functor, Arity).
@@ -655,14 +612,6 @@ copy_ref_value(Ref, Val) -->
Val = Ref.getValue();
").
-:- pragma foreign_proc("Erlang",
- unsafe_ref_value(Ref::in, Val::uo, S0::di, S::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- [{value, Val}] = ets:lookup(Ref, value),
- S = S0
-").
-
:- pragma foreign_decl("C",
"
#include ""mercury_type_info.h""
diff --git a/library/string.format.m b/library/string.format.m
index 236a10462..9145e852b 100644
--- a/library/string.format.m
+++ b/library/string.format.m
@@ -475,11 +475,6 @@ make_format(Flags, MaybeWidth, MaybePrec, LengthMod, Spec) =
"
SUCCESS_INDICATOR = false;
").
-:- pragma foreign_proc("Erlang", using_sprintf,
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SUCCESS_INDICATOR = false
-").
:- pred using_sprintf_for_char(char::in) is semidet.
@@ -1498,13 +1493,6 @@ convert_float_to_string(Float) = String :-
"
FloatString = java.lang.Double.toString(FloatVal);
").
-:- pragma foreign_proc("Erlang",
- float_to_string_first_pass(FloatVal::in, FloatString::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- List = io_lib:format(""~.17g"", [FloatVal]),
- FloatString = list_to_binary(List)
-").
% Converts a floating point number to a specified number of standard
% figures. The style used depends on the value converted; style e (or E)
diff --git a/library/string.m b/library/string.m
index 53bc2cc61..6c921688a 100644
--- a/library/string.m
+++ b/library/string.m
@@ -24,9 +24,6 @@
% A single code point requires one or two 16-bit integers (code units)
% to encode.
%
-% When Mercury is compiled to Erlang, strings are represented as Erlang
-% binaries using UTF-8 encoding.
-%
% The Mercury compiler will only allow well-formed UTF-8 or UTF-16 string
% constants. However, it is possible to produce strings containing invalid
% UTF-8 or UTF-16 via I/O, foreign code, and substring operations.
@@ -46,7 +43,6 @@
% - C's strcmp() function, when compiling to C;
% - Java's String.compareTo() method, when compiling to Java;
% - C#'s System.String.CompareOrdinal() method, when compiling to C#; and
-% - Erlang's term comparison operator, when compiling to Erlang.
%
%---------------------------------------------------------------------------%
%
@@ -1690,12 +1686,6 @@
"
SUCCESS_INDICATOR = false;
").
-:- pragma foreign_proc("Erlang",
- internal_encoding_is_utf8,
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SUCCESS_INDICATOR = true
-").
%---------------------------------------------------------------------------%
%
@@ -1873,14 +1863,6 @@ from_char_list(Chars::in, Str::uo) :-
}
Str = sb.toString();
").
-:- pragma foreign_proc("Erlang",
- semidet_from_char_list(CharList::in, Str::uo),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
- does_not_affect_liveness],
-"
- Str = unicode:characters_to_binary(CharList),
- SUCCESS_INDICATOR = true
-").
semidet_from_char_list(CharList, Str) :-
(
@@ -2235,15 +2217,6 @@ from_code_unit_list_allow_ill_formed(CodeList, Str) :-
Str = """";
}
").
-:- pragma foreign_proc("Erlang",
- do_from_code_unit_list(CodeList::in, _Verify::in, Str::uo),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
- does_not_affect_liveness],
-"
- Str = list_to_binary(CodeList),
- % XXX validate the string
- SUCCESS_INDICATOR = true
-").
%---------------------%
@@ -2423,13 +2396,6 @@ unsafe_index(S, N) = C :-
"
Ch = Str.codePointAt(Index);
").
-:- pragma foreign_proc("Erlang",
- unsafe_index(Str::in, Index::in, Ch::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX does not handle ill-formed sequences as described
- <<_:Index/binary, Ch/utf8, _/binary>> = Str
-").
%---------------------%
@@ -2529,34 +2495,6 @@ unsafe_index_next_repl(Str, Index, NextIndex, Ch, MaybeReplaced) :-
SUCCESS_INDICATOR = false;
}
").
-:- pragma foreign_proc("Erlang",
- unsafe_index_next_repl_2(Str::in, Index::in, NextIndex::out, Ch::uo,
- ReplacedCodeUnit::out),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
- does_not_affect_liveness, no_sharing],
-"
- % XXX does not handle ill-formed sequences as described
- case Str of
- << _:Index/binary, Ch/utf8, _/binary >> ->
- if
- Ch =< 16#7f ->
- NextIndex = Index + 1;
- Ch =< 16#7ff ->
- NextIndex = Index + 2;
- Ch =< 16#ffff ->
- NextIndex = Index + 3;
- true ->
- NextIndex = Index + 4
- end,
- ReplacedCodeUnit = -1,
- SUCCESS_INDICATOR = true;
- _ ->
- Ch = -1,
- ReplacedCodeUnit = -1,
- NextIndex = Index,
- SUCCESS_INDICATOR = false
- end
-").
%---------------------%
@@ -2665,43 +2603,6 @@ unsafe_prev_index_repl(Str, Index, PrevIndex, Ch, MaybeReplaced) :-
SUCCESS_INDICATOR = false;
}
").
-:- pragma foreign_proc("Erlang",
- unsafe_prev_index_repl_2(Str::in, Index::in, PrevIndex::out, Ch::uo,
- ReplacedCodeUnit::out),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
- does_not_affect_liveness, no_sharing],
-"
- % XXX does not handle ill-formed sequences as described
- {PrevIndex, Ch} = mercury__string:do_unsafe_prev_index(Str, Index - 1),
- ReplacedCodeUnit = -1,
- SUCCESS_INDICATOR = (Ch =/= -1)
-").
-
-:- pragma foreign_decl("Erlang", local, "
--export([do_unsafe_prev_index/2]).
-").
-
-:- pragma foreign_code("Erlang", "
-do_unsafe_prev_index(Str, Index) ->
- if Index >= 0 ->
- case Str of
- <<_:Index/binary, Ch/integer, _/binary>> ->
- if
- (Ch band 16#80) =:= 0 ->
- {Index, Ch};
- (Ch band 16#C0) == 16#80 ->
- do_unsafe_prev_index(Str, Index - 1);
- true ->
- <<_:Index/binary, Ch2/utf8, _/binary>> = Str,
- {Index, Ch2}
- end;
- true ->
- {Index, -1}
- end
- ; true ->
- {Index, -1}
- end.
-").
%---------------------%
@@ -2753,12 +2654,6 @@ index_check(Index, Length) :-
"
Code = Str.charAt(Index);
").
-:- pragma foreign_proc("Erlang",
- unsafe_index_code_unit(Str::in, Index::in, Code::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- <<_:Index/binary, Code/integer, _/binary>> = Str
-").
%---------------------------------------------------------------------------%
%
@@ -2890,15 +2785,6 @@ unsafe_set_char(Char, Index, Str0, Str) :-
+ new String(Character.toChars(Ch))
+ Str0.subSequence(Index + oldwidth, Str0.length());
").
-:- pragma foreign_proc("Erlang",
- unsafe_set_char_copy_string(Ch::in, Index::in, _Len0::in,
- Str0::in, Str::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX does not implement defined behaviour
- <<Left:Index/binary, _/utf8, Right/binary>> = Str0,
- Str = unicode:characters_to_binary([Left, Ch, Right])
-").
%---------------------------------------------------------------------------%
%
@@ -2929,12 +2815,6 @@ length(S) = L :-
"
Length = Str.length();
").
-:- pragma foreign_proc("Erlang",
- length(Str::in, Length::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Length = size(Str)
-").
:- pragma foreign_proc("C",
length(Str::ui, Length::uo),
@@ -2955,12 +2835,6 @@ length(S) = L :-
"
Length = Str.length();
").
-:- pragma foreign_proc("Erlang",
- length(Str::ui, Length::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Length = size(Str)
-").
length(Str, Len) :-
to_code_unit_list(Str, CodeList),
@@ -3641,25 +3515,6 @@ sub_string_search_start(WholeString, Pattern, BeginAt, Index) :-
Index = WholeString.indexOf(Pattern, BeginAt);
SUCCESS_INDICATOR = (Index >= 0);
").
-:- pragma foreign_proc("Erlang",
- unsafe_sub_string_search_start(String::in, SubString::in, BeginAt::in,
- Index::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- <<_:BeginAt/binary, Haystack/binary>> = String,
- if
- size(SubString) =:= 0 ->
- Index = BeginAt;
- true ->
- case binary:match(Haystack, SubString) of
- {FoundStart, FoundLength} ->
- Index = BeginAt + FoundStart;
- nomatch ->
- Index = -1
- end
- end,
- SUCCESS_INDICATOR = (Index =/= -1)
-").
unsafe_sub_string_search_start(String, SubString, BeginAt, Index) :-
Len = length(String),
@@ -3758,12 +3613,6 @@ append_ioi(S1, S2, S3) :-
"
S3 = S1.concat(S2);
").
-:- pragma foreign_proc("Erlang",
- append_iio(S1::in, S2::in, S3::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- S3 = list_to_binary([S1, S2])
-").
:- pred append_oii(string::uo, string::in, string::in) is semidet.
@@ -3859,13 +3708,6 @@ S1 ++ S2 = append(S1, S2).
Str = sb.toString();
").
-:- pragma foreign_proc("Erlang",
- append_list(Strs::in) = (Str::uo),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
- does_not_affect_liveness],
-"
- Str = list_to_binary(Strs)
-").
append_list(Strs) = Str :-
append_list(Strs, Str).
@@ -4348,13 +4190,6 @@ unsafe_between(Str, Start, End) = SubString :-
"
SubString = Str.substring(Start, End);
").
-:- pragma foreign_proc("Erlang",
- unsafe_between(Str::in, Start::in, End::in, SubString::uo),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- Count = End - Start,
- << _:Start/binary, SubString:Count/binary, _/binary >> = Str
-").
%---------------------%
@@ -5543,23 +5378,6 @@ accumulate_negative_int(Base, Char, N0, N) :-
}
}
").
-:- pragma foreign_proc("Erlang",
- to_float(FloatString::in, FloatVal::out),
- [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
- does_not_affect_liveness],
-"
- S = binary_to_list(FloatString),
- % string:to_float fails on integers, so tack on a trailing '.0' string.
- case string:to_float(S ++ "".0"") of
- {FloatVal, []} ->
- SUCCESS_INDICATOR = true;
- {FloatVal, "".0""} ->
- SUCCESS_INDICATOR = true;
- _ ->
- SUCCESS_INDICATOR = false,
- FloatVal = -1.0
- end
-").
det_to_float(FloatString) = Float :-
( if to_float(FloatString, FloatPrime) then
diff --git a/library/table_builtin.m b/library/table_builtin.m
index 325ffeece..6e064bf09 100644
--- a/library/table_builtin.m
+++ b/library/table_builtin.m
@@ -2065,30 +2065,5 @@ table_report_statistics :-
impure private_builtin.imp,
private_builtin.sorry("table_report_statistics").
-%---------------------------------------------------------------------------%
-
-:- pragma foreign_code("Erlang", "
-
- % These stubs are needed so that the Erlang compiler doesn't complain
- % about missing definitions for exported functions.
-
- table_memo_return_all_answers_multi_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
- table_memo_return_all_answers_nondet_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
- table_mm_completion_1_p_0(_) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
- table_mm_return_all_multi_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
- table_mm_return_all_nondet_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
- table_mm_suspend_consumer_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
- table_mmos_consume_next_answer_multi_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
- table_mmos_consume_next_answer_nondet_2_p_0(_, _) ->
- mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
-").
-
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
diff --git a/library/thread.future.m b/library/thread.future.m
index 086a43eeb..096618c1d 100644
--- a/library/thread.future.m
+++ b/library/thread.future.m
@@ -260,8 +260,6 @@ wait(Future, Value) :-
[will_not_call_mercury, thread_safe], "").
:- pragma foreign_proc("Java", make_io_state(_IO::uo),
[will_not_call_mercury, thread_safe], "").
-:- pragma foreign_proc("Erlang", make_io_state(_IO::uo),
- [will_not_call_mercury, thread_safe], "void").
:- impure pred consume_io_state(io::di) is det.
:- pragma foreign_proc("C",
@@ -273,8 +271,5 @@ wait(Future, Value) :-
:- pragma foreign_proc("Java",
consume_io_state(_IO::di),
[will_not_call_mercury, thread_safe], "").
-:- pragma foreign_proc("Erlang",
- consume_io_state(_IO::di),
- [will_not_call_mercury, thread_safe], "void").
%---------------------------------------------------------------------------%
diff --git a/library/thread.semaphore.m b/library/thread.semaphore.m
index 5261ef961..f0c76c65c 100644
--- a/library/thread.semaphore.m
+++ b/library/thread.semaphore.m
@@ -147,7 +147,6 @@ public class ML_Semaphore {
:- pragma foreign_type("C", semaphore, "struct ML_SEMAPHORE_STRUCT *",
[can_pass_as_mercury_type]).
:- pragma foreign_type("C#", semaphore, "thread__semaphore.ML_Semaphore").
-:- pragma foreign_type("Erlang", semaphore, "").
:- pragma foreign_type("Java", semaphore, "jmercury.runtime.Semaphore").
:- pragma foreign_decl("C", "
diff --git a/library/time.m b/library/time.m
index f0eaf1d0f..923e6c049 100644
--- a/library/time.m
+++ b/library/time.m
@@ -230,8 +230,6 @@
where comparison is compare_time_t_reps.
:- pragma foreign_type("Java", time_t_rep, "java.time.Instant")
where comparison is compare_time_t_reps.
-:- pragma foreign_type("Erlang", time_t_rep, "")
- where comparison is compare_time_t_reps.
:- pred compare_time_t_reps(comparison_result::uo,
time_t_rep::in, time_t_rep::in) is det.
@@ -333,12 +331,6 @@ time(Result, !IO) :-
"
Ret = java.time.Instant.now();
").
-:- pragma foreign_proc("Erlang",
- c_time(Ret::out, _IO0::di, _IO::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io],
-"
- Ret = erlang:universaltime()
-").
:- pred time_t_is_invalid(time_t_rep::in) is semidet.
@@ -360,12 +352,6 @@ time(Result, !IO) :-
"
SUCCESS_INDICATOR = false;
").
-:- pragma foreign_proc("Erlang",
- time_t_is_invalid(_Val::in),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- SUCCESS_INDICATOR = false
-").
%---------------------------------------------------------------------------%
@@ -555,14 +541,6 @@ difftime(time_t(T1), time_t(T0)) = Diff :-
"
Diff = (double) (T1.toEpochMilli() - T0.toEpochMilli()) / 1000;
").
-:- pragma foreign_proc("Erlang",
- c_difftime(T1::in, T0::in, Diff::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- S0 = calendar:datetime_to_gregorian_seconds(T0),
- S1 = calendar:datetime_to_gregorian_seconds(T1),
- Diff = float(S1 - S0)
-").
%---------------------------------------------------------------------------%
@@ -721,24 +699,6 @@ gmtime(time_t(Time)) = TM :-
WD = utcTime.getDayOfWeek().getValue() % 7;
N = 0;
").
-:- pragma foreign_proc("Erlang",
- 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],
-"
- {{Yr0, Mnt0, MD}, {Hrs, Min, Sec}} = Time,
- Yr = Yr0 - 1900,
- Mnt = Mnt0 - 1,
-
- DayNumber = calendar:date_to_gregorian_days(Yr, Mnt, MD),
- Jan1_Number = calendar:date_to_gregorian_days(Yr, 1, 1),
- YD = DayNumber - Jan1_Number,
-
- % Sunday = 7 = 0
- WD = calendar:day_of_the_week(Yr, Mnt, MD) rem 7,
-
- N = 0
-").
:- func int_to_maybe_dst(int) = maybe(dst).
diff --git a/library/type_desc.m b/library/type_desc.m
index fa09be4c5..1ee1633ec 100644
--- a/library/type_desc.m
+++ b/library/type_desc.m
@@ -370,13 +370,6 @@ type_info_desc_same_representation :-
PseudoTypeDesc = TypeDesc;
").
-:- pragma foreign_proc("Erlang",
- type_desc_to_pseudo_type_desc(TypeDesc::in) = (PseudoTypeDesc::out),
- [will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail],
-"
- PseudoTypeDesc = TypeDesc
-").
-
type_desc_to_pseudo_type_desc(_TypeDesc) = _PseudoTypeDesc :-
% The backends in which we use this definition of this predicate
% don't yet support pseudo_type_descs.
@@ -437,13 +430,6 @@ det_ground_pseudo_type_desc_to_type_desc(PseudoTypeDesc) = TypeDesc :-
TypeInfo = TypeInfo_for_T;
").
-:- pragma foreign_proc("Erlang",
- type_of(_Value::unused) = (TypeInfo::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- TypeInfo = TypeInfo_for_T
-").
-
:- pragma foreign_proc("C",
has_type(_Arg::unused, TypeInfo::in),
[will_not_call_mercury, thread_safe, promise_pure, no_sharing],
@@ -465,13 +451,6 @@ det_ground_pseudo_type_desc_to_type_desc(PseudoTypeDesc) = TypeDesc :-
TypeInfo_for_T = TypeInfo;
").
-:- pragma foreign_proc("Erlang",
- has_type(_Arg::unused, TypeInfo::in),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- TypeInfo_for_T = TypeInfo
-").
-
same_type(_, _).
% Export this function in order to use it in runtime/mercury_trace_external.c
@@ -1072,47 +1051,6 @@ get_type_info_for_type_info = TypeDesc :-
}
").
-:- pragma foreign_code("Erlang", "
- '__Unify____type_desc_0_0'(X0, Y0) ->
- Res = mercury__erlang_rtti_implementation:compare_type_infos_3_p_0(
- X0, Y0),
- case Res of
- { '=' } -> {};
- _ -> fail
- end.
-
- '__Unify____type_ctor_desc_0_0'(X0, Y0) ->
- X = eval_if_function(X0),
- Y = eval_if_function(Y0),
- case X =:= Y of
- true -> {};
- false -> fail
- end.
-
- '__Unify____pseudo_type_desc_0_0'(_, _) ->
- throw(""foreign code for unifying pseudo_type_desc"").
-
- '__Compare____type_desc_0_0'(X0, Y0) ->
- mercury__erlang_rtti_implementation:compare_type_infos_3_p_0(X0, Y0).
-
- '__Compare____type_ctor_desc_0_0'(X0, Y0) ->
- X = eval_if_function(X0),
- Y = eval_if_function(Y0),
- if
- X =:= Y -> {'='};
- X < Y -> {'<'};
- true -> {'>'}
- end.
-
- '__Compare____pseudo_type_desc_0_0'(_, _) ->
- throw(""foreign code for comparing pseudo_type_desc"").
-
- eval_if_function(X) when is_function(X, 0) -> X();
- eval_if_function(X) when is_tuple(X) ->
- list_to_tuple([eval_if_function(E) || E <- tuple_to_list(X)]);
- eval_if_function(X) -> X.
-").
-
%---------------------------------------------------------------------------%
type_desc_to_type_info(TypeDesc, TypeInfo) :-
diff --git a/library/uint.m b/library/uint.m
index bc013a26b..e5d4263f9 100644
--- a/library/uint.m
+++ b/library/uint.m
@@ -268,9 +268,6 @@ det_from_int(I) = U :-
%---------------------------------------------------------------------------%
-cast_from_int(_) = _ :-
- sorry($module, "uint.cast_from_int/1 NYI for Erlang").
-
:- pragma foreign_proc("C",
cast_to_int(U::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -293,9 +290,6 @@ cast_from_int(_) = _ :-
I = U;
").
-cast_to_int(_) = _ :-
- sorry($module, "uint.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
max(X, Y) =
@@ -418,14 +412,6 @@ odd(X) :-
Bits = 32;
").
-:- pragma foreign_proc("Erlang",
- bits_per_uint = (Bits::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- % XXX Erlang ints are actually arbitrary precision.
- Bits = 32
-").
-
%---------------------------------------------------------------------------%
uint_to_doc(X) = str(string.uint_to_string(X)).
diff --git a/library/uint16.m b/library/uint16.m
index 262fbca3c..59ba0b749 100644
--- a/library/uint16.m
+++ b/library/uint16.m
@@ -379,8 +379,6 @@ det_from_int(I) = U16 :-
error($pred, "cannot convert int to uint16")
).
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (U16::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -403,13 +401,8 @@ det_from_int(I) = U16 :-
U16 = (short) I;
").
-cast_from_int(_) = _ :-
- sorry($module, "uint16.cast_from_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(to_int/1).
-
:- pragma foreign_proc("C",
to_int(U16::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -432,11 +425,6 @@ cast_from_int(_) = _ :-
I = U16 & 0xffff;
").
-to_int(_) = _ :-
- sorry($module, "uint16.to_int/1 NYI for Erlang").
-
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(U16::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -459,13 +447,8 @@ to_int(_) = _ :-
I = U16 & 0xffff;
").
-cast_to_int(_) = _ :-
- sorry($module, "uint16.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_uint/1).
-
:- pragma foreign_proc("C",
cast_to_uint(U16::in) = (U::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -488,13 +471,8 @@ cast_to_int(_) = _ :-
U = U16 & 0xffff;
").
-cast_to_uint(_) = _ :-
- sorry($module, "uint16.cast_to_uint/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_uint64/1).
-
:- pragma foreign_proc("C",
cast_to_uint64(U16::in) = (U64::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -517,13 +495,8 @@ cast_to_uint(_) = _ :-
U64 = (long) U16 & 0xffffL;
").
-cast_to_uint64(_) = _ :-
- sorry($module, "uint16.cast_to_uint64/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_uint64/1).
-
:- pragma foreign_proc("C",
cast_from_uint64(U64::in) = (U16::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -546,13 +519,8 @@ cast_to_uint64(_) = _ :-
U16 = (short) U64;
").
-cast_from_uint64(_) = _ :-
- sorry($module, "uint16.cast_from_uint64/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_int16/1).
-
:- pragma foreign_proc("C",
cast_from_int16(I16::in) = (U16::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -575,9 +543,6 @@ cast_from_uint64(_) = _ :-
U16 = I16;
").
-cast_from_int16(_) = _ :-
- sorry($module, "uint16.cast_from_int16/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -608,9 +573,6 @@ cast_from_int16(_) = _ :-
U16 = (ushort) (MSB << 8 | (LSB & 0x00ff));
").
-from_bytes_le(_, _) = _ :-
- sorry($module, "uint16.from_bytes_le/2 NYI for Erlang").
-
from_bytes_be(MSB, LSB) =
from_bytes_le(LSB, MSB).
diff --git a/library/uint32.m b/library/uint32.m
index 5b36d2cb5..5824cfb07 100644
--- a/library/uint32.m
+++ b/library/uint32.m
@@ -371,8 +371,6 @@
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(from_int/2).
-
:- pragma foreign_proc("C",
from_int(I::in, U32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -403,9 +401,6 @@
SUCCESS_INDICATOR = (I < 0) ? false : true;
").
-from_int(_, _) :-
- sorry($module, "uint32.from_int NYI for Erlang").
-
det_from_int(I) = U :-
( if from_int(I, U0) then
U = U0
@@ -413,8 +408,6 @@ det_from_int(I) = U :-
error($pred, "cannot convert int to uint32")
).
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (U32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -437,13 +430,8 @@ det_from_int(I) = U :-
U32 = I;
").
-cast_from_int(_) = _ :-
- sorry($module, "uint32.cast_from_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(U32::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -466,13 +454,8 @@ cast_from_int(_) = _ :-
I = U32;
").
-cast_to_int(_) = _ :-
- sorry($module, "uint32.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_uint/1).
-
:- pragma foreign_proc("C",
cast_to_uint(U32::in) = (U::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -495,13 +478,8 @@ cast_to_int(_) = _ :-
U = U32;
").
-cast_to_uint(_) = _ :-
- sorry($module, "uint32.cast_to_uint/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_uint/1).
-
:- pragma foreign_proc("C",
cast_from_uint(U::in) = (U32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -524,13 +502,8 @@ cast_to_uint(_) = _ :-
U32 = U;
").
-cast_from_uint(_) = _ :-
- sorry($module, "uint32.cast_from_uint/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_uint64/1).
-
:- pragma foreign_proc("C",
cast_to_uint64(U32::in) = (U64::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -553,13 +526,8 @@ cast_from_uint(_) = _ :-
U64 = (long) U32 & 0xffffffffL;
").
-cast_to_uint64(_) = _ :-
- sorry($module, "uint32.cast_to_uint64/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_uint64/1).
-
:- pragma foreign_proc("C",
cast_from_uint64(U64::in) = (U32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -582,13 +550,8 @@ cast_to_uint64(_) = _ :-
U32 = (int) U64;
").
-cast_from_uint64(_) = _ :-
- sorry($module, "uint32.cast_from_uint64/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_int32/1).
-
:- pragma foreign_proc("C",
cast_from_int32(I32::in) = (U32::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -611,9 +574,6 @@ cast_from_uint64(_) = _ :-
U32 = I32;
").
-cast_from_int32(_) = _ :-
- sorry($module, "uint32.cast_from_int32/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -652,9 +612,6 @@ cast_from_int32(_) = _ :-
U32 = (uint) (Byte3 << 24 | Byte2 << 16 | Byte1 << 8 | Byte0);
").
-from_bytes_le(_, _, _, _) = _ :-
- sorry($module, "uint32.from_bytes_le/4 NYI for Erlang").
-
from_bytes_be(Byte3, Byte2, Byte1, Byte0) =
from_bytes_le(Byte0, Byte1, Byte2, Byte3).
diff --git a/library/uint64.m b/library/uint64.m
index ff3d5f993..f35f0b428 100644
--- a/library/uint64.m
+++ b/library/uint64.m
@@ -340,8 +340,6 @@
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(from_int/2).
-
:- pragma foreign_proc("C",
from_int(I::in, U64::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail],
@@ -372,9 +370,6 @@
SUCCESS_INDICATOR = (I < 0) ? false : true;
").
-from_int(_, _) :-
- sorry($module, "uint64.from_int NYI for Erlang").
-
det_from_int(I) = U64 :-
( if from_int(I, U64Prime) then
U64 = U64Prime
@@ -384,8 +379,6 @@ det_from_int(I) = U64 :-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (U64::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -408,13 +401,8 @@ det_from_int(I) = U64 :-
U64 = I;
").
-cast_from_int(_) = _ :-
- sorry($module, "uint64.cast_from_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(U64::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -437,13 +425,8 @@ cast_from_int(_) = _ :-
I = (int) U64;
").
-cast_to_int(_) = _ :-
- sorry($module, "uint64.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_uint/1).
-
:- pragma foreign_proc("C",
cast_to_uint(U64::in) = (U::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -466,13 +449,8 @@ cast_to_int(_) = _ :-
U = (int) U64;
").
-cast_to_uint(_) = _ :-
- sorry($module, "uint64.cast_to_uint/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_int64/1).
-
:- pragma foreign_proc("C",
cast_from_int64(I64::in) = (U64::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -495,9 +473,6 @@ cast_to_uint(_) = _ :-
U64 = I64;
").
-cast_from_int64(_) = _ :-
- sorry($module, "uint64.cast_from_int64/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
:- pragma foreign_proc("C",
@@ -559,9 +534,6 @@ cast_from_int64(_) = _ :-
(ulong) Byte0);
").
-from_bytes_le(_, _, _, _, _, _, _, _) = _ :-
- sorry($module, "uint64.from_bytes_le/8 NYI for Erlang").
-
from_bytes_be(Byte7, Byte6, Byte5,Byte4, Byte3, Byte2, Byte1, Byte0) =
from_bytes_le(Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7).
diff --git a/library/uint8.m b/library/uint8.m
index 103571c5b..b2ce2df95 100644
--- a/library/uint8.m
+++ b/library/uint8.m
@@ -332,8 +332,6 @@ det_from_int(I) = U8 :-
error($pred, "cannot convert int to uint8")
).
-:- pragma no_determinism_warning(cast_from_int/1).
-
:- pragma foreign_proc("C",
cast_from_int(I::in) = (U8::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -356,13 +354,8 @@ det_from_int(I) = U8 :-
U8 = (byte) I;
").
-cast_from_int(_) = _ :-
- sorry($module, "uint8.cast_from_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(to_int/1).
-
:- pragma foreign_proc("C",
to_int(U8::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -385,11 +378,6 @@ cast_from_int(_) = _ :-
I = U8 & 0xff;
").
-to_int(_) = _ :-
- sorry($module, "uint8.to_int/1 NYI for Erlang").
-
-:- pragma no_determinism_warning(cast_to_int/1).
-
:- pragma foreign_proc("C",
cast_to_int(U8::in) = (I::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -412,13 +400,8 @@ to_int(_) = _ :-
I = U8 & 0xff;
").
-cast_to_int(_) = _ :-
- sorry($module, "uint8.cast_to_int/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_to_uint/1).
-
:- pragma foreign_proc("C",
cast_to_uint(U8::in) = (U::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -441,13 +424,8 @@ cast_to_int(_) = _ :-
U = U8 & 0xff;
").
-cast_to_uint(_) = _ :-
- sorry($module, "uint8.cast_to_uint/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
-:- pragma no_determinism_warning(cast_from_int8/1).
-
:- pragma foreign_proc("C",
cast_from_int8(I8::in) = (U8::out),
[will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
@@ -470,9 +448,6 @@ cast_to_uint(_) = _ :-
U8 = I8;
").
-cast_from_int8(_) = _ :-
- sorry($module, "uint8.cast_from_int8/1 NYI for Erlang").
-
%---------------------------------------------------------------------------%
% The comparison operations <, >, =< and >= are builtins.
diff --git a/library/version_array.m b/library/version_array.m
index 7d14594a7..abd2e231d 100644
--- a/library/version_array.m
+++ b/library/version_array.m
@@ -753,15 +753,9 @@ unsafe_rewind(VA, unsafe_rewind(VA)).
equality is eq_version_array,
comparison is cmp_version_array.
- % This is necessary for the library to compile in the Erlang grades.
- %
-:- type version_array(T)
- ---> version_array(T).
-
:- pred eq_version_array(version_array(T)::in, version_array(T)::in)
is semidet.
:- pragma terminates(eq_version_array/2).
-:- pragma consider_used(eq_version_array/2). % For the Erlang grade.
eq_version_array(VAa, VAb) :-
N = max(VAa),
@@ -782,7 +776,6 @@ eq_version_array_2(I, VAa, VAb) :-
:- pred cmp_version_array(comparison_result::uo,
version_array(T)::in, version_array(T)::in) is det.
:- pragma terminates(cmp_version_array/3).
-:- pragma consider_used(cmp_version_array/3). % For the Erlang grade.
cmp_version_array(R, VAa, VAb) :-
SizeA = VAa ^ size,
diff --git a/mdbcomp/rtti_access.m b/mdbcomp/rtti_access.m
index 49977e9a6..f8d548ea2 100644
--- a/mdbcomp/rtti_access.m
+++ b/mdbcomp/rtti_access.m
@@ -110,7 +110,6 @@
% The following definitions are only stubs.
:- pragma foreign_type("C#", bytecode_bytes, "object", []).
:- pragma foreign_type("Java", bytecode_bytes, "java.lang.Object", []).
-:- pragma foreign_type("Erlang", bytecode_bytes, "").
% read_byte(ByteCode, Byte, !Pos):
%
@@ -206,7 +205,6 @@
% The following definitions are only stubs.
:- pragma foreign_type("C#", label_layout, "object", []).
:- pragma foreign_type("Java", label_layout, "java.lang.Object", []).
-:- pragma foreign_type("Erlang", label_layout, "").
:- pragma foreign_proc("C",
get_proc_layout_from_label_layout(Label::in) = (ProcLayout::out),
@@ -260,7 +258,6 @@ get_path_port_from_label_layout(Label) = PathPort :-
% The following definitions are only stubs.
:- pragma foreign_type("C#", proc_layout, "object", []).
:- pragma foreign_type("Java", proc_layout, "java.lang.Object", []).
-:- pragma foreign_type("Erlang", proc_layout, "").
get_proc_label_from_layout(Layout) = ProcLabel :-
( if proc_layout_is_uci(Layout) then
@@ -597,14 +594,6 @@ get_proc_name(special_proc_label(_, _, _, ProcName , _, _)) = ProcName.
if (1 == 1) throw new Error(\"not supported in java grade\");
").
-:- pragma foreign_proc("Erlang",
- proc_bytecode_bytes(_ProcLayout::in) = (ByteCodeBytes::out),
- [will_not_call_mercury, thread_safe, promise_pure],
-"
- ByteCodeBytes = 0, % Avoid a warning.
- throw({""not supported in erlang grade""})
-").
-
% Default version for non-C backends.
proc_bytecode_bytes(_) = dummy_bytecode_bytes.
@@ -615,14 +604,12 @@ proc_bytecode_bytes(_) = dummy_bytecode_bytes.
% The following definitions are only stubs.
:- pragma foreign_type("C#", module_layout, "object", []).
:- pragma foreign_type("Java", module_layout, "java.lang.Object", []).
-:- pragma foreign_type("Erlang", module_layout, "").
:- pragma foreign_type("C", string_table_chars, "MR_ConstString",
[can_pass_as_mercury_type, stable]).
% The following definitions are only stubs.
:- pragma foreign_type("C#", string_table_chars, "object", []).
:- pragma foreign_type("Java", string_table_chars, "java.lang.Object", []).
-:- pragma foreign_type("Erlang", string_table_chars, "").
:- pragma foreign_proc("C",
containing_module_layout(ProcLayout::in, ModuleLayout::out),
--
2.28.0
More information about the reviews
mailing list