[m-rev.] delete unused procedures in library implementation
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Aug 5 18:06:15 AEST 2003
Estimated hours taken: 1.5
Branches: main
Delete some unused procedures warned about by --warn-dead-procs.
library/eqvclass.m:
library/integer.m:
library/io.m:
library/list.m:
library/relation.m:
library/string.m:
library/term.m:
Delete the following procedures:
eqvclass.find_partition/3
integer.int_max/0
io.buffer_to_string/3
list.qsort/3
list.partition/4
relation.tsort_2/6
relation.tsort_3/6
string.to_int_list/2,
string.int_list_to_char_list/2,
string.char_list_to_int_list
term.require_equal/2
term.contains_functor/3
term.subterm/2
library/exception.m:
library/set_bbbtree.m:
library/tree234.m:
Comment out unused modes of
exception.wrap_success_or_failure/2
exception.call_goal/2
exception.call_handler/2
Comment out unused di/uo modes of
set_bbbtree.build_node/4
set_bbbtree.{single,double}_rot_{l,r}/4
tree234.insert2/4
tree234.insert3/4
Workspace: /home/ceres/fjh/mercury
Index: library/eqvclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/eqvclass.m,v
retrieving revision 1.12
diff -u -d -r1.12 eqvclass.m
--- library/eqvclass.m 26 May 2003 09:00:29 -0000 1.12
+++ library/eqvclass.m 26 Jul 2003 07:44:34 -0000
@@ -257,17 +257,6 @@
% Given an element, get the id of the partition containing that element.
-:- pred eqvclass__find_partition(eqvclass(T), T, partition_id).
-:- mode eqvclass__find_partition(in, in, out) is det.
-
-eqvclass__find_partition(EqvClass0, Element, Id) :-
- EqvClass0 = eqvclass(_NextId0, _PartitionMap0, ElementMap0),
- ( map__search(ElementMap0, Element, IdPrime) ->
- Id = IdPrime
- ;
- error("element not known to equivalence class")
- ).
-
% Given a partition id, get the elements of the partition.
:- pred eqvclass__id_to_partition(eqvclass(T), partition_id, set(T)).
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.80
diff -u -d -r1.80 exception.m
--- library/exception.m 5 Aug 2003 06:42:54 -0000 1.80
+++ library/exception.m 5 Aug 2003 07:06:15 -0000
@@ -379,8 +379,8 @@
:- pred wrap_success_or_failure(pred(T), exception_result(T)) is det.
:- mode wrap_success_or_failure(pred(out) is det, out) is det.
:- mode wrap_success_or_failure(pred(out) is semidet, out) is det.
-:- mode wrap_success_or_failure(pred(out) is multi, out) is multi.
-:- mode wrap_success_or_failure(pred(out) is nondet, out) is multi.
+%:- mode wrap_success_or_failure(pred(out) is multi, out) is multi. (unused)
+%:- mode wrap_success_or_failure(pred(out) is nondet, out) is multi. (unused)
:- mode wrap_success_or_failure(pred(out) is cc_multi, out) is cc_multi.
:- mode wrap_success_or_failure(pred(out) is cc_nondet, out) is cc_multi.
wrap_success_or_failure(Goal, Result) :-
@@ -1281,14 +1281,14 @@
:- 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.
-:- mode call_goal(pred(out) is nondet, out) is nondet.
+%:- mode call_goal(pred(out) is nondet, out) is nondet. % see comments below
call_goal(Goal, Result) :- Goal(Result).
:- pred call_handler(pred(univ, T), univ, T).
:- mode call_handler(pred(in, out) is det, in, out) is det.
-:- mode call_handler(pred(in, out) is semidet, in, out) is semidet.
-:- mode call_handler(pred(in, out) is nondet, in, out) is nondet.
+%:- mode call_handler(pred(in, out) is semidet, in, out) is semidet. % unused
+%:- mode call_handler(pred(in, out) is nondet, in, out) is nondet. % unused
call_handler(Handler, Exception, Result) :- Handler(Exception, Result).
Index: library/integer.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/integer.m,v
retrieving revision 1.9
diff -u -d -r1.9 integer.m
--- library/integer.m 29 Aug 2002 10:09:07 -0000 1.9
+++ library/integer.m 5 Aug 2003 07:09:47 -0000
@@ -628,10 +628,6 @@
i(-1, [D])
).
-:- func int_max = int.
-int_max = Maxint :-
- int__max_int(Maxint).
-
:- func signum(int) = int.
signum(N) = SN :-
( N < 0 ->
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.300
diff -u -d -r1.300 io.m
--- library/io.m 24 Jul 2003 03:02:29 -0000 1.300
+++ library/io.m 5 Aug 2003 07:10:09 -0000
@@ -2978,17 +2978,6 @@
io__buffer_to_string(buffer(Array), Len, from_char_list(List)) :-
array__fetch_items(Array, min(Array), min(Array) + Len - 1, List).
-:- pred io__buffer_to_string(buffer::buffer_di, string::uo) is det.
-:- pragma foreign_proc("C",
- io__buffer_to_string(Buffer::buffer_di, Str::uo),
- [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
-"{
- Str = Buffer;
-}").
-
-io__buffer_to_string(buffer(Array), from_char_list(List)) :-
- array__fetch_items(Array, min(Array), max(Array), List).
-
:- pred io__read_into_buffer(stream::in, buffer::buffer_di, int::in, int::in,
buffer::buffer_uo, int::out,
io__state::di, io__state::uo) is det.
Index: library/list.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.112
diff -u -d -r1.112 list.m
--- library/list.m 26 May 2003 10:05:25 -0000 1.112
+++ library/list.m 5 Aug 2003 07:10:25 -0000
@@ -1008,28 +1008,6 @@
list__merge_sort(L0, L1),
list__remove_adjacent_dups(L1, L).
-:- pred list__qsort(list(T), list(T), list(T)).
-:- mode list__qsort(in, in, out) is det.
-
-list__qsort([], R, R).
-list__qsort([X | L], R0, R) :-
- list__partition(L, X, L1, L2),
- list__qsort(L2, R0, R1),
- list__qsort(L1, [X | R1], R).
-
-:- pred list__partition(list(T), T, list(T), list(T)).
-:- mode list__partition(in, in, out, out) is det.
-
-list__partition([], _, [], []).
-list__partition([Head | Tail], Partition, Low, High) :-
- ( compare(<, Head, Partition) ->
- list__partition(Tail, Partition, Low1, High),
- Low = [Head | Low1]
- ;
- list__partition(Tail, Partition, Low, High1),
- High = [Head | High1]
- ).
-
%-----------------------------------------------------------------------------%
:- pred list__merge_sort(list(T), list(T)).
Index: library/relation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/relation.m,v
retrieving revision 1.27
diff -u -d -r1.27 relation.m
--- library/relation.m 26 May 2003 09:00:30 -0000 1.27
+++ library/relation.m 5 Aug 2003 07:10:56 -0000
@@ -903,36 +903,6 @@
relation__c_dfs(Rel, DomList, Vis0, _Vis, [], Tsort),
relation__check_tsort(Rel, Vis0, Tsort).
-:- pred relation__tsort_2(relation(T), list(relation_key), set(relation_key),
- set(relation_key), list(relation_key), list(relation_key)).
-:- mode relation__tsort_2(in, in, in, out, in, out) is det.
-relation__tsort_2(_Rel, [], Vis, Vis, Tsort, Tsort).
-relation__tsort_2(Rel, [X | Xs], Vis0, Vis, Tsort0, Tsort) :-
- stack__init(S0),
- stack__push(S0, X, S1),
- relation__tsort_3(Rel, S1, Vis0, Vis1, Tsort0, Tsort1),
- list__delete_elems(Xs, Tsort1, XsRed),
- relation__tsort_2(Rel, XsRed, Vis1, Vis, Tsort1, Tsort).
-
-:- pred relation__tsort_3(relation(T), stack(relation_key), set(relation_key),
- set(relation_key), list(relation_key), list(relation_key)).
-:- mode relation__tsort_3(in, in, in, out, in, out) is det.
-relation__tsort_3(Rel, S0, Vis0, Vis, Tsort0, Tsort) :-
- ( stack__pop(S0, X, S1) ->
- ( set__member(X, Vis0) ->
- relation__tsort_3(Rel, S1, Vis0, Vis, Tsort0, Tsort)
- ;
- relation__lookup_from(Rel, X, AdjSet),
- set__to_sorted_list(AdjSet, AdjList),
- set__insert(Vis0, X, Vis1),
- stack__push_list(S1, AdjList, S2),
- relation__tsort_3(Rel, S2, Vis1, Vis, Tsort0, Tsort1),
- Tsort = [ X | Tsort1 ]
- )
- ;
- Tsort = Tsort0, Vis = Vis0
- ).
-
:- pred relation__check_tsort(relation(T), set(relation_key),
list(relation_key)).
:- mode relation__check_tsort(in, in, in) is semidet.
Index: library/set_bbbtree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/set_bbbtree.m,v
retrieving revision 1.19
diff -u -d -r1.19 set_bbbtree.m
--- library/set_bbbtree.m 26 May 2003 09:00:30 -0000 1.19
+++ library/set_bbbtree.m 5 Aug 2003 07:13:40 -0000
@@ -957,7 +957,7 @@
:- pred set_bbbtree__build_node(T, set_bbbtree(T), set_bbbtree(T),
set_bbbtree(T)).
-:- mode set_bbbtree__build_node(di, di, di, uo) is det.
+% :- mode set_bbbtree__build_node(di, di, di, uo) is det. % unused
:- mode set_bbbtree__build_node(in, in, in, out) is det.
set_bbbtree__build_node(X, L, R, Tree) :-
@@ -979,7 +979,7 @@
:- pred set_bbbtree__single_rot_l(T, set_bbbtree(T), set_bbbtree(T),
set_bbbtree(T)).
-:- mode set_bbbtree__single_rot_l(di, di, di, uo) is det.
+% :- mode set_bbbtree__single_rot_l(di, di, di, uo) is det. % unused
:- mode set_bbbtree__single_rot_l(in, in, in, out) is det.
set_bbbtree__single_rot_l(_A, _X, empty, _Set) :- % Should never occur. Here
@@ -995,7 +995,7 @@
:- pred set_bbbtree__single_rot_r(T, set_bbbtree(T), set_bbbtree(T),
set_bbbtree(T)).
-:- mode set_bbbtree__single_rot_r(di, di, di, uo) is det.
+% :- mode set_bbbtree__single_rot_r(di, di, di, uo) is det. % unused
:- mode set_bbbtree__single_rot_r(in, in, in, out) is det.
set_bbbtree__single_rot_r(_B, empty, _Z, _Set) :- % Should never occur. Here
@@ -1019,7 +1019,7 @@
:- pred set_bbbtree__double_rot_l(T, set_bbbtree(T), set_bbbtree(T),
set_bbbtree(T)).
-:- mode set_bbbtree__double_rot_l(di, di, di, uo) is det.
+% :- mode set_bbbtree__double_rot_l(di, di, di, uo) is det. % unused
:- mode set_bbbtree__double_rot_l(in, in, in, out) is det.
set_bbbtree__double_rot_l(_A, _X, empty, _Set) :- % Should never occur. Here
@@ -1043,7 +1043,7 @@
:- pred set_bbbtree__double_rot_r(T, set_bbbtree(T), set_bbbtree(T),
set_bbbtree(T)).
-:- mode set_bbbtree__double_rot_r(di, di, di, uo) is det.
+% :- mode set_bbbtree__double_rot_r(di, di, di, uo) is det. % unused
:- mode set_bbbtree__double_rot_r(in, in, in, out) is det.
set_bbbtree__double_rot_r(_B, empty, _Z, _Set) :- % Should never occur. Here
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.204
diff -u -d -r1.204 string.m
--- library/string.m 14 Jul 2003 09:12:00 -0000 1.204
+++ library/string.m 5 Aug 2003 07:19:48 -0000
@@ -579,9 +579,6 @@
:- implementation.
:- import_module bool, integer, std_util, int, float, require.
-:- pred string__to_int_list(string, list(int)).
-:- mode string__to_int_list(in, out) is det.
-
string__replace(String, SubString0, SubString1, StringOut) :-
string__to_char_list(String, CharList),
string__to_char_list(SubString0, SubCharList0),
@@ -1043,27 +1040,6 @@
string__from_rev_char_list(Chars::in, Str::uo) :-
Str = string__from_char_list(list__reverse(Chars)).
-:- pred string__int_list_to_char_list(list(int), list(char)).
-:- mode string__int_list_to_char_list(in, out) is det.
-
-string__int_list_to_char_list([], []).
-string__int_list_to_char_list([Code | Codes], [Char | Chars]) :-
- ( char__to_int(Char0, Code) ->
- Char = Char0
- ;
- error("string__int_list_to_char_list: char__to_int failed")
- ),
- string__int_list_to_char_list(Codes, Chars).
-
-:- pred string__char_list_to_int_list(list(char), list(int)).
-:- mode string__char_list_to_int_list(in, out) is det.
-:- mode string__char_list_to_int_list(out, in) is semidet.
-
-string__char_list_to_int_list([], []).
-string__char_list_to_int_list([Char | Chars], [Code | Codes]) :-
- char__to_int(Char, Code),
- string__char_list_to_int_list(Chars, Codes).
-
string__to_upper(StrIn, StrOut) :-
string__to_char_list(StrIn, List),
string__char_list_to_upper(List, ListUpp),
@@ -2921,28 +2897,6 @@
}
}
}").
-
-/*-----------------------------------------------------------------------*/
-
-/*
-:- pred string__to_int_list(string, list(int)).
-:- mode string__to_int_list(in, out) is det.
-*/
-:- pragma foreign_proc("C",
- string__to_int_list(Str::in, IntList::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"{
- MR_ConstString p = Str + strlen(Str);
- IntList = MR_list_empty_msg(MR_PROC_LABEL);
- while (p > Str) {
- p--;
- IntList = MR_list_cons_msg((MR_UnsignedChar) *p, IntList,
- MR_PROC_LABEL);
- }
-}").
-string__to_int_list(String, IntList) :-
- string__to_char_list(String, CharList),
- IntList = list__map(char__to_int, CharList).
/*-----------------------------------------------------------------------*/
Index: library/tree234.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/tree234.m,v
retrieving revision 1.37
diff -u -d -r1.37 tree234.m
--- library/tree234.m 26 May 2003 09:00:31 -0000 1.37
+++ library/tree234.m 26 Jul 2003 07:24:52 -0000
@@ -832,7 +832,7 @@
).
:- pred tree234__insert2(tree234(K, V), K, V, tree234(K, V)).
-:- mode tree234__insert2(di_two, di, di, uo) is semidet.
+% :- mode tree234__insert2(di_two, di, di, uo) is semidet.
% :- mode tree234__insert2(sdi_two, in, in, uo_tree234) is semidet.
:- mode tree234__insert2(in_two, in, in, out) is semidet.
@@ -927,7 +927,7 @@
).
:- pred tree234__insert3(tree234(K, V), K, V, tree234(K, V)).
-:- mode tree234__insert3(di_three, di, di, uo) is semidet.
+% :- mode tree234__insert3(di_three, di, di, uo) is semidet.
% :- mode tree234__insert3(sdi_three, in, in, uo_tree234) is semidet.
:- mode tree234__insert3(in_three, in, in, out) is semidet.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list