[m-rev.] diff: convert most of the library to four-space indentation

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Oct 17 21:34:56 AEST 2005


library/*.m:
	Convert to four-space indentation most of the library modules that
	weren't already indented that way. Use predmode syntax where possible.
	In some modules, shorten long lines by deleting module name prefixes.
	Fix departures from our coding standards.

	In some modules, simplify code, mostly using field names and/or state
	variables.

	There are no changes in algorithms, except for neg_list in integer.m.

Zoltan.

cvs diff: Diffing .
Index: array2d.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/array2d.m,v
retrieving revision 1.4
diff -u -b -r1.4 array2d.m
Index: benchmarking.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/benchmarking.m,v
retrieving revision 1.65
diff -u -b -r1.65 benchmarking.m
Index: bool.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/bool.m,v
retrieving revision 1.13
diff -u -b -r1.13 bool.m
--- bool.m	16 Jun 2005 04:08:00 -0000	1.13
+++ bool.m	17 Oct 2005 05:26:07 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1996-1997,2000,2002-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -22,12 +24,13 @@
 
 %-----------------------------------------------------------------------------%
 
-% The boolean type.
-% Unlike most languages, we use `yes' and `no' as boolean constants
-% rather than `true' and `false'.  This is to avoid confusion
-% with the predicates `true' and `fail'.
-
-:- type bool ---> no ; yes.
+    % The boolean type.
+    % Unlike most languages, we use `yes' and `no' as boolean constants
+    % rather than `true' and `false'.  This is to avoid confusion
+    % with the predicates `true' and `fail'.
+:- type bool
+    --->    no
+    ;       yes.
 
 :- instance enum(bool).
 
@@ -57,11 +60,9 @@
 
 :- implementation.
 
-% 
 % Important:
 % The representation of bool values should correspond with the definitions of
 % MR_TRUE and MR_FALSE in runtime/mercury_std.h.
-%
 
 :- instance enum(bool) where [
 	to_int(Bool) = bool_to_int(Bool),
@@ -84,9 +85,11 @@
 
 bool__or_list([], no).
 bool__or_list([Bool | Bools], Result) :-
-	( Bool = yes ->
+    (
+        Bool = yes,
 		Result = yes
 	;
+        Bool = no,
 		bool__or_list(Bools, Result)
 	).
 
@@ -99,9 +102,11 @@
 
 bool__and_list([], yes).
 bool__and_list([Bool | Bools], Result) :-
-	( Bool = no ->
+    (
+        Bool = no,
 		Result = no
 	;
+        Bool = yes,
 		bool__and_list(Bools, Result)
 	).
 
Index: bt_array.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/bt_array.m,v
retrieving revision 1.14
diff -u -b -r1.14 bt_array.m
--- bt_array.m	16 Jun 2005 04:08:00 -0000	1.14
+++ bt_array.m	17 Oct 2005 03:17:56 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1997, 1999-2000, 2002-2003, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -36,150 +38,139 @@
 
 	% bt_array__make_empty_array(Low, Array) is true iff Array is a
 	% bt_array of size zero starting at index Low.
-:- pred bt_array__make_empty_array(int, bt_array(T)).
-:- mode bt_array__make_empty_array(in, out) is det.
-
+    %
+:- pred bt_array__make_empty_array(int::in, bt_array(T)::out) is det.
 :- func bt_array__make_empty_array(int) = bt_array(T).
 
 	% bt_array__init(Low, High, Init, Array) is true iff Array is a
 	% bt_array with bounds from Low to High whose elements each equal Init.
-:- pred bt_array__init(int, int, T, bt_array(T)).
-:- mode bt_array__init(in, in, in, out) is det. % want a bt_array_skeleton?
-
+    %
+:- pred bt_array__init(int::in, int::in, T::in, bt_array(T)::out) is det.
 :- func bt_array__init(int, int, T) = bt_array(T).
 
 %-----------------------------------------------------------------------------%
 
-	% array__min returns the lower bound of the array
-:- pred bt_array__min(bt_array(_T), int).
-:- mode bt_array__min(in, out) is det.
-
+    % array__min returns the lower bound of the array.
+    %
+:- pred bt_array__min(bt_array(_T)::in, int::out) is det.
 :- func bt_array__min(bt_array(_T)) = int.
 
-	% array__max returns the upper bound of the array
-:- pred bt_array__max(bt_array(_T), int).
-:- mode bt_array__max(in, out) is det.
-
+    % array__max returns the upper bound of the array.
+    %
+:- pred bt_array__max(bt_array(_T)::in, int::out) is det.
 :- func bt_array__max(bt_array(_T)) = int.
 
 	% array__size returns the length of the array,
 	% i.e. upper bound - lower bound + 1.
-:- pred bt_array__size(bt_array(_T), int).
-:- mode bt_array__size(in, out) is det.
-
+    %
+:- pred bt_array__size(bt_array(_T)::in, int::out) is det.
 :- func bt_array__size(bt_array(_T)) = int.
 
 	% bt_array__bounds returns the upper and lower bounds of a bt_array.
-:- pred bt_array__bounds(bt_array(_T), int, int).
-:- mode bt_array__bounds(in, out, out) is det.
+    %
+:- pred bt_array__bounds(bt_array(_T)::in, int::out, int::out) is det.
 
 	% bt_array__in_bounds checks whether an index is in the bounds
-	% of a bt_array
-:- pred bt_array__in_bounds(bt_array(_T), int).
-:- mode bt_array__in_bounds(in, in) is semidet.
+    % of a bt_array.
+    %
+:- pred bt_array__in_bounds(bt_array(_T)::in, int::in) is semidet.
 
 %-----------------------------------------------------------------------------%
 
 	% bt_array__lookup returns the Nth element of a bt_array.
 	% It is an error if the index is out of bounds.
-:- pred bt_array__lookup(bt_array(T), int, T).
-:- mode bt_array__lookup(in, in, out) is det.
-
+    %
+:- pred bt_array__lookup(bt_array(T)::in, int::in, T::out) is det.
 :- func bt_array__lookup(bt_array(T), int) = T.
 
-	% bt_array__semidet_lookup is like bt_array__lookup except that
-	% it fails if the index is out of bounds.
-:- pred bt_array__semidet_lookup(bt_array(T), int, T).
-:- mode bt_array__semidet_lookup(in, in, out) is semidet.
+    % bt_array__semidet_lookup is like bt_array__lookup except that it fails
+    % if the index is out of bounds.
+    %
+:- pred bt_array__semidet_lookup(bt_array(T)::in, int::in, T::out) is semidet.
 
 	% bt_array__set sets the nth element of a bt_array, and returns the
-	% resulting bt_array.
-	% It is an error if the index is out of bounds.
-:- pred bt_array__set(bt_array(T), int, T, bt_array(T)).
-:- mode bt_array__set(in, in, in, out) is det.
-
+    % resulting bt_array. It is an error if the index is out of bounds.
+    %
+:- pred bt_array__set(bt_array(T)::in, int::in, T::in, bt_array(T)::out)
+    is det.
 :- func bt_array__set(bt_array(T), int, T) = bt_array(T).
 
 	% bt_array__set sets the nth element of a bt_array, and returns the
 	% resulting bt_array (good opportunity for destructive update ;-).  
 	% It fails if the index is out of bounds.
-:- pred bt_array__semidet_set(bt_array(T), int, T, bt_array(T)).
-:- mode bt_array__semidet_set(in, in, in, out) is semidet.
+    %
+:- pred bt_array__semidet_set(bt_array(T)::in, int::in, T::in,
+    bt_array(T)::out) is semidet.
 
-	% `bt_array__resize(BtArray0, Lo, Hi, Item, BtArray)' is true
-	% if BtArray is a bt_array created by expanding or shrinking
-	% BtArray0 to fit the bounds (Lo,Hi).  If the new bounds are
-	% not wholly contained within the bounds of BtArray0, Item is
-	% used to fill out the other places.
-	%
-	% Note: This operation is optimised for the case where the
-	% lower bound of the new bt_array is the same as that of
-	% the old bt_array.  In that case, the operation takes time
-	% proportional to the absolute difference in size between
-	% the two bt_arrays.  If this is not the case, it may take
+    % `bt_array__resize(BtArray0, Lo, Hi, Item, BtArray)' is true if BtArray
+    % is a bt_array created by expanding or shrinking BtArray0 to fit the
+    % bounds (Lo, Hi). If the new bounds are not wholly contained within
+    % the bounds of BtArray0, Item is used to fill out the other places.
+    %
+    % Note: This operation is optimised for the case where the lower bound
+    % of the new bt_array is the same as that of the old bt_array. In that
+    % case, the operation takes time proportional to the absolute difference
+    % in size between the two bt_arrays. If this is not the case, it may take
 	% time proportional to the larger of the two bt_arrays.
-:- pred bt_array__resize(bt_array(T), int, int, T, bt_array(T)).
-:- mode bt_array__resize(in, in, in, in, out) is det.
-
+    %
+:- pred bt_array__resize(bt_array(T)::in, int::in, int::in, T::in,
+    bt_array(T)::out) is det.
 :- func bt_array__resize(bt_array(T), int, int, T) = bt_array(T).
 
-	% `bt_array__shrink(BtArray0, Lo, Hi, Item, BtArray)' is true
-	% if BtArray is a bt_array created by shrinking BtArray0 to
-	% fit the bounds (Lo,Hi).  It is an error if the new bounds
-	% are not wholly within the bounds of BtArray0.
-	%
-	% Note: This operation is optimised for the case where the
-	% lower bound of the new bt_array is the same as that of
-	% the old bt_array.  In that case, the operation takes time
-	% proportional to the absolute difference in size between
-	% the two bt_arrays.  If this is not the case, it may take
+    % bt_array__shrink(BtArray0, Lo, Hi, Item, BtArray) is true if BtArray
+    % is a bt_array created by shrinking BtArray0 to fit the bounds (Lo, Hi).
+    % It is an error if the new bounds are not wholly within the bounds of
+    % BtArray0.
+    %
+    % Note: This operation is optimised for the case where the lower bound
+    % of the new bt_array is the same as that of the old bt_array. In that
+    % case, the operation takes time proportional to the absolute difference
+    % in size between the two bt_arrays. If this is not the case, it may take
 	% time proportional to the larger of the two bt_arrays.
-:- pred bt_array__shrink(bt_array(T), int, int, bt_array(T)).
-:- mode bt_array__shrink(in, in, in, out) is det.
-
+    %
+:- pred bt_array__shrink(bt_array(T)::in, int::in, int::in, bt_array(T)::out)
+    is det.
 :- func bt_array__shrink(bt_array(T), int, int) = bt_array(T).
 
-	% `bt_array__from_list(Low, List, BtArray)' takes a list (of
-	% possibly zero length), and returns a bt_array containing
-	% those elements in the same order that they occurred in the
-	% list.  The lower bound of the new array is `Low'.
-:- pred bt_array__from_list(int, list(T), bt_array(T)).
-:- mode bt_array__from_list(in, in, out) is det.
-
+    % bt_array__from_list(Low, List, BtArray) takes a list (of possibly zero
+    % length), and returns a bt_array containing % those elements in the same
+    % order that they occurred in the list. The lower bound of the new array
+    % is `Low'.
+:- pred bt_array__from_list(int::in, list(T)::in, bt_array(T)::out) is det.
 :- func bt_array__from_list(int, list(T)) = bt_array(T).
 
 	% bt_array__to_list takes a bt_array and returns a list containing
-	% the elements of the bt_array in the same order that they
-	% occurred in the bt_array.
-:- pred bt_array__to_list(bt_array(T), list(T)).
-:- mode bt_array__to_list(in, out) is det.
-
+    % the elements of the bt_array in the same order that they occurred
+    % in the bt_array.
+    %
+:- pred bt_array__to_list(bt_array(T)::in, list(T)::out) is det.
 :- func bt_array__to_list(bt_array(T)) = list(T).
 
-	% bt_array__fetch_items takes a bt_array and a lower and upper
-	% index, and places those items in the bt_array between these
-	% indices into a list.  It is an error if either index is
-	% out of bounds.
-:- pred bt_array__fetch_items(bt_array(T), int, int, list(T)).
-:- mode bt_array__fetch_items(in, in, in, out) is det.
-
+    % bt_array__fetch_items takes a bt_array and a lower and upper index,
+    % and places those items in the bt_array between these indices into a list.
+    % It is an error if either index is out of bounds.
+    %
+:- pred bt_array__fetch_items(bt_array(T)::in, int::in, int::in, list(T)::out)
+    is det.
 :- func bt_array__fetch_items(bt_array(T), int, int) = list(T).
 
-	% bt_array__bsearch takes a bt_array, an element to be matched
-	% and a comparison predicate and returns the position of
-	% the first occurrence in the bt_array of an element which is
-	% equivalent to the given one in the ordering provided.
-	% Assumes the bt_array is sorted according to this ordering.
-	% Fails if the element is not present.
-:- pred bt_array__bsearch(bt_array(T), T, comparison_pred(T), int).
-:- mode bt_array__bsearch(in, in, in(comparison_pred), out) is semidet.
+    % bt_array__bsearch takes a bt_array, an element to be matched and a
+    % comparison predicate and returns the position of the first occurrence
+    % in the bt_array of an element which is equivalent to the given one
+    % in the ordering provided. Assumes the bt_array is sorted according
+    % to this ordering. Fails if the element is not present.
+    %
+:- pred bt_array__bsearch(bt_array(T)::in, T::in,
+    comparison_pred(T)::in(comparison_pred), int::out) is semidet.
 
 	% Field selection for arrays.
 	% Array ^ elem(Index) = bt_array__lookup(Array, Index).
+    %
 :- func bt_array__elem(int, bt_array(T)) = T.
 
 	% Field update for arrays.
 	% (Array ^ elem(Index) := Value) = bt_array__set(Array, Index, Value).
+    %
 :- func 'bt_array__elem :='(int, bt_array(T), T) = bt_array(T).
 
 %-----------------------------------------------------------------------------%
@@ -187,8 +178,10 @@
 :- implementation.
 
 :- import_module require.
+:- import_module string.
 
-:- type bt_array(T)	--->	bt_array(int, int, ra_list(T)).
+:- type bt_array(T)
+    --->    bt_array(int, int, ra_list(T)).
 
 %-----------------------------------------------------------------------------%
 
@@ -201,8 +194,8 @@
 	ElemsToAdd = High - Low + 1,
 	bt_array__add_elements(ElemsToAdd, Item, ListIn, ListOut).
 
-:- pred bt_array__add_elements(int, T, ra_list(T), ra_list(T)).
-:- mode bt_array__add_elements(in, in, in, out) is det.
+:- pred bt_array__add_elements(int::in, T::in, ra_list(T)::in, ra_list(T)::out)
+    is det.
 
 bt_array__add_elements(ElemsToAdd, Item, RaList0, RaList) :-
 	( ElemsToAdd =< 0 ->
@@ -230,8 +223,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pragma inline(actual_position/4).
-:- pred actual_position(int, int, int, int).
-:- mode actual_position(in, in, in, out) is det.
+:- pred actual_position(int::in, int::in, int::in, int::out) is det.
 
 actual_position(Low, High, Index, Pos) :-
 	Pos = High - Low - Index.
@@ -275,7 +267,8 @@
 			( ra_list_drop(SizeDiff, RaList0, RaList1) ->
 				RaList = RaList1
 			;
-				error("bt_array__resize: Can't resize to a less-than-empty array")
+                error("bt_array__resize: " ++
+                    "Can't resize to a less-than-empty array")
 			),
 			Array = bt_array(L, H, RaList)
 		; H > H0 ->
@@ -298,8 +291,7 @@
 	( ( L < L0 ; H > H0 ) ->
 		error("bt_array__shrink: New bounds are larger than old ones")
 	; L = L0 ->
-		% Optimise the common case where the lower bounds are
-		% the same.
+        % Optimise the common case where the lower bounds are the same.
 
 		SizeDiff = H0 - H,
 		( ra_list_drop(SizeDiff, RaList0, RaList1) ->
@@ -329,8 +321,8 @@
 	ra_list_nil(RaList0),
 	bt_array__reverse_into_ra_list(List, RaList0, RaList).
 
-:- pred bt_array__reverse_into_ra_list(list(T), ra_list(T), ra_list(T)).
-:- mode bt_array__reverse_into_ra_list(in, in, out) is det.
+:- pred bt_array__reverse_into_ra_list(list(T)::in,
+    ra_list(T)::in, ra_list(T)::out) is det.
 
 bt_array__reverse_into_ra_list([], RaList, RaList).
 bt_array__reverse_into_ra_list([X | Xs], RaList0, RaList) :-
@@ -339,8 +331,8 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred bt_array__insert_items(bt_array(T), int, list(T), bt_array(T)).
-:- mode bt_array__insert_items(in, in, in, out) is det.
+:- pred bt_array__insert_items(bt_array(T)::in, int::in, list(T)::in,
+    bt_array(T)::out) is det.
 
 bt_array__insert_items(Array, _N, [], Array).
 bt_array__insert_items(Array0, N, [Head|Tail], Array) :-
@@ -353,8 +345,8 @@
 bt_array__to_list(bt_array(_, _, RaList), List) :-
 	bt_array__reverse_from_ra_list(RaList, [], List).
 
-:- pred bt_array__reverse_from_ra_list(ra_list(T), list(T), list(T)).
-:- mode bt_array__reverse_from_ra_list(in, in, out) is det.
+:- pred bt_array__reverse_from_ra_list(ra_list(T)::in, list(T)::in,
+    list(T)::out) is det.
 
 bt_array__reverse_from_ra_list(RaList0, Xs0, Xs) :-
 	( ra_list_head_tail(RaList0, X, RaList1) ->
@@ -381,8 +373,8 @@
 		List = []
 	).
 
-:- pred bt_array__reverse_from_ra_list_count(int, ra_list(T), list(T), list(T)).
-:- mode bt_array__reverse_from_ra_list_count(in, in, in, out) is det.
+:- pred bt_array__reverse_from_ra_list_count(int::in, ra_list(T)::in,
+    list(T)::in, list(T)::out) is det.
 
 bt_array__reverse_from_ra_list_count(I, RaList0, Xs0, Xs) :-
 	(
@@ -404,10 +396,11 @@
 
 	% XXX Would we gain anything by traversing the ra_list instead
 	%     of doing a vanilla binary chop?
-:- pred bt_array__bsearch_2(bt_array(T), int, int, T,
-			pred(T, T, comparison_result), int).
-:- mode bt_array__bsearch_2(in, in, in, in, pred(in, in, out) is det,
-				out) is semidet.
+
+:- pred bt_array__bsearch_2(bt_array(T)::in, int::in, int::in, T::in,
+    pred(T, T, comparison_result)::in(pred(in, in, out) is det), int::out)
+    is semidet.
+
 bt_array__bsearch_2(A, Lo, Hi, El, Compare, I) :-
 	Width = Hi - Lo,
 
@@ -421,15 +414,13 @@
 		call(Compare, El, X, (=)),
 		I = Lo
 	;
-		% Otherwise find the middle element of the range
-		% and check against that.  NOTE: We can't use
-		% "// 2" because division always rounds towards
-		% zero whereas we want the result to be rounded
-		% down.  (Indices can be negative.)  We could use
-		% "div 2", but that's a little more expensive, and
-		% we know that we're always dividing by a power of
-		% 2.  Until such time as we implement strength
-		% reduction, the >> 1 stays.
+        % Otherwise find the middle element of the range and check against
+        % that. NOTE: We can't use "// 2" because division always rounds
+        % towards zero whereas we want the result to be rounded down.
+        % (Indices can be negative.)  We could use "div 2", but that's a
+        % little more expensive, and we know that we're always dividing
+        % by a power of 2. Until such time as we implement strength reduction,
+        % the >> 1 stays.
 
 		Mid = (Lo + Hi) >> 1,
 		bt_array__lookup(A, Mid, XMid),
@@ -448,14 +439,13 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-% This is a perfect application for submodules, but Mercury doesn't have
-% them. :-(
+% This is a perfect application for submodules, but Mercury didn't have them
+% when this was written. :-(
 
 % The heart of the implementation of bt_array is a `random access list'
 % or ra_list for short.  It is very similar to a list data type, and
 % it supports O(1) head/tail/cons operations, but O(log n) lookup and
-% update.  The representation is a list of perfectly balanced binary
-% trees.
+% update.  The representation is a list of perfectly balanced binary trees.
 %
 % For more details on the implementation:
 %
@@ -468,48 +458,40 @@
 
 % :- type ra_list(T).
 
-:- pred ra_list_nil(ra_list(T)).
-:- mode ra_list_nil(uo) is det.
+:- pred ra_list_nil(ra_list(T)::uo) is det.
 
-:- pred ra_list_cons(T, ra_list(T), ra_list(T)).
-:- mode ra_list_cons(in, in, out) is det.
+:- pred ra_list_cons(T::in, ra_list(T)::in, ra_list(T)::out) is det.
 
-:- pred ra_list_head(ra_list(T), T).
-:- mode ra_list_head(in, out) is semidet.
+:- pred ra_list_head(ra_list(T)::in, T::out) is semidet.
 
-:- pred ra_list_tail(ra_list(T), ra_list(T)).
-:- mode ra_list_tail(in, out) is semidet.
+:- pred ra_list_tail(ra_list(T)::in, ra_list(T)::out) is semidet.
 
-:- pred ra_list_head_tail(ra_list(T), T, ra_list(T)).
-:- mode ra_list_head_tail(in, out, out) is semidet.
+:- pred ra_list_head_tail(ra_list(T)::in, T::out, ra_list(T)::out) is semidet.
 
 %-----------------------------------------------------------------------------%
 
-:- pred ra_list_lookup(int, ra_list(T), T).
-:- mode ra_list_lookup(in, in, out) is semidet.
+:- pred ra_list_lookup(int::in, ra_list(T)::in, T::out) is semidet.
 
-:- pred ra_list_update(ra_list(T), int, T, ra_list(T)).
-:- mode ra_list_update(in, in, in, out) is semidet.
+:- pred ra_list_update(ra_list(T)::in, int::in, T::in, ra_list(T)::out)
+    is semidet.
 
 %-----------------------------------------------------------------------------%
 
-:- pred ra_list_drop(int, ra_list(T), ra_list(T)).
-:- mode ra_list_drop(in, in, out) is semidet.
+:- pred ra_list_drop(int::in, ra_list(T)::in, ra_list(T)::out) is semidet.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
 % :- implementation.
 
-:- type ra_list(T) --->
-		nil
+:- type ra_list(T)
+    --->    nil
 	;	cons(int, ra_list_bintree(T), ra_list(T)).
 
-:- type ra_list_bintree(T) --->
-		leaf(T)
+:- type ra_list_bintree(T)
+    --->    leaf(T)
 	;	node(T, ra_list_bintree(T), ra_list_bintree(T)).
 
-
 %-----------------------------------------------------------------------------%
 
 :- pragma inline(ra_list_nil/1).
@@ -556,8 +538,7 @@
 	I >= 0,
 	ra_list_lookup_2(I, List, X).
 
-:- pred ra_list_lookup_2(int, ra_list(T), T).
-:- mode ra_list_lookup_2(in, in, out) is semidet.
+:- pred ra_list_lookup_2(int::in, ra_list(T)::in, T::out) is semidet.
 
 ra_list_lookup_2(I, cons(Size, T, Rest), X) :-
 	( I < Size ->
@@ -567,8 +548,8 @@
 		ra_list_lookup_2(NewI, Rest, X)
 	).
 
-:- pred ra_list_bintree_lookup(int, ra_list_bintree(T), int, T).
-:- mode ra_list_bintree_lookup(in, in, in, out) is semidet.
+:- pred ra_list_bintree_lookup(int::in, ra_list_bintree(T)::in, int::in,
+    T::out) is semidet.
 
 ra_list_bintree_lookup(_, leaf(X), 0, X).
 ra_list_bintree_lookup(Size, node(X0, T1, T2), I, X) :-
@@ -593,8 +574,8 @@
 	I >= 0,
 	ra_list_update_2(List0, I, X, List).
 
-:- pred ra_list_update_2(ra_list(T), int, T, ra_list(T)).
-:- mode ra_list_update_2(in, in, in, out) is semidet.
+:- pred ra_list_update_2(ra_list(T)::in, int::in, T::in, ra_list(T)::out)
+    is semidet.
 
 ra_list_update_2(cons(Size, T0, Rest), I, X, List) :-
 	( I < Size ->
@@ -606,9 +587,8 @@
 		List = cons(Size, T0, List0)
 	).
 
-:- pred ra_list_bintree_update(int, ra_list_bintree(T), int, T,
-		ra_list_bintree(T)).
-:- mode ra_list_bintree_update(in, in, in, in, out) is semidet.
+:- pred ra_list_bintree_update(int::in, ra_list_bintree(T)::in, int::in, T::in,
+    ra_list_bintree(T)::out) is semidet.
 
 ra_list_bintree_update(_, leaf(_), 0, X, leaf(X)).
 ra_list_bintree_update(Size, node(X0, T1, T2), I, X, T) :-
@@ -630,9 +610,7 @@
 %-----------------------------------------------------------------------------%
 
 ra_list_drop(N, As, Bs) :-
-	(
-		N > 0
-	->
+    ( N > 0 ->
 		As = cons(Size, _, Cs),
 		( Size < N ->
 			N1 = N - Size,
@@ -644,13 +622,10 @@
 		As = Bs
 	).
 
-:- pred ra_list_slow_drop(int, ra_list(T), ra_list(T)).
-:- mode ra_list_slow_drop(in, in, out) is semidet.
+:- pred ra_list_slow_drop(int::in, ra_list(T)::in, ra_list(T)::out) is semidet.
 
 ra_list_slow_drop(N, As, Bs) :-
-	(
-		N > 0
-	->
+    ( N > 0 ->
 		N1 = N - 1,
 		ra_list_tail(As, Cs),
 		ra_list_slow_drop(N1, Cs, Bs)
Index: builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.111
diff -u -b -r1.111 builtin.m
--- builtin.m	16 Jun 2005 04:08:00 -0000	1.111
+++ builtin.m	17 Oct 2005 05:25:46 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -146,13 +148,11 @@
 	% not `unique', then the behaviour is undefined.  (If you lie to the
 	% compiler, the compiler will get its revenge!)
 	%
-:- pred unsafe_promise_unique(T, T).
-:- mode unsafe_promise_unique(in, uo) is det.
+:- pred unsafe_promise_unique(T::in, T::uo) is det.
 
-:- func unsafe_promise_unique(T) = T.
-:- mode unsafe_promise_unique(in) = uo is det.
+:- func unsafe_promise_unique(T::in) = (T::uo) is det.
 
-	% A synonym for fail/0; the name is more in keeping with Mercury's
+    % A synonym for fail/0; this name is more in keeping with Mercury's
 	% declarative style rather than its Prolog heritage.
 	%
 :- pred false is failure.
@@ -193,9 +193,9 @@
 	% the assumption is not satisfied, the behaviour is undefined.  (If you
 	% lie to the compiler, the compiler will get its revenge!)
 	%
-:- pred promise_only_solution_io(pred(T, IO, IO), T, IO, IO).
-:- mode promise_only_solution_io(pred(out, di, uo) is cc_multi,
-		out, di, uo) is det.
+:- pred promise_only_solution_io(
+    pred(T, IO, IO)::in(pred(out, di, uo) is cc_multi), T::out,
+    IO::di, IO::uo) is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -213,9 +213,8 @@
 
 :- type comparison_result ---> (=) ; (<) ; (>).
 
-	% compare(Res, X, Y) binds Res to =, <, or >
-	% depending on whether X is =, <, or > Y in the
-	% standard ordering.
+    % compare(Res, X, Y) binds Res to =, <, or > depending on whether
+    % X is =, <, or > Y in the standard ordering.
 	%
 :- pred compare(comparison_result, T, T).
 	% Note to implementors: the modes must appear in this order:
@@ -333,12 +332,12 @@
 %-----------------------------------------------------------------------------%
 :- interface.
 
-% `get_one_solution' and `get_one_solution_io' are impure alternatives
-% to `promise_one_solution' and `promise_one_solution_io', respectively.
-% They get a solution to the procedure, without requiring any promise
-% that there is only one solution.  However, they can only be used in
-% impure code.
-
+    % `get_one_solution' and `get_one_solution_io' are impure alternatives
+    % to `promise_one_solution' and `promise_one_solution_io', respectively.
+    % They get a solution to the procedure, without requiring any promise
+    % that there is only one solution.  However, they can only be used in
+    % impure code.
+    %
 :- impure func get_one_solution(pred(T)) = T.
 :-        mode get_one_solution(pred(out) is cc_multi) = out is det.
 :-        mode get_one_solution(pred(out) is cc_nondet) = out is semidet.
@@ -347,24 +346,23 @@
 :-        mode get_one_solution_io(pred(out, di, uo) is cc_multi,
 		out, di, uo) is det.
 
-% compare_representation(Result, X, Y)
-%
-% compare_representation is similar to the builtin predicate
-% compare/3, except that it does not abort when asked to compare
-% non-canonical terms.
-%
-% The declarative semantics of compare_representation for unequal
-% non-canonical terms is that the result is either (<) or (>).
-% For equal non-canonical terms the result can be anything.
-%
-% Operationally, the result of compare_representation for
-% non-canonical terms is the same as that for comparing the internal
-% representations of the terms, where the internal representation is
-% that which would be produced by deconstruct__cc.
-%
-% XXX This predicate is not yet implemented for highlevel code.
-% This is the reason it is not in the official part of the interface.
-
+    % compare_representation(Result, X, Y):
+    %
+    % compare_representation is similar to the builtin predicate compare/3,
+    % except that it does not abort when asked to compare non-canonical terms.
+    %
+    % The declarative semantics of compare_representation for unequal
+    % non-canonical terms is that the result is either (<) or (>).
+    % For equal non-canonical terms the result can be anything.
+    %
+    % Operationally, the result of compare_representation for non-canonical
+    % terms is the same as that for comparing the internal representations
+    % of the terms, where the internal representation is that which would be
+    % produced by deconstruct__cc.
+    %
+    % XXX This predicate is not yet implemented for highlevel code.
+    % This is the reason it is not in the official part of the interface.
+    %
 :- pred compare_representation(comparison_result, T, T).
 :- mode compare_representation(uo, in, in) is cc_multi.
 
@@ -381,12 +379,13 @@
 
 %-----------------------------------------------------------------------------%
 
-false :- fail.
+false :-
+    fail.
 
 %-----------------------------------------------------------------------------%
 
-% XXX The calls to unsafe_promise_unique below work around
-% mode checker limitations.
+    % XXX The calls to unsafe_promise_unique below work around
+    % mode checker limitations.
 :- pragma promise_pure(promise_only_solution/1).
 promise_only_solution(CCPred::(pred(out) is cc_multi)) = (OutVal::out) :-
 	impure OutVal = get_one_solution(CCPred).
@@ -414,8 +413,7 @@
 	Y = X;
 ").
 :- pragma foreign_proc("C",
-	cc_cast(X :: (pred(out) is cc_nondet)) =
-		(Y :: out(pred(out) is semidet)),
+    cc_cast(X :: (pred(out) is cc_nondet)) = (Y :: out(pred(out) is semidet)),
 	[will_not_call_mercury, thread_safe],
 "
 	Y = X;
@@ -440,20 +438,19 @@
 	Y = X;
 ").
 :- pragma foreign_proc("Java",
-	cc_cast(X :: (pred(out) is cc_nondet)) =
-		(Y :: out(pred(out) is semidet)),
+    cc_cast(X :: (pred(out) is cc_nondet)) = (Y :: out(pred(out) is semidet)),
 	[will_not_call_mercury, thread_safe],
 "
 	Y = X;
 ").
 
 :- pragma promise_pure(promise_only_solution_io/4).
-promise_only_solution_io(Pred, X) -->
-	impure get_one_solution_io(Pred, X).
+promise_only_solution_io(Pred, X, !IO) :-
+    impure get_one_solution_io(Pred, X, !IO).
 
-get_one_solution_io(Pred, X) -->
-	{ impure DetPred = cc_cast_io(Pred) },
-	call(DetPred, X).
+get_one_solution_io(Pred, X, !IO) :-
+    impure DetPred = cc_cast_io(Pred),
+    call(DetPred, X, !IO).
 
 :- impure func cc_cast_io(pred(T, IO, IO)) = pred(T, IO, IO).
 :- mode cc_cast_io(pred(out, di, uo) is cc_multi) =
@@ -502,8 +499,10 @@
 :- pragma foreign_decl("C", "#include ""mercury_type_info.h""").
 
 :- interface.
+
 :- pred call_rtti_generic_unify(T::in, T::in) is semidet.
 :- pred call_rtti_generic_compare(comparison_result::out, T::in, T::in) is det.
+
 :- implementation.
 :- use_module rtti_implementation.
 
@@ -514,27 +513,27 @@
 
 :- pragma foreign_code("C#", "
 
-public static void compare_3(object[] TypeInfo_for_T,
-		ref object[] Res, object X, object Y) 
+public static void compare_3(object[] TypeInfo_for_T, ref object[] Res,
+    object X, object Y)
 {
-	mercury.builtin.mercury_code.call_rtti_generic_compare_3(
-			TypeInfo_for_T, ref Res, X, Y);
+    mercury.builtin.mercury_code.call_rtti_generic_compare_3(TypeInfo_for_T,
+        ref Res, X, Y);
 }
 
-public static void compare_3_m1(object[] TypeInfo_for_T,
-		ref object[] Res, object X, object Y) 
+public static void compare_3_m1(object[] TypeInfo_for_T, ref object[] Res,
+    object X, object Y)
 {
 	compare_3(TypeInfo_for_T, ref Res, X, Y);
 }
 
-public static void compare_3_m2(object[] TypeInfo_for_T,
-		ref object[] Res, object X, object Y) 
+public static void compare_3_m2(object[] TypeInfo_for_T, ref object[] Res,
+    object X, object Y)
 {
 	compare_3(TypeInfo_for_T, ref Res, X, Y);
 }
 
-public static void compare_3_m3(object[] TypeInfo_for_T,
-		ref object[] Res, object X, object Y) 
+public static void compare_3_m3(object[] TypeInfo_for_T, ref object[] Res,
+    object X, object Y)
 {
 	compare_3(TypeInfo_for_T, ref Res, X, Y);
 }
@@ -583,8 +582,8 @@
 	}
 }
 
-public static void deep_copy_fields(
-		System.Reflection.FieldInfo[] fields, object dest, object src)
+public static void deep_copy_fields(System.Reflection.FieldInfo[] fields,
+    object dest, object src)
 {
 	// XXX We don't handle init-only fields, but I can't think of a way.
 	foreach (System.Reflection.FieldInfo f in fields)
@@ -599,8 +598,7 @@
 
 public static bool unify_2_p(object[] ti, object X, object Y) 
 {
-	return mercury.builtin.mercury_code.call_rtti_generic_unify_2_p(
-			ti, X, Y);
+    return mercury.builtin.mercury_code.call_rtti_generic_unify_2_p(ti, X, Y);
 }
 
 ").
@@ -610,32 +608,28 @@
 public static bool
 special__Unify____void_0_0(object[] x, object[] y)
 {
-	mercury.runtime.Errors.fatal_error(
-		""called unify for type `void'"");
+    mercury.runtime.Errors.fatal_error(""called unify for type `void'"");
 	return false;
 }
 
 public static bool
 special___Unify___c_pointer_0_0(object[] x, object[] y)
 {
-	mercury.runtime.Errors.fatal_error(
-		""called unify for type `c_pointer'"");
+    mercury.runtime.Errors.fatal_error(""called unify for type `c_pointer'"");
 	return false;
 }
 
 public static bool
 special__Unify____func_0_0(object[] x, object[] y)
 {
-	mercury.runtime.Errors.fatal_error(
-		""called unify for `func' type"");
+    mercury.runtime.Errors.fatal_error(""called unify for `func' type"");
 	return false;
 }
 
 public static bool
 special__Unify____tuple_0_0(object[] x, object[] y)
 {
-	mercury.runtime.Errors.fatal_error(
-		""called unify for `tuple' type"");
+    mercury.runtime.Errors.fatal_error(""called unify for `tuple' type"");
 	return false;
 }
 
@@ -643,8 +637,7 @@
 special__Compare____void_0_0(ref object[] result,
 	object[] x, object[] y)
 {
-	mercury.runtime.Errors.fatal_error(
-		""called compare/3 for type `void'"");
+    mercury.runtime.Errors.fatal_error(""called compare/3 for type `void'"");
 }
 
 public static void
@@ -659,16 +652,14 @@
 special__Compare____func_0_0(ref object[] result,
 	object[] x, object[] y)
 {
-	mercury.runtime.Errors.fatal_error(
-		""called compare/3 for `func' type"");
+    mercury.runtime.Errors.fatal_error(""called compare/3 for `func' type"");
 }
 
 public static void
 special__Compare____tuple_0_0(ref object[] result,
 	object[] x, object[] y)
 {
-	mercury.runtime.Errors.fatal_error(
-		""called compare/3 for `tuple' type"");
+    mercury.runtime.Errors.fatal_error(""called compare/3 for `tuple' type"");
 }
 
 ").
@@ -884,16 +875,14 @@
 	//
 
 	public static boolean
-	__Unify____tuple_0_0
-		(mercury.builtin.Tuple_0 x, mercury.builtin.Tuple_0 y)
+    __Unify____tuple_0_0(mercury.builtin.Tuple_0 x, mercury.builtin.Tuple_0 y)
 	{
 		// stub only
 		throw new java.lang.Error (""unify/2 for tuple types not implemented"");
 	}
 
 	public static boolean
-	__Unify____func_0_0
-		(mercury.builtin.Func_0 x, mercury.builtin.Func_0 y)
+    __Unify____func_0_0(mercury.builtin.Func_0 x, mercury.builtin.Func_0 y)
 	{
 		// stub only
 		throw new java.lang.Error (""unify/2 for tuple types not implemented"");
@@ -901,16 +890,14 @@
 
 
 	public static boolean
-	__Unify____c_pointer_0_0
-		(java.lang.Object x, java.lang.Object y)
+    __Unify____c_pointer_0_0(java.lang.Object x, java.lang.Object y)
 	{
 		// XXX should we try calling a Java comparison routine?
 		throw new java.lang.Error (""unify/2 called for c_pointer type"");
 	}
 
 	public static boolean
-	__Unify____void_0_0
-		(mercury.builtin.Void_0 x, mercury.builtin.Void_0 y)
+    __Unify____void_0_0(mercury.builtin.Void_0 x, mercury.builtin.Void_0 y)
 	{
 		// there should never be any values of type void/0
 		throw new java.lang.Error (""unify/2 called for void type"");
@@ -930,16 +917,14 @@
 	}
 
 	public static Comparison_result_0
-	__Compare____func_0_0
-		(mercury.builtin.Func_0 x, mercury.builtin.Func_0 y)
+    __Compare____func_0_0(mercury.builtin.Func_0 x, mercury.builtin.Func_0 y)
 	{
 		// comparing values of higher-order types is a run-time error
 		throw new java.lang.Error (""compare/3 called for func type"");
 	}
 
 	public static Comparison_result_0
-	__Compare____c_pointer_0_0
-		(java.lang.Object x, java.lang.Object y)
+    __Compare____c_pointer_0_0(java.lang.Object x, java.lang.Object y)
 	{
 		// XXX should we try calling a Java comparison routine?
 		throw new java.lang.Error
@@ -947,8 +932,7 @@
 	}
 
 	public static Comparison_result_0
-	__Compare____void_0_0
-		(mercury.builtin.Void_0 x, mercury.builtin.Void_0 y)
+    __Compare____void_0_0(mercury.builtin.Void_0 x, mercury.builtin.Void_0 y)
 	{
 		// there should never be any values of type void/0
 		throw new java.lang.Error (""compare/3 called for void type"");
Index: char.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/char.m,v
retrieving revision 1.49
diff -u -b -r1.49 char.m
--- char.m	27 Jan 2005 03:59:26 -0000	1.49
+++ char.m	17 Oct 2005 02:40:55 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -31,18 +33,16 @@
 
 :- instance enum(character).
 
-	% Convert a character to its corresponding numerical code
-	% (integer value).
-	% Beware that the mapping from characters to numerical codes
-	% is implementation-dependent; there is no guarantee that
-	% the integer values for characters will fit in 8 bits.
-	% Furthermore, the value returned from char__to_int might be
-	% different than the byte(s) used to store the character in a file.
-	% There is also no guarantee that characters created using
-	% `char__to_int(out, in)' can be written to files or
-	% to the standard output or standard error streams.
-	% For example, an implementation might represent characters
-	% using Unicode, but store files in an 8-bit national character set.
+    % Convert a character to its corresponding numerical code (integer value).
+    % Beware that the mapping from characters to numerical codes is
+    % implementation-dependent; there is no guarantee that the integer values
+    % for characters will fit in 8 bits. Furthermore, the value returned from
+    % char__to_int might be different than the byte(s) used to store the
+    % character in a file. There is also no guarantee that characters created
+    % using `char__to_int(out, in)' can be written to files or to the standard
+    % output or standard error streams. For example, an implementation might
+    % represent characters using Unicode, but store files in an 8-bit national
+    % character set.
 	%
 :- func char__to_int(char) = int.
 :- pred char__to_int(char, int).
@@ -140,6 +140,7 @@
 :- pred char__digit_to_int(char::in, int::out) is semidet.
 
 	% char__int_to_uppercase_digit(Int, DigitChar):
+    %
 	% True iff `Int' is an integer in the range 0-35 and
 	% `DigitChar' is a decimal digit or uppercase letter
 	% whose value as a digit is `Int'.
@@ -148,8 +149,7 @@
 :- mode char__int_to_digit(in, out) is semidet.
 :- mode char__int_to_digit(out, in) is semidet.
 
-	% Returns a decimal digit or uppercase letter corresponding to the
-	% value.
+    % Returns a decimal digit or uppercase letter corresponding to the value.
 	% Calls error/1 if the integer is not in the range 0-35.
 	%
 :- func char__det_int_to_digit(int) = char.
@@ -159,6 +159,7 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
+
 :- import_module require.
 
 :- instance enum(character) where [
@@ -467,10 +468,9 @@
 	[will_not_call_mercury, promise_pure, thread_safe],
 "
 	/*
-	** If the integer doesn't fit into a char, then
-	** the assignment `Character = Int' below will truncate it.
-	** SUCCESS_INDICATOR will be set to true only if
-	** the result was not truncated.
+    ** If the integer doesn't fit into a char, then the assignment
+    ** `Character = Int' below will truncate it. SUCCESS_INDICATOR will be set
+    ** to true only if the result was not truncated.
 	*/
 	Character = Int;
 	SUCCESS_INDICATOR = ((MR_UnsignedChar) Character == Int);
@@ -520,9 +520,8 @@
 	succeeded = ((int) Character == Int);
 ").
 
-% We used unsigned character codes, so the minimum character code
-% is always zero.
-
+    % We used unsigned character codes, so the minimum character code
+    % is always zero.
 char__min_char_value(0).
 
 :- pragma foreign_decl("C", "#include <limits.h>").
Index: counter.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/counter.m,v
retrieving revision 1.3
diff -u -b -r1.3 counter.m
--- counter.m	24 Jan 2005 23:16:36 -0000	1.3
+++ counter.m	17 Oct 2005 02:41:30 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2000, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -43,7 +45,8 @@
 
 :- import_module int.
 
-:- type counter ---> counter(int).
+:- type counter
+    --->    counter(int).
 
 counter__init(N) = counter(N).
 
Index: eqvclass.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/eqvclass.m,v
retrieving revision 1.18
diff -u -b -r1.18 eqvclass.m
Index: float.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/float.m,v
retrieving revision 1.63
diff -u -b -r1.63 float.m
--- float.m	16 Jun 2005 04:08:01 -0000	1.63
+++ float.m	17 Oct 2005 02:48:51 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1998,2001-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -54,42 +56,35 @@
 
 	% addition
 	%
-:- func float + float = float.
-:- mode in    + in    = uo  is det.
+:- func (float::in) + (float::in) = (float::uo) is det.
 
 	% subtraction
 	%
-:- func float - float = float.
-:- mode in    - in    = uo  is det.
+:- func (float::in) - (float::in) = (float::uo) is det.
 
 	% multiplication
 	%
-:- func float * float = float.
-:- mode in    * in    = uo  is det.
+:- func (float::in) * (float::in) = (float::uo) is det.
 
 	% division
-	% Throws a `math__domain_error' exception if the right
-	% operand is zero. See the comments at the top of math.m
-	% to find out how to disable this check.
+	% Throws a `math__domain_error' exception if the right operand is zero.
+    % See the comments at the top of math.m to find out how to disable
+    % this check.
 	%
-:- func float / float = float.
-:- mode in    / in    = uo  is det.
+:- func (float::in) / (float::in) = (float::uo) is det.
 
-	% unchecked_quotient(X, Y) is the same as X / Y, but the
-	% behaviour is undefined if the right operand is zero.
+	% unchecked_quotient(X, Y) is the same as X / Y, but the behaviour
+    % is undefined if the right operand is zero.
 	%
-:- func unchecked_quotient(float, float) = float.
-:- mode unchecked_quotient(in, in)    = uo  is det.
+:- func unchecked_quotient(float::in, float::in) = (float::uo) is det.
 
 	% unary plus
 	%
-:- func + float = float.
-:- mode + in    = uo  is det.
+:- func + (float::in) = (float::uo) is det.
 
 	% unary minus
 	%
-:- func - float = float.
-:- mode - in    = uo  is det.
+:- func - (float::in) = (float::uo) is det.
 
 %
 % Comparison predicates
@@ -110,13 +105,11 @@
 	%
 :- func float(int) = float.
 
-	% ceiling_to_int(X) returns the
-	% smallest integer not less than X.
+	% ceiling_to_int(X) returns the smallest integer not less than X.
 	%
 :- func ceiling_to_int(float) = int.
 
-	% floor_to_int(X) returns the
-	% largest integer not greater than X.
+	% floor_to_int(X) returns the largest integer not greater than X.
 	%
 :- func floor_to_int(float) = int.
 
@@ -231,7 +224,6 @@
 %
 
 :- pragma foreign_decl("C", "
-
 	#include <float.h>
 	#include <math.h>
 
@@ -253,11 +245,11 @@
 		Z = unchecked_quotient(X, Y)
 	).
 
-	% This code is included here rather than just calling
-	% the version in math.m because we currently don't do
-	% transitive inter-module inlining, so code which uses
-	% `/'/2 but doesn't import math.m couldn't have the
-	% domain check optimized away..
+	% This code is included here rather than just calling the version in math.m
+    % because we currently don't do transitive inter-module inlining, so code
+    % which uses `/'/2 but doesn't import math.m couldn't have the domain check
+    % optimized away..
+    %
 :- pred domain_checks is semidet.
 :- pragma inline(domain_checks/0).
 
@@ -319,8 +311,6 @@
 	FloatVal = (double) IntVal;
 ").
 
-	% float__ceiling_to_int(X) returns the
-	% smallest integer not less than X.
 :- pragma foreign_proc("C",
 	float__ceiling_to_int(X :: in) = (Ceil :: out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -347,8 +337,6 @@
 	}
 ").
 
-	% float__floor_to_int(X) returns the
-	% largest integer not greater than X.
 :- pragma foreign_proc("C",
 	float__floor_to_int(X :: in) = (Floor :: out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -375,8 +363,6 @@
 	}
 ").
 
-	% float__round_to_int(X) returns the integer closest to X.
-	% If X has a fractional value of 0.5, it is rounded up.
 :- pragma foreign_proc("C",
 	float__round_to_int(X :: in) = (Round :: out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -403,8 +389,6 @@
 	}
 ").
 
-	% float__truncate_to_int(X) returns the integer closest
-	% to X such that |float__truncate_to_int(X)| =< |X|.
 :- pragma foreign_proc("C",
 	float__truncate_to_int(X :: in) = (Trunc :: out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -437,33 +421,26 @@
 %
 
 float__abs(Num) = Abs :-
-	(
-		Num =< 0.0
-	->
+	( Num =< 0.0 ->
 		Abs = - Num
 	;
 		Abs = Num
 	).
 
 float__max(X, Y) = Max :-
-	(
-		X >= Y
-	->
+	( X >= Y ->
 		Max = X
 	;
 		Max = Y
 	).
 
 float__min(X, Y) = Min :-
-	(
-		X =< Y
-	->
+	( X =< Y ->
 		Min = X
 	;
 		Min = Y
 	).
 
-
 float__pow(Base, Exp) = Ans :-
 	( Exp >= 0 ->
 		Ans = float__multiply_by_pow(1.0, Base, Exp)
@@ -477,10 +454,12 @@
 		)
 	).
 
-:- func float__multiply_by_pow(float, float, int) = float.
 	% Returns Scale0 * (Base ** Exp) (where X ** 0 == 1.0 for all X).
 	% Requires that Exp >= 0.
 	% Uses a simple "Russian peasants" algorithm.  O(lg(Exp+1)).
+    %
+:- func float__multiply_by_pow(float, float, int) = float.
+
 float__multiply_by_pow(Scale0, Base, Exp) = Result :-
 	( Exp = 0 ->
 		Result = Scale0
@@ -517,7 +496,6 @@
 
 	% In hashing a float in .NET or Java, we ensure that the value is
 	% non-negative, as this condition is not guaranteed by either API.
-
 :- pragma foreign_proc("C",
 	float__hash(F::in) = (H::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -615,7 +593,6 @@
 
 :- pragma foreign_decl("C",
 "
-
 	#define	ML_FLOAT_RADIX	FLT_RADIX	/* There is no DBL_RADIX. */
 
 	#if defined MR_USE_SINGLE_PREC_FLOAT
@@ -633,10 +610,8 @@
 		#define	ML_FLOAT_MIN_EXP	DBL_MIN_EXP
 		#define	ML_FLOAT_MAX_EXP	DBL_MAX_EXP
 	#endif
-
 ").
 
-	% Maximum floating-point number
 :- pragma foreign_proc("C",
 	float__max = (Max::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -656,7 +631,6 @@
 	Max = java.lang.Double.MAX_VALUE;
 ").
 
-	% Minimum normalised floating-point number */
 :- pragma foreign_proc("C",
 	float__min = (Min::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -678,7 +652,6 @@
 %
 float__min = 2.2250738585072014e-308.
 
-	% Smallest x such that x \= 1.0 + x
 :- pragma foreign_proc("C",
 	float__epsilon = (Eps::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -701,7 +674,6 @@
 %
 float__epsilon = 2.2204460492503131e-16.
 
-	% Radix of the floating-point representation.
 :- pragma foreign_proc("C",
 	float__radix = (Radix::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -720,7 +692,6 @@
 %
 float__radix = 2.
 
-	% The number of base-radix digits in the mantissa.
 :- pragma foreign_proc("C",
 	float__mantissa_digits = (MantDig::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -737,9 +708,6 @@
 %
 float__mantissa_digits = 53.
 
-	% Minimum negative integer such that:
-	%	radix ** (min_exponent - 1)
-	% is a normalised floating-point number.
 :- pragma foreign_proc("C",
 	float__min_exponent = (MinExp::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
@@ -756,9 +724,6 @@
 %
 float__min_exponent = -1021.
 
-	% Maximum integer such that:
-	%	radix ** (max_exponent - 1)
-	% is a normalised floating-point number.
 :- pragma foreign_proc("C",
 	float__max_exponent = (MaxExp::out),
 	[will_not_call_mercury, promise_pure, thread_safe],
Index: gc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/gc.m,v
retrieving revision 1.18
diff -u -b -r1.18 gc.m
--- gc.m	20 May 2005 05:40:19 -0000	1.18
+++ gc.m	17 Oct 2005 02:41:59 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1999,2001-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
Index: getopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/getopt.m,v
retrieving revision 1.34
diff -u -b -r1.34 getopt.m
Index: getopt_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/getopt_io.m,v
retrieving revision 1.3
diff -u -b -r1.3 getopt_io.m
Index: graph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/graph.m,v
retrieving revision 1.24
diff -u -b -r1.24 graph.m
--- graph.m	16 Jun 2005 04:08:01 -0000	1.24
+++ graph.m	17 Oct 2005 03:25:03 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1999, 2003, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -40,16 +42,13 @@
 
 :- type arc		== arc(unit).
 
-	% graph__init(Graph) binds Graph to an empty graph
-	% containing no nodes and no arcs. (The graph contains
-	% a counter of the number of nodes allocated in it, so
-	% it is possible for a graph to contain no nodes or arcs
-	% and still fail to unify with the binding of Graph from
+    % graph__init(Graph) binds Graph to an empty graph containing no nodes
+    % and no arcs. (The graph contains a counter of the number of nodes
+    % allocated in it, so it is possible for a graph to contain no nodes
+    % or arcs and still fail to unify with the binding of Graph from
 	% graph__init.)
 	%
-:- pred graph__init(graph(N, A)).
-:- mode graph__init(out) is det.
-
+:- pred graph__init(graph(N, A)::out) is det.
 :- func graph__init = graph(N, A).
 
 	% graph__set_node(OldGraph, NodeInfo, Node, NewGraph) takes
@@ -62,8 +61,8 @@
 	%
 	% This operation is O(lgN) for a graph containing N nodes.
 	%
-:- pred graph__set_node(graph(N, A), N, node(N), graph(N, A)).
-:- mode graph__set_node(in, in, out, out) is det.
+:- pred graph__set_node(graph(N, A)::in, N::in, node(N)::out,
+    graph(N, A)::out) is det.
 
 	% graph__insert_node/4 is the same as graph__set_node/4 except
 	% that if the information to be stored in the node is stored
@@ -73,14 +72,14 @@
 	% this predicate has to check that the node data isn't in an
 	% existing node.
 	%
-:- pred graph__insert_node(graph(N, A), N, node(N), graph(N, A)).
-:- mode graph__insert_node(in, in, out, out) is semidet.
+:- pred graph__insert_node(graph(N, A)::in, N::in, node(N)::out,
+    graph(N, A)::out) is semidet.
 
 	% graph__det_insert_node/4 is like graph__insert_node, except
 	% that if the insertion would fail, it calls error/1.
 	%
-:- pred graph__det_insert_node(graph(N, A), N, node(N), graph(N, A)).
-:- mode graph__det_insert_node(in, in, out, out) is det.
+:- pred graph__det_insert_node(graph(N, A)::in, N::in, node(N)::out,
+    graph(N, A)::out) is det.
 
 	% graph__search_node(Graph, NodeInfo, Node) nondeterministically
 	% produces bindings of Node such that Node is a node in Graph
@@ -89,8 +88,7 @@
 	% This operation is O(lgN) for the first solution for a graph
 	% containing N nodes.
 	%
-:- pred graph__search_node(graph(N, A), N, node(N)).
-:- mode graph__search_node(in, in, out) is nondet.
+:- pred graph__search_node(graph(N, A)::in, N::in, node(N)::out) is nondet.
 
 	% graph__find_matching_nodes(Graph, NodeInfo, Nodes) takes a graph
 	% Graph and the information NodeInfo and returns the set of nodes
@@ -99,9 +97,8 @@
 	%
 	% This operation is O(NlgN) for a graph containing N nodes.
 	%
-:- pred graph__find_matching_nodes(graph(N, A), N, set(node(N))).
-:- mode graph__find_matching_nodes(in, in, out) is det.
-
+:- pred graph__find_matching_nodes(graph(N, A)::in, N::in, set(node(N))::out)
+    is det.
 :- func graph__find_matching_nodes(graph(N, A), N) = set(node(N)).
 
 	% graph__node_contents(Graph, Node, NodeInfo) takes Graph and
@@ -109,9 +106,7 @@
 	%
 	% This operation is O(lgN) for a graph containing N nodes.
 	%
-:- pred graph__node_contents(graph(N, A), node(N), N).
-:- mode graph__node_contents(in, in, out) is det.
-
+:- pred graph__node_contents(graph(N, A)::in, node(N)::in, N::out) is det.
 :- func graph__node_contents(graph(N, A), node(N)) = N.
 
 	% graph__successors(Graph, Node, Nodes) takes a graph Graph and
@@ -120,16 +115,13 @@
 	%
 	% This operation is O(NlgN) for a graph containing N nodes.
 	%
-:- pred graph__successors(graph(N, A), node(N), set(node(N))).
-:- mode graph__successors(in, in, out) is det.
-
+:- pred graph__successors(graph(N, A)::in, node(N)::in, set(node(N))::out)
+    is det.
 :- func graph__successors(graph(N, A), node(N)) = set(node(N)).
 
 	% graph__nodes(Graph, Nodes) binds Nodes to the set of nodes in Graph.
 	%
-:- pred graph__nodes(graph(N, A), set(node(N))).
-:- mode graph__nodes(in, out) is det.
-
+:- pred graph__nodes(graph(N, A)::in, set(node(N))::out) is det.
 :- func graph__nodes(graph(N, A)) = set(node(N)).
 
 	% graph__set_edge(OldGraph, Start, End, ArcInfo, Arc, NewGraph)
@@ -141,31 +133,28 @@
 	%
 	% This operation is O(lgN+lgM) for a graph with N nodes and M arcs.
 	%
-:- pred graph__set_edge(graph(N, A), node(N), node(N), A,
-						arc(A), graph(N, A)).
-:- mode graph__set_edge(in, in, in, in, out, out) is det.
+:- pred graph__set_edge(graph(N, A)::in, node(N)::in, node(N)::in, A::in,
+    arc(A)::out, graph(N, A)::out) is det.
 
 	% graph__insert_edge/6 is the same as graph__set_edge/6 except that
 	% if an identical arc already exists in the graph the operation fails.
 	% This is O(N) for a graph with N edges between the two nodes.
 	%
-:- pred graph__insert_edge(graph(N, A), node(N), node(N), A,
-						arc(A), graph(N, A)).
-:- mode graph__insert_edge(in, in, in, in, out, out) is semidet.
+:- pred graph__insert_edge(graph(N, A)::in, node(N)::in, node(N)::in, A::in,
+    arc(A)::out, graph(N, A)::out) is semidet.
 
 	% graph__det_insert_edge/6 is like graph__insert_edge except
 	% than instead of failing, it calls error/1.
 	%
-:- pred graph__det_insert_edge(graph(N, A), node(N), node(N), A,
-						arc(A), graph(N, A)).
-:- mode graph__det_insert_edge(in, in, in, in, out, out) is det.
+:- pred graph__det_insert_edge(graph(N, A)::in, node(N)::in, node(N)::in,
+    A::in, arc(A)::out, graph(N, A)::out) is det.
 
 	% graph__arc_contents(Graph, Arc, Start, End, ArcInfo) takes a
 	% graph Graph and an arc Arc and returns the start and end nodes
 	% and the information stored in that arc.
 	%
-:- pred graph__arc_contents(graph(N, A), arc(A), node(N), node(N), A).
-:- mode graph__arc_contents(in, in, out, out, out) is det.
+:- pred graph__arc_contents(graph(N, A)::in, arc(A)::in,
+    node(N)::out, node(N)::out, A::out) is det.
 
 	% graph__path(Graph, Start, End, Path) is true iff there is a path
 	% from the node Start to the node End in Graph that goes through
@@ -180,104 +169,96 @@
 
 :- implementation.
 
+:- import_module counter.
 :- import_module int.
 :- import_module list.
 :- import_module map.
 :- import_module require.
 :- import_module std_util.
 
-:- type graph(N, A)	--->
-		graph(
-			graph__node_supply,
-			graph__arc_supply,
-			map(node(N), N),
-			map(arc(A), arc_info(N, A)),
-			map(node(N), map(arc(A), node(N)))
+:- type graph(N, A)
+    --->    graph(
+                node_supply     :: counter,
+                arc_supply      :: counter,
+                node_map        :: map(node(N), N),
+                arc_map         :: map(arc(A), arc_info(N, A)),
+                edge_map        :: map(node(N), map(arc(A), node(N)))
 		).
 
-:- type graph__node_supply	==	int.
+:- type node(N)
+    --->    node(int).
 
-:- type graph__arc_supply	==	int.
+:- type arc(A)
+    --->    arc(int).
 
-:- type node(N)			--->	node(int).
-
-:- type arc(A)			--->	arc(int).
-
-:- type arc_info(N, A)	--->	arc_info(node(N), node(N), A).
+:- type arc_info(N, A)
+    --->    arc_info(node(N), node(N), A).
 
 %------------------------------------------------------------------------------%
 
 graph__init(Graph) :-
-	Graph = graph(0, 0, Nodes, Arcs, Edges),
+    Graph = graph(counter__init(0), counter__init(0), Nodes, Arcs, Edges),
 	map__init(Nodes),
 	map__init(Arcs),
 	map__init(Edges).
 
 %------------------------------------------------------------------------------%
 
-graph__set_node(G0, NInfo, node(N), G) :-
-	graph__get_node_supply(G0, NS0),
-	NS = NS0 + 1,
-	N = NS,
-	graph__set_node_supply(G0, NS, G1),
+graph__set_node(!.G, NInfo, node(N), !:G) :-
+    NS0 = !.G ^ node_supply,
+    counter__allocate(N, NS0, NS),
+    !:G = !.G ^ node_supply := NS,
 
-	graph__get_nodes(G1, Nodes0),
+    Nodes0 = !.G ^ node_map,
 	map__set(Nodes0, node(N), NInfo, Nodes),
-	graph__set_nodes(G1, Nodes, G2),
+    !:G = !.G ^ node_map := Nodes,
 
-	graph__get_edges(G2, Edges0),
+    Edges0 = !.G ^ edge_map,
 	map__init(EdgeMap),
 	map__set(Edges0, node(N), EdgeMap, Edges),
-	graph__set_edges(G2, Edges, G).
+    !:G = !.G ^ edge_map := Edges.
 
-graph__det_insert_node(G0, NInfo, N, G) :-
-	(
-		graph__insert_node(G0, NInfo, N1, G1)
-	->
-		N = N1,
-		G = G1
+graph__det_insert_node(!.G, NInfo, N, !:G) :-
+    ( graph__insert_node(!.G, NInfo, NPrime, !:G) ->
+        N = NPrime
 	;
 		error("graph__det_insert_node: node already exists.")
 	).
 
-graph__insert_node(G0, NInfo, node(N), G) :-
-		% Make sure that the graph doesn't contain
-		% NInfo already.
-	graph__get_nodes(G0, Nodes0),
-	\+ map__member(Nodes0, _, NInfo),
-
-	graph__get_node_supply(G0, NS0),
-	NS = NS0 + 1,
-	N = NS,
-	graph__set_node_supply(G0, NS, G1),
-
-	graph__get_nodes(G1, Nodes1),
-	map__set(Nodes1, node(N), NInfo, Nodes),
-	graph__set_nodes(G1, Nodes, G2),
+graph__insert_node(!.G, NInfo, node(N), !:G) :-
+    % Make sure that the graph doesn't contain NInfo already.
+    \+ map__member(!.G ^ node_map, _, NInfo),
+
+    NS0 = !.G ^ node_supply,
+    counter__allocate(N, NS0, NS),
+    !:G = !.G ^ node_supply := NS,
+
+    Nodes0 = !.G ^ node_map,
+    map__set(Nodes0, node(N), NInfo, Nodes),
+    !:G = !.G ^ node_map := Nodes,
 
-	graph__get_edges(G2, Edges0),
+    Edges0 = !.G ^ edge_map,
 	map__init(EdgeSet),
 	map__set(Edges0, node(N), EdgeSet, Edges),
-	graph__set_edges(G2, Edges, G).
+    !:G = !.G ^ edge_map := Edges.
 
 %------------------------------------------------------------------------------%
 
 graph__search_node(Graph, NodeInfo, Node) :-
-	graph__get_nodes(Graph, NodeTable),
+    NodeTable = Graph ^ node_map,
 	map__member(NodeTable, Node, NodeInfo).
 
 %------------------------------------------------------------------------------%
 
 graph__find_matching_nodes(Graph, NodeInfo, NodeSet) :-
-	graph__get_nodes(Graph, NodeTable),
+    NodeTable = Graph ^ node_map,
 %	SolnGoal = lambda([Node::out] is nondet,
 %			map__member(NodeTable, Node, NodeInfo)),
 %	solutions(SolnGoal, NodeList),
 	solutions(graph__select_node(NodeTable, NodeInfo), NodeList),
 	set__sorted_list_to_set(NodeList, NodeSet).
 
-:- pred graph__select_node(map(node(N), N), N, node(N)).
-:- mode graph__select_node(in, in, out) is nondet.
+:- pred graph__select_node(map(node(N), N)::in, N::in, node(N)::out) is nondet.
 
 graph__select_node(NodeTable, NodeInfo, Node) :-
 	map__member(NodeTable, Node, NodeInfo).
@@ -285,75 +266,68 @@
 %------------------------------------------------------------------------------%
 
 graph__node_contents(G, N, I) :-
-	graph__get_nodes(G, Ns),
-	map__lookup(Ns, N, I).
+    map__lookup(G ^ node_map, N, I).
 
 %------------------------------------------------------------------------------%
 
 graph__successors(G, N, Ss) :-
-	graph__get_edges(G, Es),
-	map__lookup(Es, N, E),
+    map__lookup(G ^ edge_map, N, E),
 	map__values(E, SsList),
 	set__list_to_set(SsList, Ss).
 
 %------------------------------------------------------------------------------%
 
 graph__nodes(G, Ns) :-
-	graph__get_nodes(G, Ns0),
-	map__keys(Ns0, Ns1),
+    map__keys(G ^ node_map, Ns1),
 	set__list_to_set(Ns1, Ns).
 
 %------------------------------------------------------------------------------%
 
-graph__set_edge(G0, Start, End, Info, Arc, G) :-
-	graph__get_arc_supply(G0, AS0),
-	AS = AS0 + 1,
-	Arc = arc(AS),
-	graph__set_arc_supply(G0, AS, G1),
+graph__set_edge(!.G, Start, End, Info, Arc, !:G) :-
+    AS0 = !.G ^ arc_supply,
+    counter__allocate(A, AS0, AS),
+    Arc = arc(A),
+    !:G = !.G ^ arc_supply := AS,
 
-	graph__get_arcs(G1, Arcs0),
+    Arcs0 = !.G ^ arc_map,
 	map__set(Arcs0, Arc, arc_info(Start, End, Info), Arcs),
-	graph__set_arcs(G1, Arcs, G2),
+    !:G = !.G ^ arc_map := Arcs,
 
-	graph__get_edges(G2, Es0),
+    Es0 = !.G ^ edge_map,
 	map__lookup(Es0, Start, EdgeMap0),
 	map__set(EdgeMap0, Arc, End, EdgeMap),
 	map__set(Es0, Start, EdgeMap, Es),
-	graph__set_edges(G2, Es, G).
+    !:G = !.G ^ edge_map := Es.
 
 %------------------------------------------------------------------------------%
 
-graph__det_insert_edge(G0, Start, End, Info, Arc, G) :-
-	(
-		graph__insert_edge(G0, Start, End, Info, Arc1, G1)
-	->
-		Arc = Arc1,
-		G = G1
+graph__det_insert_edge(!.G, Start, End, Info, Arc, !:G) :-
+    ( graph__insert_edge(!.G, Start, End, Info, ArcPrime, !:G) ->
+        Arc = ArcPrime
 	;
 		error("graph__det_insert_edge: this edge is already in the graph.")
 	).
 
-graph__insert_edge(G0, Start, End, Info, Arc, G) :-
-	graph__get_arc_supply(G0, AS0),
-	AS = AS0 + 1,
-	Arc = arc(AS),
-	graph__set_arc_supply(G0, AS, G1),
+graph__insert_edge(!.G, Start, End, Info, Arc, !:G) :-
+    AS0 = !.G ^ arc_supply,
+    counter__allocate(A, AS0, AS),
+    Arc = arc(A),
+    !:G = !.G ^ arc_supply := AS,
 
-	graph__get_arcs(G1, Arcs0),
+    Arcs0 = !.G ^ arc_map,
 	map__insert(Arcs0, Arc, arc_info(Start, End, Info), Arcs),
-	graph__set_arcs(G1, Arcs, G2),
+    !:G = !.G ^ arc_map := Arcs,
 
-	graph__get_edges(G2, Es0),
+    Es0 = !.G ^ edge_map,
 	map__lookup(Es0, Start, EdgeMap0),
 	map__set(EdgeMap0, Arc, End, EdgeMap),
 	map__set(Es0, Start, EdgeMap, Es),
-	graph__set_edges(G2, Es, G).
+    !:G = !.G ^ edge_map := Es.
 
 %------------------------------------------------------------------------------%
 
 graph__arc_contents(G, N, S, E, A) :-
-	graph__get_arcs(G, Ns),
-	map__lookup(Ns, N, I),
+    map__lookup(G ^ arc_map, N, I),
 	I = arc_info(S, E, A).
 
 %------------------------------------------------------------------------------%
@@ -367,7 +341,7 @@
 :- mode graph__path_2(in, in, out, in, out) is nondet.
 
 graph__path_2(G, S, E, Nodes0, Path) :-
-	graph__get_edges(G, Es),
+    Es = G ^ edge_map,
 	map__lookup(Es, S, Arcs),
 	(
 		map__member(Arcs, A, E),
@@ -376,78 +350,10 @@
 	;
 		map__member(Arcs, A, N),
 		\+ list__member(N, Nodes0),
-		graph__path_2(G, N, E, [N|Nodes0], Path0),
-		Path = [A|Path0]
+        graph__path_2(G, N, E, [N | Nodes0], Path0),
+        Path = [A | Path0]
 	).
 
-%------------------------------------------------------------------------------%
-%------------------------------------------------------------------------------%
-
-:- pred graph__get_node_supply(graph(N, A), graph__node_supply).
-:- mode graph__get_node_supply(in, out) is det.
-
-graph__get_node_supply(G, NS) :-
-	G = graph(NS, _AS, _N, _A, _E).
-
-:- pred graph__get_arc_supply(graph(N, A), graph__arc_supply).
-:- mode graph__get_arc_supply(in, out) is det.
-
-graph__get_arc_supply(G, AS) :-
-	G = graph(_NS, AS, _N, _A, _E).
-
-:- pred graph__get_nodes(graph(N, A), map(node(N), N)).
-:- mode graph__get_nodes(in, out) is det.
-
-graph__get_nodes(G, N) :-
-	G = graph(_NS, _AS, N, _A, _E).
-
-:- pred graph__get_arcs(graph(N, A), map(arc(A), arc_info(N, A))).
-:- mode graph__get_arcs(in, out) is det.
-
-graph__get_arcs(G, A) :-
-	G = graph(_NS, _AS, _N, A, _E).
-
-:- pred graph__get_edges(graph(N, A), map(node(N), map(arc(A), node(N)))).
-:- mode graph__get_edges(in, out) is det.
-
-graph__get_edges(G, E) :-
-	G = graph(_NS, _AS, _N, _A, E).
-
-:- pred graph__set_node_supply(graph(N, A), graph__node_supply, graph(N, A)).
-:- mode graph__set_node_supply(in, in, out) is det.
-
-graph__set_node_supply(G0, NS, G) :-
-	G0 = graph(_, AS, N, A, E),
-	G = graph(NS, AS, N, A, E).
-
-:- pred graph__set_arc_supply(graph(N, A), graph__arc_supply, graph(N, A)).
-:- mode graph__set_arc_supply(in, in, out) is det.
-
-graph__set_arc_supply(G0, AS, G) :-
-	G0 = graph(NS, _, N, A, E),
-	G = graph(NS, AS, N, A, E).
-
-:- pred graph__set_nodes(graph(N, A), map(node(N), N), graph(N, A)).
-:- mode graph__set_nodes(in, in, out) is det.
-
-graph__set_nodes(G0, N, G) :-
-	G0 = graph(NS, AS, _, A, E),
-	G = graph(NS, AS, N, A, E).
-
-:- pred graph__set_arcs(graph(N, A), map(arc(A), arc_info(N, A)), graph(N, A)).
-:- mode graph__set_arcs(in, in, out) is det.
-
-graph__set_arcs(G0, A, G) :-
-	G0 = graph(NS, AS, N, _, E),
-	G = graph(NS, AS, N, A, E).
-
-:- pred graph__set_edges(graph(N, A), map(node(N), map(arc(A), node(N))), graph(N, A)).
-:- mode graph__set_edges(in, in, out) is det.
-
-graph__set_edges(G0, E, G) :-
-	G0 = graph(NS, AS, N, A, _),
-	G = graph(NS, AS, N, A, E).
-
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 % Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
@@ -467,4 +373,3 @@
 
 graph__nodes(G) = S :-
 	graph__nodes(G,S).
-
Index: group.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/group.m,v
retrieving revision 1.22
diff -u -b -r1.22 group.m
--- group.m	16 Jun 2005 04:08:01 -0000	1.22
+++ group.m	17 Oct 2005 03:35:26 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1997, 1999, 2003, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -31,72 +33,53 @@
 
 :- type group__key.
 
-	% Create an empty group
-
-:- pred group__init(group(T)).
-:- mode group__init(out) is det.
-
+    % Create an empty group.
+    %
+:- pred group__init(group(T)::out) is det.
 :- func group__init = group(T).
 
 	% Insert a set of elements into the group.
-
-:- pred group__insert(group(T), set(T), group(T)).
-:- mode group__insert(in, in, out) is det.
-
+    %
+:- pred group__insert(group(T)::in, set(T)::in, group(T)::out) is det.
 :- func group__insert(group(T), set(T)) = group(T).
 
 	% Given an element, get the set containing that element.
-
-:- pred group__group(group(T), T, set(T)).
-:- mode group__group(in, in, out) is det.
-
+    %
+:- pred group__group(group(T)::in, T::in, set(T)::out) is det.
 :- func group__group(group(T), T) = set(T).
 
 	% Convert the group to a set of sets.
-
-:- pred group__to_set(group(T), set(set(T))).
-:- mode group__to_set(in, out) is det.
-
+    %
+:- pred group__to_set(group(T)::in, set(set(T))::out) is det.
 :- func group__to_set(group(T)) = set(set(T)).
 
-:- pred group__sets_and_keys(group(T), assoc_list(set(T), group__key)).
-:- mode group__sets_and_keys(in, out) is det.
-
+:- pred group__sets_and_keys(group(T)::in,
+    assoc_list(set(T), group__key)::out) is det.
 :- func group__sets_and_keys(group(T)) = assoc_list(set(T), group__key).
 
-	% Given an element, get the key for the group containing
-	% that element.
-
-:- pred group__group_key(group(T), T, group__key).
-:- mode group__group_key(in, in, out) is det.
-
+    % Given an element, get the key for the group containing that element.
+    %
+:- pred group__group_key(group(T)::in, T::in, group__key::out) is det.
 :- func group__group_key(group(T), T) = group__key.
 
 	% Given a group key, get the corresponding set of elements.
-
-:- pred group__key_group(group(T), group__key, set(T)).
-:- mode group__key_group(in, in, out) is det.
-
+    %
+:- pred group__key_group(group(T)::in, group__key::in, set(T)::out) is det.
 :- func group__key_group(group(T), group__key) = set(T).
 
 	% Remove a set from the group, and return the set.
-
-:- pred group__remove_group(group(T), group__key, set(T), group(T)).
-:- mode group__remove_group(in, in, out, out) is det.
+    %
+:- pred group__remove_group(group(T)::in, group__key::in, set(T)::out,
+    group(T)::out) is det.
 
 	% Test to see if two elements are in the same set.
+    %
+:- pred group__same_group(group(T)::in, T::in, T::in) is semidet.
 
-:- pred group__same_group(group(T), T, T).
-:- mode group__same_group(in, in, in) is semidet.
-
-:- pred group__largest_group_key(group(T), group__key).
-:- mode group__largest_group_key(in, out) is det.
-
+:- pred group__largest_group_key(group(T)::in, group__key::out) is det.
 :- func group__largest_group_key(group(T)) = group__key.
 
-:- pred group__group_keys(group(T), list(group__key)).
-:- mode group__group_keys(in, out) is det.
-
+:- pred group__group_keys(group(T)::in, list(group__key)::out) is det.
 :- func group__group_keys(group(T)) = list(group__key).
 
 %---------------------------------------------------------------------------%
@@ -104,16 +87,17 @@
 
 :- implementation.
 
+:- import_module counter.
 :- import_module int.
 :- import_module map.
 :- import_module require.
 :- import_module std_util.
 
-:- type group(T)	--->
-		group(
-			group__key,
-			map(group__key, set(T)),
-			map(T, group__key)
+:- type group(T)
+    --->    group(
+                key_supply      :: counter,
+                sets            :: map(group__key, set(T)),
+                elements        :: map(T, group__key)
 		).
 
 :- type group__key	==	int.
@@ -121,99 +105,83 @@
 group__init(G) :-
 	map__init(Es),
 	map__init(Ss),
-	G = group(0, Es, Ss).
+    G = group(counter__init(0), Es, Ss).
 
-group__insert(G0, S, G) :-
-	group__get_group_count(G0, C0),
-	C = C0 + 1,
-	group__get_sets(G0, Ss0),
+group__insert(!.G, S, !:G) :-
+    !.G = group(KS0, Ss0, Es0),
+    counter__allocate(C, KS0, KS),
 	map__set(Ss0, C, S, Ss),
-	group__get_elements(G0, Es0),
 	set__to_sorted_list(S, SL),
 	group__insert_elements(SL, C, Es0, Es),
-	group__set_group_count(G0, C, G1),
-	group__set_sets(G1, Ss, G2),
-	group__set_elements(G2, Es, G).
-
-:- pred group__insert_elements(list(T), group__key,
-				map(T, group__key), map(T, group__key)).
-:- mode group__insert_elements(in, in, in, out) is det.
+    !:G = group(KS, Ss, Es).
+
+:- pred group__insert_elements(list(T)::in, group__key::in,
+    map(T, group__key)::in, map(T, group__key)::out) is det.
 
 group__insert_elements([], _GK, Es, Es).
-group__insert_elements([I|Is], GK, Es0, Es) :-
+group__insert_elements([I | Is], GK, Es0, Es) :-
 	map__set(Es0, I, GK, Es1),
 	group__insert_elements(Is, GK, Es1, Es).
 
 group__group(G, E, S) :-
-	group__get_elements(G, Es),
-	map__lookup(Es, E, GK),
-	group__get_sets(G, Ss),
-	map__lookup(Ss, GK, S).
+    map__lookup(G ^ elements, E, GK),
+    map__lookup(G ^ sets, GK, S).
 
 group__to_set(G, S) :-
-	group__get_sets(G, SS),
-	map__values(SS, S0),
+    map__values(G ^ sets, S0),
 	set__list_to_set(S0, S).
 
 group__sets_and_keys(G, SKs) :-
-	group__get_sets(G, SS),
-	map__to_assoc_list(SS, SKs0),
+    map__to_assoc_list(G ^ sets, SKs0),
 	assoc_list__reverse_members(SKs0, SKs).
 
 group__group_key(G, E, GK) :-
-	group__get_elements(G, Es),
-	map__lookup(Es, E, GK).
+    map__lookup(G ^ elements, E, GK).
 
 group__key_group(G, GK, S) :-
-	group__get_sets(G, Ss),
-	map__lookup(Ss, GK, S).
+    map__lookup(G ^ sets, GK, S).
 
-group__remove_group(G0, GK, S, G) :-
-	group__get_sets(G0, Ss0),
-	(
-		map__remove(Ss0, GK, S1, Ss1)
-	->
-		S = S1,
-		Ss = Ss1
+group__remove_group(!.G, GK, S, !:G) :-
+    Ss0 = !.G ^ sets,
+    Es0 = !.G ^ elements,
+    ( map__remove(Ss0, GK, SPrime, SsPrime) ->
+        S = SPrime,
+        Ss = SsPrime
 	;
 		error("map__remove unexpectedly failed.")
 	),
-	group__get_elements(G0, Es0),
 	set__to_sorted_list(S, SL),
 	group__remove_elements(SL, Es0, Es),
-	group__set_sets(G0, Ss, G1),
-	group__set_elements(G1, Es, G).
+    !:G = !.G ^ sets := Ss,
+    !:G = !.G ^ elements := Es.
 
-:- pred group__remove_elements(list(T), map(T, group__key), map(T, group__key)).
-:- mode group__remove_elements(in, in, out) is det.
+:- pred group__remove_elements(list(T)::in,
+    map(T, group__key)::in, map(T, group__key)::out) is det.
 
 group__remove_elements([], Es, Es).
-group__remove_elements([I|Is], Es0, Es) :-
+group__remove_elements([I | Is], Es0, Es) :-
 	map__delete(Es0, I, Es1),
 	group__remove_elements(Is, Es1, Es).
 
 group__same_group(G, E0, E1) :-
-	group__get_elements(G, Es),
+    Es = G ^ elements,
 	map__lookup(Es, E0, GK),
 	map__lookup(Es, E1, GK).
 
 group__largest_group_key(G, GK) :-
-	group__get_sets(G, Ss),
+    Ss = G ^ sets,
 	map__to_assoc_list(Ss, SL),
 	group__largest_group_key_2(SL, 0, 0, GK).
 
-:- pred group__largest_group_key_2(assoc_list(group__key, set(T)), int,
-							group__key, group__key).
-:- mode group__largest_group_key_2(in, in, in, out) is det.
+:- pred group__largest_group_key_2(assoc_list(group__key, set(T))::in, int::in,
+    group__key::in, group__key::out) is det.
 
 group__largest_group_key_2([], _, GK, GK).
-group__largest_group_key_2([GK0-S0|Ss], Sz0, GK1, GK) :-
+group__largest_group_key_2([GK0 - S0 | Ss], Sz0, GK1, GK) :-
 	set__to_sorted_list(S0, S1),
 	list__length(S1, Sz1),
 	compare(R, Sz1, Sz0),
-	(
-		R = (>)
-	->
+    ( R = (>) ->
 		Sz = Sz1,
 		GK2 = GK0
 	;
@@ -225,49 +193,7 @@
 %---------------------------------------------------------------------------%
 
 group__group_keys(G, Ks) :-
-	group__get_sets(G, Ss),
-	map__keys(Ss, Ks).
-
-%---------------------------------------------------------------------------%
-
-:- pred group__get_group_count(group(T), int).
-:- mode group__get_group_count(in, out) is det.
-
-group__get_group_count(G, C) :-
-	G = group(C, _, _).
-
-:- pred group__get_sets(group(T), map(group__key, set(T))).
-:- mode group__get_sets(in, out) is det.
-
-group__get_sets(G, S) :-
-	G = group(_, S, _).
-
-:- pred group__get_elements(group(T), map(T, group__key)).
-:- mode group__get_elements(in, out) is det.
-
-group__get_elements(G, E) :-
-	G = group(_, _, E).
-
-:- pred group__set_group_count(group(T), int, group(T)).
-:- mode group__set_group_count(in, in, out) is det.
-
-group__set_group_count(G0, C, G) :-
-	G0 = group(_, S, E),
-	G = group(C, S, E).
-
-:- pred group__set_sets(group(T), map(group__key, set(T)), group(T)).
-:- mode group__set_sets(in, in, out) is det.
-
-group__set_sets(G0, S, G) :-
-	G0 = group(C, _, E),
-	G = group(C, S, E).
-
-:- pred group__set_elements(group(T), map(T, group__key), group(T)).
-:- mode group__set_elements(in, in, out) is det.
-
-group__set_elements(G0, E, G) :-
-	G0 = group(C, S, _),
-	G = group(C, S, E).
+    map__keys(G ^ sets, Ks).
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: hash_table.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/hash_table.m,v
retrieving revision 1.10
diff -u -b -r1.10 hash_table.m
--- hash_table.m	16 Jun 2005 04:08:01 -0000	1.10
+++ hash_table.m	17 Oct 2005 05:27:39 -0000
@@ -125,8 +125,7 @@
 :- mode set(hash_table_di, in, in) = hash_table_uo is det.
 
 :- pred set(K::in, V::in,
-        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
-        is det.
+    hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo) is det.
 
     % Field update for hash tables.
     % HT ^ elem(K) := V  is equivalent to  set(HT, K, V).
@@ -134,27 +133,23 @@
 :- func 'elem :='(K, hash_table(K, V), V) = hash_table(K, V).
 :- mode 'elem :='(in, hash_table_di, in) = hash_table_uo is det.
 
-    % Insert a key-value binding into a hash table.  An
-    % exception is thrown if a binding for the key is already
-    % present.
+    % Insert a key-value binding into a hash table. An exception is thrown
+    % if a binding for the key is already present.
     %
 :- func det_insert(hash_table(K, V), K, V) = hash_table(K, V).
 :- mode det_insert(hash_table_di, in, in) = hash_table_uo is det.
 
 :- pred det_insert(K::in, V::in,
-        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
-        is det.
+    hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo) is det.
 
-    % Change a key-value binding in a hash table.  An
-    % exception is thrown if a binding for the key does not
-    % already exist.
+    % Change a key-value binding in a hash table. An exception is thrown
+    % if a binding for the key does not already exist.
     %
 :- func det_update(hash_table(K, V), K, V) = hash_table(K, V).
 :- mode det_update(hash_table_di, in, in) = hash_table_uo is det.
 
 :- pred det_update(K::in, V::in,
-        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
-        is det.
+    hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo) is det.
 
     % Delete the entry for the given key, leaving the hash table
     % unchanged if there is no such entry.
@@ -163,11 +158,10 @@
 :- mode delete(hash_table_di, in) = hash_table_uo is det.
 
 :- pred delete(K::in, 
-        hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo)
-        is det.
+    hash_table(K, V)::hash_table_di, hash_table(K, V)::hash_table_uo) is det.
 
-    % Lookup the value associated with the given key.  An exception
-    % is raised if there is no entry for the key.
+    % Lookup the value associated with the given key. An exception is raised
+    % if there is no entry for the key.
     %
 :- func lookup(hash_table(K, V), K) = V.
 :- mode lookup(hash_table_ui, in) = out is det.
Index: injection.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/injection.m,v
retrieving revision 1.2
diff -u -b -r1.2 injection.m
--- injection.m	23 Jul 2005 16:04:19 -0000	1.2
+++ injection.m	17 Oct 2005 04:03:57 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -398,11 +400,8 @@
 
 injection.set_2(K, V, !F, !R) :-
 	svmap.set(K, V, !F),
-	(
-		map.search(!.R, V, OrigK)
-	->
-		% Fail if the existing key is not the same as the
-		% given key.
+    ( map.search(!.R, V, OrigK) ->
+        % Fail if the existing key is not the same as the given key.
 		K = OrigK
 	;
 		svmap.det_insert(V, K, !R)
@@ -418,11 +417,8 @@
 
 injection.det_set_2(K, V, !F, !R) :-
 	svmap.set(K, V, !F),
-	(
-		map.search(!.R, V, OrigK)
-	->
-		% Abort if the existing key is not the same as the
-		% given key.
+    ( map.search(!.R, V, OrigK) ->
+        % Abort if the existing key is not the same as the given key.
 		(
 			K = OrigK
 		->
@@ -477,8 +473,7 @@
 
 injection.insert_from_corresponding_lists(As, Bs, injection(F0, R0)) =
 		injection(F, R) :-
-	P = (pred(K::in, V::in, !.F::in, !:F::out, !.R::in, !:R::out)
-		is semidet :-
+    P = (pred(K::in, V::in, !.F::in, !:F::out, !.R::in, !:R::out) is semidet :-
 			svmap.insert(K, V, !F),
 			svmap.insert(V, K, !R)
 		),
@@ -513,9 +508,7 @@
 	injection.det_set_from_corresponding_lists(As, Bs, I)).
 
 injection.delete_key(injection(!.F, !.R), K) = injection(!:F, !:R) :-
-	(
-		svmap.remove(K, _, !F)
-	->
+    ( svmap.remove(K, _, !F) ->
 		map.foldl(filter_values_with_key(K), !.R, map.init, !:R)
 	;
 		true
@@ -527,25 +520,18 @@
 	map(V, K)::out) is det.
 
 filter_values_with_key(FilterKey, V, K, !Map) :-
-	(
-		K = FilterKey
-	->
+    ( K = FilterKey ->
 		true
 	;
 		svmap.det_insert(V, K, !Map)
 	).
 
 injection.delete_value(injection(!.F, !.R), V) = injection(!:F, !:R) :-
-	(
-		svmap.remove(V, K, !R)
-	->
+    ( svmap.remove(V, K, !R) ->
 		% Only K could possibly be associated with V.  If it is,
 		% then we throw an exception.
-		(
-			map.lookup(!.F, K, V)
-		->
-			error("injection.delete_value: " ++
-				"value is associated with a key")
+        ( map.lookup(!.F, K, V) ->
+            error("injection.delete_value: value is associated with a key")
 		;
 			true
 		)
@@ -622,9 +608,7 @@
 	= out is det.
 
 maybe_set_transformed_key(Pred, K, V, !.Map) = !:Map :-
-	(
-		Pred(V, K, L)
-	->
+    ( Pred(V, K, L) ->
 		svmap.set(L, V, !Map)
 	;
 		true
@@ -645,16 +629,12 @@
 
 insert_transformed_value_f(Func, V, K, !.Map) = !:Map :-
 	W = Func(K, V),
-	(
-		svmap.insert(W, K, !Map)
-	->
+    ( svmap.insert(W, K, !Map) ->
 		true
 	;
-		% Another value in the original was already mapped to this
-		% value.  We ensure that it had the same key.
-		(
-			map.lookup(!.Map, W, K)
-		->
+        % Another value in the original was already mapped to this value.
+        % We ensure that it had the same key.
+        ( map.lookup(!.Map, W, K) ->
 			true
 		;
 			error("injection.map_values: " ++
Index: int.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.107
diff -u -b -r1.107 int.m
--- int.m	7 Oct 2005 05:08:17 -0000	1.107
+++ int.m	17 Oct 2005 05:25:29 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1994-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -29,23 +31,19 @@
 
 	% less than
 	%
-:- pred int < int.
-:- mode in  < in is semidet.
+:- pred (int::in) < (int::in) is semidet.
 
 	% greater than
 	%
-:- pred int > int.
-:- mode in  > in is semidet.
+:- pred (int::in) > (int::in) is semidet.
 
 	% less than or equal
 	%
-:- pred int =< int.
-:- mode in  =< in is semidet.
+:- pred (int::in) =< (int::in) is semidet.
 
 	% greater than or equal
 	%
-:- pred int >= int.
-:- mode in >= in is semidet.
+:- pred (int::in) >= (int::in) is semidet.
 
 	% absolute value
 	%
@@ -94,9 +92,7 @@
 
 	% multiplication
 	%
-:- func int * int = int.
-:- mode in  * in  = uo  is det.
-
+:- func (int::in) * (int::in) = (int::uo) is det.
 :- func int__times(int, int) = int.
 
 	% subtraction
@@ -126,14 +122,12 @@
 	% is zero. See the comments at the top of math.m to find out how to
 	% disable domain checks.
 	%
-:- func int // int = int.
-:- mode in  // in  = uo  is det.
+:- func (int::in) // (int::in) = (int::uo) is det.
 
 	% (/)/2 is a synonym for (//)/2 to bring Mercury into line with
 	% the common convention for naming integer division.
 	%
-:- func int / int = int.
-:- mode in  / in  = uo  is det.
+:- func (int::in) / (int::in) = (int::uo) is det.
 
 	% unchecked_quotient(X, Y) is the same as X // Y, but the
 	% behaviour is undefined if the right operand is zero.
@@ -143,8 +137,7 @@
 	% modulus
 	% X mod Y = X - (X div Y) * Y
 	%
-:- func int mod int = int.
-:- mode in  mod in  = uo  is det.
+:- func (int::in) mod (int::in) = (int::uo) is det.
 
 	% remainder
 	% X rem Y = X - (X // Y) * Y
@@ -155,21 +148,18 @@
 	% is zero. See the comments at the top of math.m to find out how to
 	% disable domain checks.
 	%
-:- func int rem int = int.
-:- mode in rem in = uo is det.
+:- func (int::in) rem (int::in) = (int::uo) is det.
 
 	% unchecked_rem(X, Y) is the same as X rem Y, but the
 	% behaviour is undefined if the right operand is zero.
-:- func unchecked_rem(int, int) = int.
-:- mode unchecked_rem(in, in) = uo is det.
+:- func unchecked_rem(int::in, int::in) = (int::uo) is det.
 
 	% Left shift.
 	% X << Y returns X "left shifted" by Y bits. 
 	% To be precise, if Y is negative, the result is
 	% X div (2^(-Y)), otherwise the result is X * (2^Y).
 	%
-:- func int << int = int.
-:- mode in  << in  = uo  is det.
+:- func (int::in) << (int::in) = (int::uo) is det.
 
 	% unchecked_left_shift(X, Y) is the same as X << Y
 	% except that the behaviour is undefined if Y is negative,
@@ -183,8 +173,7 @@
 	% To be precise, if Y is negative, the result is
 	% X * (2^(-Y)), otherwise the result is X div (2^Y).
 	%
-:- func int >> int = int.
-:- mode in  >> in  = uo  is det.
+:- func (int::in) >> (int::in) = (int::uo) is det.
 
 	% unchecked_right_shift(X, Y) is the same as X >> Y
 	% except that the behaviour is undefined if Y is negative,
@@ -203,13 +192,11 @@
 
 	% bitwise and
 	%
-:- func int /\ int = int.
-:- mode in  /\ in  = uo  is det.
+:- func (int::in) /\ (int::in) = (int::uo) is det.
 
 	% bitwise or
 	%
-:- func int \/ int = int.
-:- mode in  \/ in  = uo  is det.
+:- func (int::in) \/ (int::in) = (int::uo) is det.
 
 	% bitwise exclusive or (xor)
 	%
@@ -220,18 +207,15 @@
 
 	% bitwise complement
 	%
-:- func \ int = int.
-:- mode \ in  = uo  is det.
+:- func \ (int::in) = (int::uo) is det.
 
 	% unary plus
 	%
-:- func + int = int.
-:- mode + in = uo is det.
+:- func + (int::in) = (int::uo) is det.
 
 	% unary minus
 	%
-:- func - int = int.
-:- mode - in = uo is det.
+:- func - (int::in) = (int::uo) is det.
 
 	% is/2, for backwards compatibility with Prolog.
 	%
@@ -360,23 +344,26 @@
 
 %-----------------------------------------------------------------------------%
 
-	% floor_to_multiple_of_bits_per_int(Int)
+    % floor_to_multiple_of_bits_per_int(Int):
 	%
-	% Returns the largest multiple of bits_per_int which
-	% is less than or equal to `Int'.
+    % Returns the largest multiple of bits_per_int which is less than or
+    % equal to `Int'.
 	%
 	% Used by sparse_bitset.m. Makes it clearer to gcc that parts
 	% of this operation can be optimized into shifts, without
 	% turning up the optimization level.
+    %
 :- func floor_to_multiple_of_bits_per_int(int) = int.
 
 	% Used by floor_to_multiple_of_bits_per_int, placed
 	% here to make sure they go in the `.opt' file.
 
 	% int__quot_bits_per_int(X) = X // bits_per_int.		
+    %
 :- func int__quot_bits_per_int(int) = int.
 
 	% int__times_bits_per_int(X) = X * bits_per_int.		
+    %
 :- func int__times_bits_per_int(int) = int.
 
 	% Used by bitmap.m.  Like the ones above, the purpose of
@@ -384,6 +371,7 @@
 	% this can be optimized.
 
 	% int__rem_bits_per_int(X) = X `rem` bits_per_int.		
+    %
 :- func int__rem_bits_per_int(int) = int.
 
 %-----------------------------------------------------------------------------%
@@ -571,9 +559,11 @@
 		Result = int__multiply_by_pow(1, Base, Exp)
 	).
 
-:- func int__multiply_by_pow(int, int, int) = int.
 	% Returns Scale0 * (Base ** Exp).
 	% Requires that Exp >= 0.
+    %
+:- func int__multiply_by_pow(int, int, int) = int.
+
 int__multiply_by_pow(Scale0, Base, Exp) = Result :-
 	( Exp = 0 ->
 		Result = Scale0
@@ -618,10 +608,6 @@
 
 %-----------------------------------------------------------------------------%
 
-/*
-:- pred int__to_float(int, float) is det.
-:- mode int__to_float(in, out) is det.
-*/
 :- pragma foreign_proc("C",
 	int__to_float(IntVal::in, FloatVal::out),
 	[will_not_call_mercury, promise_pure],
Index: integer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/integer.m,v
retrieving revision 1.18
diff -u -b -r1.18 integer.m
--- integer.m	16 Jun 2005 04:08:01 -0000	1.18
+++ integer.m	17 Oct 2005 04:22:03 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1997-2000, 2003-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -274,10 +276,11 @@
 
 big_abs(i(Sign, Ds)) = ( Sign < 0 -> big_neg(i(Sign, Ds)) ; i(Sign, Ds) ).
 
-:- pred neg_list(list(int)::in, list(int)::out, list(int)::in) is det.
+:- pred neg_list(list(int)::in, list(int)::out) is det.
 
-neg_list([]) --> [].
-neg_list([H | T]) --> [-H], neg_list(T).
+neg_list([], []).
+neg_list([H | T], [-H | NT]) :-
+    neg_list(T, NT).
 
 :- pred big_isnegative(integer::in) is semidet.
 
@@ -290,7 +293,7 @@
 :- func big_neg(integer) = integer.
 
 big_neg(i(S, Digits0)) = i(-S, Digits) :-
-	neg_list(Digits0, Digits, []).
+    neg_list(Digits0, Digits).
 
 :- func big_mul(integer, integer) = integer.
 
@@ -1036,7 +1039,7 @@
 integer__to_string(i(Sign, Digits)) = SignStr ++ digits_to_string(AbsDigits) :-
 	( Sign < 0 ->
 		SignStr = "-",
-		neg_list(Digits, AbsDigits, [])
+        neg_list(Digits, AbsDigits)
 	;
 		SignStr = "",
 		Digits = AbsDigits
Index: lexer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/lexer.m,v
retrieving revision 1.42
diff -u -b -r1.42 lexer.m
--- lexer.m	7 Sep 2005 08:30:00 -0000	1.42
+++ lexer.m	17 Oct 2005 05:25:27 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1993-2000, 2003-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -55,8 +57,7 @@
 	%
 :- type token_context == int.	% line number
 
-	% This "fat list" representation is more efficient than a list of
-	% pairs.
+    % This "fat list" representation is more efficient than a list of pairs.
 	%
 :- type token_list
 	--->	token_cons(token, token_context, token_list)
@@ -66,34 +67,33 @@
 	% Keep reading until we encounter either an `end' token
 	% (i.e. a full stop followed by whitespace) or the end-of-file.
 	%
-:- pred lexer__get_token_list(token_list::out, io::di, io::uo) is det.
+:- pred get_token_list(token_list::out, io::di, io::uo) is det.
 
 	% The type `offset' represents a (zero-based) offset into a string.
 	%
 :- type offset == int.
 
-	% lexer__string_get_token_list(String, MaxOffset, Tokens,
-	%		InitialPos, FinalPos):
-	% Scan a list of tokens from a string,
-	% starting at the current offset specified by InitialPos.
-	% Keep scanning until either we encounter either an `end' token
-	% (i.e. a full stop followed by whitespace) or until
-	% we reach MaxOffset.  (MaxOffset must be =< the length of the string.)
-	% Return the tokens scanned in Tokens, and return the position
-	% one character past the end of the last token in FinalPos.
+    % string_get_token_list(String, MaxOffset, Tokens, InitialPos, FinalPos):
+    %
+    % Scan a list of tokens from a string, starting at the current offset
+    % specified by InitialPos. Keep scanning until either we encounter either
+    % an `end' token (i.e. a full stop followed by whitespace) or until we
+    % reach MaxOffset. (MaxOffset must be =< the length of the string.)
+    % Return the tokens scanned in Tokens, and return the position one
+    % character past the end of the last token in FinalPos.
 	%
-:- pred lexer__string_get_token_list(string::in, offset::in, token_list::out,
+:- pred string_get_token_list(string::in, offset::in, token_list::out,
 	posn::in, posn::out) is det.
 
-	% lexer__string_get_token_list(String, Tokens, InitialPos, FinalPos):
+    % string_get_token_list(String, Tokens, InitialPos, FinalPos):
 	% calls string_get_token_list/5 above with MaxPos = length of String.
 	%
-:- pred lexer__string_get_token_list(string::in, token_list::out,
+:- pred string_get_token_list(string::in, token_list::out,
 	posn::in, posn::out) is det.
 
 	% Convert a token to a human-readable string describing the token.
 	%
-:- pred lexer__token_to_string(token::in, string::out) is det.
+:- pred token_to_string(token::in, string::out) is det.
 
 %-----------------------------------------------------------------------------%
 :- implementation.
@@ -101,10 +101,11 @@
 
 :- interface.
 
-	% lexer__graphic_token_char(Char): true iff `Char'
+    % graphic_token_char(Char): true iff `Char'
 	% is "graphic token char" (ISO Prolog 6.4.2).
 	% This is exported for use by term_io__quote_atom.
-:- pred lexer__graphic_token_char(char::in) is semidet.
+    %
+:- pred graphic_token_char(char::in) is semidet.
 
 %-----------------------------------------------------------------------------%
 
@@ -116,7 +117,6 @@
 :- import_module string.
 :- import_module term.
 
-%
 % Note that there are two implementations of most predicates here:
 % one which deals with strings, the other that deals with io__states.
 % We can't write the io__state version in terms of the string
@@ -144,49 +144,48 @@
 % should also think about moving the `String' and `Len' arguments
 % into the posn (or making a new `lexer_state' struct which contains
 % both the posn and the String and Len arguments).
-%
 
 %-----------------------------------------------------------------------------%
 
-lexer__token_to_string(name(Name), String) :-
+token_to_string(name(Name), String) :-
 	string__append_list(["token '", Name, "'"], String).
-lexer__token_to_string(variable(Var), String) :-
+token_to_string(variable(Var), String) :-
 	string__append_list(["variable `", Var, "'"], String).
-lexer__token_to_string(integer(Int), String) :-
+token_to_string(integer(Int), String) :-
 	string__int_to_string(Int, IntString),
 	string__append_list(["integer `", IntString, "'"], String).
-lexer__token_to_string(float(Float), String) :-
+token_to_string(float(Float), String) :-
 	string__float_to_string(Float, FloatString),
 	string__append_list(["float `", FloatString, "'"], String).
-lexer__token_to_string(string(Token), String) :-
+token_to_string(string(Token), String) :-
 	string__append_list(["string """, Token, """"], String).
-lexer__token_to_string(open, "token ` ('").
-lexer__token_to_string(open_ct, "token `('").
-lexer__token_to_string(close, "token `)'").
-lexer__token_to_string(open_list, "token `['").
-lexer__token_to_string(close_list, "token `]'").
-lexer__token_to_string(open_curly, "token `{'").
-lexer__token_to_string(close_curly, "token `}'").
-lexer__token_to_string(ht_sep, "token `|'").
-lexer__token_to_string(comma, "token `,'").
-lexer__token_to_string(end, "token `. '").
-lexer__token_to_string(eof, "end-of-file").
-lexer__token_to_string(junk(JunkChar), String) :-
+token_to_string(open, "token ` ('").
+token_to_string(open_ct, "token `('").
+token_to_string(close, "token `)'").
+token_to_string(open_list, "token `['").
+token_to_string(close_list, "token `]'").
+token_to_string(open_curly, "token `{'").
+token_to_string(close_curly, "token `}'").
+token_to_string(ht_sep, "token `|'").
+token_to_string(comma, "token `,'").
+token_to_string(end, "token `. '").
+token_to_string(eof, "end-of-file").
+token_to_string(junk(JunkChar), String) :-
 	char__to_int(JunkChar, Code),
 	string__int_to_base_string(Code, 16, Hex),
 	string__append_list(["illegal character <<0x", Hex, ">>"], String).
-lexer__token_to_string(io_error(IO_Error), String) :-
+token_to_string(io_error(IO_Error), String) :-
 	io__error_message(IO_Error, IO_ErrorMessage),
 	string__append("I/O error: ", IO_ErrorMessage, String).
-lexer__token_to_string(error(Message), String) :-
+token_to_string(error(Message), String) :-
 	string__append_list(["illegal token (", Message, ")"], String).
-lexer__token_to_string(integer_dot(Int), String) :-
+token_to_string(integer_dot(Int), String) :-
 	string__int_to_string(Int, IntString),
 	string__append_list(["integer `", IntString, "'."], String).
 
 	% We build the tokens up as lists of characters in reverse order.
 	% When we get to the end of each token, we call
-	% `lexer__rev_char_list_to_string/2' to convert that representation
+    % `rev_char_list_to_string/2' to convert that representation
 	% into a string.
 
 	% Comments of the form
@@ -194,73 +193,74 @@
 	% mean that we are parsing a `foo', and we've already scanned
 	% past the `bar', so now we need to match with a `baz'.
 
-lexer__get_token_list(Tokens, !IO) :-
-	lexer__get_token(Token, Context, !IO),
-	lexer__get_token_list_2(Token, Context, Tokens, !IO).
+get_token_list(Tokens, !IO) :-
+    get_token(Token, Context, !IO),
+    get_token_list_2(Token, Context, Tokens, !IO).
 
-:- pred lexer__get_token_list_2(token::in, token_context::in, token_list::out,
+:- pred get_token_list_2(token::in, token_context::in, token_list::out,
 	io::di, io::uo) is det.
 
-lexer__get_token_list_2(Token0, Context0, Tokens, !IO) :-
+get_token_list_2(Token0, Context0, Tokens, !IO) :-
 	( Token0 = eof ->
 		Tokens = token_nil
 	; ( Token0 = end ; Token0 = error(_) ; Token0 = io_error(_) ) ->
 		Tokens = token_cons(Token0, Context0, token_nil)
 	; Token0 = integer_dot(Int) ->
-		lexer__get_context(Context1, !IO),
-		lexer__get_dot(Token1, !IO),
-		lexer__get_token_list_2(Token1, Context1, Tokens1, !IO),
+        get_context(Context1, !IO),
+        get_dot(Token1, !IO),
+        get_token_list_2(Token1, Context1, Tokens1, !IO),
 		Tokens = token_cons(integer(Int), Context0, Tokens1)
 	;
-		lexer__get_token(Token1, Context1, !IO),
-		lexer__get_token_list_2(Token1, Context1, Tokens1, !IO),
+        get_token(Token1, Context1, !IO),
+        get_token_list_2(Token1, Context1, Tokens1, !IO),
 		Tokens = token_cons(Token0, Context0, Tokens1)
 	).
 
-lexer__string_get_token_list(String, Tokens, !Posn) :-
+string_get_token_list(String, Tokens, !Posn) :-
 	string__length(String, Len),
-	lexer__string_get_token_list(String, Len, Tokens, !Posn).
+    string_get_token_list(String, Len, Tokens, !Posn).
 
-lexer__string_get_token_list(String, Len, Tokens, !Posn) :-
-	lexer__string_get_token(String, Len, Token, Context, !Posn),
+string_get_token_list(String, Len, Tokens, !Posn) :-
+    string_get_token(String, Len, Token, Context, !Posn),
 	( Token = eof ->
 		Tokens = token_nil
 	; ( Token = end ; Token = error(_) ; Token = io_error(_) ) ->
 		Tokens = token_cons(Token, Context, token_nil)
 	;
 		Tokens = token_cons(Token, Context, Tokens1),
-		lexer__string_get_token_list(String, Len, Tokens1, !Posn)
+        string_get_token_list(String, Len, Tokens1, !Posn)
 	).
 
 %-----------------------------------------------------------------------------%
+%
+% Some low-level routines.
 
-% some low-level routines
-
-:- pred lexer__get_context(token_context::out, io::di, io::uo) is det.
+:- pred get_context(token_context::out, io::di, io::uo) is det.
 
-lexer__get_context(Context, !IO) :-
+get_context(Context, !IO) :-
 	io__get_line_number(Context, !IO).
 
 :- type string_token_context == token_context.
 
-:- pred lexer__string_get_context(posn::in, string_token_context::out,
+:- pred string_get_context(posn::in, string_token_context::out,
 	posn::in, posn::out) is det.
 
-lexer__string_get_context(StartPosn, Context, !Posn) :-
+string_get_context(StartPosn, Context, !Posn) :-
 	StartPosn = posn(StartLineNum, _, _),
 	Context = StartLineNum.
 	% In future, we might want to modify this code to read something
 	% like this:
+    %
 	%	posn_to_line_and_column(StartPosn, StartLineNum, StartColumn),
 	%	posn_to_line_and_column(!.Posn, EndLineNum, EndColumn),
 	%	Context = detailed(StartLine, StartColumn, EndLine, EndColumn).
 
-:- pred lexer__string_read_char(string::in, int::in, char::out,
+:- pred string_read_char(string::in, int::in, char::out,
 	posn::in, posn::out) is semidet.
 
-:- pragma inline(lexer__string_read_char/5).
+:- pragma inline(string_read_char/5).
 
-lexer__string_read_char(String, Len, Char, Posn0, Posn) :-
+string_read_char(String, Len, Char, Posn0, Posn) :-
 	Posn0 = posn(LineNum0, LineOffset0, Offset0),
 	Offset0 < Len,
 	string__unsafe_index(String, Offset0, Char),
@@ -272,9 +272,9 @@
 		Posn = posn(LineNum0, LineOffset0, Offset)
 	).
 
-:- pred lexer__string_ungetchar(string::in, posn::in, posn::out) is det.
+:- pred string_ungetchar(string::in, posn::in, posn::out) is det.
 
-lexer__string_ungetchar(String, Posn0, Posn) :-
+string_ungetchar(String, Posn0, Posn) :-
 	Posn0 = posn(LineNum0, LineOffset0, Offset0),
 	Offset = Offset0 - 1,
 	string__unsafe_index(String, Offset, Char),
@@ -285,295 +285,276 @@
 		Posn = posn(LineNum0, LineOffset0, Offset)
 	).
 
-:- pred lexer__grab_string(string::in, posn::in, string::out,
+:- pred grab_string(string::in, posn::in, string::out,
 	posn::in, posn::out) is det.
 
-lexer__grab_string(String, Posn0, SubString, Posn, Posn) :-
+grab_string(String, Posn0, SubString, Posn, Posn) :-
 	Posn0 = posn(_, _, Offset0),
 	Posn = posn(_, _, Offset),
 	Count = Offset - Offset0,
 	string__unsafe_substring(String, Offset0, Count, SubString).
 
-:- pred lexer__string_set_line_number(int::in, posn::in, posn::out) is det.
+:- pred string_set_line_number(int::in, posn::in, posn::out) is det.
 
-lexer__string_set_line_number(LineNumber, Posn0, Posn) :-
+string_set_line_number(LineNumber, Posn0, Posn) :-
 	Posn0 = posn(_, _, Offset),
 	Posn = posn(LineNumber, Offset, Offset).
 
 %-----------------------------------------------------------------------------%
 
-:- pred lexer__get_token(token::out, token_context::out, io::di, io::uo)
+:- pred get_token(token::out, token_context::out, io::di, io::uo)
 	is det.
 
-lexer__get_token(Token, Context, !IO) :-
+get_token(Token, Context, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = eof
 	;
 		Result = ok(Char),
 		( char__is_whitespace(Char) ->
-			lexer__get_token_2(Token, Context, !IO)
+            get_token_2(Token, Context, !IO)
 		; ( char__is_upper(Char) ; Char = '_' ) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_variable([Char], Token, !IO)
+            get_context(Context, !IO),
+            get_variable([Char], Token, !IO)
 		; char__is_lower(Char) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_name([Char], Token, !IO)
+            get_context(Context, !IO),
+            get_name([Char], Token, !IO)
 		; Char = '0' ->
-			lexer__get_context(Context, !IO),
-			lexer__get_zero(Token, !IO)
+            get_context(Context, !IO),
+            get_zero(Token, !IO)
 		; char__is_digit(Char) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_number([Char], Token, !IO)
-		; lexer__special_token(Char, SpecialToken) ->
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
+            get_number([Char], Token, !IO)
+        ; special_token(Char, SpecialToken) ->
+            get_context(Context, !IO),
 			( SpecialToken = open ->
 				Token = open_ct
 			;
 				Token = SpecialToken
 			)
 		; Char = ('.') ->
-			lexer__get_context(Context, !IO),
-			lexer__get_dot(Token, !IO)
+            get_context(Context, !IO),
+            get_dot(Token, !IO)
 		; Char = ('%') ->
-			lexer__skip_to_eol(Token, Context, !IO)
+            skip_to_eol(Token, Context, !IO)
 		; ( Char = '"' ; Char = '''' ) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_quoted_name(Char, [], Token, !IO)
+            get_context(Context, !IO),
+            get_quoted_name(Char, [], Token, !IO)
 		; Char = ('/') ->
-			lexer__get_slash(Token, Context, !IO)
+            get_slash(Token, Context, !IO)
 		; Char = ('#') ->
-			lexer__get_source_line_number([], Token, Context, !IO)
+            get_source_line_number([], Token, Context, !IO)
 		; Char = ('`') ->
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
 			Token = name("`")
-		; lexer__graphic_token_char(Char) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_graphic([Char], Token, !IO)
+        ; graphic_token_char(Char) ->
+            get_context(Context, !IO),
+            get_graphic([Char], Token, !IO)
 		;
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
 			Token = junk(Char)
 		)
 	).
 
-:- pred lexer__string_get_token(string::in, int::in, token::out,
+:- pred string_get_token(string::in, int::in, token::out,
 	token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_token(String, Len, Token, Context, !Posn) :-
+string_get_token(String, Len, Token, Context, !Posn) :-
 	Posn0 = !.Posn,
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_whitespace(Char) ->
-			lexer__string_get_token_2(String, Len, Token, Context,
-				!Posn)
+            string_get_token_2(String, Len, Token, Context, !Posn)
 		; ( char__is_upper(Char) ; Char = '_' ) ->
-			lexer__string_get_variable(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_variable(String, Len, Posn0, Token, Context, !Posn)
 		; char__is_lower(Char) ->
-			lexer__string_get_name(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_name(String, Len, Posn0, Token, Context, !Posn)
 		; Char = '0' ->
-			lexer__string_get_zero(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_zero(String, Len, Posn0, Token, Context, !Posn)
 		; char__is_digit(Char) ->
-			lexer__string_get_number(String, Len, Posn0,
-				Token, Context, !Posn)
-		; lexer__special_token(Char, SpecialToken) ->
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_number(String, Len, Posn0, Token, Context, !Posn)
+        ; special_token(Char, SpecialToken) ->
+            string_get_context(Posn0, Context, !Posn),
 			( SpecialToken = open ->
 				Token = open_ct
 			;
 				Token = SpecialToken
 			)
 		; Char = ('.') ->
-			lexer__string_get_dot(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_dot(String, Len, Posn0, Token, Context, !Posn)
 		; Char = ('%') ->
-			lexer__string_skip_to_eol(String, Len, Token, Context,
-			!Posn)
+            string_skip_to_eol(String, Len, Token, Context, !Posn)
 		; ( Char = '"' ; Char = '''' ) ->
-			lexer__string_get_quoted_name(String, Len, Char, [],
-				Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, Char, [], Posn0, Token,
+                Context, !Posn)
 		; Char = ('/') ->
-			lexer__string_get_slash(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_slash(String, Len, Posn0, Token, Context, !Posn)
 		; Char = ('#') ->
-			lexer__string_get_source_line_number(String, Len,
-				!.Posn, Token, Context, !Posn)
+            string_get_source_line_number(String, Len, !.Posn, Token, Context,
+                !Posn)
 		; Char = ('`') ->
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = name("`")
-		; lexer__graphic_token_char(Char) ->
-			lexer__string_get_graphic(String, Len, Posn0,
-				Token, Context, !Posn)
+        ; graphic_token_char(Char) ->
+            string_get_graphic(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = junk(Char)
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = eof
 	).
 
 %-----------------------------------------------------------------------------%
 
-:- pred lexer__get_token_2(token::out, token_context::out, io::di, io::uo)
+    % This is just like get_token, except that we have already scanned past
+    % some whitespace, so '(' gets scanned as `open' rather than `open_ct'.
+    %
+:- pred get_token_2(token::out, token_context::out, io::di, io::uo)
 	is det.
 
-	% This is just like get_token, except that we have already
-	% scanned past some whitespace, so '(' gets scanned as `open'
-	% rather than `open_ct'.
-
-lexer__get_token_2(Token, Context, !IO) :-
+get_token_2(Token, Context, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = eof
 	;
 		Result = ok(Char),
 		( char__is_whitespace(Char) ->
-			lexer__get_token_2(Token, Context, !IO)
+            get_token_2(Token, Context, !IO)
 		; ( char__is_upper(Char) ; Char = '_' ) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_variable([Char], Token, !IO)
+            get_context(Context, !IO),
+            get_variable([Char], Token, !IO)
 		; char__is_lower(Char) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_name([Char], Token, !IO)
+            get_context(Context, !IO),
+            get_name([Char], Token, !IO)
 		; Char = '0' ->
-			lexer__get_context(Context, !IO),
-			lexer__get_zero(Token, !IO)
+            get_context(Context, !IO),
+            get_zero(Token, !IO)
 		; char__is_digit(Char) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_number([Char], Token, !IO)
-		; lexer__special_token(Char, SpecialToken) ->
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
+            get_number([Char], Token, !IO)
+        ; special_token(Char, SpecialToken) ->
+            get_context(Context, !IO),
 			Token = SpecialToken
 		; Char = ('.') ->
-			lexer__get_context(Context, !IO),
-			lexer__get_dot(Token, !IO)
+            get_context(Context, !IO),
+            get_dot(Token, !IO)
 		; Char = ('%') ->
-			lexer__skip_to_eol(Token, Context, !IO)
+            skip_to_eol(Token, Context, !IO)
 		; ( Char = '"' ; Char = '''' ) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_quoted_name(Char, [], Token, !IO)
+            get_context(Context, !IO),
+            get_quoted_name(Char, [], Token, !IO)
 		; Char = ('/') ->
-			lexer__get_slash(Token, Context, !IO)
+            get_slash(Token, Context, !IO)
 		; Char = ('#') ->
-			lexer__get_source_line_number([], Token, Context, !IO)
+            get_source_line_number([], Token, Context, !IO)
 		; Char = ('`') ->
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
 			Token = name("`")
-		; lexer__graphic_token_char(Char) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_graphic([Char], Token, !IO)
+        ; graphic_token_char(Char) ->
+            get_context(Context, !IO),
+            get_graphic([Char], Token, !IO)
 		;
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
 			Token = junk(Char)
 		)
 	).
 
-:- pred lexer__string_get_token_2(string::in, int::in, token::out,
+:- pred string_get_token_2(string::in, int::in, token::out,
 	token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_token_2(String, Len, Token, Context, !Posn) :-
+string_get_token_2(String, Len, Token, Context, !Posn) :-
 	Posn0 = !.Posn,
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_whitespace(Char) ->
-			lexer__string_get_token_2(String, Len, Token, Context,
-				!Posn)
+            string_get_token_2(String, Len, Token, Context, !Posn)
 		; ( char__is_upper(Char) ; Char = '_' ) ->
-			lexer__string_get_variable(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_variable(String, Len, Posn0, Token, Context, !Posn)
 		; char__is_lower(Char) ->
-			lexer__string_get_name(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_name(String, Len, Posn0, Token, Context, !Posn)
 		; Char = '0' ->
-			lexer__string_get_zero(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_zero(String, Len, Posn0, Token, Context, !Posn)
 		; char__is_digit(Char) ->
-			lexer__string_get_number(String, Len, Posn0,
-				Token, Context, !Posn)
-		; lexer__special_token(Char, SpecialToken) ->
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_number(String, Len, Posn0, Token, Context, !Posn)
+        ; special_token(Char, SpecialToken) ->
+            string_get_context(Posn0, Context, !Posn),
 			Token = SpecialToken
 		; Char = ('.') ->
-			lexer__string_get_dot(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_dot(String, Len, Posn0, Token, Context, !Posn)
 		; Char = ('%') ->
-			lexer__string_skip_to_eol(String, Len, Token, Context,
-			!Posn)
+            string_skip_to_eol(String, Len, Token, Context, !Posn)
 		; ( Char = '"' ; Char = '''' ) ->
-			lexer__string_get_quoted_name(String, Len, Char, [],
-				Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, Char, [], Posn0, Token,
+                Context, !Posn)
 		; Char = ('/') ->
-			lexer__string_get_slash(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_slash(String, Len, Posn0, Token, Context, !Posn)
 		; Char = ('#') ->
-			lexer__string_get_source_line_number(String, Len,
-				!.Posn, Token, Context, !Posn)
+            string_get_source_line_number(String, Len, !.Posn, Token, Context,
+                !Posn)
 		; Char = ('`') ->
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = name("`")
-		; lexer__graphic_token_char(Char) ->
-			lexer__string_get_graphic(String, Len, Posn0,
-				Token, Context, !Posn)
+        ; graphic_token_char(Char) ->
+            string_get_graphic(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = junk(Char)
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = eof
 	).
 
 %-----------------------------------------------------------------------------%
 
-:- pred lexer__special_token(char::in, token::out) is semidet.
+:- pred special_token(char::in, token::out) is semidet.
 
-lexer__special_token('(', open).	% May get converted to open_ct
-lexer__special_token(')', close).
-lexer__special_token('[', open_list).
-lexer__special_token(']', close_list).
-lexer__special_token('{', open_curly).
-lexer__special_token('}', close_curly).
-lexer__special_token('|', ht_sep).
-lexer__special_token(',', comma).
-lexer__special_token(';', name(";")).
-
-lexer__graphic_token_char('!').
-lexer__graphic_token_char('#').
-lexer__graphic_token_char('$').
-lexer__graphic_token_char('&').
-lexer__graphic_token_char('*').
-lexer__graphic_token_char('+').
-lexer__graphic_token_char('-').
-lexer__graphic_token_char('.').
-lexer__graphic_token_char('/').
-lexer__graphic_token_char(':').
-lexer__graphic_token_char('<').
-lexer__graphic_token_char('=').
-lexer__graphic_token_char('>').
-lexer__graphic_token_char('?').
-lexer__graphic_token_char('@').
-lexer__graphic_token_char('^').
-lexer__graphic_token_char('~').
-lexer__graphic_token_char('\\').
+special_token('(', open).    % May get converted to open_ct
+special_token(')', close).
+special_token('[', open_list).
+special_token(']', close_list).
+special_token('{', open_curly).
+special_token('}', close_curly).
+special_token('|', ht_sep).
+special_token(',', comma).
+special_token(';', name(";")).
+
+graphic_token_char('!').
+graphic_token_char('#').
+graphic_token_char('$').
+graphic_token_char('&').
+graphic_token_char('*').
+graphic_token_char('+').
+graphic_token_char('-').
+graphic_token_char('.').
+graphic_token_char('/').
+graphic_token_char(':').
+graphic_token_char('<').
+graphic_token_char('=').
+graphic_token_char('>').
+graphic_token_char('?').
+graphic_token_char('@').
+graphic_token_char('^').
+graphic_token_char('~').
+graphic_token_char('\\').
 
 %-----------------------------------------------------------------------------%
 
-:- pred lexer__get_dot(token::out, io::di, io::uo) is det.
+:- pred get_dot(token::out, io::di, io::uo) is det.
 
-lexer__get_dot(Token, !IO) :-
+get_dot(Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -583,232 +564,218 @@
 		Token = end
 	;
 		Result = ok(Char),
-		( lexer__whitespace_after_dot(Char) ->
+        ( whitespace_after_dot(Char) ->
 			io__putback_char(Char, !IO),
 			Token = end
-		; lexer__graphic_token_char(Char) ->
-			lexer__get_graphic([Char, '.'], Token, !IO)
+        ; graphic_token_char(Char) ->
+            get_graphic([Char, '.'], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
 			Token = name(".")
 		)
 	).
 
-:- pred lexer__string_get_dot(string::in, int::in, posn::in, token::out,
-	string_token_context::out,
-	posn::in, posn::out) is det.
+:- pred string_get_dot(string::in, int::in, posn::in, token::out,
+    string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_dot(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
-		( lexer__whitespace_after_dot(Char) ->
-			lexer__string_ungetchar(String, !Posn),
-			lexer__string_get_context(Posn0, Context, !Posn),
+string_get_dot(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
+        ( whitespace_after_dot(Char) ->
+            string_ungetchar(String, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = end
-		; lexer__graphic_token_char(Char) ->
-			lexer__string_get_graphic(String, Len, Posn0,
-				Token, Context, !Posn)
+        ; graphic_token_char(Char) ->
+            string_get_graphic(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_ungetchar(String, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = name(".")
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = end
 	).
 
-:- pred lexer__whitespace_after_dot(char::in) is semidet.
+:- pred whitespace_after_dot(char::in) is semidet.
 
-lexer__whitespace_after_dot(Char) :-
+whitespace_after_dot(Char) :-
 	( char__is_whitespace(Char) 
 	; Char = '%'
 	).
 
 %-----------------------------------------------------------------------------%
+%
+% Comments.
 
-	% comments
-
-:- pred lexer__skip_to_eol(token::out, token_context::out, io::di, io::uo)
+:- pred skip_to_eol(token::out, token_context::out, io::di, io::uo)
 	is det.
 
-lexer__skip_to_eol(Token, Context, !IO) :-
+skip_to_eol(Token, Context, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = eof
 	;
 		Result = ok(Char),
 		( Char = '\n' ->
-			lexer__get_token_2(Token, Context, !IO)
+            get_token_2(Token, Context, !IO)
 		;
-			lexer__skip_to_eol(Token, Context, !IO)
+            skip_to_eol(Token, Context, !IO)
 		)
 	).
 
-:- pred lexer__string_skip_to_eol(string::in, int::in, token::out,
+:- pred string_skip_to_eol(string::in, int::in, token::out,
 	token_context::out, posn::in, posn::out) is det.
 
-lexer__string_skip_to_eol(String, Len, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_skip_to_eol(String, Len, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( Char = '\n' ->
-			lexer__string_get_token_2(String, Len, Token, Context,
-				!Posn)
+            string_get_token_2(String, Len, Token, Context, !Posn)
 		;
-			lexer__string_skip_to_eol(String, Len, Token, Context,
-				!Posn)
+            string_skip_to_eol(String, Len, Token, Context, !Posn)
 		)
 	;
-		lexer__string_get_context(!.Posn, Context, !Posn),
+        string_get_context(!.Posn, Context, !Posn),
 		Token = eof
 	).
 
-:- pred lexer__get_slash(token::out, token_context::out, io::di, io::uo)
-	is det.
+:- pred get_slash(token::out, token_context::out, io::di, io::uo) is det.
 
-lexer__get_slash(Token, Context, !IO) :-
+get_slash(Token, Context, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = name("/")
 	;
 		Result = ok(Char),
 		( Char = ('*') ->
-			lexer__get_comment(Token, Context, !IO)
-		; lexer__graphic_token_char(Char) ->
-			lexer__get_context(Context, !IO),
-			lexer__get_graphic([Char, '/'], Token, !IO)
+            get_comment(Token, Context, !IO)
+        ; graphic_token_char(Char) ->
+            get_context(Context, !IO),
+            get_graphic([Char, '/'], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
 			Token = name("/")
 		)
 	).
 
-:- pred lexer__string_get_slash(string::in, int::in, posn::in, token::out,
-	string_token_context::out,
-	posn::in, posn::out) is det.
+:- pred string_get_slash(string::in, int::in, posn::in, token::out,
+    string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_slash(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_slash(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( Char = ('*') ->
-			lexer__string_get_comment(String, Len, Posn0,
-				Token, Context, !Posn)
-		; lexer__graphic_token_char(Char) ->
-			lexer__string_get_graphic(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_comment(String, Len, Posn0, Token, Context, !Posn)
+        ; graphic_token_char(Char) ->
+            string_get_graphic(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_ungetchar(String, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = name("/")
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = name("/")
 	).
 
-:- pred lexer__get_comment(token::out, token_context::out,
+:- pred get_comment(token::out, token_context::out,
 	io::di, io::uo) is det.
 
-lexer__get_comment(Token, Context, !IO) :-
+get_comment(Token, Context, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = error("unterminated '/*' comment")
 	;
 		Result = ok(Char),
 		( Char = ('*') ->
-			lexer__get_comment_2(Token, Context, !IO)
+            get_comment_2(Token, Context, !IO)
 		;
-			lexer__get_comment(Token, Context, !IO)
+            get_comment(Token, Context, !IO)
 		)
 	).
 
-:- pred lexer__string_get_comment(string::in, int::in, posn::in, token::out,
+:- pred string_get_comment(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_comment(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_comment(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( Char = ('*') ->
-			lexer__string_get_comment_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_comment_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_comment(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_comment(String, Len, Posn0, Token, Context, !Posn)
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = error("unterminated '/*' comment")
 	).
 
-:- pred lexer__get_comment_2(token::out, token_context::out, io::di, io::uo)
-	is det.
+:- pred get_comment_2(token::out, token_context::out, io::di, io::uo) is det.
 
-lexer__get_comment_2(Token, Context, !IO) :-
+get_comment_2(Token, Context, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = error("unterminated '/*' comment")
 	;
 		Result = ok(Char),
 		( Char = ('/') ->
 			% end of /* ... */ comment, so get next token
-			lexer__get_token_2(Token, Context, !IO)
+            get_token_2(Token, Context, !IO)
 		; Char = ('*') ->
-			lexer__get_comment_2(Token, Context, !IO)
+            get_comment_2(Token, Context, !IO)
 		;
-			lexer__get_comment(Token, Context, !IO)
+            get_comment(Token, Context, !IO)
 		)
 	).
 
-:- pred lexer__string_get_comment_2(string::in, int::in, posn::in, token::out,
+:- pred string_get_comment_2(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_comment_2(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_comment_2(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( Char = ('/') ->
 			% end of /* ... */ comment, so get next token
-			lexer__string_get_token_2(String, Len, Token, Context,
-				!Posn)
+            string_get_token_2(String, Len, Token, Context, !Posn)
 		; Char = ('*') ->
-			lexer__string_get_comment_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_comment_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_comment(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_comment(String, Len, Posn0, Token, Context, !Posn)
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = error("unterminated '/*' comment")
 	).
 
 %-----------------------------------------------------------------------------%
+%
+% Quoted names and quoted strings.
 
-	% quoted names and quoted strings
-
-:- pred lexer__get_quoted_name(char::in, list(char)::in, token::out,
+:- pred get_quoted_name(char::in, list(char)::in, token::out,
 	io::di, io::uo) is det.
 
-lexer__get_quoted_name(QuoteChar, Chars, Token, !IO) :-
+get_quoted_name(QuoteChar, Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -819,85 +786,81 @@
 	;
 		Result = ok(Char),
 		( Char = QuoteChar ->
-			lexer__get_quoted_name_quote(QuoteChar, Chars, Token,
-				!IO)
+            get_quoted_name_quote(QuoteChar, Chars, Token, !IO)
 		; Char = ('\\') ->
-			lexer__get_quoted_name_escape(QuoteChar, Chars, Token,
-				!IO)
+            get_quoted_name_escape(QuoteChar, Chars, Token, !IO)
 		;
-			lexer__get_quoted_name(QuoteChar, [Char | Chars],
-				Token, !IO)
+            get_quoted_name(QuoteChar, [Char | Chars], Token, !IO)
 		)
 	).
 
-:- pred lexer__string_get_quoted_name(string::in, int::in, char::in,
+:- pred string_get_quoted_name(string::in, int::in, char::in,
 	list(char)::in, posn::in, token::out, string_token_context::out,
 	posn::in, posn::out) is det.
 
-lexer__string_get_quoted_name(String, Len, QuoteChar, Chars, Posn0,
-		Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_quoted_name(String, Len, QuoteChar, Chars, Posn0, Token, Context,
+        !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( Char = QuoteChar ->
-			lexer__string_get_quoted_name_quote(String, Len,
-				QuoteChar, Chars, Posn0, Token, Context, !Posn)
+            string_get_quoted_name_quote(String, Len, QuoteChar, Chars,
+                Posn0, Token, Context, !Posn)
 		; Char = ('\\') ->
-			lexer__string_get_quoted_name_escape(String, Len,
-				QuoteChar, Chars, Posn0, Token, Context, !Posn)
+            string_get_quoted_name_escape(String, Len, QuoteChar, Chars,
+                Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_quoted_name(String, Len, QuoteChar,
-				[Char | Chars], Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, QuoteChar, [Char | Chars],
+                Posn0, Token, Context, !Posn)
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = error("unterminated quote")
 	).
 
-:- pred lexer__get_quoted_name_quote(char::in, list(char)::in, token::out,
+:- pred get_quoted_name_quote(char::in, list(char)::in, token::out,
 	io::di, io::uo) is det.
 
-lexer__get_quoted_name_quote(QuoteChar, Chars, Token, !IO) :-
+get_quoted_name_quote(QuoteChar, Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__finish_quoted_name(QuoteChar, Chars, Token)
+        finish_quoted_name(QuoteChar, Chars, Token)
 	;
 		Result = ok(Char),
 		( Char = QuoteChar ->
-			lexer__get_quoted_name(QuoteChar, [Char | Chars],
-				Token, !IO)
+            get_quoted_name(QuoteChar, [Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__finish_quoted_name(QuoteChar, Chars, Token)
+            finish_quoted_name(QuoteChar, Chars, Token)
 		)
 	).
 
-:- pred lexer__string_get_quoted_name_quote(string::in, int::in, char::in,
+:- pred string_get_quoted_name_quote(string::in, int::in, char::in,
 	list(char)::in, posn::in, token::out, string_token_context::out,
 	posn::in, posn::out) is det.
 
-lexer__string_get_quoted_name_quote(String, Len, QuoteChar, Chars, Posn0,
+string_get_quoted_name_quote(String, Len, QuoteChar, Chars, Posn0,
 		Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( Char = QuoteChar ->
-			lexer__string_get_quoted_name(String, Len, QuoteChar,
-				[Char | Chars], Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, QuoteChar, [Char | Chars],
+                Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__string_get_context(Posn0, Context, !Posn),
-			lexer__finish_quoted_name(QuoteChar, Chars, Token)
+            string_ungetchar(String, !Posn),
+            string_get_context(Posn0, Context, !Posn),
+            finish_quoted_name(QuoteChar, Chars, Token)
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
-		lexer__finish_quoted_name(QuoteChar, Chars, Token)
+        string_get_context(Posn0, Context, !Posn),
+        finish_quoted_name(QuoteChar, Chars, Token)
 	).
 
-:- pred lexer__finish_quoted_name(char::in, list(char)::in, token::out) is det.
+:- pred finish_quoted_name(char::in, list(char)::in, token::out) is det.
 
-lexer__finish_quoted_name(QuoteChar, Chars, Token) :-
-	lexer__rev_char_list_to_string(Chars, String),
+finish_quoted_name(QuoteChar, Chars, Token) :-
+    rev_char_list_to_string(Chars, String),
 	( QuoteChar = '''' ->
 		Token = name(String)
 	; QuoteChar = '"' ->
@@ -906,10 +869,10 @@
 		error("lexer.m: unknown quote character")
 	).
 
-:- pred lexer__get_quoted_name_escape(char::in, list(char)::in, token::out,
+:- pred get_quoted_name_escape(char::in, list(char)::in, token::out,
 	io::di, io::uo) is det.
 
-lexer__get_quoted_name_escape(QuoteChar, Chars, Token, !IO) :-
+get_quoted_name_escape(QuoteChar, Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -920,77 +883,73 @@
 	;
 		Result = ok(Char),
 		( Char = '\n' ->
-			lexer__get_quoted_name(QuoteChar, Chars, Token, !IO)
+            get_quoted_name(QuoteChar, Chars, Token, !IO)
 		; Char = '\r' ->
-			% Files created on Windows may have an extra
-			% return character.
-			lexer__get_quoted_name_escape(QuoteChar, Chars, Token, 
-				!IO)
-		; lexer__escape_char(Char, EscapedChar) ->
+            % Files created on Windows may have an extra return character.
+            get_quoted_name_escape(QuoteChar, Chars, Token, !IO)
+        ; escape_char(Char, EscapedChar) ->
 			Chars1 = [EscapedChar | Chars],
-			lexer__get_quoted_name(QuoteChar, Chars1, Token, !IO)
+            get_quoted_name(QuoteChar, Chars1, Token, !IO)
 		; Char = 'x' ->
-			lexer__get_hex_escape(QuoteChar, Chars, [], Token, !IO)
+            get_hex_escape(QuoteChar, Chars, [], Token, !IO)
 		; char__is_octal_digit(Char) ->
-			lexer__get_octal_escape(QuoteChar, Chars, [Char],
-				Token, !IO)
+            get_octal_escape(QuoteChar, Chars, [Char], Token, !IO)
 		;
 			Token = error("invalid escape character")
 		)
 	).
 
-:- pred lexer__string_get_quoted_name_escape(string::in, int::in, char::in,
+:- pred string_get_quoted_name_escape(string::in, int::in, char::in,
 	list(char)::in, posn::in, token::out, string_token_context::out,
 	posn::in, posn::out) is det.
 
-lexer__string_get_quoted_name_escape(String, Len, QuoteChar, Chars, Posn0,
+string_get_quoted_name_escape(String, Len, QuoteChar, Chars, Posn0,
 		Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( Char = '\n' ->
-			lexer__string_get_quoted_name(String, Len, QuoteChar,
-				Chars, Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, QuoteChar, Chars,
+                Posn0, Token, Context, !Posn)
 		; Char = '\r' -> 
-			% Files created on Windows may have an extra
-			% return character.
-			lexer__string_get_quoted_name_escape(String, Len, 
-				QuoteChar, Chars, Posn0, Token, Context, !Posn)
-		; lexer__escape_char(Char, EscapedChar) ->
+            % Files created on Windows may have an extra return character.
+            string_get_quoted_name_escape(String, Len, QuoteChar, Chars,
+                Posn0, Token, Context, !Posn)
+        ; escape_char(Char, EscapedChar) ->
 			Chars1 = [EscapedChar | Chars],
-			lexer__string_get_quoted_name(String, Len, QuoteChar,
-				Chars1, Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, QuoteChar, Chars1,
+                Posn0, Token, Context, !Posn)
 		; Char = 'x' ->
-			lexer__string_get_hex_escape(String, Len, QuoteChar,
-				Chars, [], Posn0, Token, Context, !Posn)
+            string_get_hex_escape(String, Len, QuoteChar, Chars, [],
+                Posn0, Token, Context, !Posn)
 		; char__is_octal_digit(Char) ->
-			lexer__string_get_octal_escape(String, Len, QuoteChar,
-				Chars, [Char], Posn0, Token, Context, !Posn)
+            string_get_octal_escape(String, Len, QuoteChar, Chars, [Char],
+                Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_context(!.Posn, Context, !Posn),
+            string_get_context(!.Posn, Context, !Posn),
 			Token = error("invalid escape character")
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = error("unterminated quoted name")
 	).
 
-:- pred lexer__escape_char(char::in, char::out) is semidet.
+:- pred escape_char(char::in, char::out) is semidet.
 
-lexer__escape_char('a', '\a').
-lexer__escape_char('b', '\b').
-lexer__escape_char('r', '\r').
-lexer__escape_char('f', '\f').
-lexer__escape_char('t', '\t').
-lexer__escape_char('n', '\n').
-lexer__escape_char('v', '\v').
-lexer__escape_char('\\', '\\').
-lexer__escape_char('''', '''').
-lexer__escape_char('"', '"').
-lexer__escape_char('`', '`').
+escape_char('a', '\a').
+escape_char('b', '\b').
+escape_char('r', '\r').
+escape_char('f', '\f').
+escape_char('t', '\t').
+escape_char('n', '\n').
+escape_char('v', '\v').
+escape_char('\\', '\\').
+escape_char('''', '''').
+escape_char('"', '"').
+escape_char('`', '`').
 
-:- pred lexer__get_hex_escape(char::in, list(char)::in, list(char)::in,
+:- pred get_hex_escape(char::in, list(char)::in, list(char)::in,
 	token::out, io::di, io::uo) is det.
 
-lexer__get_hex_escape(QuoteChar, Chars, HexChars, Token, !IO) :-
+get_hex_escape(QuoteChar, Chars, HexChars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1001,86 +960,83 @@
 	;
 		Result = ok(Char),
 		( char__is_hex_digit(Char) ->
-			lexer__get_hex_escape(QuoteChar, Chars,
-				[Char | HexChars], Token, !IO)
+            get_hex_escape(QuoteChar, Chars, [Char | HexChars], Token, !IO)
 		; Char = ('\\') ->
-			lexer__finish_hex_escape(QuoteChar, Chars, HexChars,
-				Token, !IO)
+            finish_hex_escape(QuoteChar, Chars, HexChars, Token, !IO)
 		;
 			Token = error("unterminated hex escape")
 		)
 	).
 
-:- pred lexer__string_get_hex_escape(string::in, int::in, char::in,
+:- pred string_get_hex_escape(string::in, int::in, char::in,
 	list(char)::in, list(char)::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_hex_escape(String, Len, QuoteChar, Chars, HexChars, Posn0,
+string_get_hex_escape(String, Len, QuoteChar, Chars, HexChars, Posn0,
 		Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_hex_digit(Char) ->
-			lexer__string_get_hex_escape(String, Len, QuoteChar,
-				    Chars, [Char | HexChars], Posn0,
-				    Token, Context, !Posn)
+            string_get_hex_escape(String, Len, QuoteChar, Chars,
+                [Char | HexChars], Posn0, Token, Context, !Posn)
 		; Char = ('\\') ->
-			lexer__string_finish_hex_escape(String, Len, QuoteChar,
-				    Chars, HexChars, Posn0, Token, Context,
-				    !Posn)
+            string_finish_hex_escape(String, Len, QuoteChar, Chars,
+                HexChars, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = error("unterminated hex escape")
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = error("unterminated quote")
 	).
 
-:- pred lexer__finish_hex_escape(char::in, list(char)::in, list(char)::in,
+:- pred finish_hex_escape(char::in, list(char)::in, list(char)::in,
 	token::out, io::di, io::uo) is det.
 
-lexer__finish_hex_escape(QuoteChar, Chars, HexChars, Token, !IO) :-
+finish_hex_escape(QuoteChar, Chars, HexChars, Token, !IO) :-
 	( HexChars = [] ->
 		Token = error("empty hex escape")
 	;
-		lexer__rev_char_list_to_string(HexChars, HexString),
+        rev_char_list_to_string(HexChars, HexString),
 		(
 			string__base_string_to_int(16, HexString, Int),
 			char__to_int(Char, Int)
 		->
-			lexer__get_quoted_name(QuoteChar, [Char|Chars], Token,
-				!IO)
+            get_quoted_name(QuoteChar, [Char|Chars], Token, !IO)
 		;
 			Token = error("invalid hex escape")
 		)
 	).
 
-:- pred lexer__string_finish_hex_escape(string::in, int::in, char::in,
+:- pred string_finish_hex_escape(string::in, int::in, char::in,
 	list(char)::in, list(char)::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_finish_hex_escape(String, Len, QuoteChar, Chars, HexChars, Posn0,
+string_finish_hex_escape(String, Len, QuoteChar, Chars, HexChars, Posn0,
 		Token, Context, !Posn) :-
-	( HexChars = [] ->
-		lexer__string_get_context(Posn0, Context, !Posn),
+    (
+        HexChars = [],
+        string_get_context(Posn0, Context, !Posn),
 		Token = error("empty hex escape")
 	;
-		lexer__rev_char_list_to_string(HexChars, HexString),
+        HexChars = [_ | _],
+        rev_char_list_to_string(HexChars, HexString),
 		(
 			string__base_string_to_int(16, HexString, Int),
 			char__to_int(Char, Int)
 		->
-			lexer__string_get_quoted_name(String, Len, QuoteChar,
-				[Char | Chars], Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, QuoteChar, [Char | Chars],
+                Posn0, Token, Context, !Posn)
 		;
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = error("invalid hex escape")
 		)
 	).
 
-:- pred lexer__get_octal_escape(char::in, list(char)::in, list(char)::in,
+:- pred get_octal_escape(char::in, list(char)::in, list(char)::in,
 	token::out, io::di, io::uo) is det.
 
-lexer__get_octal_escape(QuoteChar, Chars, OctalChars, Token, !IO) :-
+get_octal_escape(QuoteChar, Chars, OctalChars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1091,146 +1047,133 @@
 	;
 		Result = ok(Char),
 		( char__is_octal_digit(Char) ->
-			lexer__get_octal_escape(QuoteChar, Chars,
-				[Char | OctalChars], Token, !IO)
+            get_octal_escape(QuoteChar, Chars, [Char | OctalChars], Token, !IO)
 		; Char = ('\\') ->
-			lexer__finish_octal_escape(QuoteChar, Chars,
+            finish_octal_escape(QuoteChar, Chars,
 				OctalChars, Token, !IO)
 		;
-			/******
-				% We don't report this as an error since
-				% we need bug-for-bug compatibility with
-				% NU-Prolog XXX
-			Token = error("unterminated octal escape")
-			******/
+            % XXX We don't report this as an error since we need bug-for-bug
+            % compatibility with NU-Prolog.
+            % Token = error("unterminated octal escape")
 			io__putback_char(Char, !IO),
-			lexer__finish_octal_escape(QuoteChar, Chars,
-				OctalChars, Token, !IO)
+            finish_octal_escape(QuoteChar, Chars, OctalChars, Token, !IO)
 		)
 	).
 
-:- pred lexer__string_get_octal_escape(string::in, int::in, char::in,
+:- pred string_get_octal_escape(string::in, int::in, char::in,
 	list(char)::in, list(char)::in, posn::in, token::out,
-	string_token_context::out,
-	posn::in, posn::out) is det.
+    string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_octal_escape(String, Len, QuoteChar, Chars, OctalChars,
+string_get_octal_escape(String, Len, QuoteChar, Chars, OctalChars,
 		Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_octal_digit(Char) ->
-			lexer__string_get_octal_escape(String, Len,
-				QuoteChar, Chars, [Char | OctalChars], Posn0,
-				Token, Context, !Posn)
+            string_get_octal_escape(String, Len, QuoteChar, Chars,
+                [Char | OctalChars], Posn0, Token, Context, !Posn)
 		; Char = ('\\') ->
-			lexer__string_finish_octal_escape(String, Len,
-				QuoteChar, Chars, OctalChars, Posn0,
-				Token, Context, !Posn)
-		;
-			/******
-				% We don't report this as an error since
-				% we need bug-for-bug compatibility with
-				% NU-Prolog XXX
-			Token = error("unterminated octal escape")
-			******/
-			lexer__string_ungetchar(String, !Posn),
-			lexer__string_finish_octal_escape(String, Len,
-				QuoteChar, Chars, OctalChars, Posn0,
-				Token, Context, !Posn)
+            string_finish_octal_escape(String, Len, QuoteChar, Chars,
+                OctalChars, Posn0, Token, Context, !Posn)
+        ;
+            % XXX We don't report this as an error since we need bug-for-bug
+            % compatibility with NU-Prolog.
+            % Token = error("unterminated octal escape")
+            string_ungetchar(String, !Posn),
+            string_finish_octal_escape(String, Len, QuoteChar, Chars,
+                OctalChars, Posn0, Token, Context, !Posn)
 		)
 	;
 		Token = error("unterminated quote"),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__finish_octal_escape(char::in, list(char)::in, list(char)::in,
+:- pred finish_octal_escape(char::in, list(char)::in, list(char)::in,
 	token::out, io::di, io::uo) is det.
 
-lexer__finish_octal_escape(QuoteChar, Chars, OctalChars, Token, !IO) :-
+finish_octal_escape(QuoteChar, Chars, OctalChars, Token, !IO) :-
 	( OctalChars = [] ->
 		Token = error("empty octal escape")
 	;
-		lexer__rev_char_list_to_string(OctalChars, OctalString),
+        rev_char_list_to_string(OctalChars, OctalString),
 		(
 			string__base_string_to_int(8, OctalString, Int),
 			char__to_int(Char, Int)
 		->
-			lexer__get_quoted_name(QuoteChar, [Char | Chars],
-				Token, !IO)
+            get_quoted_name(QuoteChar, [Char | Chars], Token, !IO)
 		;
 			Token = error("invalid octal escape")
 		)
 	).
 
-:- pred lexer__string_finish_octal_escape(string::in, int::in, char::in,
+:- pred string_finish_octal_escape(string::in, int::in, char::in,
 	list(char)::in, list(char)::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_finish_octal_escape(String, Len, QuoteChar, Chars, OctalChars,
+string_finish_octal_escape(String, Len, QuoteChar, Chars, OctalChars,
 		Posn0, Token, Context, !Posn) :-
-	( OctalChars = [] ->
+    (
+        OctalChars = [],
 		Token = error("empty octal escape"),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	;
-		lexer__rev_char_list_to_string(OctalChars, OctalString),
+        OctalChars = [_ | _],
+        rev_char_list_to_string(OctalChars, OctalString),
 		(
 			string__base_string_to_int(8, OctalString, Int),
 			char__to_int(Char, Int)
 		->
-			lexer__string_get_quoted_name(String, Len, QuoteChar,
-				[Char | Chars], Posn0, Token, Context, !Posn)
+            string_get_quoted_name(String, Len, QuoteChar, [Char | Chars],
+                Posn0, Token, Context, !Posn)
 		;
 			Token = error("invalid octal escape"),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	).
 
 %-----------------------------------------------------------------------------%
+%
+% Names and variables.
 
-	% names and variables
-
-:- pred lexer__get_name(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_name(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_name(Chars, Token, !IO) :-
+get_name(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_string(Chars, Name),
+        rev_char_list_to_string(Chars, Name),
 		Token = name(Name)
 	;
 		Result = ok(Char),
 		( char__is_alnum_or_underscore(Char) ->
-			lexer__get_name([Char | Chars], Token, !IO)
+            get_name([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_string(Chars, Name),
+            rev_char_list_to_string(Chars, Name),
 			Token = name(Name)
 		)
 	).
 
-:- pred lexer__string_get_name(string::in, int::in, posn::in, token::out,
+:- pred string_get_name(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_name(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_name(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_alnum_or_underscore(Char) ->
-			lexer__string_get_name(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_name(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, Name, !Posn),
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, Name, !Posn),
 			Token = name(Name),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, Name, !Posn),
+        grab_string(String, Posn0, Name, !Posn),
 		Token = name(Name),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-	%
 	% A line number directive token is `#' followed by an integer
 	% (specifying the line number) followed by a newline.
 	% Such a token sets the source line number for the next
@@ -1240,187 +1183,169 @@
 	% (The source file name can be set with a `:- pragma source_file'
 	% declaration.)
 	%
-
-:- pred lexer__get_source_line_number(list(char)::in, token::out,
+:- pred get_source_line_number(list(char)::in, token::out,
 	token_context::out, io::di, io::uo) is det.
 
-lexer__get_source_line_number(Chars, Token, Context, !IO) :-
+get_source_line_number(Chars, Token, Context, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
-		lexer__get_context(Context, !IO),
+        get_context(Context, !IO),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__get_context(Context, !IO),
-		Token = error(
-			"unexpected end-of-file in `#' line number directive")
+        get_context(Context, !IO),
+        Token = error("unexpected end-of-file in `#' line number directive")
 	;
 		Result = ok(Char),
 		( char__is_digit(Char) ->
-			lexer__get_source_line_number([Char | Chars],
-				Token, Context, !IO)
+            get_source_line_number([Char | Chars], Token, Context, !IO)
 		; Char = '\n' ->
-			lexer__rev_char_list_to_string(Chars, String),
+            rev_char_list_to_string(Chars, String),
 			(
 				string__base_string_to_int(10, String, Int),
 				Int > 0
 			->
 				io__set_line_number(Int, !IO),
-				lexer__get_token(Token, Context, !IO)
+                get_token(Token, Context, !IO)
 			;
-				lexer__get_context(Context, !IO),
-				string__append_list([
-					"invalid line number `", String,
-					"' in `#' line number directive"],
-					Message),
+                get_context(Context, !IO),
+                string__append_list(["invalid line number `", String,
+                    "' in `#' line number directive"], Message),
 				Token = error(Message)
 			)
 		;
-			lexer__get_context(Context, !IO),
+            get_context(Context, !IO),
 			string__from_char_list([Char], String),
-			string__append_list([
-				"invalid character `", String,
-				"' in `#' line number directive"],
-				Message),
+            string__append_list(["invalid character `", String,
+                "' in `#' line number directive"], Message),
 			Token = error(Message)
 		)
 	).
 
-:- pred lexer__string_get_source_line_number(string::in, int::in, posn::in,
+:- pred string_get_source_line_number(string::in, int::in, posn::in,
 	token::out, token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_source_line_number(String, Len, Posn1, Token, Context,
-		!Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_source_line_number(String, Len, Posn1, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_digit(Char) ->
-			lexer__string_get_source_line_number(String, Len,
-				Posn1, Token, Context, !Posn)
+            string_get_source_line_number(String, Len, Posn1, Token, Context,
+                !Posn)
 		; Char = '\n' ->
-			lexer__grab_string(String, Posn1, LineNumString, !Posn),
+            grab_string(String, Posn1, LineNumString, !Posn),
 			(
-				string__base_string_to_int(10, LineNumString,
-					LineNum),
+                string__base_string_to_int(10, LineNumString, LineNum),
 				LineNum > 0
 			->
-				lexer__string_set_line_number(LineNum, !Posn),
-				lexer__string_get_token(String, Len, Token,
-					Context, !Posn)
+                string_set_line_number(LineNum, !Posn),
+                string_get_token(String, Len, Token, Context, !Posn)
 			;
-				lexer__string_get_context(Posn1, Context,
-					!Posn),
-				string__append_list([
-					"invalid line number `", LineNumString,
-					"' in `#' line number directive"],
-					Message),
+                string_get_context(Posn1, Context, !Posn),
+                string__append_list(["invalid line number `", LineNumString,
+                    "' in `#' line number directive"], Message),
 				Token = error(Message)
 			)
 		;
-			lexer__string_get_context(Posn1, Context, !Posn),
+            string_get_context(Posn1, Context, !Posn),
 			string__from_char_list([Char], DirectiveString),
-			string__append_list([
-				"invalid character `", DirectiveString,
-				"' in `#' line number directive"],
-				Message),
+            string__append_list(["invalid character `", DirectiveString,
+                "' in `#' line number directive"], Message),
 			Token = error(Message)
 		)
 	;
-		lexer__string_get_context(Posn1, Context, !Posn),
-		Token = error(
-			"unexpected end-of-file in `#' line number directive")
+        string_get_context(Posn1, Context, !Posn),
+        Token = error("unexpected end-of-file in `#' line number directive")
 	).
 
-:- pred lexer__get_graphic(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_graphic(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_graphic(Chars, Token, !IO) :-
+get_graphic(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_string(Chars, Name),
+        rev_char_list_to_string(Chars, Name),
 		Token = name(Name)
 	;
 		Result = ok(Char),
-		( lexer__graphic_token_char(Char) ->
-			lexer__get_graphic([Char | Chars], Token, !IO)
+        ( graphic_token_char(Char) ->
+            get_graphic([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_string(Chars, Name),
+            rev_char_list_to_string(Chars, Name),
 			Token = name(Name)
 		)
 	).
 
-:- pred lexer__string_get_graphic(string::in, int::in, posn::in, token::out,
+:- pred string_get_graphic(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_graphic(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
-		( lexer__graphic_token_char(Char) ->
-			lexer__string_get_graphic(String, Len, Posn0,
-				Token, Context, !Posn)
+string_get_graphic(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
+        ( graphic_token_char(Char) ->
+            string_get_graphic(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, Name, !Posn),
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, Name, !Posn),
 			Token = name(Name),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, Name, !Posn),
-		lexer__string_get_context(Posn0, Context, !Posn),
+        grab_string(String, Posn0, Name, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = name(Name)
 	).
 
-:- pred lexer__get_variable(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_variable(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_variable(Chars, Token, !IO) :-
+get_variable(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_string(Chars, VariableName),
+        rev_char_list_to_string(Chars, VariableName),
 		Token = variable(VariableName)
 	;
 		Result = ok(Char),
 		( char__is_alnum_or_underscore(Char) ->
-			lexer__get_variable([Char | Chars], Token, !IO)
+            get_variable([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_string(Chars, VariableName),
+            rev_char_list_to_string(Chars, VariableName),
 			Token = variable(VariableName)
 		)
 	).
 
-:- pred lexer__string_get_variable(string::in, int::in, posn::in, token::out,
+:- pred string_get_variable(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_variable(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_variable(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_alnum_or_underscore(Char) ->
-			lexer__string_get_variable(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_variable(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, VariableName, !Posn),
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, VariableName, !Posn),
 			Token = variable(VariableName),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, VariableName, !Posn),
+        grab_string(String, Posn0, VariableName, !Posn),
 		Token = variable(VariableName),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
 %-----------------------------------------------------------------------------%
+%
+% Integer and float literals.
 
-	% integer and float literals
-
-:- pred lexer__get_zero(token::out, io::di, io::uo) is det.
+:- pred get_zero(token::out, io::di, io::uo) is det.
 
-lexer__get_zero(Token, !IO) :-
+get_zero(Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1431,65 +1356,58 @@
 	;
 		Result = ok(Char),
 		( char__is_digit(Char) ->
-			lexer__get_number([Char], Token, !IO)
+            get_number([Char], Token, !IO)
 		; Char = '''' ->
-			lexer__get_char_code(Token, !IO)
+            get_char_code(Token, !IO)
 		; Char = 'b' ->
-			lexer__get_binary(Token, !IO)
+            get_binary(Token, !IO)
 		; Char = 'o' ->
-			lexer__get_octal(Token, !IO)
+            get_octal(Token, !IO)
 		; Char = 'x' ->
-			lexer__get_hex(Token, !IO)
+            get_hex(Token, !IO)
 		; Char = ('.') ->
-			lexer__get_int_dot(['0'], Token, !IO)
+            get_int_dot(['0'], Token, !IO)
 		; ( Char = 'e' ; Char = 'E' ) ->
-			lexer__get_float_exponent([Char, '0'], Token, !IO)
+            get_float_exponent([Char, '0'], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
 			Token = integer(0)
 		)
 	).
 
-:- pred lexer__string_get_zero(string::in, int::in, posn::in, token::out,
-	string_token_context::out,
-	posn::in, posn::out) is det.
+:- pred string_get_zero(string::in, int::in, posn::in, token::out,
+    string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_zero(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_zero(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_digit(Char) ->
-			lexer__string_get_number(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_number(String, Len, Posn0, Token, Context, !Posn)
 		; Char = '''' ->
-			lexer__string_get_char_code(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_char_code(String, Len, Posn0, Token, Context, !Posn)
 		; Char = 'b' ->
-			lexer__string_get_binary(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_binary(String, Len, Posn0, Token, Context, !Posn)
 		; Char = 'o' ->
-			lexer__string_get_octal(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_octal(String, Len, Posn0, Token, Context, !Posn)
 		; Char = 'x' ->
-			lexer__string_get_hex(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_hex(String, Len, Posn0, Token, Context, !Posn)
 		; Char = ('.') ->
-			lexer__string_get_int_dot(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_int_dot(String, Len, Posn0, Token, Context, !Posn)
 		; ( Char = 'e' ; Char = 'E' ) ->
-			lexer__string_get_float_exponent(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_exponent(String, Len, Posn0, Token, Context,
+                !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__string_get_context(Posn0, Context, !Posn),
+            string_ungetchar(String, !Posn),
+            string_get_context(Posn0, Context, !Posn),
 			Token = integer(0)
 		)
 	;
-		lexer__string_get_context(Posn0, Context, !Posn),
+        string_get_context(Posn0, Context, !Posn),
 		Token = integer(0)
 	).
 
-:- pred lexer__get_char_code(token::out, io::di, io::uo) is det.
+:- pred get_char_code(token::out, io::di, io::uo) is det.
 
-lexer__get_char_code(Token, !IO) :-
+get_char_code(Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1503,22 +1421,22 @@
 		Token = integer(CharCode)
 	).
 
-:- pred lexer__string_get_char_code(string::in, int::in, posn::in, token::out,
+:- pred string_get_char_code(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_char_code(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_char_code(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		char__to_int(Char, CharCode),
 		Token = integer(CharCode),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	;
 		Token = error("unterminated char code constant"),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_binary(token::out, io::di, io::uo) is det.
+:- pred get_binary(token::out, io::di, io::uo) is det.
 
-lexer__get_binary(Token, !IO) :-
+get_binary(Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1529,74 +1447,72 @@
 	;
 		Result = ok(Char),
 		( char__is_binary_digit(Char) ->
-			lexer__get_binary_2([Char], Token, !IO)
+            get_binary_2([Char], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
 			Token = error("unterminated binary constant")
 		)
 	).
 
-:- pred lexer__string_get_binary(string::in, int::in, posn::in, token::out,
+:- pred string_get_binary(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_binary(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_binary(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_binary_digit(Char) ->
-			lexer__string_get_binary_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_binary_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
+            string_ungetchar(String, !Posn),
 			Token = error("unterminated binary constant"),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
 		Token = error("unterminated binary constant"),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_binary_2(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_binary_2(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_binary_2(Chars, Token, !IO) :-
+get_binary_2(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_int(Chars, 2, Token)
+        rev_char_list_to_int(Chars, 2, Token)
 	;
 		Result = ok(Char),
 		( char__is_binary_digit(Char) ->
-			lexer__get_binary_2([Char | Chars], Token, !IO)
+            get_binary_2([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_int(Chars, 2, Token)
+            rev_char_list_to_int(Chars, 2, Token)
 		)
 	).
 
-:- pred lexer__string_get_binary_2(string::in, int::in, posn::in, token::out,
+:- pred string_get_binary_2(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_binary_2(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_binary_2(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_binary_digit(Char) ->
-			lexer__string_get_binary_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_binary_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, BinaryString, !Posn),
-			lexer__conv_string_to_int(BinaryString, 2, Token),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, BinaryString, !Posn),
+            conv_string_to_int(BinaryString, 2, Token),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, BinaryString, !Posn),
-		lexer__conv_string_to_int(BinaryString, 2, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        grab_string(String, Posn0, BinaryString, !Posn),
+        conv_string_to_int(BinaryString, 2, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_octal(token::out, io::di, io::uo) is det.
+:- pred get_octal(token::out, io::di, io::uo) is det.
 
-lexer__get_octal(Token, !IO) :-
+get_octal(Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1607,75 +1523,73 @@
 	;
 		Result = ok(Char),
 		( char__is_octal_digit(Char) ->
-			lexer__get_octal_2([Char], Token, !IO)
+            get_octal_2([Char], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
 			Token = error("unterminated octal constant")
 		)
 	).
 
-:- pred lexer__string_get_octal(string::in, int::in, posn::in, token::out,
+:- pred string_get_octal(string::in, int::in, posn::in, token::out,
 	string_token_context::out,
 	posn::in, posn::out) is det.
 
-lexer__string_get_octal(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_octal(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_octal_digit(Char) ->
-			lexer__string_get_octal_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_octal_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
+            string_ungetchar(String, !Posn),
 			Token = error("unterminated octal constant"),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
 		Token = error("unterminated octal constant"),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_octal_2(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_octal_2(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_octal_2(Chars, Token, !IO) :-
+get_octal_2(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_int(Chars, 8, Token)
+        rev_char_list_to_int(Chars, 8, Token)
 	;
 		Result = ok(Char),
 		( char__is_octal_digit(Char) ->
-			lexer__get_octal_2([Char | Chars], Token, !IO)
+            get_octal_2([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_int(Chars, 8, Token)
+            rev_char_list_to_int(Chars, 8, Token)
 		)
 	).
 
-:- pred lexer__string_get_octal_2(string::in, int::in, posn::in, token::out,
+:- pred string_get_octal_2(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_octal_2(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_octal_2(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_octal_digit(Char) ->
-			lexer__string_get_octal_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_octal_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, BinaryString, !Posn),
-			lexer__conv_string_to_int(BinaryString, 8, Token),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, BinaryString, !Posn),
+            conv_string_to_int(BinaryString, 8, Token),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, BinaryString, !Posn),
-		lexer__conv_string_to_int(BinaryString, 8, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        grab_string(String, Posn0, BinaryString, !Posn),
+        conv_string_to_int(BinaryString, 8, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_hex(token::out, io::di, io::uo) is det.
+:- pred get_hex(token::out, io::di, io::uo) is det.
 
-lexer__get_hex(Token, !IO) :-
+get_hex(Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1686,127 +1600,122 @@
 	;
 		Result = ok(Char),
 		( char__is_hex_digit(Char) ->
-			lexer__get_hex_2([Char], Token, !IO)
+            get_hex_2([Char], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
 			Token = error("unterminated hex constant")
 		)
 	).
 
-:- pred lexer__string_get_hex(string::in, int::in, posn::in, token::out,
+:- pred string_get_hex(string::in, int::in, posn::in, token::out,
 	string_token_context::out,
 	posn::in, posn::out) is det.
 
-lexer__string_get_hex(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_hex(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_hex_digit(Char) ->
-			lexer__string_get_hex_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_hex_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
+            string_ungetchar(String, !Posn),
 			Token = error("unterminated hex constant"),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
 		Token = error("unterminated hex constant"),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_hex_2(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_hex_2(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_hex_2(Chars, Token, !IO) :-
+get_hex_2(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_int(Chars, 16, Token)
+        rev_char_list_to_int(Chars, 16, Token)
 	;
 		Result = ok(Char),
 		( char__is_hex_digit(Char) ->
-			lexer__get_hex_2([Char | Chars], Token, !IO)
+            get_hex_2([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_int(Chars, 16, Token)
+            rev_char_list_to_int(Chars, 16, Token)
 		)
 	).
 
-:- pred lexer__string_get_hex_2(string::in, int::in, posn::in, token::out,
+:- pred string_get_hex_2(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_hex_2(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_hex_2(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_hex_digit(Char) ->
-			lexer__string_get_hex_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_hex_2(String, Len, Posn0, Token, Context, !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, BinaryString, !Posn),
-			lexer__conv_string_to_int(BinaryString, 16, Token),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, BinaryString, !Posn),
+            conv_string_to_int(BinaryString, 16, Token),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, BinaryString, !Posn),
-		lexer__conv_string_to_int(BinaryString, 16, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        grab_string(String, Posn0, BinaryString, !Posn),
+        conv_string_to_int(BinaryString, 16, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_number(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_number(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_number(Chars, Token, !IO) :-
+get_number(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_int(Chars, 10, Token)
+        rev_char_list_to_int(Chars, 10, Token)
 	;
 		Result = ok(Char),
 		( char__is_digit(Char) ->
-			lexer__get_number([Char | Chars], Token, !IO)
+            get_number([Char | Chars], Token, !IO)
 		; Char = ('.') ->
-			lexer__get_int_dot(Chars, Token, !IO)
+            get_int_dot(Chars, Token, !IO)
 		; ( Char = 'e' ; Char = 'E' ) ->
-			lexer__get_float_exponent([Char | Chars], Token, !IO)
+            get_float_exponent([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_int(Chars, 10, Token)
+            rev_char_list_to_int(Chars, 10, Token)
 		)
 	).
 
-:- pred lexer__string_get_number(string::in, int::in, posn::in, token::out,
+:- pred string_get_number(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_number(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_number(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_digit(Char) ->
-			lexer__string_get_number(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_number(String, Len, Posn0, Token, Context, !Posn)
 		; Char = ('.') ->
-			lexer__string_get_int_dot(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_int_dot(String, Len, Posn0, Token, Context, !Posn)
 		; ( Char = 'e' ; Char = 'E' ) ->
-			lexer__string_get_float_exponent(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_exponent(String, Len, Posn0, Token, Context,
+                !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, NumberString, !Posn),
-			lexer__conv_string_to_int(NumberString, 10, Token),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, NumberString, !Posn),
+            conv_string_to_int(NumberString, 10, Token),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, NumberString, !Posn),
-		lexer__conv_string_to_int(NumberString, 10, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        grab_string(String, Posn0, NumberString, !Posn),
+        conv_string_to_int(NumberString, 10, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-	% XXX the float literal syntax doesn't match ISO Prolog
-
-:- pred lexer__get_int_dot(list(char)::in, token::out, io::di, io::uo) is det.
+:- pred get_int_dot(list(char)::in, token::out, io::di, io::uo) is det.
 
-lexer__get_int_dot(Chars, Token, !IO) :-
+get_int_dot(Chars, Token, !IO) :-
+    % XXX The float literal syntax doesn't match ISO Prolog.
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1814,20 +1723,18 @@
 	;
 		Result = eof,
 		io__putback_char('.', !IO),
-		lexer__rev_char_list_to_int(Chars, 10, Token)
+        rev_char_list_to_int(Chars, 10, Token)
 	;
 		Result = ok(Char),
 		( char__is_digit(Char) ->
-			lexer__get_float_decimals([Char, '.' | Chars], Token,
-				!IO)
+            get_float_decimals([Char, '.' | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			% We can't putback the ".", because io__putback_char
-			% only guarantees one character of pushback.
-			% So instead, we return an `integer_dot' token;
-			% the main loop of lexer__get_token_list_2 will
+            % We can't putback the ".", because io__putback_char only
+            % guarantees one character of pushback. So instead, we return
+            % an `integer_dot' token; the main loop of get_token_list_2 will
 			% handle this appropriately.
-			lexer__rev_char_list_to_int(Chars, 10, Token0),
+            rev_char_list_to_int(Chars, 10, Token0),
 			( Token0 = integer(Int) ->
 				Token = integer_dot(Int)
 			;
@@ -1836,130 +1743,129 @@
 		)
 	).
 
-:- pred lexer__string_get_int_dot(string::in, int::in, posn::in, token::out,
+:- pred string_get_int_dot(string::in, int::in, posn::in, token::out,
 	string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_int_dot(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_int_dot(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_digit(Char) ->
-			lexer__string_get_float_decimals(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_decimals(String, Len, Posn0, Token, Context,
+                !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, NumberString, !Posn),
-			lexer__conv_string_to_int(NumberString, 10, Token),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, NumberString, !Posn),
+            conv_string_to_int(NumberString, 10, Token),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__string_ungetchar(String, !Posn),
-		lexer__grab_string(String, Posn0, NumberString, !Posn),
-		lexer__conv_string_to_int(NumberString, 10, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_ungetchar(String, !Posn),
+        grab_string(String, Posn0, NumberString, !Posn),
+        conv_string_to_int(NumberString, 10, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_float_decimals(list(char)::in, token::out,
+:- pred get_float_decimals(list(char)::in, token::out,
 	io::di, io::uo) is det.
 
-	% we've read past the decimal point, so now get the decimals
-
-lexer__get_float_decimals(Chars, Token, !IO) :-
+    % We've read past the decimal point, so now get the decimals.
+    %
+get_float_decimals(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_float(Chars, Token)
+        rev_char_list_to_float(Chars, Token)
 	;
 		Result = ok(Char),
 		( char__is_digit(Char) ->
-			lexer__get_float_decimals([Char | Chars], Token, !IO)
+            get_float_decimals([Char | Chars], Token, !IO)
 		; ( Char = 'e' ; Char = 'E' ) ->
-			lexer__get_float_exponent([Char | Chars], Token, !IO)
+            get_float_exponent([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_float(Chars, Token)
+            rev_char_list_to_float(Chars, Token)
 		)
 	).
 
-:- pred lexer__string_get_float_decimals(string::in, int::in, posn::in,
+:- pred string_get_float_decimals(string::in, int::in, posn::in,
 	token::out, string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_float_decimals(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_float_decimals(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_digit(Char) ->
-			lexer__string_get_float_decimals(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_decimals(String, Len, Posn0, Token, Context,
+                !Posn)
 		; ( Char = 'e' ; Char = 'E' ) ->
-			lexer__string_get_float_exponent(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_exponent(String, Len, Posn0, Token, Context,
+                !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, FloatString, !Posn),
-			lexer__conv_to_float(FloatString, Token),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, FloatString, !Posn),
+            conv_to_float(FloatString, Token),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, FloatString, !Posn),
-		lexer__conv_to_float(FloatString, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        grab_string(String, Posn0, FloatString, !Posn),
+        conv_to_float(FloatString, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_float_exponent(list(char)::in, token::out,
+:- pred get_float_exponent(list(char)::in, token::out,
 	io::di, io::uo) is det.
 
-lexer__get_float_exponent(Chars, Token, !IO) :-
+get_float_exponent(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_float(Chars, Token)
+        rev_char_list_to_float(Chars, Token)
 	;
 		Result = ok(Char),
 		( ( Char = ('+') ; Char = ('-') ) ->
-			lexer__get_float_exponent_2([Char | Chars], Token, !IO)
+            get_float_exponent_2([Char | Chars], Token, !IO)
 		; char__is_digit(Char) ->
-			lexer__get_float_exponent_3([Char | Chars], Token, !IO)
+            get_float_exponent_3([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
 			Token = error("unterminated exponent in float token")
 		)
 	).
 
-:- pred lexer__string_get_float_exponent(string::in, int::in, posn::in,
+:- pred string_get_float_exponent(string::in, int::in, posn::in,
 	token::out, string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_float_exponent(String, Len, Posn0, Token, Context, !Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_float_exponent(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( ( Char = ('+') ; Char = ('-') ) ->
-			lexer__string_get_float_exponent_2(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_exponent_2(String, Len, Posn0, Token, Context,
+                !Posn)
 		; char__is_digit(Char) ->
-			lexer__string_get_float_exponent_3(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_exponent_3(String, Len, Posn0, Token, Context,
+                !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			Token =
-			  error("unterminated exponent in float token"),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            Token = error("unterminated exponent in float token"),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, FloatString, !Posn),
-		lexer__conv_to_float(FloatString, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        grab_string(String, Posn0, FloatString, !Posn),
+        conv_to_float(FloatString, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_float_exponent_2(list(char)::in, token::out,
+:- pred get_float_exponent_2(list(char)::in, token::out,
 	io::di, io::uo) is det.
 
-	% we've read past the E signalling the start of the exponent -
+    % We've read past the E signalling the start of the exponent -
 	% make sure that there's at least one digit following,
-	% and then get the remaining digits
-
-lexer__get_float_exponent_2(Chars, Token, !IO) :-
+    % and then get the remaining digits.
+    %
+get_float_exponent_2(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
@@ -1970,119 +1876,116 @@
 	;
 		Result = ok(Char),
 		( char__is_digit(Char) ->
-			lexer__get_float_exponent_3([Char | Chars], Token, !IO)
+            get_float_exponent_3([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
 			Token = error("unterminated exponent in float token")
 		)
 	).
 
-:- pred lexer__string_get_float_exponent_2(string::in, int::in, posn::in,
+:- pred string_get_float_exponent_2(string::in, int::in, posn::in,
 	token::out, string_token_context::out, posn::in, posn::out) is det.
 
-	% we've read past the E signalling the start of the exponent -
+    % We've read past the E signalling the start of the exponent -
 	% make sure that there's at least one digit following,
-	% and then get the remaining digits
-
-lexer__string_get_float_exponent_2(String, Len, Posn0, Token, Context,
-		!Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+    % and then get the remaining digits.
+    %
+string_get_float_exponent_2(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_digit(Char) ->
-			lexer__string_get_float_exponent_3(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_exponent_3(String, Len, Posn0, Token, Context,
+                !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
+            string_ungetchar(String, !Posn),
 			Token = error("unterminated exponent in float token"),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
 		Token = error("unterminated exponent in float token"),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        string_get_context(Posn0, Context, !Posn)
 	).
 
-:- pred lexer__get_float_exponent_3(list(char)::in, token::out,
+:- pred get_float_exponent_3(list(char)::in, token::out,
 	io::di, io::uo) is det.
 
-	% we've read past the first digit of the exponent -
-	% now get the remaining digits
-
-lexer__get_float_exponent_3(Chars, Token, !IO) :-
+    % We've read past the first digit of the exponent -
+    % now get the remaining digits.
+    %
+get_float_exponent_3(Chars, Token, !IO) :-
 	io__read_char(Result, !IO),
 	(
 		Result = error(Error),
 		Token = io_error(Error)
 	;
 		Result = eof,
-		lexer__rev_char_list_to_float(Chars, Token)
+        rev_char_list_to_float(Chars, Token)
 	;
 		Result = ok(Char),
 		( char__is_digit(Char) ->
-			lexer__get_float_exponent_3([Char | Chars], Token, !IO)
+            get_float_exponent_3([Char | Chars], Token, !IO)
 		;
 			io__putback_char(Char, !IO),
-			lexer__rev_char_list_to_float(Chars, Token)
+            rev_char_list_to_float(Chars, Token)
 		)
 	).
 
-:- pred lexer__string_get_float_exponent_3(string::in, int::in, posn::in,
+:- pred string_get_float_exponent_3(string::in, int::in, posn::in,
 	token::out, string_token_context::out, posn::in, posn::out) is det.
 
-lexer__string_get_float_exponent_3(String, Len, Posn0, Token, Context,
-		!Posn) :-
-	( lexer__string_read_char(String, Len, Char, !Posn) ->
+string_get_float_exponent_3(String, Len, Posn0, Token, Context, !Posn) :-
+    ( string_read_char(String, Len, Char, !Posn) ->
 		( char__is_digit(Char) ->
-			lexer__string_get_float_exponent_3(String, Len, Posn0,
-				Token, Context, !Posn)
+            string_get_float_exponent_3(String, Len, Posn0, Token, Context,
+                !Posn)
 		;
-			lexer__string_ungetchar(String, !Posn),
-			lexer__grab_string(String, Posn0, FloatString, !Posn),
-			lexer__conv_to_float(FloatString, Token),
-			lexer__string_get_context(Posn0, Context, !Posn)
+            string_ungetchar(String, !Posn),
+            grab_string(String, Posn0, FloatString, !Posn),
+            conv_to_float(FloatString, Token),
+            string_get_context(Posn0, Context, !Posn)
 		)
 	;
-		lexer__grab_string(String, Posn0, FloatString, !Posn),
-		lexer__conv_to_float(FloatString, Token),
-		lexer__string_get_context(Posn0, Context, !Posn)
+        grab_string(String, Posn0, FloatString, !Posn),
+        conv_to_float(FloatString, Token),
+        string_get_context(Posn0, Context, !Posn)
 	).
 
 %-----------------------------------------------------------------------------%
+%
+% Utility routines.
 
-	% Utility routines
-
-:- pred lexer__rev_char_list_to_int(list(char)::in, int::in, token::out)
-	is det.
+:- pred rev_char_list_to_int(list(char)::in, int::in, token::out) is det.
 
-lexer__rev_char_list_to_int(RevChars, Base, Token) :-
-	lexer__rev_char_list_to_string(RevChars, String),
-	lexer__conv_string_to_int(String, Base, Token).
+rev_char_list_to_int(RevChars, Base, Token) :-
+    rev_char_list_to_string(RevChars, String),
+    conv_string_to_int(String, Base, Token).
 
-:- pred lexer__conv_string_to_int(string::in, int::in, token::out) is det.
+:- pred conv_string_to_int(string::in, int::in, token::out) is det.
 
-lexer__conv_string_to_int(String, Base, Token) :-
+conv_string_to_int(String, Base, Token) :-
 	( string__base_string_to_int(Base, String, Int) ->
 		Token = integer(Int)
 	;
 		Token = error("invalid integer token")
 	).
 
-:- pred lexer__rev_char_list_to_float(list(char)::in, token::out) is det.
+:- pred rev_char_list_to_float(list(char)::in, token::out) is det.
 
-lexer__rev_char_list_to_float(RevChars, Token) :-
-	lexer__rev_char_list_to_string(RevChars, String),
-	lexer__conv_to_float(String, Token).
+rev_char_list_to_float(RevChars, Token) :-
+    rev_char_list_to_string(RevChars, String),
+    conv_to_float(String, Token).
 
-:- pred lexer__conv_to_float(string::in, token::out) is det.
+:- pred conv_to_float(string::in, token::out) is det.
 
-lexer__conv_to_float(String, Token) :-
+conv_to_float(String, Token) :-
 	( string__to_float(String, Float) ->
 		Token = float(Float)
 	;
 		Token = error("invalid float token")
 	).
 
-:- pred lexer__rev_char_list_to_string(list(char)::in, string::out) is det.
+:- pred rev_char_list_to_string(list(char)::in, string::out) is det.
 
-lexer__rev_char_list_to_string(RevChars, String) :-
+rev_char_list_to_string(RevChars, String) :-
        string__from_rev_char_list(RevChars, String).
 
 %-----------------------------------------------------------------------------%
Index: library.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/library.m,v
retrieving revision 1.89
diff -u -b -r1.89 library.m
--- library.m	22 Jul 2005 12:32:06 -0000	1.89
+++ library.m	17 Oct 2005 05:25:25 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1993-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
Index: list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.141
diff -u -b -r1.141 list.m
--- list.m	29 Aug 2005 03:22:29 -0000	1.141
+++ list.m	17 Oct 2005 05:25:07 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1993-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -23,7 +25,9 @@
 	%	or an element `Head' of type `T' followed by a tail `Tail'
 	%	of type `list(T)', denoted `[Head | Tail]'.
 	%
-:- type list(T) ---> [] ; [T | list(T)].
+:- type list(T)
+    --->    []
+    ;       [T | list(T)].
 
 %-----------------------------------------------------------------------------%
 
@@ -61,8 +65,7 @@
 
 	% list__cons(X, Y, Z) <=> Z = [X | Y].
 	%
-:- pred list__cons(T, list(T), list(T)).
-:- mode list__cons(in, in, out) is det.
+:- pred list__cons(T::in, list(T)::in, list(T)::out) is det.
 :- func list__cons(T, list(T)) = list(T).
 
 	% Standard append predicate:
@@ -86,11 +89,9 @@
 	% associativity of append
 :- promise all [A, B, C, ABC]
 	(
-		( some [AB]
-			(list__append(A, B, AB), list__append(AB, C, ABC)) )
+        ( some [AB] (list__append(A, B, AB), list__append(AB, C, ABC)) )
 	<=>
-		( some [BC]
-			(list__append(B, C, BC), list__append(A, BC, ABC)) )
+        ( some [BC] (list__append(B, C, BC), list__append(A, BC, ABC)) )
 	).
 	% construction equivalence law.
 	% XXX when we implement rewrite rules, we should change this law
@@ -102,59 +103,66 @@
 :- func list(T) ++ list(T) = list(T).
 
 	% list__remove_suffix(List, Suffix, Prefix):
+    %
 	%	The same as list__append(Prefix, Suffix, List) except that
 	%	this is semidet whereas list__append(out, in, in) is nondet.
 	%
 :- pred list__remove_suffix(list(T)::in, list(T)::in, list(T)::out) is semidet.
 
 	% list__merge(L1, L2, L):
-	%	L is the result of merging the elements of L1 and L2,
-	%	in ascending order.  L1 and L2 must be sorted.
+    %
+    % L is the result of merging the elements of L1 and L2, in ascending order.
+    % L1 and L2 must be sorted.
 	%
 :- pred list__merge(list(T)::in, list(T)::in, list(T)::out) is det.
 :- func list__merge(list(T), list(T)) = list(T).
 
 	% list__merge_and_remove_dups(L1, L2, L):
-	%	L is the result of merging the elements of L1 and L2,
-	%	in ascending order, and eliminating any duplicates.
-	%	L1 and L2 must be sorted and must each not contain any
-	%	duplicates.
+    %
+    % L is the result of merging the elements of L1 and L2, in ascending order,
+    % and eliminating any duplicates. L1 and L2 must be sorted and must each
+    % not contain any duplicates.
 	%
 :- pred list__merge_and_remove_dups(list(T)::in, list(T)::in, list(T)::out)
 	is det.
 :- func list__merge_and_remove_dups(list(T), list(T)) = list(T).
 
-	% list__remove_adjacent_dups(L0, L) :
-	%	L is the result of replacing every sequence of duplicate
-	%	elements in L0 with a single such element.
+    % list__remove_adjacent_dups(L0, L):
+    %
+    % L is the result of replacing every sequence of duplicate elements in L0
+    % with a single such element.
 	%
 :- pred list__remove_adjacent_dups(list(T)::in, list(T)::out) is det.
 :- func list__remove_adjacent_dups(list(T)) = list(T).
 
-	% list__remove_dups(L0, L) :
-	%	L is the result of deleting the second and subsequent
-	%	occurrences of every element that occurs twice in L0.
+    % list__remove_dups(L0, L):
+    %
+    % L is the result of deleting the second and subsequent occurrences
+    % of every element that occurs twice in L0.
 	%
 :- pred list__remove_dups(list(T)::in, list(T)::out) is det.
 :- func list__remove_dups(list(T)) = list(T).
 
-	% list__member(Elem, List) :
+    % list__member(Elem, List):
+    %
 	%	True iff `List' contains `Elem'.
 	%
 :- pred list__member(T, list(T)).
 :- mode list__member(in, in) is semidet.
 :- mode list__member(out, in) is nondet.
 
-	% list__member(Elem, List, SubList) :
-	%	True iff `List' contains `Elem', and `SubList' is
-	%	a suffix of `List' beginning with `Elem'.
+    % list__member(Elem, List, SubList):
+    %
+    % True iff `List' contains `Elem', and `SubList' is a suffix of `List'
+    % beginning with `Elem'.
 	%	Same as `SubList = [Elem | _], list__append(_, SubList, List)'.
 	%
 :- pred list__member(T::out, list(T)::in, list(T)::out) is nondet.
 
-	% list__length(List, Length) :
-	%	True iff `Length' is the length of `List', i.e. if
-	%	`List' contains `Length' elements.
+    % list__length(List, Length):
+    %
+    % True iff `Length' is the length of `List', i.e. if `List' contains
+    % `Length' elements.
 	%
 :- pred list__length(list(_T), int).
 :- mode list__length(in, out) is det.
@@ -163,7 +171,8 @@
 
 :- func list__length(list(T)) = int.
 
-	% list__same_length(ListA, ListB) :
+    % list__same_length(ListA, ListB):
+    %
 	%	True iff `ListA' and `ListB' have the same length,
 	%	i.e. iff they both contain the same number of elements.
 	%
@@ -177,35 +186,37 @@
 % :- mode list__same_length(output_list_skel, input_list_skel) is det.
 
 	% list__split_list(Len, List, Start, End):
-	%	splits `List' into a prefix `Start' of length `Len',
-	%	and a remainder `End'.
-	%	See also: list__take, list__drop.
+    %
+    % splits `List' into a prefix `Start' of length `Len', and a remainder
+    % `End'. See also: list__take, list__drop.
 	%
 :- pred list__split_list(int::in, list(T)::in, list(T)::out, list(T)::out)
 	is semidet.
 
 	% list__take(Len, List, Start):
-	%	`Start' is the first `Len' elements of `List'.
-	%	Fails if `List' has less than `Len' elements.
-	%	See also: list__split_list.
+    %
+    % `Start' is the first `Len' elements of `List'. Fails if `List' has
+    % less than `Len' elements. See also: list__split_list.
 	%
 :- pred list__take(int::in, list(T)::in, list(T)::out) is semidet.
 
 	% list__take_upto(Len, List, Start):
-	%	`Start' is the first `Len' elements of `List'.
-	%	If `List' has less than `Len' elements, return the entire list.
+    %
+    % `Start' is the first `Len' elements of `List'. If `List' has less than
+    % `Len' elements, return the entire list.
 	%
 :- pred list__take_upto(int::in, list(T)::in, list(T)::out) is det.
 :- func list__take_upto(int, list(T)) = list(T).
 
 	% list__drop(Len, List, End):
-	%	`End' is the remainder of `List' after removing the
-	%	first `Len' elements.
+    %
+    % `End' is the remainder of `List' after removing the first `Len' elements.
 	%	See also: list__split_list.
 	%
 :- pred list__drop(int::in, list(T)::in, list(T)::out) is semidet.
 
 	% list__insert(Elem, List0, List):
+    %
 	%	`List' is the result of inserting `Elem' somewhere in `List0'.
 	%	Same as `list__delete(List, Elem, List0)'.
 	%
@@ -216,9 +227,9 @@
 :- mode list__insert(in, in, out) is multi.
 
 	% list__delete(List, Elem, Remainder):
-	%	True iff `Elem' occurs in `List', and
-	%	`Remainder' is the result of deleting one occurrence of
-	%	`Elem' from `List'.
+    %
+    % True iff `Elem' occurs in `List', and `Remainder' is the result of
+    % deleting one occurrence of `Elem' from `List'.
 	%
 :- pred list__delete(list(T), T, list(T)).
 :- mode list__delete(in, in, in) is semidet.
@@ -285,19 +296,22 @@
 :- func list__det_replace_nth(list(T), int, T) = list(T).
 
 	% list__sort_and_remove_dups(List0, List):
-	%	List is List0 sorted with the second and subsequent
-	%	occurrence of any duplicates removed.
+    %
+    % List is List0 sorted with the second and subsequent occurrence of
+    % any duplicates removed.
 	%
 :- pred list__sort_and_remove_dups(list(T)::in, list(T)::out) is det.
 :- func list__sort_and_remove_dups(list(T)) = list(T).
 
 	% list__sort(List0, List):
+    %
 	%	List is List0 sorted.
 	%
 :- pred list__sort(list(T)::in, list(T)::out) is det.
 :- func list__sort(list(T)) = list(T).
 
 	% list__reverse(List, Reverse):
+    %
 	%	`Reverse' is a list containing the same elements as `List'
 	%	but in reverse order.
 	%
@@ -305,11 +319,13 @@
 :- func list__reverse(list(T)) = list(T).
 
 	% list__perm(List0, List):
+    %
 	%	True iff `List' is a permutation of `List0'.
 	%
 :- pred	list__perm(list(T)::in, list(T)::out) is multi.
 
 	% list__nth_member_search(List, Elem, Position):
+    %
 	%	Elem is the Position'th member of List.
 	% 	(Position numbers start from 1.)
 	%
@@ -321,12 +337,12 @@
 :- pred list__nth_member_lookup(list(T)::in, T::in, int::out) is det.
 
 	% list__index*(List, Position, Elem):
-	%	These predicates select an element in a list from it's
-	%	position.  The `index0' preds consider the first element
-	%	element to be element number zero, whereas the `index1' preds
-	%	consider the first element to be element number one.
-	%	The `_det' preds call error/1 if the index is out of
-	%	range, whereas the semidet preds fail if the index is out of
+    %
+    % These predicates select an element in a list from it's position.
+    % The `index0' preds consider the first element element to be element
+    % number zero, whereas the `index1' preds consider the first element
+    % to be element number one. The `_det' preds call error/1 if the index
+    % is out of range, whereas the semidet preds fail if the index is out of
 	%	range.
 	%
 :- pred list__index0(list(T)::in, int::in, T::out) is semidet.
@@ -340,9 +356,10 @@
 :- func list__det_index1(list(T), int) = T.
 
 	% list__index*_of_first_occurrence(List, Elem, Position):
+    %
 	% 	Computes the least value of Position such that
-	% 	list_index*(List, Position, Elem).  The `det_' funcs
-	% 	call error/1 if Elem is not a member of List.
+    % list_index*(List, Position, Elem). The `det_' funcs call error/1
+    % if Elem is not a member of List.
 	%
 :- pred list__index0_of_first_occurrence(list(T)::in, T::in, int::out)
 	is semidet.
@@ -352,13 +369,12 @@
 :- func list__det_index1_of_first_occurrence(list(T), T) = int.
 
 	% list__zip(ListA, ListB, List):
-	%	List is the result of alternating the elements
-	%	of ListA and ListB, starting with the first element
-	%	of ListA (followed by the first element of ListB,
-	%	then the second element of listA, then the second
-	%	element of ListB, etc.).  When there are no more
-	%	elements remaining in one of the lists,
-	% 	the remainder of the nonempty list is appended.
+    %
+    % List is the result of alternating the elements of ListA and ListB,
+    % starting with the first element of ListA (followed by the first element
+    % of ListB, then the second element of listA, then the second element
+    % of ListB, etc.). When there are no more elements remaining in one of
+    % the lists, the remainder of the nonempty list is appended.
 	%
 :- pred list__zip(list(T)::in, list(T)::in, list(T)::out) is det.
 :- func list__zip(list(T), list(T)) = list(T).
@@ -370,36 +386,33 @@
 :- func list__duplicate(int, T) = list(T).
 
 	% list__condense(ListOfLists, List):
-	%	`List' is the result of concatenating all the
-	%	elements of `ListOfLists'.
+    %
+    % `List' is the result of concatenating all the elements of `ListOfLists'.
 	%
 :- pred list__condense(list(list(T))::in, list(T)::out) is det.
 :- func list__condense(list(list(T))) = list(T).
 
 	% list__chunk(List, ChunkSize, Chunks):
+    %
 	%	Takes a list `List' and breaks it into a list of lists `Chunks',
-	%	such that the length of each list in `Chunks' is at most
-	%	`ChunkSize.  (More precisely, the length of each list in
-	%	`Chunks' other than the last one is exactly `ChunkSize',
-	%	and the length of the last list in `Chunks' is between one
-	%	and `ChunkSize'.)
+    % such that the length of each list in `Chunks' is at most `ChunkSize.
+    % (More precisely, the length of each list in `Chunks' other than the
+    % last one is exactly `ChunkSize', and the length of the last list in
+    % `Chunks' is between one and `ChunkSize'.)
 	%
 :- pred list__chunk(list(T)::in, int::in, list(list(T))::out) is det.
 :- func list__chunk(list(T), int) = list(list(T)).
 
-	% list__sublist(SubList, FullList) is true
-	%	if one can obtain SubList by starting with FullList
-	%	and deleting some of its elements.
+    % list__sublist(SubList, FullList) is true if one can obtain SubList
+    % by starting with FullList and deleting some of its elements.
 	%
 :- pred list__sublist(list(T)::in, list(T)::in) is semidet.
 
-	% list__all_same(List) is true
-	% 	if all elements of the list are the same
+    % list__all_same(List) is true if all elements of the list are the same.
 	%
 :- pred list__all_same(list(T)::in) is semidet.
 
-	% list__last(List, Last) is true
-	%	if Last is the last element of List.
+    % list__last(List, Last) is true if Last is the last element of List.
 	%
 :- pred list__last(list(T)::in, T::out) is semidet.
 
@@ -410,9 +423,8 @@
 :- pred list__det_last(list(T)::in, T::out) is det.
 :- func list__det_last(list(T)) = T.
 
-	% list__split_last(List, AllButLast, Last) is true
-	%	if Last is the last element of List and AllButLast is the list
-	%	of elements before it.
+    % list__split_last(List, AllButLast, Last) is true if Last is the
+    % last element of List and AllButLast is the list of elements before it.
 	%
 :- pred list__split_last(list(T)::in, list(T)::out, T::out) is semidet.
 
@@ -432,6 +444,7 @@
 
 	% list__map(T, L, M) uses the closure T
 	% to transform the elements of L into the elements of M.
+    %
 :- pred list__map(pred(X, Y), list(X), list(Y)).
 :- mode list__map(pred(in, out) is det, in, out) is det.
 :- mode list__map(pred(in, out) is cc_multi, in, out) is cc_multi.
@@ -444,6 +457,7 @@
 
 	% list__map2(T, L, M1, M2) uses the closure T
 	% to transform the elements of L into the elements of M1 and M2.
+    %
 :- pred list__map2(pred(A, B, C), list(A), list(B), list(C)).
 :- mode list__map2(pred(in, out, out) is det, in, out, out) is det.
 :- mode list__map2(pred(in, out, out) is cc_multi, in, out, out) is cc_multi.
@@ -454,6 +468,7 @@
 
 	% list__map3(T, L, M1, M2, M3) uses the closure T
 	% to transform the elements of L into the elements of M1, M2 and M3.
+    %
 :- pred list__map3(pred(A, B, C, D), list(A), list(B), list(C), list(D)).
 :- mode list__map3(pred(in, out, out, out) is det, in, out, out, out) is det.
 :- mode list__map3(pred(in, out, out, out) is cc_multi, in, out, out, out)
@@ -467,8 +482,7 @@
 :- mode list__map3(pred(in, in, in, in) is semidet, in, in, in, in) is semidet.
 
 	% list__map4(T, L, M1, M2, M3, M4) uses the closure T
-	% to transform the elements of L into the elements of M1, M2, M3 and 
-	% M4.
+    % to transform the elements of L into the elements of M1, M2, M3 and M4.
 :- pred list__map4(pred(A, B, C, D, E), list(A), list(B), list(C), list(D),
 	list(E)).
 :- mode list__map4(pred(in, out, out, out, out) is det, in, out, out, out, out) 
@@ -1936,7 +1950,8 @@
 		error("hosort failed")
 	).
 
-% list__hosort is actually det but the compiler can't confirm it
+    % list__hosort is actually det but the compiler can't confirm it.
+    %
 :- pred list__hosort(comparison_pred(X)::in(comparison_pred), int::in,
 	list(X)::in, list(X)::out, list(X)::out) is semidet.
 
@@ -1976,9 +1991,7 @@
 list__merge(_P, [], [Y | Ys], [Y | Ys]).
 list__merge(_P, [X | Xs], [], [X | Xs]).
 list__merge(P, [H1 | T1], [H2 | T2], L) :-
-	(
-		P(H1, H2, (>))
-	->
+    ( P(H1, H2, (>)) ->
 		L = [H2 | T],
 		list__merge(P, [H1 | T1], T2, T)
 	;
@@ -2007,11 +2020,10 @@
 
 %-----------------------------------------------------------------------------%
 
-%
 % These functions are exported so that they can be used instead of the
 % names [|]_2 and []_0. These two names can be difficult to use from other
 % managed languages on the il backend.
-%
+
 :- func empty_list = list(T).
 :- pragma export(empty_list = out, "ML_empty_list").
 
Index: map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/map.m,v
retrieving revision 1.100
diff -u -b -r1.100 map.m
Index: math.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/math.m,v
retrieving revision 1.50
diff -u -b -r1.50 math.m
--- math.m	16 Jun 2005 04:08:02 -0000	1.50
+++ math.m	17 Oct 2005 05:24:40 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1995-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -55,11 +57,11 @@
 % Mathematical constants
 %
 
-	% Pythagoras' number
+    % Pythagoras' number.
 	%
 :- func math__pi = float.
 
-	% Base of natural logarithms
+    % Base of natural logarithms.
 	%
 :- func math__e = float.
 
@@ -78,14 +80,13 @@
 	%
 :- func math__floor(float) = float.
 
-	% math__round(X) = Round is true if Round is the integer
-	% closest to X.  If X has a fractional value of 0.5, it
-	% is rounded up.
+    % math__round(X) = Round is true if Round is the integer closest to X.
+    % If X has a fractional value of 0.5, it is rounded up.
 	%
 :- func math__round(float) = float.
 
-	% math__truncate(X) = Trunc is true if Trunc is the integer
-	% closest to X such that |Trunc| =< |X|.
+    % math__truncate(X) = Trunc is true if Trunc is the integer closest to X
+    % such that |Trunc| =< |X|.
 	%
 :- func math__truncate(float) = float.
 
@@ -94,8 +95,7 @@
 % Polynomial roots
 %
 
-	% math__sqrt(X) = Sqrt is true if Sqrt is the positive square
-	% root of X.
+    % math__sqrt(X) = Sqrt is true if Sqrt is the positive square root of X.
 	%
 	% Domain restriction: X >= 0
 	%
@@ -118,41 +118,35 @@
 % Power/logarithm operations
 %
 
-	% math__pow(X, Y) = Res is true if Res is X raised to the
-	% power of Y.
+    % math__pow(X, Y) = Res is true if Res is X raised to the power of Y.
 	%
 	% Domain restriction: X >= 0 and (X = 0 implies Y > 0)
 	%
 :- func math__pow(float, float) = float.
 
-	% math__exp(X) = Exp is true if Exp is e raised to the
-	% power of X.
+    % math__exp(X) = Exp is true if Exp is e raised to the power of X.
 	%
 :- func math__exp(float) = float.
 
-	% math__ln(X) = Log is true if Log is the natural logarithm
-	% of X.
+    % math__ln(X) = Log is true if Log is the natural logarithm of X.
 	%
 	% Domain restriction: X > 0
 	%
 :- func math__ln(float) = float.
 
-	% math__log10(X) = Log is true if Log is the logarithm to
-	% base 10 of X.
+    % math__log10(X) = Log is true if Log is the logarithm to base 10 of X.
 	%
 	% Domain restriction: X > 0
 	%
 :- func math__log10(float) = float.
 
-	% math__log2(X) = Log is true if Log is the logarithm to
-	% base 2 of X.
+    % math__log2(X) = Log is true if Log is the logarithm to base 2 of X.
 	%
 	% Domain restriction: X > 0
 	%
 :- func math__log2(float) = float.
 
-	% math__log(B, X) = Log is true if Log is the logarithm to
-	% base B of X.
+    % math__log(B, X) = Log is true if Log is the logarithm to base B of X.
 	%
 	% Domain restriction: X > 0 and B > 0 and B \= 1
 	%
@@ -175,27 +169,27 @@
 	%
 :- func math__tan(float) = float.
 
-	% math__asin(X) = ASin is true if ASin is the inverse
-	% sine of X, where ASin is in the range [-pi/2,pi/2].
+    % math__asin(X) = ASin is true if ASin is the inverse sine of X,
+    % where ASin is in the range [-pi/2,pi/2].
 	%
 	% Domain restriction: X must be in the range [-1,1]
 	%
 :- func math__asin(float) = float.
 
-	% math__acos(X) = ACos is true if ACos is the inverse
-	% cosine of X, where ACos is in the range [0, pi].
+    % math__acos(X) = ACos is true if ACos is the inverse cosine of X,
+    % where ACos is in the range [0, pi].
 	%
 	% Domain restriction: X must be in the range [-1,1]
 	%
 :- func math__acos(float) = float.
 
-	% math__atan(X) = ATan is true if ATan is the inverse
-	% tangent of X, where ATan is in the range [-pi/2,pi/2].
+    % math__atan(X) = ATan is true if ATan is the inverse tangent of X,
+    % where ATan is in the range [-pi/2,pi/2].
 	%
 :- func math__atan(float) = float.
 
-	% math__atan2(Y, X) = ATan is true if ATan is the inverse
-	% tangent of Y/X, where ATan is in the range [-pi,pi].
+    % math__atan2(Y, X) = ATan is true if ATan is the inverse tangent of Y/X,
+    % where ATan is in the range [-pi,pi].
 	%
 :- func math__atan2(float, float) = float.
 
@@ -204,18 +198,15 @@
 % Hyperbolic functions
 %
 
-	% math__sinh(X) = Sinh is true if Sinh is the hyperbolic
-	% sine of X.
+    % math__sinh(X) = Sinh is true if Sinh is the hyperbolic sine of X.
 	%
 :- func math__sinh(float) = float.
 
-	% math__cosh(X) = Cosh is true if Cosh is the hyperbolic
-	% cosine of X.
+    % math__cosh(X) = Cosh is true if Cosh is the hyperbolic cosine of X.
 	%
 :- func math__cosh(float) = float.
 
-	% math__tanh(X) = Tanh is true if Tanh is the hyperbolic
-	% tangent of X.
+    % math__tanh(X) = Tanh is true if Tanh is the hyperbolic tangent of X.
 	%
 :- func math__tanh(float) = float.
 
@@ -268,8 +259,10 @@
 
 :- pred domain_checks is semidet.
 
-:- pragma foreign_proc("C", domain_checks,
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    domain_checks,
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 #ifdef ML_OMIT_MATH_DOMAIN_CHECKS
 	SUCCESS_INDICATOR = MR_FALSE;
 #else
@@ -277,8 +270,10 @@
 #endif
 ").
 
-:- pragma foreign_proc("C#", domain_checks,
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    domain_checks,
+    [thread_safe, promise_pure],
+"
 #if ML_OMIT_MATH_DOMAIN_CHECKS
 	SUCCESS_INDICATOR = false;
 #else
@@ -286,8 +281,10 @@
 #endif
 ").
 
-:- pragma foreign_proc("Java", domain_checks,
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("Java",
+    domain_checks,
+    [thread_safe, promise_pure],
+"
 	succeeded = true;
 ").
 
@@ -295,17 +292,22 @@
 % Mathematical constants from math.m
 %
 	% Pythagoras' number
-:- pragma foreign_proc("C", math__pi = (Pi::out),
+:- pragma foreign_proc("C",
+    math__pi = (Pi::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Pi = ML_FLOAT_PI;
 ").
-:- pragma foreign_proc("C#", math__pi = (Pi::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__pi = (Pi::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Pi = System.Math.PI;
 ").
-:- pragma foreign_proc("Java", math__pi = (Pi::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("Java",
+    math__pi = (Pi::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Pi = java.lang.Math.PI;
 ").
 	% This version is only used for back-ends for which there is no
@@ -316,16 +318,22 @@
 math__pi = 3.1415926535897932384626433832795029.
 
 	% Base of natural logarithms
-:- pragma foreign_proc("C", math__e = (E::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__e = (E::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	E = ML_FLOAT_E;
 ").
-:- pragma foreign_proc("C#", math__e = (E::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__e = (E::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	E = System.Math.E;
 ").
-:- pragma foreign_proc("Java", math__e = (E::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("Java",
+    math__e = (E::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	E = java.lang.Math.E;
 ").
 	% This version is only used for back-ends for which there is no
@@ -335,84 +343,68 @@
 	% to be accurate enough for 128-bit IEEE float.
 math__e = 2.7182818284590452353602874713526625.
 
-%
-% math__ceiling(X) = Ceil is true if Ceil is the smallest integer
-% not less than X.
-%
-:- pragma foreign_proc("C", math__ceiling(Num::in) = (Ceil::out),
+:- pragma foreign_proc("C",
+    math__ceiling(Num::in) = (Ceil::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Ceil = ceil(Num);
 ").
-:- pragma foreign_proc("C#", math__ceiling(Num::in) = (Ceil::out),
+:- pragma foreign_proc("C#",
+    math__ceiling(Num::in) = (Ceil::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Ceil = System.Math.Ceiling(Num);
 ").
-:- pragma foreign_proc("Java", math__ceiling(Num::in) = (Ceil::out),
+:- pragma foreign_proc("Java",
+    math__ceiling(Num::in) = (Ceil::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Ceil = java.lang.Math.ceil(Num);
 ").
 
-%
-% math__floor(X) = Floor is true if Floor is the largest integer
-% not greater than X.
-%
-:- pragma foreign_proc("C", math__floor(Num::in) = (Floor::out),
+:- pragma foreign_proc("C",
+    math__floor(Num::in) = (Floor::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Floor = floor(Num);
 ").
-:- pragma foreign_proc("C#", math__floor(Num::in) = (Floor::out),
+:- pragma foreign_proc("C#",
+    math__floor(Num::in) = (Floor::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Floor = System.Math.Floor(Num);
 ").
-:- pragma foreign_proc("Java", math__floor(Num::in) = (Floor::out),
+:- pragma foreign_proc("Java",
+    math__floor(Num::in) = (Floor::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Floor = java.lang.Math.floor(Num);
 ").
 
-%
-% math__round(X) = Round is true if Round is the integer
-% closest to X.  If X has a fractional component of 0.5,
-% it is rounded up.
-%
-% XXX Why do we even both implementing this in C/C#?
-:- pragma foreign_proc("C", math__round(Num::in) = (Rounded::out),
+:- pragma foreign_proc("C",
+    math__round(Num::in) = (Rounded::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Rounded = floor(Num+0.5);
 ").
-:- pragma foreign_proc("C#", math__round(Num::in) = (Rounded::out),
+:- pragma foreign_proc("C#",
+    math__round(Num::in) = (Rounded::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	// XXX the semantics of System.Math.Round() are not the same as ours.
 	// Unfortunately they are better (round to nearest even number).
 	Rounded = System.Math.Floor(Num+0.5);
 ").
-:- pragma foreign_proc("Java", math__round(Num::in) = (Rounded::out),
+:- pragma foreign_proc("Java",
+    math__round(Num::in) = (Rounded::out),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "
 	Rounded = java.lang.Math.round(Num);
 ").
 math__round(Num) = math__floor(Num + 0.5).
 
-%
-% math__truncate(X) = Trunc is true if Trunc is the integer
-% closest to X such that |Trunc| =< |X|.
-%
 math__truncate(X) = (X < 0.0 -> math__ceiling(X) ; math__floor(X)).
 
-%
-% math__sqrt(X) = Sqrt is true if Sqrt is the positive square
-% root of X.  
-%
-% Domain restrictions:
-%		X >= 0
-%
 math__sqrt(X) = SquareRoot :-
 	( domain_checks, X < 0.0 ->
 		throw(domain_error("math__sqrt"))
@@ -422,34 +414,31 @@
 
 :- func math__sqrt_2(float) = float.
 
-:- pragma foreign_proc("C", math__sqrt_2(X::in) = (SquareRoot::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__sqrt_2(X::in) = (SquareRoot::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	SquareRoot = sqrt(X);
 ").
-:- pragma foreign_proc("C#", math__sqrt_2(X::in) = (SquareRoot::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__sqrt_2(X::in) = (SquareRoot::out),
+    [thread_safe, promise_pure],
+"
 	SquareRoot = System.Math.Sqrt(X);
 ").
-:- pragma foreign_proc("Java", math__sqrt_2(X::in) = (SquareRoot::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("Java",
+    math__sqrt_2(X::in) = (SquareRoot::out),
+    [thread_safe, promise_pure],
+"
 	SquareRoot = java.lang.Math.sqrt(X);
 ").
 	% This version is only used for back-ends for which there is no
 	% matching foreign_proc version.
 math__sqrt_2(X) = math__exp(math__ln(X) / 2.0).
 
-%
-% math__solve_quadratic(A, B, C) = Roots is true if Roots are
-% the solutions to the equation Ax^2 + Bx + C.
-%
-% Domain restrictions:
-% 		A \= 0
-%
 math__solve_quadratic(A, B, C) = Roots :-
-	%
 	% This implementation is designed to minimise numerical errors;
 	% it is adapted from "Numerical recipes in C".
-	%
 	DSquared = B * B - 4.0 * A * C,
 	compare(CmpD, DSquared, 0.0),
 	(
@@ -481,14 +470,6 @@
 		Roots = two_roots(Root1, Root2)
 	).
 
-%
-% math__pow(X, Y) = Res is true if Res is X raised to the
-% power of Y.
-%
-% Domain restrictions:
-%		X >= 0
-%		X = 0 implies Y > 0
-%
 math__pow(X, Y) = Res :-
 	( domain_checks, X < 0.0 ->
 		throw(domain_error("math__pow"))
@@ -504,45 +485,46 @@
 
 :- func math__pow_2(float, float) = float.
 
-:- pragma foreign_proc("C", math__pow_2(X::in, Y::in) = (Res::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__pow_2(X::in, Y::in) = (Res::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Res = pow(X, Y);
 ").
 
-:- pragma foreign_proc("C#", math__pow_2(X::in, Y::in) = (Res::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__pow_2(X::in, Y::in) = (Res::out),
+    [thread_safe, promise_pure],
+"
 	Res = System.Math.Pow(X, Y);
 ").
 
-:- pragma foreign_proc("Java", math__pow_2(X::in, Y::in) = (Res::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("Java",
+    math__pow_2(X::in, Y::in) = (Res::out),
+    [thread_safe, promise_pure],
+"
 	Res = java.lang.Math.pow(X, Y);
 ").
 
-%
-% math__exp(X) = Exp is true if Exp is e raised to the
-% power of X.
-%
-:- pragma foreign_proc("C", math__exp(X::in) = (Exp::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__exp(X::in) = (Exp::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Exp = exp(X);
 ").
-:- pragma foreign_proc("C#", math__exp(X::in) = (Exp::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__exp(X::in) = (Exp::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Exp = System.Math.Exp(X);
 ").
-:- pragma foreign_proc("Java", math__exp(X::in) = (Exp::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("Java",
+    math__exp(X::in) = (Exp::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Exp = java.lang.Math.exp(X);
 ").
 
-%
-% math__ln(X) = Log is true if Log is the natural logarithm
-% of X.
-%
-% Domain restrictions:
-%		X > 0
-%
 math__ln(X) = Log :-
 	( domain_checks, X =< 0.0 ->
 		throw(domain_error("math__ln"))
@@ -552,26 +534,25 @@
 
 :- func math__ln_2(float) = float.
 
-:- pragma foreign_proc("C", math__ln_2(X::in) = (Log::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__ln_2(X::in) = (Log::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Log = log(X);
 ").
-:- pragma foreign_proc("C#", math__ln_2(X::in) = (Log::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__ln_2(X::in) = (Log::out),
+    [thread_safe, promise_pure],
+"
 	Log = System.Math.Log(X);
 ").
-:- pragma foreign_proc("Java", math__ln_2(X::in) = (Log::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("Java",
+    math__ln_2(X::in) = (Log::out),
+    [thread_safe, promise_pure],
+"
 	Log = java.lang.Math.log(X);
 ").
 
-%
-% math__log10(X) = Log is true if Log is the logarithm to
-% base 10 of X.
-%
-% Domain restrictions:
-%		X > 0
-%
 math__log10(X) = Log :-
 	( domain_checks, X =< 0.0 ->
 		throw(domain_error("math__log10"))
@@ -581,24 +562,21 @@
 
 :- func math__log10_2(float) = float.
 
-:- pragma foreign_proc("C", math__log10_2(X::in) = (Log10::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__log10_2(X::in) = (Log10::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Log10 = log10(X);
 ").
-:- pragma foreign_proc("C#", math__log10_2(X::in) = (Log10::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__log10_2(X::in) = (Log10::out),
+    [thread_safe, promise_pure],
+"
 	Log10 = System.Math.Log10(X);
 ").
 % Java doesn't have a built-in log10, so default to mercury here.
 math__log10_2(X) = math__ln_2(X) / math__ln_2(10.0).
 
-%
-% math__log2(X) = Log is true if Log is the logarithm to
-% base 2 of X.
-%
-% Domain restrictions:
-%		X > 0
-%
 math__log2(X) = Log :-
 	( domain_checks, X =< 0.0 ->
 		throw(domain_error("math__log2"))
@@ -608,29 +586,26 @@
 
 :- func math__log2_2(float) = float.
 
-:- pragma foreign_proc("C", math__log2_2(X::in) = (Log2::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__log2_2(X::in) = (Log2::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Log2 = log(X) / ML_FLOAT_LN2;
 ").
-:- pragma foreign_proc("C#", math__log2_2(X::in) = (Log2::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__log2_2(X::in) = (Log2::out),
+    [thread_safe, promise_pure],
+"
 	Log2 = System.Math.Log(X) / ML_FLOAT_LN2;
 ").
-:- pragma foreign_proc("Java", math__log2_2(X::in) = (Log2::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("Java",
+    math__log2_2(X::in) = (Log2::out),
+    [thread_safe, promise_pure],
+"
 	Log2 = java.lang.Math.log(X) / ML_FLOAT_LN2;
 ").
 math__log2_2(X) = math__ln_2(X) / math__ln_2(2.0).
 
-%
-% math__log(B, X) = Log is true if Log is the logarithm to
-% base B of X.
-%
-% Domain restrictions:
-%		X > 0
-%		B > 0
-%		B \= 1
-%
 math__log(B, X) = Log :-
 	(
 		domain_checks,
@@ -646,73 +621,78 @@
 
 :- func math__log_2(float, float) = float.
 
-:- pragma foreign_proc("C", math__log_2(B::in, X::in) = (Log::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__log_2(B::in, X::in) = (Log::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Log = log(X) / log(B);
 ").
-:- pragma foreign_proc("C#", math__log_2(B::in, X::in) = (Log::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__log_2(B::in, X::in) = (Log::out),
+    [thread_safe, promise_pure],
+"
 	Log = System.Math.Log(X, B);
 ").
 % Java implementation will default to mercury here.
 math__log_2(B, X) = math__ln_2(X) / math__ln_2(B).
 
-%
-% math__sin(X) = Sin is true if Sin is the sine of X.
-%
-:- pragma foreign_proc("C", math__sin(X::in) = (Sin::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__sin(X::in) = (Sin::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Sin = sin(X);
 ").
-:- pragma foreign_proc("C#", math__sin(X::in) = (Sin::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__sin(X::in) = (Sin::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Sin = System.Math.Sin(X);
 ").
-:- pragma foreign_proc("Java", math__sin(X::in) = (Sin::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("Java",
+    math__sin(X::in) = (Sin::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Sin = java.lang.Math.sin(X);
 ").
 
-
-%
-% math__cos(X) = Sin is true if Cos is the cosine of X.
-%
-:- pragma foreign_proc("C", math__cos(X::in) = (Cos::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__cos(X::in) = (Cos::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Cos = cos(X);
 ").
-:- pragma foreign_proc("C#", math__cos(X::in) = (Cos::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__cos(X::in) = (Cos::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Cos = System.Math.Cos(X);
 ").
-:- pragma foreign_proc("Java", math__cos(X::in) = (Cos::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("Java",
+    math__cos(X::in) = (Cos::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Cos = java.lang.Math.cos(X);
 ").
 
-%
-% math__tan(X) = Tan is true if Tan is the tangent of X.
-%
-:- pragma foreign_proc("C", math__tan(X::in) = (Tan::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__tan(X::in) = (Tan::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Tan = tan(X);
 ").
-:- pragma foreign_proc("C#", math__tan(X::in) = (Tan::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__tan(X::in) = (Tan::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Tan = System.Math.Tan(X);
 ").
-:- pragma foreign_proc("Java", math__tan(X::in) = (Tan::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("Java",
+    math__tan(X::in) = (Tan::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Tan = java.lang.Math.tan(X);
 ").
 
-%
-% math__asin(X) = ASin is true if ASin is the inverse
-% sine of X, where ASin is in the range [-pi/2,pi/2].
-%
-% Domain restrictions:
-%		X must be in the range [-1,1]
-%
 math__asin(X) = ASin :-
 	(
 		domain_checks,
@@ -727,26 +707,25 @@
 
 :- func math__asin_2(float) = float.
 
-:- pragma foreign_proc("C", math__asin_2(X::in) = (ASin::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__asin_2(X::in) = (ASin::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ASin = asin(X);
 ").
-:- pragma foreign_proc("C#", math__asin_2(X::in) = (ASin::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__asin_2(X::in) = (ASin::out),
+    [thread_safe, promise_pure],
+"
 	ASin = System.Math.Asin(X);
 ").
-:- pragma foreign_proc("Java", math__asin_2(X::in) = (ASin::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("Java",
+    math__asin_2(X::in) = (ASin::out),
+    [thread_safe, promise_pure],
+"
 	ASin = java.lang.Math.asin(X);
 ").
 
-%
-% math__acos(X) = ACos is true if ACos is the inverse
-% cosine of X, where ACos is in the range [0, pi].
-%
-% Domain restrictions:
-%		X must be in the range [-1,1]
-%
 math__acos(X) = ACos :-
 	(
 		domain_checks,
@@ -761,96 +740,106 @@
 
 :- func math__acos_2(float) = float.
 
-:- pragma foreign_proc("C", math__acos_2(X::in) = (ACos::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__acos_2(X::in) = (ACos::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ACos = acos(X);
 ").
-:- pragma foreign_proc("C#", math__acos_2(X::in) = (ACos::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+    math__acos_2(X::in) = (ACos::out),
+    [thread_safe, promise_pure],
+"
 	ACos = System.Math.Acos(X);
 ").
-:- pragma foreign_proc("Java", math__acos_2(X::in) = (ACos::out),
-		[thread_safe, promise_pure], "
+:- pragma foreign_proc("Java",
+    math__acos_2(X::in) = (ACos::out),
+    [thread_safe, promise_pure],
+"
 	ACos = java.lang.Math.acos(X);
 ").
 
 
-%
-% math__atan(X) = ATan is true if ATan is the inverse
-% tangent of X, where ATan is in the range [-pi/2,pi/2].
-%
-:- pragma foreign_proc("C", math__atan(X::in) = (ATan::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__atan(X::in) = (ATan::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ATan = atan(X);
 ").
-:- pragma foreign_proc("C#", math__atan(X::in) = (ATan::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__atan(X::in) = (ATan::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ATan = System.Math.Atan(X);
 ").
-:- pragma foreign_proc("Java", math__atan(X::in) = (ATan::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("Java",
+    math__atan(X::in) = (ATan::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ATan = java.lang.Math.atan(X);
 ").
 
-%
-% math__atan2(Y, X) = ATan is true if ATan is the inverse
-% tangent of Y/X, where ATan is in the range [-pi,pi].
-%
-:- pragma foreign_proc("C", math__atan2(Y::in, X::in) = (ATan2::out), 
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C",
+    math__atan2(Y::in, X::in) = (ATan2::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ATan2 = atan2(Y, X);
 ").
-:- pragma foreign_proc("C#", math__atan2(Y::in, X::in) = (ATan2::out), 
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("C#",
+    math__atan2(Y::in, X::in) = (ATan2::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ATan2 = System.Math.Atan2(Y, X);
 ").
-:- pragma foreign_proc("Java", math__atan2(Y::in, X::in) = (ATan2::out), 
-		[will_not_call_mercury, promise_pure, thread_safe], "
+:- pragma foreign_proc("Java",
+    math__atan2(Y::in, X::in) = (ATan2::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	ATan2 = java.lang.Math.atan2(Y, X);
 ").
 
-%
-% math__sinh(X) = Sinh is true if Sinh is the hyperbolic
-% sine of X.
-%
-:- pragma foreign_proc("C", math__sinh(X::in) = (Sinh::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__sinh(X::in) = (Sinh::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Sinh = sinh(X);
 ").
-:- pragma foreign_proc("C#", math__sinh(X::in) = (Sinh::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__sinh(X::in) = (Sinh::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Sinh = System.Math.Sinh(X);
 ").
 % Java doesn't have any hyperbolic functions built in.
 math__sinh(X) = Sinh :-
 	Sinh = (exp(X)-exp(-X)) / 2.0.
 
-%
-% math__cosh(X) = Cosh is true if Cosh is the hyperbolic
-% cosine of X.
-%
-:- pragma foreign_proc("C", math__cosh(X::in) = (Cosh::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__cosh(X::in) = (Cosh::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Cosh = cosh(X);
 ").
-:- pragma foreign_proc("C#", math__cosh(X::in) = (Cosh::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__cosh(X::in) = (Cosh::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Cosh = System.Math.Cosh(X);
 ").
 % Java doesn't have any hyperbolic functions built in.
 math__cosh(X) = Cosh :-
 	Cosh = (exp(X)+exp(-X)) / 2.0.
 
-%
-% math__tanh(X) = Tanh is true if Tanh is the hyperbolic
-% tangent of X.
-%
-:- pragma foreign_proc("C", math__tanh(X::in) = (Tanh::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C",
+    math__tanh(X::in) = (Tanh::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Tanh = tanh(X);
 ").
-:- pragma foreign_proc("C#", math__tanh(X::in) = (Tanh::out),
-		[will_not_call_mercury, promise_pure, thread_safe],"
+:- pragma foreign_proc("C#",
+    math__tanh(X::in) = (Tanh::out),
+    [will_not_call_mercury, promise_pure, thread_safe],
+"
 	Tanh = System.Math.Tanh(X);
 ").
 % Java doesn't have any hyperbolic functions built in.
Index: multi_map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/multi_map.m,v
retrieving revision 1.18
diff -u -b -r1.18 multi_map.m
--- multi_map.m	16 Jun 2005 04:08:02 -0000	1.18
+++ multi_map.m	17 Oct 2005 05:25:06 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1995, 1997, 2000, 2002-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -358,10 +360,10 @@
 		list__delete_all(Values0, Value, Values)
 	->
 		(
-			Values = []
-		->
+            Values = [],
 			map__delete(MultiMap0, Key, MultiMap)
 		;
+            Values = [_ | _],
 			map__set(MultiMap0, Key, Values, MultiMap)
 		)
 	;
@@ -406,8 +408,7 @@
 	->
 		MultiMap = MultiMap1
 	;
-		error("multi_map__from_corresponding_lists: " ++
-			"list length mismatch")
+        error("multi_map__from_corresponding_lists: list length mismatch")
 	).
 
 :- pred multi_map__from_corresponding_lists_2(multi_map(K, V)::in, list(K)::in,
@@ -417,8 +418,7 @@
 multi_map__from_corresponding_lists_2(MultiMap0, [Key | Keys],
 		[Value | Values], MultiMap) :-
 	multi_map__set(MultiMap0, Key, Value, MultiMap1),
-	multi_map__from_corresponding_lists_2(MultiMap1, Keys, Values,
-		MultiMap).
+    multi_map__from_corresponding_lists_2(MultiMap1, Keys, Values, MultiMap).
 
 multi_map__from_corresponding_list_lists(Keys, Values, MultiMap) :-
 	map__from_corresponding_lists(Keys, Values, MultiMap).
@@ -448,14 +448,12 @@
 		Res = (<),
 		Key = KeyA,
 		Data = DataA,
-		multi_map__assoc_list_merge(ListA, [(KeyB - DataB) | ListB],
-			List)
+        multi_map__assoc_list_merge(ListA, [(KeyB - DataB) | ListB], List)
 	;
 		Res = (>),
 		Key = KeyB,
 		Data = DataB,
-		multi_map__assoc_list_merge([(KeyA - DataA) | ListA], ListB,
-			List)
+        multi_map__assoc_list_merge([(KeyA - DataA) | ListA], ListB, List)
 	).
 
 %-----------------------------------------------------------------------------%
Index: ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/ops.m,v
retrieving revision 1.55
diff -u -b -r1.55 ops.m
--- ops.m	4 Oct 2005 07:20:21 -0000	1.55
+++ ops.m	17 Oct 2005 05:24:25 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1995-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -115,10 +117,20 @@
 	% while `xfy' indicates a right-associative infix operator.
 	%
 :- type ops__specifier
-	--->	fx ; fy ; xf ; yf ; xfx ; yfx ; xfy ; fxx ; fxy ; fyx.
+    --->    fx
+    ;       fy
+    ;       xf
+    ;       yf
+    ;       xfx
+    ;       yfx
+    ;       xfy
+    ;       fxx
+    ;       fxy
+    ;       fyx.
 
 :- type ops__assoc
-	--->	x ; y.
+    --->    x
+    ;       y.
 
 :- type ops__class
 	--->	infix(ops__assoc, ops__assoc)
@@ -139,11 +151,8 @@
 
 :- interface.
 
-	% 
 	% The Mercury operator table used to be the only one allowed.
 	% The old names are no longer appropriate.
-	%
-
 :- type ops__table == ops__mercury_op_table.
 
 %-----------------------------------------------------------------------------%
@@ -161,13 +170,16 @@
 ops__op_specifier_to_class(fyx, binary_prefix(y,x)).
 ops__op_specifier_to_class(fxy, binary_prefix(x,y)).
 
-:- type ops__mercury_op_table ---> ops__mercury_op_table.
+:- type ops__mercury_op_table
+    --->    ops__mercury_op_table.
 
 	% ops__category is used to index the op_table so that
 	% lookups are semidet rather than nondet.
 	% Prefix and binary_prefix operators have ops__category `before'.
 	% Infix and postfix operators have ops__category `after'.
-:- type ops__category ---> before ; after.
+:- type ops__category
+    --->    before
+    ;       after.
 
 ops__init_mercury_op_table = ops__mercury_op_table.
 
Index: parser.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/parser.m,v
retrieving revision 1.47
diff -u -b -r1.47 parser.m
--- parser.m	16 Jun 2005 04:08:03 -0000	1.47
+++ parser.m	17 Oct 2005 05:08:01 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1995-2001, 2003-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -8,12 +10,12 @@
 % main author: fjh.
 % stability: high.
 %
-% This file exports the predicate parser__read_term, which reads
+% This file exports the predicate read_term, which reads
 % a term from the current input stream.
-% The parser__read_term_from_string predicates are the same as the
+% The read_term_from_string predicates are the same as the
 % read_term predicates, except that the term is read from
 % a string rather than from the current input stream.
-% The parser__parse_token_list predicate is similar,
+% The parse_token_list predicate is similar,
 % but it takes a list of tokens rather than a string.
 %
 % The parser and lexer are intended to exactly follow ISO Prolog
@@ -42,90 +44,91 @@
 
 %-----------------------------------------------------------------------------%
 
+    % read_term/{3,4}:
 	%
-	% parser__read_term/{3,4}:
 	%	Reads in (and parses) terms from the current input stream.
 
-	% parser__read_term(Result):
+    % read_term(Result):
+    %
 	%	Reads a Mercury term from the current input stream.
 	%
-:- pred parser__read_term(read_term(T)::out, io::di, io::uo) is det.
+:- pred read_term(read_term(T)::out, io::di, io::uo) is det.
 
-	% parser__read_term_with_op_table(Result):
-	%	Reads a term from the current input stream, using the
-	%	given op_table to interpret the operators.
+    % read_term_with_op_table(Result):
 	%
-:- pred parser__read_term_with_op_table(Ops::in, read_term(T)::out,
-	io::di, io::uo) is det <= op_table(Ops).
+    % Reads a term from the current input stream, using the given op_table
+    % to interpret the operators.
+    %
+:- pred read_term_with_op_table(Ops::in, read_term(T)::out, io::di, io::uo)
+    is det <= op_table(Ops).
 
-	% parser__read_term(FileName, Result):
-	%	Reads a term from the current input stream.
-	%	The string is the filename to use for the current input stream;
-	%	this is used in constructing the term__contexts in the read
-	%	term. This interface is used to support the `:- pragma
-	%	source_file' directive.
+    % read_term(FileName, Result):
 	%
-:- pred parser__read_term(string::in, read_term(T)::out, io::di, io::uo)
-	is det.
+    % Reads a term from the current input stream. The string is the filename
+    % to use for the current input stream; this is used in constructing the
+    % term__contexts in the read term. This interface is used to support
+    % the `:- pragma source_file' directive.
+    %
+:- pred read_term(string::in, read_term(T)::out, io::di, io::uo) is det.
 
-	% parser__read_term_with_op_table(Ops, FileName, Result):
+    % read_term_with_op_table(Ops, FileName, Result):
+    %
 	%	As above but using the given op_table.
 	%
-:- pred parser__read_term_with_op_table(Ops::in, string::in, read_term(T)::out,
+:- pred read_term_with_op_table(Ops::in, string::in, read_term(T)::out,
 	io::di, io::uo) is det <= op_table(Ops).
 
 %-----------------------------------------------------------------------------%
 
-	% parser__read_term_from_string/{4,6}:
+    % read_term_from_string/{4,6}:
+    %
 	%	Parses terms from a string.
 
-	% The read_term_from_string predicates are the same as the
-	% read_term predicates, except that the term is read from
-	% a string rather than from the current input stream.
-	% The returned value `EndPos' is the position one character
-	% past the end of the term read.
-	% The arguments `MaxOffset' and `StartPos' in the six-argument version
-	% specify the length of the string and the position within the
-	% string at which to start parsing.
+    % The read_term_from_string predicates are the same as the read_term
+    % predicates, except that the term is read from a string rather than from
+    % the current input stream. The returned value `EndPos' is the position
+    % one character past the end of the term read. The arguments `MaxOffset'
+    % and `StartPos' in the six-argument version specify the length of the
+    % string and the position within the string at which to start parsing.
 
-	% parser__read_term_from_string(FileName, String, EndPos, Term).
+    % read_term_from_string(FileName, String, EndPos, Term).
 	%
-:- pred parser__read_term_from_string(string::in, string::in, posn::out,
+:- pred read_term_from_string(string::in, string::in, posn::out,
 	read_term(T)::out) is det.
 
-	% parser__read_term_from_string_with_op_table(Ops, FileName,
+    % read_term_from_string_with_op_table(Ops, FileName,
 	%	String, EndPos, Term).
 	%
-:- pred parser__read_term_from_string_with_op_table(Ops::in, string::in,
+:- pred read_term_from_string_with_op_table(Ops::in, string::in,
 	string::in, posn::out, read_term(T)::out) is det <= op_table(Ops).
 
-	% parser__read_term_from_string(FileName, String, MaxOffset, StartPos,
+    % read_term_from_string(FileName, String, MaxOffset, StartPos,
 	%	EndPos, Term).
 	%
-:- pred parser__read_term_from_string(string::in, string::in, int::in,
+:- pred read_term_from_string(string::in, string::in, int::in,
 	posn::in, posn::out, read_term(T)::out) is det.
 
-	% parser__read_term_from_string_with_op_table(Ops, FileName, String,
+    % read_term_from_string_with_op_table(Ops, FileName, String,
 	%	MaxOffset, StartPos, EndPos, Term).
 	%
-:- pred parser__read_term_from_string_with_op_table(Ops::in, string::in,
+:- pred read_term_from_string_with_op_table(Ops::in, string::in,
 	string::in, int::in, posn::in, posn::out, read_term(T)::out) is det
 	<= op_table(Ops).
 
 %-----------------------------------------------------------------------------%
 
-	% parser__parse_tokens/{3,4}:
+    % parse_tokens/{3,4}:
+    %
 	%	Parses a list of tokens.
 
-	% parser__parse_tokens(FileName, TokenList, Result):
+    % parse_tokens(FileName, TokenList, Result):
 	%
-:- pred parser__parse_tokens(string::in, token_list::in, read_term(T)::out)
-	is det.
+:- pred parse_tokens(string::in, token_list::in, read_term(T)::out) is det.
 
-	% parser__parse_tokens(FileName, TokenList, Result):
+    % parse_tokens(FileName, TokenList, Result):
 	%
-:- pred parser__parse_tokens_with_op_table(Ops::in, string::in,
-	token_list::in, read_term(T)::out) is det <= op_table(Ops).
+:- pred parse_tokens_with_op_table(Ops::in, string::in, token_list::in,
+    read_term(T)::out) is det <= op_table(Ops).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -157,112 +160,97 @@
 
 %-----------------------------------------------------------------------------%
 
-parser__read_term(Result, !IO) :-
+read_term(Result, !IO) :-
 	io__input_stream_name(FileName, !IO),
-	parser__read_term_with_op_table(ops__init_mercury_op_table,
-		FileName, Result, !IO).
+    read_term_with_op_table(ops__init_mercury_op_table, FileName, Result, !IO).
 
-parser__read_term_with_op_table(Ops, Result, !IO) :-
+read_term_with_op_table(Ops, Result, !IO) :-
 	io__input_stream_name(FileName, !IO),
-	parser__read_term_with_op_table(Ops, FileName, Result, !IO).
+    read_term_with_op_table(Ops, FileName, Result, !IO).
 
-parser__read_term(FileName, Result, !IO) :-
-	parser__read_term_with_op_table(ops__init_mercury_op_table,
-		FileName, Result, !IO).
+read_term(FileName, Result, !IO) :-
+    read_term_with_op_table(ops__init_mercury_op_table, FileName, Result, !IO).
 
-parser__read_term_with_op_table(Ops, FileName, Result, !IO) :-
+read_term_with_op_table(Ops, FileName, Result, !IO) :-
 	lexer__get_token_list(Tokens, !IO),
-	parser__parse_tokens_with_op_table(Ops, FileName, Tokens, Result).
+    parse_tokens_with_op_table(Ops, FileName, Tokens, Result).
 
-parser__read_term_from_string(FileName, String, EndPos, Result) :-
-	parser__read_term_from_string_with_op_table(ops__init_mercury_op_table,
-		FileName, String, EndPos, Result).
+read_term_from_string(FileName, String, EndPos, Result) :-
+    read_term_from_string_with_op_table(ops__init_mercury_op_table, FileName,
+        String, EndPos, Result).
 
-parser__read_term_from_string_with_op_table(Ops, FileName, String,
-		EndPos, Result) :-
+read_term_from_string_with_op_table(Ops, FileName, String, EndPos, Result) :-
 	string__length(String, Len),
 	StartPos = posn(1, 0, 0),
-	parser__read_term_from_string_with_op_table(Ops, FileName, String, Len,
+    read_term_from_string_with_op_table(Ops, FileName, String, Len,
 		StartPos, EndPos, Result).
 
-parser__read_term_from_string(FileName, String, Len,
-		StartPos, EndPos, Result) :-
-	parser__read_term_from_string_with_op_table(ops__init_mercury_op_table,
+read_term_from_string(FileName, String, Len, StartPos, EndPos, Result) :-
+    read_term_from_string_with_op_table(ops__init_mercury_op_table,
 		FileName, String, Len, StartPos, EndPos, Result).
 
-parser__read_term_from_string_with_op_table(Ops, FileName, String, Len,
+read_term_from_string_with_op_table(Ops, FileName, String, Len,
 		StartPos, EndPos, Result) :-
 	lexer__string_get_token_list(String, Len, Tokens, StartPos, EndPos),
-	parser__parse_tokens_with_op_table(Ops, FileName, Tokens, Result).
+    parse_tokens_with_op_table(Ops, FileName, Tokens, Result).
 
 %-----------------------------------------------------------------------------%
 
-parser__parse_tokens(FileName, Tokens, Result) :-
-	parser__parse_tokens_with_op_table(ops__init_mercury_op_table,
-		FileName, Tokens, Result).
+parse_tokens(FileName, Tokens, Result) :-
+    parse_tokens_with_op_table(ops__init_mercury_op_table, FileName, Tokens,
+        Result).
 
-parser__parse_tokens_with_op_table(Ops, FileName, Tokens, Result) :-
+parse_tokens_with_op_table(Ops, FileName, Tokens, Result) :-
 	( Tokens = token_nil ->
 		Result = eof
 	;
-		parser__init_state(Ops, FileName, Tokens, ParserState0),
-		parser__parse_whole_term(Term, ParserState0, ParserState),
-		parser__final_state(ParserState, VarSet, LeftOverTokens),
-		parser__check_for_errors(Term, VarSet,
-			Tokens, LeftOverTokens, Result)
+        init_state(Ops, FileName, Tokens, ParserState0),
+        parse_whole_term(Term, ParserState0, ParserState),
+        final_state(ParserState, VarSet, LeftOverTokens),
+        check_for_errors(Term, VarSet, Tokens, LeftOverTokens, Result)
 	).
 
-:- pred parser__check_for_errors(parse(term(T))::in, varset(T)::in,
+:- pred check_for_errors(parse(term(T))::in, varset(T)::in,
 	token_list::in, token_list::in, read_term(T)::out) is det.
 
-parser__check_for_errors(error(ErrorMessage, ErrorTokens), _VarSet, Tokens,
+check_for_errors(error(ErrorMessage, ErrorTokens), _VarSet, Tokens,
 		_LeftOverTokens, Result) :-
-	% check if the error was caused by a bad token
-	(
-		parser__check_for_bad_token(Tokens,
-			BadTokenMessage, BadTokenLineNum)
-	->
+    % Check if the error was caused by a bad token.
+    ( check_for_bad_token(Tokens, BadTokenMessage, BadTokenLineNum) ->
 		Message = BadTokenMessage,
 		LineNum = BadTokenLineNum
 	;
-		% find the token that caused the error
+        % Find the token that caused the error.
 		( ErrorTokens = token_cons(ErrorTok, ErrorTokLineNum, _) ->
 			lexer__token_to_string(ErrorTok, TokString),
-			string__append_list( ["Syntax error at ", TokString,
-				": ", ErrorMessage], Message),
+            string__append_list( ["Syntax error at ", TokString, ": ",
+                ErrorMessage], Message),
 			LineNum = ErrorTokLineNum
 		;
 			( Tokens = token_cons(_, FirstTokLineNum, _) ->
 				LineNum = FirstTokLineNum
 			;
-				error("parser__check_for_errors")
+                error("check_for_errors")
 			),
 			string__append("Syntax error: ", ErrorMessage, Message)
 		)
 	),
 	Result = error(Message, LineNum).
 
-parser__check_for_errors(ok(Term), VarSet, Tokens, LeftOverTokens, Result) :-
-	(
-		parser__check_for_bad_token(Tokens, Message, LineNum)
-	->
+check_for_errors(ok(Term), VarSet, Tokens, LeftOverTokens, Result) :-
+    ( check_for_bad_token(Tokens, Message, LineNum) ->
 		Result = error(Message, LineNum)
-	;
-		LeftOverTokens = token_cons(Token, LineNum, _)
-	->
+    ; LeftOverTokens = token_cons(Token, LineNum, _) ->
 		lexer__token_to_string(Token, TokString),
-		string__append("Syntax error: unexpected ", TokString,
-			Message),
+        Message = "Syntax error: unexpected " ++ TokString,
 		Result = error(Message, LineNum)
 	;
 		Result = term(VarSet, Term)
 	).
 
-:- pred parser__check_for_bad_token(token_list::in, string::out, int::out)
-	is semidet.
+:- pred check_for_bad_token(token_list::in, string::out, int::out) is semidet.
 
-parser__check_for_bad_token(token_cons(Token, LineNum, Tokens),
-		Message, LineNum) :-
+check_for_bad_token(token_cons(Token, LineNum, Tokens), Message, LineNum) :-
 	( Token = io_error(IO_Error) ->
 		io__error_message(IO_Error, IO_ErrorMessage),
 		string__append("I/O error: ", IO_ErrorMessage, Message)
@@ -270,180 +258,157 @@
 		char__to_int(Char, Code),
 		string__int_to_base_string(Code, 10, Decimal),
 		string__int_to_base_string(Code, 16, Hex),
-		string__append_list(["Syntax error: Illegal character 0x",
-			Hex, " (", Decimal, ") in input"], Message)
+        string__append_list(["Syntax error: Illegal character 0x", Hex,
+            " (", Decimal, ") in input"], Message)
 	; Token = error(ErrorMessage) ->
 		string__append("Syntax error: ", ErrorMessage, Message)
 	;
-		parser__check_for_bad_token(Tokens, Message, LineNum)
+        check_for_bad_token(Tokens, Message, LineNum)
 	).
 
-:- pred parser__parse_whole_term(parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_whole_term(parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_whole_term(Term, !PS) :-
-	parser__parse_term(Term0, !PS),
+parse_whole_term(Term, !PS) :-
+    parse_term(Term0, !PS),
 	( Term0 = ok(_) ->
-		( parser__get_token(end, !PS) ->
+        ( get_token(end, !PS) ->
 			Term = Term0
 		;
-			parser__unexpected("operator or `.' expected", Term,
-				!PS)
+            unexpected("operator or `.' expected", Term, !PS)
 		)
 	;
-		% propagate error upwards
+        % Propagate error upwards.
 		Term = Term0
 	).
 
-:- pred parser__parse_term(parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_term(parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_term(Term, !PS) :-
-	parser__get_ops_table(!.PS, OpTable),
-	parser__parse_term_2(ops__max_priority(OpTable) + 1, ordinary_term,
-		Term, !PS).
+parse_term(Term, !PS) :-
+    get_ops_table(!.PS, OpTable),
+    parse_term_2(ops__max_priority(OpTable) + 1, ordinary_term, Term, !PS).
 
-:- pred parser__parse_arg(parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_arg(parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_arg(Term, !PS) :-
-	parser__get_ops_table(!.PS, OpTable),
-	parser__parse_term_2(ops__arg_priority(OpTable), argument, Term, !PS).
+parse_arg(Term, !PS) :-
+    get_ops_table(!.PS, OpTable),
+    parse_term_2(ops__arg_priority(OpTable), argument, Term, !PS).
 
-:- pred parser__parse_list_elem(parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_list_elem(parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_list_elem(Term, !PS) :-
-	parser__get_ops_table(!.PS, OpTable),
-	parser__parse_term_2(ops__arg_priority(OpTable), list_elem, Term, !PS).
+parse_list_elem(Term, !PS) :-
+    get_ops_table(!.PS, OpTable),
+    parse_term_2(ops__arg_priority(OpTable), list_elem, Term, !PS).
 
-:- pred parser__parse_term_2(int::in, term_kind::in, parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_term_2(int::in, term_kind::in, parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_term_2(MaxPriority, TermKind, Term, !PS) :-
-	parser__parse_left_term(MaxPriority, TermKind, LeftPriority, LeftTerm0,
-		!PS),
+parse_term_2(MaxPriority, TermKind, Term, !PS) :-
+    parse_left_term(MaxPriority, TermKind, LeftPriority, LeftTerm0, !PS),
 	( LeftTerm0 = ok(LeftTerm) ->
-		parser__parse_rest(MaxPriority, TermKind, LeftPriority,
-			LeftTerm, Term, !PS)
+        parse_rest(MaxPriority, TermKind, LeftPriority, LeftTerm, Term, !PS)
 	;
 		% propagate error upwards
 		Term = LeftTerm0
 	).
 
-:- pred parser__parse_left_term(int::in, term_kind::in, int::out,
-	parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_left_term(int::in, term_kind::in, int::out, parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_left_term(MaxPriority, TermKind, OpPriority, Term, !PS) :-
-	( parser__get_token(Token, Context, !PS) ->
+parse_left_term(MaxPriority, TermKind, OpPriority, Term, !PS) :-
+    ( get_token(Token, Context, !PS) ->
 		(
-			% check for unary minus of integer
+            % Check for unary minus of integer.
 			Token = name("-"),
-			parser__get_token(integer(X), _IntContext, !PS)
+            get_token(integer(X), _IntContext, !PS)
 		->
-			parser__get_term_context(!.PS, Context, TermContext),
+            get_term_context(!.PS, Context, TermContext),
 			NegX = 0 - X,
-			Term = ok(term__functor(term__integer(NegX), [],
-				TermContext)),
+            Term = ok(term__functor(term__integer(NegX), [], TermContext)),
 			OpPriority = 0
 		;
-			% check for unary minus of float
+            % Check for unary minus of float.
 			Token = name("-"),
-			parser__get_token(float(F), _FloatContext, !PS)
+            get_token(float(F), _FloatContext, !PS)
 		->
-			parser__get_term_context(!.PS, Context, TermContext),
+            get_term_context(!.PS, Context, TermContext),
 			NegF = 0.0 - F,
-			Term = ok(term__functor(term__float(NegF), [],
-				TermContext)),
+            Term = ok(term__functor(term__float(NegF), [], TermContext)),
 			OpPriority = 0
 		;
-			% check for binary prefix op
+            % Check for binary prefix op.
 			Token = name(Op),
-			\+ parser__peek_token(open_ct, !.PS, _),
-			parser__get_ops_table(!.PS, OpTable),
-			ops__lookup_binary_prefix_op(OpTable, Op,
-				BinOpPriority, RightAssoc, RightRightAssoc),
+            \+ peek_token(open_ct, !.PS, _),
+            get_ops_table(!.PS, OpTable),
+            ops__lookup_binary_prefix_op(OpTable, Op, BinOpPriority,
+                RightAssoc, RightRightAssoc),
 			BinOpPriority =< MaxPriority,
-			parser__peek_token(NextToken, !PS),
-			parser__could_start_term(NextToken, yes)
+            peek_token(NextToken, !PS),
+            could_start_term(NextToken, yes)
 		->
 			adjust_priority_for_assoc(BinOpPriority,
 				RightAssoc, RightPriority),
 			adjust_priority_for_assoc(BinOpPriority,
 				RightRightAssoc, RightRightPriority),
 			OpPriority = BinOpPriority,
-			parser__parse_term_2(RightPriority, TermKind,
-				RightResult, !PS),
+            parse_term_2(RightPriority, TermKind, RightResult, !PS),
 			( RightResult = ok(RightTerm) ->
-				parser__parse_term_2(RightRightPriority,
-					TermKind, RightRightResult, !PS),
+                parse_term_2(RightRightPriority, TermKind, RightRightResult,
+                    !PS),
 				( RightRightResult = ok(RightRightTerm) ->
-					parser__get_term_context(!.PS, Context,
-						TermContext),
-					Term = ok(term__functor(
-						term__atom(Op),
-						[RightTerm, RightRightTerm],
-						TermContext))
+                    get_term_context(!.PS, Context, TermContext),
+                    Term = ok(term__functor(term__atom(Op),
+                        [RightTerm, RightRightTerm], TermContext))
 				;
-					% propagate error upwards
+                    % Propagate error upwards.
 					Term = RightRightResult
 				)
 			;
-				% propagate error upwards
+                % Propagate error upwards.
 				Term = RightResult
 			)
 		;
-			% check for unary prefix op
+            % Check for unary prefix op.
 			Token = name(Op),
-			\+ parser__peek_token(open_ct, !.PS, _),
-			parser__get_ops_table(!.PS, OpTable),
-			ops__lookup_prefix_op(OpTable, Op, UnOpPriority,
-				RightAssoc),
+            \+ peek_token(open_ct, !.PS, _),
+            get_ops_table(!.PS, OpTable),
+            ops__lookup_prefix_op(OpTable, Op, UnOpPriority, RightAssoc),
 			UnOpPriority =< MaxPriority,
-			parser__peek_token(NextToken, !PS),
-			parser__could_start_term(NextToken, yes)
+            peek_token(NextToken, !PS),
+            could_start_term(NextToken, yes)
 		->
 			adjust_priority_for_assoc(UnOpPriority, RightAssoc,
 				RightPriority),
-			parser__parse_term_2(RightPriority, TermKind,
-				RightResult, !PS),
+            parse_term_2(RightPriority, TermKind, RightResult, !PS),
 			OpPriority = UnOpPriority,
 			( RightResult = ok(RightTerm) ->
-				parser__get_term_context(!.PS, Context,
-					TermContext),
-				Term = ok(term__functor(term__atom(Op),
-					[RightTerm], TermContext))
+                get_term_context(!.PS, Context, TermContext),
+                Term = ok(term__functor(term__atom(Op), [RightTerm],
+                    TermContext))
 			;
-				% propagate error upwards
+                % Propagate error upwards.
 				Term = RightResult
 			)
 		;
-			parser__parse_simple_term(Token, Context, MaxPriority,
-				Term, !PS),
+            parse_simple_term(Token, Context, MaxPriority, Term, !PS),
 			OpPriority = 0
 		)
 	;
-		parser__error(!.PS,
-			"unexpected end-of-file at start of sub-term", Term),
+        error(!.PS, "unexpected end-of-file at start of sub-term", Term),
 		OpPriority = 0
 	).
 
-:- pred parser__parse_rest(int::in, term_kind::in, int::in, term(T)::in,
+:- pred parse_rest(int::in, term_kind::in, int::in, term(T)::in,
 	parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_rest(MaxPriority, TermKind, LeftPriority, LeftTerm, Term, !PS) :-
+parse_rest(MaxPriority, TermKind, LeftPriority, LeftTerm, Term, !PS) :-
 	(
-		% infix op
-		parser__get_token(Token, Context, !PS),
+        % Infix op.
+        get_token(Token, Context, !PS),
 		(
 			Token = comma,
 			TermKind = ordinary_term,
@@ -456,123 +421,112 @@
 			Token = name(Op0)
 		),
 		(
-				% A token surrounded by backquotes is a
-				% prefix token being using in an
-				% infix manner.
+            % A token surrounded by backquotes is a prefix token being used
+            % in an infix manner.
 			Op0 = "`",
-			parser__get_ops_table(!.PS, OpTable),
+            get_ops_table(!.PS, OpTable),
 			ops__lookup_operator_term(OpTable, OpPriority0,
 				LeftAssoc0, RightAssoc0)
 		->
 			OpPriority = OpPriority0,
 			LeftAssoc = LeftAssoc0,
 			RightAssoc = RightAssoc0,
-			parse_backquoted_operator(Qualifier, Op, VariableTerm,
-				!PS),
-			parser__get_token(name("`"), _, !PS)
+            parse_backquoted_operator(Qualifier, Op, VariableTerm, !PS),
+            get_token(name("`"), _, !PS)
 		;
 			Op = Op0,
 			VariableTerm = [],
 			Qualifier = no,
-			parser__get_ops_table(!.PS, OpTable),
+            get_ops_table(!.PS, OpTable),
 			ops__lookup_infix_op(OpTable, Op, OpPriority,
 				LeftAssoc, RightAssoc)
 		),
 		OpPriority =< MaxPriority,
-		parser__check_priority(LeftAssoc, OpPriority, LeftPriority)
+        check_priority(LeftAssoc, OpPriority, LeftPriority)
 	->
-		adjust_priority_for_assoc(OpPriority, RightAssoc,
-			RightPriority),
-		parser__parse_term_2(RightPriority, TermKind, RightTerm0, !PS),
+        adjust_priority_for_assoc(OpPriority, RightAssoc, RightPriority),
+        parse_term_2(RightPriority, TermKind, RightTerm0, !PS),
 		( RightTerm0 = ok(RightTerm) ->
-			parser__get_term_context(!.PS, Context, TermContext),
+            get_term_context(!.PS, Context, TermContext),
 			OpTerm0 = term__functor(term__atom(Op),
-				list__append(VariableTerm,
-					[LeftTerm, RightTerm]),
+                list__append(VariableTerm, [LeftTerm, RightTerm]),
 				TermContext),
 			(
 				Qualifier = no,
 				OpTerm = OpTerm0
 			;
 				Qualifier = yes(QTerm),
-				OpTerm = term__functor(term__atom("."),
-					[QTerm, OpTerm0],
+                OpTerm = term__functor(term__atom("."), [QTerm, OpTerm0],
 					TermContext)
 			),
-			parser__parse_rest(MaxPriority, TermKind, OpPriority,
-				OpTerm, Term, !PS)
+            parse_rest(MaxPriority, TermKind, OpPriority, OpTerm, Term, !PS)
 		;
-			% propagate error upwards
+            % Propagate error upwards.
 			Term = RightTerm0
 		)
 	;
-		% postfix op
-		parser__get_token(name(Op), Context, !PS),
-		parser__get_ops_table(!.PS, OpTable),
+        % Postfix op.
+        get_token(name(Op), Context, !PS),
+        get_ops_table(!.PS, OpTable),
 		ops__lookup_postfix_op(OpTable, Op, OpPriority, LeftAssoc),
 		OpPriority =< MaxPriority,
-		parser__check_priority(LeftAssoc, OpPriority, LeftPriority)
+        check_priority(LeftAssoc, OpPriority, LeftPriority)
 	->
-		parser__get_term_context(!.PS, Context, TermContext),
-		OpTerm = term__functor(term__atom(Op), [LeftTerm],
-			TermContext),
-		parser__parse_rest(MaxPriority, TermKind, OpPriority, OpTerm,
-			Term, !PS)
+        get_term_context(!.PS, Context, TermContext),
+        OpTerm = term__functor(term__atom(Op), [LeftTerm], TermContext),
+        parse_rest(MaxPriority, TermKind, OpPriority, OpTerm, Term, !PS)
 	;
 		Term = ok(LeftTerm)
 	).
 
 :- pred parse_backquoted_operator(maybe(term(T))::out, string::out,
 	list(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is semidet
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is semidet <= op_table(Ops).
 
 parse_backquoted_operator(Qualifier, OpName, VariableTerm, !PS) :-
-	parser__get_token(Token, Context, !PS),
+    get_token(Token, Context, !PS),
 	(
 		Token = variable(VariableOp),
 		Qualifier = no,
 		OpName = "",
-		parser__add_var(VariableOp, Var, !PS),
+        add_var(VariableOp, Var, !PS),
 		VariableTerm = [variable(Var)]
 	;
 		Token = name(OpName0),
 		VariableTerm = [],
-		parser__get_term_context(!.PS, Context, OpCtxt0),
-		parse_backquoted_operator_2(no, Qualifier,
-			OpCtxt0, OpName0, OpName, !PS)
+        get_term_context(!.PS, Context, OpCtxt0),
+        parse_backquoted_operator_2(no, Qualifier, OpCtxt0, OpName0, OpName,
+            !PS)
 	).
 
 :- pred parse_backquoted_operator_2(maybe(term(T))::in, maybe(term(T))::out,
 	term__context::in, string::in, string::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
 parse_backquoted_operator_2(Qualifier0, Qualifier, OpCtxt0, OpName0, OpName,
 		!PS) :-
 	(
-		parser__get_token(name(ModuleSeparator), SepContext, !PS),
+        get_token(name(ModuleSeparator), SepContext, !PS),
 		(
 			ModuleSeparator = "."
 		;
 			ModuleSeparator = ":"
 		),
-		parser__get_token(name(OpName1), NameContext, !PS),
+        get_token(name(OpName1), NameContext, !PS),
 		OpName1 \= "`"
 	->
-		parser__get_term_context(!.PS, SepContext, SepCtxt),
-		parser__get_term_context(!.PS, NameContext, OpCtxt1),
+        get_term_context(!.PS, SepContext, SepCtxt),
+        get_term_context(!.PS, NameContext, OpCtxt1),
 		QTerm1 = term__functor(atom(OpName0), [], OpCtxt0),
 		(
 			Qualifier0 = no,
 			Qualifier1 = yes(QTerm1)
 		;
 			Qualifier0 = yes(QTerm0),
-			Qualifier1 = yes(functor(atom("."), [QTerm0, QTerm1],
-					SepCtxt))
+            Qualifier1 = yes(functor(atom("."), [QTerm0, QTerm1], SepCtxt))
 		),
-		parse_backquoted_operator_2(Qualifier1, Qualifier,
-			OpCtxt1, OpName1, OpName, !PS)
+        parse_backquoted_operator_2(Qualifier1, Qualifier, OpCtxt1,
+            OpName1, OpName, !PS)
 	;
 		Qualifier = Qualifier0,
 		OpName = OpName0
@@ -580,16 +534,15 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred parser__parse_simple_term(token::in, token_context::in, int::in,
+:- pred parse_simple_term(token::in, token_context::in, int::in,
 	parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_simple_term(Token, Context, Priority, Term, !PS) :-
-	( parser__parse_simple_term_2(Token, Context, Priority, Term0, !PS) ->
-		parser__check_for_higher_order_term(Term0, Context, Term, !PS)
+parse_simple_term(Token, Context, Priority, Term, !PS) :-
+    ( parse_simple_term_2(Token, Context, Priority, Term0, !PS) ->
+        check_for_higher_order_term(Term0, Context, Term, !PS)
 	;
-		parser__unexpected_tok(Token, Context,
+        unexpected_tok(Token, Context,
 			"unexpected token at start of (sub)term", Term, !PS)
 	).
 
@@ -612,26 +565,24 @@
 	% term --> op, term		% with various conditions
 	% term --> term, op		% with various conditions
 
-:- pred parser__parse_simple_term_2(token::in, token_context::in, int::in,
+:- pred parse_simple_term_2(token::in, token_context::in, int::in,
 	parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is semidet
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is semidet <= op_table(Ops).
 
-parser__parse_simple_term_2(name(Atom), Context, Prec, Term, !PS) :-
-	parser__get_term_context(!.PS, Context, TermContext),
-	( parser__get_token(open_ct, !PS) ->
-		parser__parse_args(Args0, !PS),
+parse_simple_term_2(name(Atom), Context, Prec, Term, !PS) :-
+    get_term_context(!.PS, Context, TermContext),
+    ( get_token(open_ct, !PS) ->
+        parse_args(Args0, !PS),
 		(
 			Args0 = ok(Args),
-			Term = ok(term__functor(term__atom(Atom), Args,
-				TermContext))
+            Term = ok(term__functor(term__atom(Atom), Args, TermContext))
 		;
-			% propagate error upwards
+            % Propagate error upwards.
 			Args0 = error(Message, Tokens),
 			Term = error(Message, Tokens)
 		)
 	;
-		parser__get_ops_table(!.PS, OpTable),
+        get_ops_table(!.PS, OpTable),
 		( ops__lookup_op(OpTable, Atom) ->
 			Prec > ops__max_priority(OpTable)
 		;
@@ -640,110 +591,101 @@
 		Term = ok(term__functor(term__atom(Atom), [], TermContext))
 	).
 
-parser__parse_simple_term_2(variable(VarName), _, _, Term, !PS) :-
-	parser__add_var(VarName, Var, !PS),
+parse_simple_term_2(variable(VarName), _, _, Term, !PS) :-
+    add_var(VarName, Var, !PS),
 	Term = ok(term__variable(Var)).
 
-parser__parse_simple_term_2(integer(Int), Context, _, Term, !PS) :-
-	parser__get_term_context(!.PS, Context, TermContext),
+parse_simple_term_2(integer(Int), Context, _, Term, !PS) :-
+    get_term_context(!.PS, Context, TermContext),
 	Term = ok(term__functor(term__integer(Int), [], TermContext)).
 
-parser__parse_simple_term_2(float(Float), Context, _, Term, !PS) :-
-	parser__get_term_context(!.PS, Context, TermContext),
+parse_simple_term_2(float(Float), Context, _, Term, !PS) :-
+    get_term_context(!.PS, Context, TermContext),
 	Term = ok(term__functor(term__float(Float), [], TermContext)).
 
-parser__parse_simple_term_2(string(String), Context, _, Term, !PS) :-
-	parser__get_term_context(!.PS, Context, TermContext),
+parse_simple_term_2(string(String), Context, _, Term, !PS) :-
+    get_term_context(!.PS, Context, TermContext),
 	Term = ok(term__functor(term__string(String), [], TermContext)).
 
-parser__parse_simple_term_2(open, _, _, Term, !PS) :-
-	parser__parse_term(Term0, !PS),
+parse_simple_term_2(open, _, _, Term, !PS) :-
+    parse_term(Term0, !PS),
 	( Term0 = ok(_) ->
-		( parser__get_token(close, !PS) ->
+        ( get_token(close, !PS) ->
 			Term = Term0
 		;
-			parser__unexpected("expecting `)' or operator", Term,
-				!PS)
+            unexpected("expecting `)' or operator", Term, !PS)
 		)
 	;
-		% propagate error upwards
+        % Propagate error upwards.
 		Term = Term0
 	).
 
-parser__parse_simple_term_2(open_ct, Context, Prec, Term, !PS) :-
-	parser__parse_simple_term_2(open, Context, Prec, Term, !PS).
+parse_simple_term_2(open_ct, Context, Prec, Term, !PS) :-
+    parse_simple_term_2(open, Context, Prec, Term, !PS).
 
-parser__parse_simple_term_2(open_list, Context, _, Term, !PS) :-
-	parser__get_term_context(!.PS, Context, TermContext),
-	( parser__get_token(close_list, !PS) ->
-		parser__parse_special_atom("[]", TermContext, Term, !PS)
-	;
-		parser__parse_list(Term, !PS)
-	).
-
-parser__parse_simple_term_2(open_curly, Context, _, Term, !PS) :-
-	parser__get_term_context(!.PS, Context, TermContext),
-	( parser__get_token(close_curly, !PS) ->
-		parser__parse_special_atom("{}", TermContext, Term, !PS)
-	;
-		% This is a slight departure from ISO Prolog
-		% syntax -- instead of parsing "{1,2,3}"
-		% as "'{}'(','(1, ','(2, 3)))" we parse
-		% it as "'{}'(1,2,3)". This makes the
-		% structure of tuple functors the same
+parse_simple_term_2(open_list, Context, _, Term, !PS) :-
+    get_term_context(!.PS, Context, TermContext),
+    ( get_token(close_list, !PS) ->
+        parse_special_atom("[]", TermContext, Term, !PS)
+    ;
+        parse_list(Term, !PS)
+    ).
+
+parse_simple_term_2(open_curly, Context, _, Term, !PS) :-
+    get_term_context(!.PS, Context, TermContext),
+    ( get_token(close_curly, !PS) ->
+        parse_special_atom("{}", TermContext, Term, !PS)
+    ;
+        % This is a slight departure from ISO Prolog syntax -- instead of
+        % parsing "{1,2,3}" as "'{}'(','(1, ','(2, 3)))" we parse it as
+        % "'{}'(1,2,3)". This makes the structure of tuple functors the same
 		% as other functors.
-		parser__parse_term(SubTerm0, !PS),
+        parse_term(SubTerm0, !PS),
 		( SubTerm0 = ok(SubTerm) ->
 			conjunction_to_list(SubTerm, ArgTerms),
-			( parser__get_token(close_curly, !PS) ->
-				Term = ok(term__functor(term__atom("{}"),
-					ArgTerms, TermContext))
+            ( get_token(close_curly, !PS) ->
+                Term = ok(term__functor(term__atom("{}"), ArgTerms,
+                    TermContext))
 			;
-				parser__unexpected("expecting `}' or operator",
-					Term, !PS)
+                unexpected("expecting `}' or operator", Term, !PS)
 			)
 		;
-			% propagate error upwards
+            % Propagate error upwards.
 			Term = SubTerm0
 		)
 	).
 
-:- pred parser__conjunction_to_list(term(T)::in, list(term(T))::out) is det.
+:- pred conjunction_to_list(term(T)::in, list(term(T))::out) is det.
 
-parser__conjunction_to_list(Term, ArgTerms) :-
+conjunction_to_list(Term, ArgTerms) :-
 	( Term = term__functor(term__atom(","), [LeftTerm, RightTerm], _) ->
-		parser__conjunction_to_list(RightTerm, ArgTerms0),
+        conjunction_to_list(RightTerm, ArgTerms0),
 		ArgTerms = [LeftTerm | ArgTerms0]
 	;
 		ArgTerms = [Term]
 	).
 
-:- pred parser__check_for_higher_order_term(parse(term(T))::in,
+:- pred check_for_higher_order_term(parse(term(T))::in,
 	token_context::in, parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__check_for_higher_order_term(Term0, Context, Term, !PS) :-
-	%
-	% As an extension to ISO Prolog syntax,
-	% we check for the syntax "Term(Args)", and parse it
-	% as the term ''(Term, Args).  The aim of this extension
-	% is to provide a nicer syntax for higher-order stuff.
-	%
+check_for_higher_order_term(Term0, Context, Term, !PS) :-
+    % As an extension to ISO Prolog syntax, we check for the syntax
+    % "Term(Args)", and parse it as the term ''(Term, Args). The aim of this
+    % extension is to provide a nicer syntax for higher-order stuff.
 	(
 		Term0 = ok(Term1),
-		parser__get_token(open_ct, !PS)
+        get_token(open_ct, !PS)
 	->
-		parser__get_term_context(!.PS, Context, TermContext),
-		parser__parse_args(Args0, !PS),
+        get_term_context(!.PS, Context, TermContext),
+        parse_args(Args0, !PS),
 		(
 			Args0 = ok(Args),
-			Term2 = ok(term__functor(term__atom(""),
-				[Term1 | Args], TermContext)),
-			parser__check_for_higher_order_term(Term2, Context,
-				Term, !PS)
+            Term2 = ok(term__functor(term__atom(""), [Term1 | Args],
+                TermContext)),
+            check_for_higher_order_term(Term2, Context, Term, !PS)
 		;
-			% propagate error upwards
+            % Propagate error upwards.
 			Args0 = error(Message, Tokens),
 			Term = error(Message, Tokens)
 		)
@@ -751,20 +693,18 @@
 		Term = Term0
 	).
 
-:- pred parser__parse_special_atom(string::in, term__context::in,
+:- pred parse_special_atom(string::in, term__context::in,
 	parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_special_atom(Atom, TermContext, Term, !PS) :-
-	( parser__get_token(open_ct, !PS) ->
-		parser__parse_args(Args0, !PS),
+parse_special_atom(Atom, TermContext, Term, !PS) :-
+    ( get_token(open_ct, !PS) ->
+        parse_args(Args0, !PS),
 		(
 			Args0 = ok(Args),
-			Term = ok(term__functor(term__atom(Atom),
-				Args, TermContext))
+            Term = ok(term__functor(term__atom(Atom), Args, TermContext))
 		;
-			% propagate error upwards
+            % Propagate error upwards.
 			Args0 = error(Message, Tokens),
 			Term = error(Message, Tokens)
 		)
@@ -772,107 +712,99 @@
 		Term = ok(term__functor(term__atom(Atom), [], TermContext))
 	).
 
-:- pred parser__parse_list(parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_list(parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_list(List, !PS) :-
-	parser__parse_list_elem(Arg0, !PS),
+parse_list(List, !PS) :-
+    parse_list_elem(Arg0, !PS),
 	( Arg0 = ok(Arg) ->
-		parser__parse_list_2(Arg, List, !PS)
+        parse_list_2(Arg, List, !PS)
 	;
 		% propagate error
 		List = Arg0
 	).
 
-:- pred parser__parse_list_2(term(T)::in, parse(term(T))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_list_2(term(T)::in, parse(term(T))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_list_2(Arg, List, !PS) :-
-	( parser__get_token(Token, Context, !PS) ->
-		parser__get_term_context(!.PS, Context, TermContext),
+parse_list_2(Arg, List, !PS) :-
+    ( get_token(Token, Context, !PS) ->
+        get_term_context(!.PS, Context, TermContext),
 		( Token = comma ->
-			parser__parse_list(Tail0, !PS),
+            parse_list(Tail0, !PS),
 			( Tail0 = ok(Tail) ->
-				List = ok(term__functor(term__atom("[|]"),
-					[Arg, Tail], TermContext))
+                List = ok(term__functor(term__atom("[|]"), [Arg, Tail],
+                    TermContext))
 			;
-				% propagate error
+                % Propagate error.
 				List = Tail0
 			)
 		; Token = ht_sep ->
-			parser__parse_arg(Tail0, !PS),
+            parse_arg(Tail0, !PS),
 			( Tail0 = ok(Tail) ->
-				( parser__get_token(close_list, !PS) ->
-					List = ok(term__functor(
-						term__atom("[|]"),
-						[Arg, Tail], TermContext))
+                ( get_token(close_list, !PS) ->
+                    List = ok(term__functor(term__atom("[|]"), [Arg, Tail],
+                        TermContext))
 				;
-					parser__unexpected("expecting ']' " ++
-						"or operator", List, !PS)
+                    unexpected("expecting ']' or operator", List, !PS)
 				)
 			;
-				% propagate error
+                % Propagate error.
 				List = Tail0
 			)
 		; Token = close_list ->
-			Tail = term__functor(term__atom("[]"), [],
-				TermContext),
+            Tail = term__functor(term__atom("[]"), [], TermContext),
 			List = ok(term__functor(term__atom("[|]"), [Arg, Tail],
 				TermContext))
 		;
-			parser__unexpected_tok(Token, Context,
+            unexpected_tok(Token, Context,
 			"expected comma, `|', `]', or operator", List, !PS)
 		)
 	;
-		% XXX error message should state the line that the
-		% list started on
-		parser__error(!.PS, "unexpected end-of-file in list", List)
+        % XXX The error message should state the line that the
+        % list started on.
+        error(!.PS, "unexpected end-of-file in list", List)
 	).
 
-:- pred parser__parse_args(parse(list(term(T)))::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+:- pred parse_args(parse(list(term(T)))::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__parse_args(List, !PS) :-
-	parser__parse_arg(Arg0, !PS),
+parse_args(List, !PS) :-
+    parse_arg(Arg0, !PS),
 	(
 		Arg0 = ok(Arg),
-		( parser__get_token(Token, Context, !PS) ->
+        ( get_token(Token, Context, !PS) ->
 			( Token = comma ->
-				parser__parse_args(Tail0, !PS),
+                parse_args(Tail0, !PS),
 				( Tail0 = ok(Tail) ->
 					List = ok([Arg|Tail])
 				;
-					% propagate error upwards
+                    % Propagate error upwards.
 					List = Tail0
 				)
 			; Token = close ->
 				List = ok([Arg])
 			;
-				parser__unexpected_tok(Token, Context,
-					"expected `,', `)', or operator",
-					List, !PS)
+                unexpected_tok(Token, Context,
+                    "expected `,', `)', or operator", List, !PS)
 			)
 		;
-			parser__error(!.PS,
-				"unexpected end-of-file in argument list",
-				List)
+            error(!.PS, "unexpected end-of-file in argument list", List)
 		)
 	;
 		Arg0 = error(Message, Tokens),
-		% propagate error upwards
+        % Propagate error upwards.
 		List = error(Message, Tokens)
 	).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-	% Routines that manipulate the parser state.
+%
+% Routines that manipulate the parser state.
 
-:- type parser__state(Ops, T)	% <= op_table(Ops)
-	--->	parser__state(
+:- type state(Ops, T)   % <= op_table(Ops)
+    --->    state(
 			stream_name	:: string,
 					% the name of the stream being parsed
 			ops_table	:: Ops,
@@ -887,19 +819,19 @@
 					% so we know when to make a fresh var
 		).
 
-:- func parser_state_get_stream_name(parser__state(Ops, T)) = string.
-:- func parser_state_get_ops_table(parser__state(Ops, T)) = Ops.
-:- func parser_state_get_varset(parser__state(Ops, T)) = varset(T).
-:- func parser_state_get_tokens_left(parser__state(Ops, T)) = token_list.
-:- func parser_state_get_var_names(parser__state(Ops, T)) =
+:- func parser_state_get_stream_name(state(Ops, T)) = string.
+:- func parser_state_get_ops_table(state(Ops, T)) = Ops.
+:- func parser_state_get_varset(state(Ops, T)) = varset(T).
+:- func parser_state_get_tokens_left(state(Ops, T)) = token_list.
+:- func parser_state_get_var_names(state(Ops, T)) =
 	map(string, var(T)).
 
-:- func parser_state_set_varset(parser__state(Ops, T), varset(T))
-	= parser__state(Ops, T).
-:- func parser_state_set_tokens_left(parser__state(Ops, T), token_list)
-	= parser__state(Ops, T).
-:- func parser_state_set_var_names(parser__state(Ops, T), map(string, var(T)))
-	= parser__state(Ops, T).
+:- func parser_state_set_varset(state(Ops, T), varset(T))
+    = state(Ops, T).
+:- func parser_state_set_tokens_left(state(Ops, T), token_list)
+    = state(Ops, T).
+:- func parser_state_set_var_names(state(Ops, T), map(string, var(T)))
+    = state(Ops, T).
 
 % If you want profiling to tell you the frequencies of these operations,
 % change the inline pragmas to no_inline pragmas.
@@ -929,141 +861,136 @@
 
 %-----------------------------------------------------------------------------%
 
-	% We encountered an error.  See if the next token
-	% was an infix or postfix operator.  If so, it would
-	% normally form part of the term, so the error must
-	% have been an operator precedence error.  Otherwise,
-	% it was some other sort of error, so issue the usual
-	% error message.
-
-:- pred parser__unexpected(string::in, parse(U)::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+    % We encountered an error. See if the next token was an infix or postfix
+    % operator. If so, it would normally form part of the term, so the error
+    % must have been an operator precedence error. Otherwise, it was some
+    % other sort of error, so issue the usual error message.
+    %
+:- pred unexpected(string::in, parse(U)::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__unexpected(UsualMessage, Error, !PS) :-
-	( parser__get_token(Token, Context, !PS) ->
-		parser__unexpected_tok(Token, Context, UsualMessage, Error,
-			!PS)
+unexpected(UsualMessage, Error, !PS) :-
+    ( get_token(Token, Context, !PS) ->
+        unexpected_tok(Token, Context, UsualMessage, Error, !PS)
 	;
-		parser__error(!.PS, UsualMessage, Error)
+        error(!.PS, UsualMessage, Error)
 	).
 
-:- pred parser__unexpected_tok(token::in, token_context::in, string::in,
+:- pred unexpected_tok(token::in, token_context::in, string::in,
 	parse(U)::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det
-	<= op_table(Ops).
+    state(Ops, T)::in, state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__unexpected_tok(Token, Context, UsualMessage, Error, !PS) :-
-	% push the token back, so that the error message
-	% points at it rather than at the following token
-	parser__unget_token(Token, Context, !PS),
+unexpected_tok(Token, Context, UsualMessage, Error, !PS) :-
+    % Push the token back, so that the error message points at it
+    % rather than at the following token.
+    unget_token(Token, Context, !PS),
 	(
 		( Token = name(Op)
 		; Token = comma, Op = ","
 		),
-		parser__get_ops_table(!.PS, OpTable),
+        get_ops_table(!.PS, OpTable),
 		( ops__lookup_infix_op(OpTable, Op, _, _, _)
 		; ops__lookup_postfix_op(OpTable, Op, _, _)
 		)
 	->
-		parser__error(!.PS, "operator precedence error", Error)
+        error(!.PS, "operator precedence error", Error)
 	;
-		parser__error(!.PS, UsualMessage, Error)
+        error(!.PS, UsualMessage, Error)
 	).
 
 %-----------------------------------------------------------------------------%
 
-:- pred parser__error(parser__state(Ops, T)::in, string::in, parse(U)::out)
+:- pred error(state(Ops, T)::in, string::in, parse(U)::out)
 	is det.
 
-parser__error(ParserState, Message, error(Message, Tokens)) :-
+error(ParserState, Message, error(Message, Tokens)) :-
 	Tokens = parser_state_get_tokens_left(ParserState).
 
 %-----------------------------------------------------------------------------%
 
-:- pred parser__could_start_term(token::in, bool::out) is det.
+:- pred could_start_term(token::in, bool::out) is det.
 
-parser__could_start_term(name(_), yes).
-parser__could_start_term(variable(_), yes).
-parser__could_start_term(integer(_), yes).
-parser__could_start_term(float(_), yes).
-parser__could_start_term(string(_), yes).
-parser__could_start_term(open, yes).
-parser__could_start_term(open_ct, yes).
-parser__could_start_term(close, no).
-parser__could_start_term(open_list, yes).
-parser__could_start_term(close_list, no).
-parser__could_start_term(open_curly, yes).
-parser__could_start_term(close_curly, no).
-parser__could_start_term(ht_sep, no).
-parser__could_start_term(comma, no).
-parser__could_start_term(end, no).
-parser__could_start_term(junk(_), no).
-parser__could_start_term(error(_), no).
-parser__could_start_term(io_error(_), no).
-parser__could_start_term(eof, no).
-parser__could_start_term(integer_dot(_), no).
+could_start_term(name(_), yes).
+could_start_term(variable(_), yes).
+could_start_term(integer(_), yes).
+could_start_term(float(_), yes).
+could_start_term(string(_), yes).
+could_start_term(open, yes).
+could_start_term(open_ct, yes).
+could_start_term(close, no).
+could_start_term(open_list, yes).
+could_start_term(close_list, no).
+could_start_term(open_curly, yes).
+could_start_term(close_curly, no).
+could_start_term(ht_sep, no).
+could_start_term(comma, no).
+could_start_term(end, no).
+could_start_term(junk(_), no).
+could_start_term(error(_), no).
+could_start_term(io_error(_), no).
+could_start_term(eof, no).
+could_start_term(integer_dot(_), no).
 
 %-----------------------------------------------------------------------------%
 
-:- pred parser__init_state(Ops::in, string::in, token_list::in,
-	parser__state(Ops, T)::out) is det <= op_table(Ops).
+:- pred init_state(Ops::in, string::in, token_list::in,
+    state(Ops, T)::out) is det <= op_table(Ops).
 
-parser__init_state(Ops, FileName, Tokens, ParserState) :-
+init_state(Ops, FileName, Tokens, ParserState) :-
 	varset__init(VarSet),
 	map__init(Names),
-	ParserState = parser__state(FileName, Ops, VarSet, Tokens, Names).
+    ParserState = state(FileName, Ops, VarSet, Tokens, Names).
 
-:- pred parser__final_state(parser__state(Ops, T)::in, varset(T)::out,
+:- pred final_state(state(Ops, T)::in, varset(T)::out,
 	token_list::out) is det.
 
-parser__final_state(ParserState, VarSet, TokenList) :-
+final_state(ParserState, VarSet, TokenList) :-
 	VarSet = parser_state_get_varset(ParserState),
 	TokenList = parser_state_get_tokens_left(ParserState).
 
 %-----------------------------------------------------------------------------%
 
-:- pred parser__get_token(token::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is semidet.
+:- pred get_token(token::out,
+    state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-parser__get_token(Token, !PS) :-
-	parser__get_token(Token, _Context, !PS).
+get_token(Token, !PS) :-
+    get_token(Token, _Context, !PS).
 
-:- pred parser__get_token(token::out, token_context::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is semidet.
+:- pred get_token(token::out, token_context::out,
+    state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-parser__get_token(Token, Context, ParserState0, ParserState) :-
+get_token(Token, Context, ParserState0, ParserState) :-
 	Tokens0 = parser_state_get_tokens_left(ParserState0),
 	Tokens0 = token_cons(Token, Context, Tokens),
 	ParserState = parser_state_set_tokens_left(ParserState0, Tokens).
 
-:- pred parser__unget_token(token::in, token_context::in,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det.
+:- pred unget_token(token::in, token_context::in,
+    state(Ops, T)::in, state(Ops, T)::out) is det.
 
-parser__unget_token(Token, Context, ParserState0, ParserState) :-
+unget_token(Token, Context, ParserState0, ParserState) :-
 	Tokens0 = parser_state_get_tokens_left(ParserState0),
 	Tokens = token_cons(Token, Context, Tokens0),
 	ParserState = parser_state_set_tokens_left(ParserState0, Tokens).
 
-:- pred parser__peek_token(token::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is semidet.
+:- pred peek_token(token::out,
+    state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-parser__peek_token(Token, !PS) :-
-	parser__peek_token(Token, _Context, !PS).
+peek_token(Token, !PS) :-
+    peek_token(Token, _Context, !PS).
 
-:- pred parser__peek_token(token::out, token_context::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is semidet.
+:- pred peek_token(token::out, token_context::out,
+    state(Ops, T)::in, state(Ops, T)::out) is semidet.
 
-parser__peek_token(Token, Context, ParserState, ParserState) :-
+peek_token(Token, Context, ParserState, ParserState) :-
 	Tokens = parser_state_get_tokens_left(ParserState),
 	Tokens = token_cons(Token, Context, _).
 
 %-----------------------------------------------------------------------------%
 
-:- pred parser__add_var(string::in, var(T)::out,
-	parser__state(Ops, T)::in, parser__state(Ops, T)::out) is det.
+:- pred add_var(string::in, var(T)::out,
+    state(Ops, T)::in, state(Ops, T)::out) is det.
 
-parser__add_var(VarName, Var, ParserState0, ParserState) :-
+add_var(VarName, Var, ParserState0, ParserState) :-
 	( VarName = "_" ->
 		VarSet0 = parser_state_get_varset(ParserState0),
 		varset__new_var(VarSet0, Var, VarSet),
@@ -1077,33 +1004,31 @@
 			VarSet0 = parser_state_get_varset(ParserState0),
 			varset__new_named_var(VarSet0, VarName, Var, VarSet),
 			map__det_insert(Names0, VarName, Var, Names),
-			ParserState1 = parser_state_set_varset(ParserState0,
-				VarSet),
-			ParserState = parser_state_set_var_names(ParserState1,
-				Names)
+            ParserState1 = parser_state_set_varset(ParserState0, VarSet),
+            ParserState = parser_state_set_var_names(ParserState1, Names)
 		)
 	).
 
-:- pred parser__get_ops_table(parser__state(Ops, T)::in, Ops::out) is det
+:- pred get_ops_table(state(Ops, T)::in, Ops::out) is det
 	<= op_table(Ops).
 
-parser__get_ops_table(ParserState, OpTable) :-
+get_ops_table(ParserState, OpTable) :-
 	OpTable = parser_state_get_ops_table(ParserState).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- pred parser__check_priority(ops__assoc::in, int::in, int::in) is semidet.
+:- pred check_priority(ops__assoc::in, int::in, int::in) is semidet.
 
-parser__check_priority(y, MaxPriority, Priority) :-
+check_priority(y, MaxPriority, Priority) :-
 	Priority =< MaxPriority.
-parser__check_priority(x, MaxPriority, Priority) :-
+check_priority(x, MaxPriority, Priority) :-
 	Priority < MaxPriority.
 
-:- pred parser__get_term_context(parser__state(Ops, T)::in, token_context::in,
+:- pred get_term_context(state(Ops, T)::in, token_context::in,
 	term__context::out) is det.
 
-parser__get_term_context(ParserState, TokenContext, TermContext) :-
+get_term_context(ParserState, TokenContext, TermContext) :-
 	FileName = parser_state_get_stream_name(ParserState),
 	term__context_init(FileName, TokenContext, TermContext).
 
Index: pqueue.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/pqueue.m,v
retrieving revision 1.19
diff -u -b -r1.19 pqueue.m
--- pqueue.m	16 Jun 2005 04:08:03 -0000	1.19
+++ pqueue.m	17 Oct 2005 05:24:23 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1995, 1997, 1999, 2003-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -28,7 +30,7 @@
 
 :- type pqueue(K, V).
 
-	% Create an empty priority queue
+    % Create an empty priority queue.
 	%
 :- func pqueue__init = pqueue(K, V).
 :- pred pqueue__init(pqueue(K, V)::out) is det.
Index: profiling_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/profiling_builtin.m,v
retrieving revision 1.14
diff -u -b -r1.14 profiling_builtin.m
--- profiling_builtin.m	19 May 2004 03:59:42 -0000	1.14
+++ profiling_builtin.m	17 Oct 2005 05:22:04 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 2001-2004 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -802,22 +804,23 @@
 % instances of save_recursion_depth_N
 %---------------------------------------------------------------------------%
 
-:- pragma foreign_proc("C", save_recursion_depth_1(CSD::in, CSN::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_1(CSD::in, CSN::in,
 		OuterCount1::out),
 		[thread_safe, will_not_call_mercury],
 "{
 /* shut up warning: CSD, CSN, OuterCount1 */
 #define MR_PROCNAME		""save_recursion_depth_1""
 #define MR_REC_DEPTH_BODY	{					     \\
-				MR_SAVE_DEPTH_ACTION(OuterCount1,	     \\
-					CSN);				     \\
+                MR_SAVE_DEPTH_ACTION(OuterCount1, CSN);                 \\
 				}
 #include ""mercury_deep_rec_depth_body.h""
 #undef MR_PROCNAME
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_2(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_2(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out),
 		[thread_safe, will_not_call_mercury],
 "{
@@ -834,7 +837,8 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_3(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_3(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out, OuterCount3::out),
 		[thread_safe, will_not_call_mercury],
 "{
@@ -853,7 +857,8 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_4(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_4(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out, OuterCount3::out,
 		OuterCount4::out),
 		[thread_safe, will_not_call_mercury],
@@ -876,7 +881,8 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_5(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_5(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out, OuterCount3::out,
 		OuterCount4::out, OuterCount5::out),
 		[thread_safe, will_not_call_mercury],
@@ -901,7 +907,8 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_6(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_6(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out, OuterCount3::out,
 		OuterCount4::out, OuterCount5::out, OuterCount6::out),
 		[thread_safe, will_not_call_mercury],
@@ -928,7 +935,8 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_7(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_7(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out, OuterCount3::out,
 		OuterCount4::out, OuterCount5::out, OuterCount6::out,
 		OuterCount7::out),
@@ -958,7 +966,8 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_8(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_8(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out, OuterCount3::out,
 		OuterCount4::out, OuterCount5::out, OuterCount6::out,
 		OuterCount7::out, OuterCount8::out),
@@ -991,7 +1000,8 @@
 #undef MR_REC_DEPTH_BODY
 }").
 
-:- pragma foreign_proc("C", save_recursion_depth_9(CSD::in, CSNsVector::in,
+:- pragma foreign_proc("C",
+    save_recursion_depth_9(CSD::in, CSNsVector::in,
 		OuterCount1::out, OuterCount2::out, OuterCount3::out,
 		OuterCount4::out, OuterCount5::out, OuterCount6::out,
 		OuterCount7::out, OuterCount8::out, OuterCount9::out),
@@ -1030,15 +1040,15 @@
 % instances of restore_recursion_depth_exit_N
 %---------------------------------------------------------------------------%
 
-:- pragma foreign_proc("C", restore_recursion_depth_exit_1(CSD::in, CSN::in,
+:- pragma foreign_proc("C",
+    restore_recursion_depth_exit_1(CSD::in, CSN::in,
 		OuterCount1::in),
 		[thread_safe, will_not_call_mercury],
 "{
 /* shut up warning: CSD, CSN, OuterCount1 */
 #define MR_PROCNAME		""restore_recursion_depth_exit_1""
 #define MR_REC_DEPTH_BODY	{					     \\
-				MR_RESTORE_DEPTH_EXIT(OuterCount1,	     \\
-					CSN);				     \\
+                MR_RESTORE_DEPTH_EXIT(OuterCount1, CSN);                \\
 				}
 #include ""mercury_deep_rec_depth_body.h""
 #undef MR_PROCNAME
@@ -1274,8 +1284,7 @@
 /* shut up warning: CSD, CSN, OuterCount1 */
 #define MR_PROCNAME		""restore_recursion_depth_fail_1""
 #define MR_REC_DEPTH_BODY	{					     \\
-				MR_RESTORE_DEPTH_FAIL(OuterCount1,	     \\
-					CSN);				     \\
+                MR_RESTORE_DEPTH_FAIL(OuterCount1, CSN);                \\
 				}
 #include ""mercury_deep_rec_depth_body.h""
 #undef MR_PROCNAME
Index: prolog.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/prolog.m,v
retrieving revision 1.14
diff -u -b -r1.14 prolog.m
Index: queue.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/queue.m,v
retrieving revision 1.29
diff -u -b -r1.29 queue.m
--- queue.m	16 Jun 2005 04:08:03 -0000	1.29
+++ queue.m	17 Oct 2005 05:13:19 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1995, 1997-1999, 2003-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -38,36 +40,32 @@
 	%
 :- pred queue__is_empty(queue(T)::in) is semidet.
 
-	% `queue__is_full(Queue)' is intended to be true iff `Queue'
-	% is a queue whose capacity is exhausted.  This
-	% implementation allows arbitrary-sized queues, so queue__is_full
-	% always fails.
+    % `queue__is_full(Queue)' is intended to be true iff `Queue' is a queue
+    % whose capacity is exhausted. This implementation allows arbitrary-sized
+    % queues, so queue__is_full always fails.
 	%
 :- pred queue__is_full(queue(T)::in) is semidet.
 
-	% `queue__put(Queue0, Elem, Queue)' is true iff `Queue' is
-	% the queue which results from appending `Elem' onto the end
-	% of `Queue0'.
+    % `queue__put(Queue0, Elem, Queue)' is true iff `Queue' is the queue
+    % which results from appending `Elem' onto the end of `Queue0'.
 	%
 :- pred queue__put(queue(T)::in, T::in, queue(T)::out) is det.
 :- func queue__put(queue(T), T) = queue(T).
 
-	% `queue__put_list(Queue0, Elems, Queue)' is true iff `Queue'
-	% is the queue which results from inserting the items in the
-	% list `Elems' into `Queue0'.
+    % `queue__put_list(Queue0, Elems, Queue)' is true iff `Queue' is the queue
+    % which results from inserting the items in the list `Elems' into `Queue0'.
 	%
 :- pred queue__put_list(queue(T)::in, list(T)::in, queue(T)::out) is det.
 :- func queue__put_list(queue(T), list(T)) = queue(T).
 
-	% `queue__first(Queue, Elem)' is true iff `Queue' is a non-empty
-	% queue whose first element is `Elem'.
+    % `queue__first(Queue, Elem)' is true iff `Queue' is a non-empty queue
+    % whose first element is `Elem'.
 	%
 :- pred queue__first(queue(T)::in, T::out) is semidet.
 
-	% `queue__get(Queue0, Elem, Queue)' is true iff `Queue0' is
-	% a non-empty queue whose first element is `Elem', and `Queue'
-	% the queue which results from removing that element from
-	% the front of `Queue0'.
+    % `queue__get(Queue0, Elem, Queue)' is true iff `Queue0' is a non-empty
+    % queue whose first element is `Elem', and `Queue' the queue which results
+    % from removing that element from the front of `Queue0'.
 	%
 :- pred queue__get(queue(T)::in, T::out, queue(T)::out) is semidet.
 
@@ -92,9 +90,8 @@
 	%
 :- func queue__to_list(queue(T)) = list(T).
 
-	% `queue__delete_all(Queue0, Elem, Queue)' is true iff `Queue' is
-	% the same queue as `Queue0' with all occurrences of `Elem' removed
-	% from it.
+    % `queue__delete_all(Queue0, Elem, Queue)' is true iff `Queue' is the same
+    % queue as `Queue0' with all occurrences of `Elem' removed from it.
 	% 
 :- pred queue__delete_all(queue(T)::in, T::in, queue(T)::out) is det.
 :- func queue__delete_all(queue(T), T) = queue(T).
@@ -126,10 +123,9 @@
 :- import_module int.
 :- import_module std_util.
 
-% This implementation is in terms of a pair of lists.  We impose the
-% extra constraint that the `off' list is empty if and only if the queue
-% is empty.
-
+    % This implementation is in terms of a pair of lists. We impose the
+    % extra constraint that the `off' list is empty if and only if the queue
+    % is empty.
 :- type queue(T) == pair(list(T)).
 
 queue__init([] - []).
@@ -147,19 +143,23 @@
 	semidet_fail.
 
 queue__put(On0 - Off0, Elem, On - Off) :-
-	( Off0 = [] ->
+    (
+        Off0 = [],
 		On = On0,
 		Off = [Elem]
 	;
+        Off0 = [_ | _],
 		On = [Elem | On0],
 		Off = Off0
 	).
 
 queue__put_list(On0 - Off0, Xs, On - Off) :-
-	( Off0 = [] ->
+    (
+        Off0 = [],
 		On = On0,
 		Off = Xs
 	;
+        Off0 = [_ | _],
 		Off = Off0,
 		queue__put_list_2(Xs, On0, On)
 	).
@@ -173,10 +173,12 @@
 queue__first(_ - [Elem | _], Elem).
 
 queue__get(On0 - [Elem | Off0], Elem, On - Off) :-
-	( Off0 = [] ->
+    (
+        Off0 = [],
 		list__reverse(On0, Off),
 		On = []
 	;
+        Off0 = [_ | _],
 		On = On0,
 		Off = Off0
 	).
@@ -195,10 +197,12 @@
 queue__delete_all(On0 - Off0, Elem, On - Off) :-
 	list__delete_all(On0, Elem, On1),
 	list__delete_all(Off0, Elem, Off1),
-	( Off1 = [] ->
+    (
+        Off1 = [],
 		list__reverse(On1, Off),
 		On = []
 	;
+        Off1 = [_ | _],
 		On = On1,
 		Off = Off1
 	).
@@ -215,26 +219,21 @@
 
 queue__get_from_back(On0 - Off0, Elem, On - Off) :-
 	(
-		% The On list is non-empty and the last element
-		% in the queue is the head of the On list.
-		%
+        % The On list is non-empty and the last element in the queue
+        % is the head of the On list.
 		On0 = [Elem | On],
 		Off = Off0
 	;
 		% The On list is empty.
-		%
 		On0 = [],
 		(
 			% The Off list contains a single element.
-			%
 			Off0 = [Elem],
 			On   = [],
 			Off  = []
 		;
-			% The Off list contains two or more elements.
-			% We split it in two and take the head of the
-			% new On list as Elem.
-			%
+            % The Off list contains two or more elements. We split it in two
+            % and take the head of the new On list as Elem.
 			Off0 = [_, _ | _],
 			N    = list__length(Off0),
 			list__split_list(N / 2, Off0, Off, RevOn),
Index: random.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/random.m,v
retrieving revision 1.25
diff -u -b -r1.25 random.m
--- random.m	16 Jun 2005 04:08:03 -0000	1.25
+++ random.m	17 Oct 2005 05:28:44 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1998,2001-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -121,7 +123,8 @@
 :- import_module array.
 :- import_module int.
 
-:- type random__supply ---> rs(int). % I(j)
+:- type random__supply
+    ---> rs(int). % I(j)
 
 :- pred random__params(int::out, int::out, int::out) is det.	% a, c, m
 
@@ -206,9 +209,7 @@
 :- mode random__test_2(in, out, in, out) is det.
 
 random__test_2(N, Is, RS0, RS) :-
-	(
-		N > 0
-	->
+	( N > 0 ->
 		N1 = N - 1,
 		random__random(I, RS0, RS1),
 		random__test_2(N1, Is0, RS1, RS),
Index: rational.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/rational.m,v
retrieving revision 1.8
diff -u -b -r1.8 rational.m
--- rational.m	23 Aug 2004 06:30:12 -0000	1.8
+++ rational.m	17 Oct 2005 05:29:55 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1997-1998, 2003-2004 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -20,17 +22,13 @@
 
 :- type rational.
 
-:- pred '<'(rational, rational).
-:- mode '<'(in, in) is semidet.
+:- pred '<'(rational::in, rational::in) is semidet.
 
-:- pred '>'(rational, rational).
-:- mode '>'(in, in) is semidet.
+:- pred '>'(rational::in, rational::in) is semidet.
 
-:- pred '=<'(rational, rational).
-:- mode '=<'(in, in) is semidet.
+:- pred '=<'(rational::in, rational::in) is semidet.
 
-:- pred '>='(rational, rational).
-:- mode '>='(in, in) is semidet.
+:- pred '>='(rational::in, rational::in) is semidet.
 
 :- func rational__rational(int) = rational.
 
Index: rbtree.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/rbtree.m,v
retrieving revision 1.21
diff -u -b -r1.21 rbtree.m
--- rbtree.m	16 Jun 2005 04:08:03 -0000	1.21
+++ rbtree.m	17 Oct 2005 05:35:23 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1995-2000, 2003-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -254,21 +256,20 @@
 rbtree__insert(black(K0, V0, L0, R0), K, V, Tree) :-
 	rbtree__insert_2(black(K0, V0, L0, R0), K, V, Tree0),
 	% Ensure that the root of the tree is black.
-	(
-		Tree0 = red(K1, V1, L1, R1)
-	->
+    ( Tree0 = red(K1, V1, L1, R1) ->
 		Tree = black(K1, V1, L1, R1)
 	;
 		Tree = Tree0
 	).
 
-:- pred rbtree__insert_2(rbtree(K, V), K, V, rbtree(K, V)).
-:- mode rbtree__insert_2(in, in, in, out) is semidet.
+    % rbtree__insert_2:
+    %
+    % We traverse down the tree until we find the correct spot to insert.
+    % Then as we fall back out of the recursions we look for possible
+    % rotation cases.
 
-% rbtree__insert_2:
-%	We traverse down the tree until we find the correct spot to insert.
-%	Then as we fall back out of the recursions we look for possible
-%	rotation cases.
+:- pred rbtree__insert_2(rbtree(K, V)::in, K::in, V::in, rbtree(K, V)::out)
+    is semidet.
 
 % Red node always inserted at the bottom as it will be rotated into the
 % correct place as we move back up the tree.
@@ -277,16 +278,15 @@
 	% Work out which side of the rbtree to insert.
 	compare(Result, K, K0),
 	(
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__insert_2(L0, K, V, NewL),
 		Tree = red(K0, V0, NewL, R0)
 	;
-		Result = (>)
-	->
+        Result = (>),
 		rbtree__insert_2(R0, K, V, NewR),
 		Tree = red(K0, V0, L0, NewR)
 	;
+        Result = (=),
 		fail
 	).
 % Only ever need to look for a possible rotation if we are in a black node.
@@ -307,8 +307,7 @@
 		% Work out which side of the rbtree to insert.
 		compare(Result, K, K0),
 		(
-			Result = (<)
-		->
+            Result = (<),
 			rbtree__insert_2(L0, K, V, NewL),
 			(
 				% Only need to start looking for a rotation case
@@ -316,16 +315,11 @@
 				% new child red.
 				NewL = red(LK, LV, LL, LR)
 			->
-				% Check to see if a grandchild is red and if so
-				% rotate.
-				(
-					LL = red(_LLK, _LLV, _LLL, _LLR)
-				->
+                % Check to see if a grandchild is red and if so rotate.
+                ( LL = red(_LLK, _LLV, _LLL, _LLR) ->
 					TreeR = red(K0, V0, LR, R0),
 					Tree = black(LK, LV, LL, TreeR)
-				;
-					LR = red(LRK, LRV, LRL, LRR)
-				->
+                ; LR = red(LRK, LRV, LRL, LRR) ->
 					TreeL = red(LK, LV, LL, LRL),
 					TreeR = red(K0, V0, LRR, R0),
 					Tree = black(LRK, LRV, TreeL, TreeR)
@@ -336,8 +330,7 @@
 				Tree = black(K0, V0, NewL, R0)
 			)
 		;
-			Result = (>)
-		->
+            Result = (>),
 			rbtree__insert_2(R0, K, V, NewR),
 			(
 				% Only need to start looking for a rotation case
@@ -345,17 +338,12 @@
 				% new child red.
 				NewR = red(RK, RV, RL, RR)
 			->
-				% Check to see if a grandchild is red and if so
-				% rotate.
-				(
-					RL = red(RLK, RLV, RLL, RLR)
-				->
+                % Check to see if a grandchild is red and if so rotate.
+                ( RL = red(RLK, RLV, RLL, RLR) ->
 					TreeL = red(K0, V0, L0, RLL),
 					TreeR = red(RK, RV, RLR, RR),
 					Tree = black(RLK, RLV, TreeL, TreeR)
-				;
-					RR = red(_RRK, _RRV, _RRL, _RRR)
-				->
+                ; RR = red(_RRK, _RRV, _RRL, _RRR) ->
 					TreeL = red(K0, V0, L0, RL),
 					Tree = black(RK, RV, TreeL, RR)
 				;
@@ -365,6 +353,7 @@
 				Tree = black(K0, V0, L0, NewR)
 			)
 		;
+            Result = (=),
 			fail
 		)
 	).
@@ -376,30 +365,28 @@
 rbtree__update(red(K0, V0, L, R), K, V, Tree) :-
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		Tree = red(K, V, L, R)
 	;
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__update(L, K, V, NewL),
 		Tree = red(K0, V0, NewL, R)
 	;
+        Result = (>),
 		rbtree__update(R, K, V, NewR),
 		Tree = red(K0, V0, L, NewR)
 	).
 rbtree__update(black(K0, V0, L, R), K, V, Tree) :-
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		Tree = black(K, V, L, R)
 	;
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__update(L, K, V, NewL),
 		Tree = black(K0, V0, NewL, R)
 	;
+        Result = (>),
 		rbtree__update(R, K, V, NewR),
 		Tree = black(K0, V0, L, NewR)
 	).
@@ -411,32 +398,30 @@
 rbtree__transform_value(P, K, red(K0, V0, L, R), Tree) :-
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		P(V0, NewV),
 		Tree = red(K, NewV, L, R)
 	;
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__transform_value(P, K, L, NewL),
 		Tree = red(K0, V0, NewL, R)
 	;
+        Result = (>),
 		rbtree__transform_value(P, K, R, NewR),
 		Tree = red(K0, V0, L, NewR)
 	).
 rbtree__transform_value(P, K, black(K0, V0, L, R), Tree) :-
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		P(V0, NewV),
 		Tree = black(K, NewV, L, R)
 	;
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__transform_value(P, K, L, NewL),
 		Tree = black(K0, V0, NewL, R)
 	;
+        Result = (>),
 		rbtree__transform_value(P, K, R, NewR),
 		Tree = black(K0, V0, L, NewR)
 	).
@@ -453,23 +438,22 @@
 rbtree__set(black(K0, V0, L0, R0), K, V, Tree) :-
 	rbtree__set_2(black(K0, V0, L0, R0), K, V, Tree0),
 	% Ensure that the root of the tree is black.
-	(
-		Tree0 = red(K1, V1, L1, R1)
-	->
+    ( Tree0 = red(K1, V1, L1, R1) ->
 		Tree = black(K1, V1, L1, R1)
 	;
 		Tree = Tree0
 	).
 
+    % rbtree__set_2:
+    %
+    % We traverse down the tree until we find the correct spot to insert, or
+    % update. Then as we fall back out of the recursions we look for possible
+    % rotation cases.
+
 :- pred rbtree__set_2(rbtree(K, V), K, V, rbtree(K, V)).
 :- mode rbtree__set_2(di, di, di, uo) is det.
 :- mode rbtree__set_2(in, in, in, out) is det.
 
-% rbtree__set_2:
-%	We traverse down the tree until we find the correct spot to insert, or
-%	update.  Then as we fall back out of the recursions we look for possible
-%	rotation cases.
-
 % Red node always inserted at the bottom as it will be rotated into the
 % correct place as we move back up the tree.
 rbtree__set_2(empty, K, V, red(K, V, empty, empty)).
@@ -477,15 +461,14 @@
 	% Work out which side of the rbtree to insert.
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		Tree = red(K, V, L0, R0)
 	;
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__set_2(L0, K, V, NewL),
 		Tree = red(K0, V0, NewL, R0)
 	;
+        Result = (>),
 		rbtree__set_2(R0, K, V, NewR),
 		Tree = red(K0, V0, L0, NewR)
 	).
@@ -503,12 +486,10 @@
 		% Work out which side of the rbtree to insert.
 		compare(Result, K, K0),
 		(
-			Result = (=)
-		->
+            Result = (=),
 			Tree = black(K, V, L0, R0)
 		;
-			Result = (<)
-		->
+            Result = (<),
 			rbtree__set_2(L0, K, V, NewL),
 			(
 				% Only need to start looking for a rotation case
@@ -516,16 +497,11 @@
 				% new child red.
 				NewL = red(LK, LV, LL, LR)
 			->
-				% Check to see if a grandchild is red and if so
-				% rotate.
-				(
-					LL = red(_LLK, _LLV, _LLL, _LLR)
-				->
+                % Check to see if a grandchild is red and if so rotate.
+                ( LL = red(_LLK, _LLV, _LLL, _LLR) ->
 					TreeR = red(K0, V0, LR, R0),
 					Tree = black(LK, LV, LL, TreeR)
-				;
-					LR = red(LRK, LRV, LRL, LRR)
-				->
+                ; LR = red(LRK, LRV, LRL, LRR) ->
 					TreeL = red(LK, LV, LL, LRL),
 					TreeR = red(K0, V0, LRR, R0),
 					Tree = black(LRK, LRV, TreeL, TreeR)
@@ -539,6 +515,7 @@
 				Tree = black(K0, V0, NewL, R0)
 			)
 		;
+            Result = (>),
 			rbtree__set_2(R0, K, V, NewR),
 			(
 				% Only need to start looking for a rotation case
@@ -546,17 +523,12 @@
 				% new child red.
 				NewR = red(RK, RV, RL, RR)
 			->
-				% Check to see if a grandchild is red and if so
-				% rotate.
-				(
-					RL = red(RLK, RLV, RLL, RLR)
-				->
+                % Check to see if a grandchild is red and if so rotate.
+                ( RL = red(RLK, RLV, RLL, RLR) ->
 					TreeL = red(K0, V0, L0, RLL),
 					TreeR = red(RK, RV, RLR, RR),
 					Tree = black(RLK, RLV, TreeL, TreeR)
-				;
-					RR = red(_RRK, _RRV, _RRL, _RRR)
-				->
+                ; RR = red(_RRK, _RRV, _RRL, _RRR) ->
 					TreeL = red(K0, V0, L0, RL),
 					Tree = black(RK, RV, TreeL, RR)
 				;
@@ -583,22 +555,21 @@
 rbtree__insert_duplicate(black(K0, V0, L0, R0), K, V, Tree) :-
 	rbtree__insert_duplicate_2(black(K0, V0, L0, R0), K, V, Tree0),
 	% Ensure that the root of the tree is black.
-	(
-		Tree0 = red(K1, V1, L1, R1)
-	->
+    ( Tree0 = red(K1, V1, L1, R1) ->
 		Tree = black(K1, V1, L1, R1)
 	;
 		Tree = Tree0
 	).
 
+    % rbtree__insert_duplicate_2:
+    %
+    % We traverse down the tree until we find the correct spot to insert.
+    % Then as we fall back out of the recursions we look for possible
+    % rotation cases.
+
 :- pred rbtree__insert_duplicate_2(rbtree(K, V), K, V, rbtree(K, V)).
 :- mode rbtree__insert_duplicate_2(in, in, in, out) is det.
 
-% rbtree__insert_duplicate_2:
-%	We traverse down the tree until we find the correct spot to insert.
-%	Then as we fall back out of the recursions we look for possible
-%	rotation cases.
-
 % Red node always inserted at the bottom as it will be rotated into the
 % correct place as we move back up the tree.
 rbtree__insert_duplicate_2(empty, K, V, red(K, V, empty, empty)).
@@ -644,16 +615,11 @@
 				% new child red.
 				NewL = red(LK, LV, LL, LR)
 			->
-				% Check to see if a grandchild is red and if so
-				% rotate.
-				(
-					LL = red(_LLK1, _LLV1, _LLL1, _LLR1)
-				->
+                % Check to see if a grandchild is red and if so rotate.
+                ( LL = red(_LLK1, _LLV1, _LLL1, _LLR1) ->
 					TreeR = red(K0, V0, LR, R0),
 					Tree = black(LK, LV, LL, TreeR)
-				;
-					LR = red(LRK, LRV, LRL, LRR)
-				->
+                ; LR = red(LRK, LRV, LRL, LRR) ->
 					TreeL = red(LK, LV, LL, LRL),
 					TreeR = red(K0, V0, LRR, R0),
 					Tree = black(LRK, LRV, TreeL, TreeR)
@@ -672,17 +638,12 @@
 				% new child red.
 				NewR = red(RK, RV, RL, RR)
 			->
-				% Check to see if a grandchild is red and if so
-				% rotate.
-				(
-					RL = red(RLK, RLV, RLL, RLR)
-				->
+                % Check to see if a grandchild is red and if so rotate.
+                ( RL = red(RLK, RLV, RLL, RLR) ->
 					TreeL = red(K0, V0, L0, RLL),
 					TreeR = red(RK, RV, RLR, RR),
 					Tree = black(RLK, RLV, TreeL, TreeR)
-				;
-					RR = red(_RRK, _RRV, _RRL, _RRR)
-				->
+                ; RR = red(_RRK, _RRV, _RRL, _RRR) ->
 					TreeL = red(K0, V0, L0, RL),
 					Tree = black(RK, RV, TreeL, RR)
 				;
@@ -700,16 +661,11 @@
 				% new child red.
 				NewL = red(LK, LV, LL, LR)
 			->
-				% Check to see if a grandchild is red and if so
-				% rotate.
-				(
-					LL = red(_LLK2, _LLV2, _LLL2, _LLR2)
-				->
+                % Check to see if a grandchild is red and if so rotate.
+                ( LL = red(_LLK2, _LLV2, _LLL2, _LLR2) ->
 					TreeR = red(K0, V0, LR, R0),
 					Tree = black(LK, LV, LL, TreeR)
-				;
-					LR = red(LRK, LRV, LRL, LRR)
-				->
+                ; LR = red(LRK, LRV, LRL, LRR) ->
 					TreeL = red(LK, LV, LL, LRL),
 					TreeR = red(K0, V0, LRR, R0),
 					Tree = black(LRK, LRV, TreeL, TreeR)
@@ -752,14 +708,13 @@
 	),
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		V = V0
 	;
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__search(Left, K, V)
 	;
+        Result = (>),
 		rbtree__search(Right, K, V)
 	).
 
@@ -778,15 +733,14 @@
 	),
 	compare(Result, SearchK, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		K = K0,
 		V = V0
 	;
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__lower_bound_search(Left, SearchK, K, V)
 	;
+        Result = (>),
 		( rbtree__lower_bound_search(Right, SearchK, Kp, Vp) ->
 			K = Kp,
 			V = Vp
@@ -813,13 +767,11 @@
 	),
 	compare(Result, SearchK, K0),
 	(
-		Result = (=)
-	->
+        Result = (=),
 		K = K0,
 		V = V0
 	;
-		Result = (<)
-	->
+        Result = (<),
 		( rbtree__upper_bound_search(Left, SearchK, Kp, Vp) ->
 			K = Kp,
 			V = Vp
@@ -828,6 +780,7 @@
 			V = V0
 		)
 	;
+        Result = (>),
 		rbtree__upper_bound_search(Right, SearchK, K, V)
 	).
 
@@ -845,25 +798,27 @@
 rbtree__delete(Tree0, K, Tree) :-
 	rbtree__delete_2(Tree0, K, no, _, Tree).
 
-% rbtree__delete_2(Tree0, Key, MustRemove, MaybeValue, Tree):
-%	Search the tree Tree0, looking for a node with key Key to delete.
-%	If MustRemove is `yes' and we don't find the key, fail.
-%	If we find the key, return it in MaybeValue and delete the node.
-%	Tree is the resulting tree, whether a node was removed or not.
-%
-% Deletion algorithm:
-%	Search down the tree, looking for the node to delete.  O(log N)
-%	When we find it, there are 4 possible conditions ->
-%		* Leaf node
-%		    Remove node  O(1)
-%		* Left subtree of node to be deleted exists
-%		    Move maximum key of Left subtree to current node. O(log N)
-%		* Right subtree of node to be deleted exists
-%		    Move minimum key of Right subtree to current node. O(log N)
-%		* Both left and right subtrees of node to be deleted exist
-%		    Move maximum key of Left subtree to current node. O(log N)
-%
-%	Algorithm O(log N).
+    % rbtree__delete_2(Tree0, Key, MustRemove, MaybeValue, Tree):
+    %
+    % Search the tree Tree0, looking for a node with key Key to delete.
+    % If MustRemove is `yes' and we don't find the key, fail.
+    % If we find the key, return it in MaybeValue and delete the node.
+    % Tree is the resulting tree, whether a node was removed or not.
+    %
+    % Deletion algorithm:
+    %
+    % Search down the tree, looking for the node to delete.  O(log N)
+    % When we find it, there are 4 possible conditions ->
+    %   * Leaf node
+    %       Remove node  O(1)
+    %   * Left subtree of node to be deleted exists
+    %       Move maximum key of Left subtree to current node. O(log N)
+    %   * Right subtree of node to be deleted exists
+    %       Move minimum key of Right subtree to current node. O(log N)
+    %   * Both left and right subtrees of node to be deleted exist
+    %       Move maximum key of Left subtree to current node. O(log N)
+    %
+    % Algorithm O(log N).
 
 :- pred rbtree__delete_2(rbtree(K, V), K, bool, maybe(V), rbtree(K, V)).
 :- mode rbtree__delete_2(in, in, in, out, out) is semidet.
@@ -873,17 +828,12 @@
 rbtree__delete_2(red(K0, V0, L, R), K, MustRemove, MaybeV, Tree) :-
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
-		(
-			rbtree__remove_largest(L, NewK, NewV, NewL)
-		->
+        Result = (=),
+        ( rbtree__remove_largest(L, NewK, NewV, NewL) ->
 			Tree = red(NewK, NewV, NewL, R)
 		;
-			% L must be empty
-			(
-				rbtree__remove_smallest(R, NewK, NewV, NewR)
-			->
+            % L must be empty.
+            ( rbtree__remove_smallest(R, NewK, NewV, NewR) ->
 				Tree = red(NewK, NewV, empty, NewR)
 			;
 				% R must be empty
@@ -892,29 +842,23 @@
 		),
 		MaybeV = yes(V0)
 	;
-
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__delete_2(L, K, MustRemove, MaybeV, NewL),
 		Tree = red(K0, V0, NewL, R)
 	;
+        Result = (>),
 		rbtree__delete_2(R, K, MustRemove, MaybeV, NewR),
 		Tree = red(K0, V0, L, NewR)
 	).
 rbtree__delete_2(black(K0, V0, L, R), K, MustRemove, MaybeV, Tree) :-
 	compare(Result, K, K0),
 	(
-		Result = (=)
-	->
-		(
-			rbtree__remove_largest(L, NewK, NewV, NewL)
-		->
+        Result = (=),
+        ( rbtree__remove_largest(L, NewK, NewV, NewL) ->
 			Tree = black(NewK, NewV, NewL, R)
 		;
 			% L must be empty
-			(
-				rbtree__remove_smallest(R, NewK, NewV, NewR)
-			->
+            ( rbtree__remove_smallest(R, NewK, NewV, NewR) ->
 				Tree = black(NewK, NewV, empty, NewR)
 			;
 				% R must be empty
@@ -923,12 +867,11 @@
 		),
 		MaybeV = yes(V0)
 	;
-
-		Result = (<)
-	->
+        Result = (<),
 		rbtree__delete_2(L, K, MustRemove, MaybeV, NewL),
 		Tree = black(K0, V0, NewL, R)
 	;
+        Result = (>),
 		rbtree__delete_2(R, K, MustRemove, MaybeV, NewR),
 		Tree = black(K0, V0, L, NewR)
 	).
@@ -941,16 +884,10 @@
 rbtree__remove(Tree0, K, Tree) :-
 	rbtree__remove(Tree0, K, _, Tree).
 
-% rbtree__remove_largest:
-%	Deletes the node with the maximum K from the tree, and returns the
-%	key and value fields.
-
 rbtree__remove_largest(empty, _K, _V, _Tree) :-
 	fail.
 rbtree__remove_largest(red(K0, V0, L, R), NewK, NewV, Tree) :-
-	(
-		R = empty
-	->
+    ( R = empty ->
 		NewK = K0,
 		NewV = V0,
 		Tree = L
@@ -959,9 +896,7 @@
 		Tree = red(K0, V0, L, NewR)
 	).
 rbtree__remove_largest(black(K0, V0, L, R), NewK, NewV, Tree) :-
-	(
-		R = empty
-	->
+    ( R = empty ->
 		NewK = K0,
 		NewV = V0,
 		Tree = L
@@ -977,9 +912,7 @@
 rbtree__remove_smallest(empty, _K, _V, _Tree) :-
 	fail.
 rbtree__remove_smallest(red(K0, V0, L, R), NewK, NewV, Tree) :-
-	(
-		L = empty
-	->
+    ( L = empty ->
 		NewK = K0,
 		NewV = V0,
 		Tree = R
@@ -988,9 +921,7 @@
 		Tree = red(K0, V0, NewL, R)
 	).
 rbtree__remove_smallest(black(K0, V0, L, R), NewK, NewV, Tree) :-
-	(
-		L = empty
-	->
+    ( L = empty ->
 		NewK = K0,
 		NewV = V0,
 		Tree = R
Index: relation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/relation.m,v
retrieving revision 1.37
diff -u -b -r1.37 relation.m
Index: require.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/require.m,v
retrieving revision 1.35
diff -u -b -r1.35 require.m
--- require.m	16 Jun 2005 04:08:03 -0000	1.35
+++ require.m	17 Oct 2005 05:36:32 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1993-1999, 2003, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -16,19 +18,22 @@
 
 :- type software_error ---> software_error(string).
 
-	% error(Message).
+    % error(Message):
+    %
 	% Throw a `software_error(Message)' exception.
 	% This will normally cause execution to abort with an error message.
 	%
 :- pred error(string::in) is erroneous.
 
-	% func_error(Message).
+    % func_error(Message):
+    %
 	% An expression that results in a `software_error(Message)'
 	% exception being thrown.
 	%
 :- func func_error(string) = _ is erroneous.
 
-	% require(Goal, Message).
+    % require(Goal, Message):
+    %
 	% Call goal, and call error(Message) if Goal fails.
 	% This is not as useful as you might imagine, since it requires
 	% that the goal not produce any output variables.  In
@@ -37,7 +42,8 @@
 	%
 :- pred require((pred)::((pred) is semidet), string::in) is det.
 
-	% report_lookup_error(Message, Key, Value).
+    % report_lookup_error(Message, Key, Value):
+    %
 	% Call error/1 with an error message that is appropriate for
 	% the failure of a lookup operation involving the specified
 	% Key and Value.  The error message will include Message
@@ -45,7 +51,8 @@
 	%
 :- pred report_lookup_error(string::in, K::in, V::unused) is erroneous.
 
-	% report_lookup_error(Message, Key).
+    % report_lookup_error(Message, Key):
+    %
 	% Call error/1 with an error message that is appropriate for
 	% the failure of a lookup operation involving the specified
 	% Key.  The error message will include Message
Index: robdd.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/robdd.m,v
retrieving revision 1.6
diff -u -b -r1.6 robdd.m
Index: set.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set.m,v
retrieving revision 1.72
diff -u -b -r1.72 set.m
--- set.m	16 Jun 2005 04:08:04 -0000	1.72
+++ set.m	17 Oct 2005 05:35:56 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1997, 1999-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
Index: set_bbbtree.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_bbbtree.m,v
retrieving revision 1.26
diff -u -b -r1.26 set_bbbtree.m
--- set_bbbtree.m	16 Jun 2005 04:08:04 -0000	1.26
+++ set_bbbtree.m	17 Oct 2005 07:30:28 -0000
@@ -1,4 +1,6 @@
 %------------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%------------------------------------------------------------------------------%
 % Copyright (C) 1995-1997, 1999-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -371,11 +373,11 @@
 % set_bbbtree__least(empty, _) :- fail.
 set_bbbtree__least(tree(V, _N, L, _R), X) :-
 	(
-			% found least element
+        % Found least element.
 		L = empty,
 		X = V
 	;
-			% search further in left subtree
+        % Search further in left subtree.
 		L = tree(_V0, _N0, _L0, _R0),
 		set_bbbtree__least(L, X)
 	).
@@ -385,11 +387,11 @@
 % set_bbbtree__largest(empty, _) :- fail.
 set_bbbtree__largest(tree(V, _N, _L, R), X) :-
 	(
-			% found largest element
+        % Found largest element.
 		R = empty,
 		X = V
 	;
-			% search further in right subtree
+        % Search further in right subtree.
 		R = tree(_V0, _N0, _L0, _R0),
 		set_bbbtree__largest(R, X)
 	).
@@ -426,17 +428,17 @@
 set_bbbtree__insert_r(tree(V, N, L, R), X, Set, Ratio) :-
 	compare(Result, X, V),
 	(
-			% insert X into left subtree and re-balance it
+        % Insert X into left subtree and re-balance it.
 		Result = (<),
 		set_bbbtree__insert_r(L, X, NewL, Ratio),
 		set_bbbtree__balance(V, NewL, R, Set, Ratio)
 	;
-			% insert X into right subtree and re-balance it
+        % Insert X into right subtree and re-balance it.
 		Result = (>),
 		set_bbbtree__insert_r(R, X, NewR, Ratio),
 		set_bbbtree__balance(V, L, NewR, Set, Ratio)
 	;
-			% X already in tree
+        % X already in tree.
 		Result = (=),
 		Set = tree(V, N, L, R)
 	).
@@ -461,19 +463,19 @@
 % set_bbbtree__delete(tree(V, N, L, R), X, Set) :-
 % 	compare(Result, X, V),
 % 	(
-% 			% delete X from left subtree
+%       % Delete X from left subtree.
 % 		Result = (<),
 % 		set_bbbtree__delete(L, X, NewL), % X in left tree
 % 		NewN = N - 1,
 % 		Set = tree(V, NewN, NewL, R)
 % 	;
-% 			% delete X from right subtree
+%       % Delete X from right subtree.
 % 		Result = (>),
 % 		set_bbbtree__delete(R, X, NewR), % X in right tree
 % 		NewN = N - 1,
 % 		Set = tree(V, NewN, L, NewR)
 % 	;
-% 			% found X so just concatenate its two subtrees together
+%       % Found X so just concatenate its two subtrees together.
 % 		Result = (=),
 % 		set_bbbtree__concat3(L, R, Set)
 % 	).
@@ -506,19 +508,19 @@
 set_bbbtree__remove(tree(V, N, L, R), X, Set) :-
 	compare(Result, X, V),
 	(
-			% remove X from left subtree
+        % Remove X from left subtree.
 		Result = (<),
 		set_bbbtree__remove(L, X, NewL), % X in left tree
 		NewN = N - 1,
 		Set = tree(V, NewN, NewL, R)
 	;
-			% remove X from right subtree
+        % Remove X from right subtree.
 		Result = (>),
 		set_bbbtree__remove(R, X, NewR), % X in right tree
 		NewN = N - 1,
 		Set = tree(V, NewN, L, NewR)
 	;
-			% found X so just concatenate its two subtrees together
+        % Found X so just concatenate its two subtrees together.
 		Result = (=),
 		set_bbbtree__concat3(L, R, Set)
 	).
@@ -538,12 +540,12 @@
 % set_bbbtree__remove_least(empty, X, _) :- fail.
 set_bbbtree__remove_least(tree(V, N, L, R), X, Set) :-
 	(
-			% found the least element
+        % Found the least element.
 		L = empty,
 		X = V,
 		Set = R
 	;
-			% search further in the left subtree
+        % Search further in the left subtree.
 		L = tree(_V, _N, _L, _R),
 		set_bbbtree__remove_least(L, X, NewL),
 		NewN = N - 1,
@@ -558,12 +560,12 @@
 % set_bbbtree__remove_largest(empty, X, _) :- fail.
 set_bbbtree__remove_largest(tree(V, N, L, R), X, Set) :-
 	(
-			% found the largest element
+        % Found the largest element.
 		R = empty,
 		X = V,
 		Set = L
 	;
-			% search further in the right subtree
+        % Search further in the right subtree.
 		R = tree(_V, _N, _L, _R),
 		set_bbbtree__remove_largest(R, X, NewR),
 		NewN = N - 1,
@@ -610,11 +612,12 @@
 set_bbbtree__sorted_list_to_set_len([], empty, _N).
 set_bbbtree__sorted_list_to_set_len([X | Xs], Set, N) :-
 	set_bbbtree__sorted_list_to_set_len2([X | Xs], RestOfList, N, Set),
-	% The list should be exhausted on completion
-	( RestOfList = [] ->
-		true
+    % The list should be exhausted on completion.
+    (
+        RestOfList = []
 	;
-			% Should never happen. Here only to satisfy det checker
+        RestOfList = [_ | _],
+        % Should never happen. Here only to satisfy det checker.
 		error("set_bbbtree__sorted_list_to_set_r")
 	).
 
@@ -628,12 +631,11 @@
 		set_bbbtree__sorted_list_to_set_len2(List, RestOfList0, NL, L),
 		(
 			RestOfList0 = [V | RestOfList1],
-			set_bbbtree__sorted_list_to_set_len2(RestOfList1,
-				RestOfList, NR, R),
+            set_bbbtree__sorted_list_to_set_len2(RestOfList1, RestOfList,
+                NR, R),
 			Set = tree(V, N, L, R)
 		;
-				% Should never occur.
-				%Here only to satisfy det checker
+            % Should never occur. Here only to satisfy det checker.
 			RestOfList0 = [],
 			error("set_bbbtree__sorted_list_to_set_len2.1")
 		)
@@ -644,7 +646,7 @@
 				tree(X, 1, empty, empty),
 				tree(Z, 1, empty, empty))
 		;
-			% Should never occur.Here only to satisfy det checker
+            % Should never occur. Here only to satisfy det checker
 			error("set_bbbtree__sorted_list_to_set_len2.2")
 		)
 	; N = 2 ->
@@ -864,9 +866,9 @@
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%
 
-	% given X, L and R create a new tree who's root is X,
+    % Given X, L and R create a new tree who's root is X,
 	% left subtree is L and right subtree is R.
-
+    %
 :- pred set_bbbtree__build_node(T::in, set_bbbtree(T)::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::out) is det.
 
@@ -880,13 +882,13 @@
 %------------------------------------------------------------------------------%
 
 	% Single rotation to the left.
-
+    %
 	%     A                        B
 	%   /   \                    /   \
 	%  X     B      ----->      A     Z
 	%      /   \              /   \
 	%     Y     Z            X     Y
-
+    %
 :- pred set_bbbtree__single_rot_l(T::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::in, set_bbbtree(T)::out) is det.
 
@@ -899,7 +901,7 @@
 %------------------------------------------------------------------------------%
 
 	% Single rotation to the right.
-
+    %
 :- pred set_bbbtree__single_rot_r(T::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::in, set_bbbtree(T)::out) is det.
 
@@ -912,7 +914,7 @@
 %------------------------------------------------------------------------------%
 
 	% Double rotation to the left.
-
+    %
 	%        A
 	%      /   \                         B
 	%     X     C                      /   \
@@ -920,7 +922,7 @@
 	%        B     Z               /   \   /   \
 	%      /   \                  X    Y1 Y2    Z
 	%    Y1     Y2
-
+    %
 :- pred set_bbbtree__double_rot_l(T::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::in, set_bbbtree(T)::out) is det.
 
@@ -940,7 +942,7 @@
 %------------------------------------------------------------------------------%
 
 	% Double rotation to the right.
-
+    %
 :- pred set_bbbtree__double_rot_r(T::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::in, set_bbbtree(T)::out) is det.
 
@@ -959,11 +961,11 @@
 
 %------------------------------------------------------------------------------%
 
-% Given two trees L and R, such that all the elements of L are less than those
-% of R, and an element V that lies between the values of L and the values of R
-% construct a new tree consisting of V, L and R that is balanced by the use of
-% single and double left and right rotations.
-
+    % Given two trees L and R, such that all the elements of L are less than
+    % those of R, and an element V that lies between the values of L and the
+    % values of R construct a new tree consisting of V, L and R that is
+    % balanced by the use of single and double left and right rotations.
+    %
 :- pred set_bbbtree__balance(T::in, set_bbbtree(T)::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::out, int::in) is det.
 
@@ -974,7 +976,7 @@
 		Val = LSize + RSize,
 		Val < 2
 	->
-			% The two trees are too small to bother rebalancing
+        % the two trees are too small to bother rebalancing.
 		set_bbbtree__build_node(V, L, R, Set)
 	;
 		Val = Ratio * LSize,
@@ -982,11 +984,9 @@
 	->
 		(
 			R = tree(_V0, _N0, RL, RR),
-			set_bbbtree__size(RL, RLSize),	% right side too big
+            set_bbbtree__size(RL, RLSize),  % Right side too big.
 			set_bbbtree__size(RR, RRSize),
-			(
-				RLSize < RRSize
-			->
+            ( RLSize < RRSize ->
 				set_bbbtree__single_rot_l(V, L, R, Set)
 			;
 				set_bbbtree__double_rot_l(V, L, R, Set)
@@ -1001,11 +1001,9 @@
 	->
 		(
 			L = tree(_V1, _N1, LL, LR),
-			set_bbbtree__size(LL, LLSize),	% left side too big
+            set_bbbtree__size(LL, LLSize),  % Left side too big.
 			set_bbbtree__size(LR, LRSize),
-			(
-				LRSize < LLSize
-			->
+            ( LRSize < LLSize ->
 				set_bbbtree__single_rot_r(V, L, R, Set)
 			;
 				set_bbbtree__double_rot_r(V, L, R, Set)
@@ -1020,28 +1018,27 @@
 
 %------------------------------------------------------------------------------%
 
-% Given two trees concatenate them by removing the greatest element from the
-% left subtree if it is larger than the right subtree by a factor of ratio,
-% else the smallest element from the right subtree, and make it the root along
-% with the two remaining trees as its subtrees. No rebalancing is performed on
-% the resultant tree. `set_bbbtree__concat3' is largely used for deletion of
-% elements. This predicate should not be confused with the predicate `concat3'
-% in the paper for that is `set_bbbtree__concat4'.
-
+    % Given two trees concatenate them by removing the greatest element
+    % from the left subtree if it is larger than the right subtree by a
+    % factor of ratio, else the smallest element from the right subtree,
+    % and make it the root along with the two remaining trees as its subtrees.
+    % No rebalancing is performed on the resultant tree. `set_bbbtree__concat3'
+    % is largely used for deletion of elements. This predicate should not be
+    % confused with the predicate `concat3' in the paper for that is
+    % `set_bbbtree__concat4'.
+    %
 :- pred set_bbbtree__concat3(set_bbbtree(T)::in, set_bbbtree(T)::in,
 	set_bbbtree(T)::out) is det.
 
 set_bbbtree__concat3(L, R, Set) :-
 	set_bbbtree__size(L, LSize),
-	(
-		LSize = 0		% Left tree empty so just
-	->				% return the right tree
+    ( LSize = 0 ->
+        % Left tree empty so just return the right tree.
 		Set = R
 	;
 		set_bbbtree__size(R, RSize),
-		(
-			RSize = 0	% Right tree empty so just
-		->			% just return the left tree
+        ( RSize = 0 ->
+            % Right tree empty so just just return the left tree.
 			Set = L
 		;
 			% If the left tree is the larger of the two then
@@ -1050,19 +1047,15 @@
 			% Otherwise remove the smallest value from the
 			% right tree and make it the root of the left and
 			% the new right trees.
-			(
-				LSize > RSize
-			->
+            ( LSize > RSize ->
 				( set_bbbtree__remove_largest(L, X, NewL) ->
-					set_bbbtree__build_node(X, NewL, R,
-						Set)
+                    set_bbbtree__build_node(X, NewL, R, Set)
 				;
 					error("set_bbbtree__concat3.1")
 				)
 			;
 				( set_bbbtree__remove_least(R, X, NewR) ->
-					set_bbbtree__build_node(X, L, NewR,
-						Set)
+                    set_bbbtree__build_node(X, L, NewR, Set)
 				;
 					error("set_bbbtree__concat3.2")
 				)
@@ -1072,11 +1065,11 @@
 
 %------------------------------------------------------------------------------%
 
-% Given two trees L and R, such that all the elements of L are less than those
-% of R, and an element V that lies between the values of L and the values of R
-% construct a new tree consisting of V and the elements of L and R.
-% This predicate is the equivalent of concat3 in the paper.
-
+    % Given two trees L and R, such that all the elements of L are less than
+    % those of R, and an element V that lies between the values of L and the
+    % values of R construct a new tree consisting of V and the elements of
+    % L and R. This predicate is the equivalent of concat3 in the paper.
+    %
 :- pred set_bbbtree__concat4(set_bbbtree(T)::in, set_bbbtree(T)::in, T::in,
 	set_bbbtree(T)::out, int::in) is det.
 
@@ -1093,18 +1086,16 @@
 			Val = Ratio * LN,	% Right too big
 			Val < RN
 		->
-			set_bbbtree__concat4(tree(LV,LN,LL,LR), RL, V,
-								NewL, Ratio),
+            set_bbbtree__concat4(tree(LV, LN, LL, LR), RL, V, NewL, Ratio),
 			set_bbbtree__balance(RV, NewL, RR, Set, Ratio)
 		;
 			Val = Ratio * RN,	% Left too big
 			Val < LN
 		->
-			set_bbbtree__concat4(LR, tree(RV,RN,RL,RR), V,
-								NewR, Ratio),
+            set_bbbtree__concat4(LR, tree(RV, RN, RL, RR), V, NewR, Ratio),
 			set_bbbtree__balance(LV, LL, NewR, Set, Ratio)
 		;
-			set_bbbtree__build_node(V, tree(LV,LN,LL,LR), R, Set)
+            set_bbbtree__build_node(V, tree(LV, LN, LL, LR), R, Set)
 		)
 	).
 
@@ -1132,8 +1123,8 @@
 
 %------------------------------------------------------------------------------%
 
-% Given a set return the subset of it that is greater that X
-
+    % Given a set return the subset of it that is greater than X.
+    %
 :- pred set_bbbtree__split_gt(set_bbbtree(T)::in, T::in, set_bbbtree(T)::out,
 	int::in) is det.
 
Index: set_ordlist.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_ordlist.m,v
retrieving revision 1.22
diff -u -b -r1.22 set_ordlist.m
Index: set_tree234.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/set_tree234.m,v
retrieving revision 1.3
diff -u -b -r1.3 set_tree234.m
Index: sparse_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/sparse_bitset.m,v
retrieving revision 1.24
diff -u -b -r1.24 sparse_bitset.m
Index: stack.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/stack.m,v
retrieving revision 1.21
diff -u -b -r1.21 stack.m
--- stack.m	16 Jun 2005 04:08:04 -0000	1.21
+++ stack.m	17 Oct 2005 05:43:52 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1994-1995, 1997-1999, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -105,19 +107,20 @@
 stack__top([Elem | _], Elem).
 
 stack__top_det(Stack, Elem) :-
-	( Stack = [Elem1 | _] ->
-		Elem = Elem1
+	(
+        Stack = [Elem | _]
 	;
+        Stack = [],
 		error("stack__top_det: top of empty stack")
 	).
 
 stack__pop([Elem | Stack], Elem, Stack).
 
 stack__pop_det(Stack0, Elem, Stack) :-
-	( Stack0 = [Elem1 | Stack1] ->
-		Elem = Elem1,
-		Stack = Stack1
+	(
+        Stack0 = [Elem | Stack]
 	;
+        Stack0 = [],
 		error("stack__pop_det: pop from empty stack")
 	).
 
@@ -149,5 +152,3 @@
 
 stack__depth(S) = N :-
 	stack__depth(S, N).
-
-
Index: std_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.302
diff -u -b -r1.302 std_util.m
--- std_util.m	20 Sep 2005 03:51:33 -0000	1.302
+++ std_util.m	17 Oct 2005 05:52:05 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1994-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -26,16 +28,15 @@
 %-----------------------------------------------------------------------------%
 %
 % The universal type `univ'.
-%
-% An object of type `univ' can hold the type and value of an object of any
-% other type.
 
+    % An object of type `univ' can hold the type and value of an object of any
+    % other type.
 :- type univ.
 
 	% type_to_univ(Object, Univ):
-	% 	true iff the type stored in `Univ' is the same as the type
-	%	of `Object', and the value stored in `Univ' is equal to the
-	%	value of `Object'.
+    %
+    % True iff the type stored in `Univ' is the same as the type of `Object',
+    % and the value stored in `Univ' is equal to the value of `Object'.
 	%
 	% Operational, the forwards mode converts an object to type `univ',
 	% while the reverse mode converts the value stored in `Univ'
@@ -54,9 +55,7 @@
 :- mode univ_to_type(out, in) is det.
 :- mode univ_to_type(uo, di) is det.
 
-	% The function univ/1 provides the same
-	% functionality as type_to_univ/2.
-
+    % The function univ/1 provides the same functionality as type_to_univ/2.
 	% univ(Object) = Univ :- type_to_univ(Object, Univ).
 	%
 :- func univ(T) = univ.
@@ -65,18 +64,22 @@
 :- mode univ(out) = in is semidet.
 
 	% det_univ_to_type(Univ, Object):
-	% 	the same as the forwards mode of univ_to_type, but
-	% 	abort if univ_to_type fails.
+    %
+    % The same as the forwards mode of univ_to_type, but aborts
+    % if univ_to_type fails.
 	%
 :- pred det_univ_to_type(univ::in, T::out) is det.
 
 	% univ_type(Univ):
-	%	returns the type_desc for the type stored in `Univ'.
+    %
+    % Returns the type_desc for the type stored in `Univ'.
 	%
 :- func univ_type(univ) = type_desc__type_desc.
 
 	% univ_value(Univ):
-	%	returns the value of the object stored in Univ.
+    %
+    % Returns the value of the object stored in Univ.
+    %
 :- some [T] func univ_value(univ) = T.
 
 %-----------------------------------------------------------------------------%
@@ -149,20 +152,23 @@
 % The "pair" type.  Useful for many purposes.
 %
 
-:- type pair(T1, T2)	--->	(T1 - T2).
-:- type pair(T)		==	pair(T,T).
-:- inst pair(I1, I2)	--->	(I1 - I2).
-:- inst pair(I)		==	pair(I,I).
+:- type pair(T1, T2)
+    --->    (T1 - T2).
+:- type pair(T) ==  pair(T, T).
+
+:- inst pair(I1, I2)
+    --->    (I1 - I2).
+:- inst pair(I) ==  pair(I, I).
 
 	% Return the first element of the pair.
 	%
-:- pred fst(pair(X,Y)::in, X::out) is det.
-:- func fst(pair(X,Y)) = X.
+:- pred fst(pair(X, Y)::in, X::out) is det.
+:- func fst(pair(X, Y)) = X.
 
 	% Return the second element of the pair.
 	%
-:- pred snd(pair(X,Y)::in, Y::out) is det.
-:- func snd(pair(X,Y)) = Y.
+:- pred snd(pair(X, Y)::in, Y::out) is det.
+:- func snd(pair(X, Y)) = Y.
 
 :- func pair(T1, T2) = pair(T1, T2).
 
@@ -197,10 +203,10 @@
 :- mode unsorted_solutions(pred(out) is nondet, out) is cc_multi.
 
 :- func aggregate(pred(T), func(T, U) = U, U) = U.
-:- mode aggregate(pred(out) is multi, func(in, in) = out is det,
-		in) = out is det.
-:- mode aggregate(pred(out) is nondet, func(in, in) = out is det,
-		in) = out is det.
+:- mode aggregate(pred(out) is multi, func(in, in) = out is det, in)
+    = out is det.
+:- mode aggregate(pred(out) is nondet, func(in, in) = out is det, in)
+    = out is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -366,7 +372,7 @@
 	% determinism declarations which could be stricter.
 	% Similarly, `semidet_fail' is like `fail' except that its
 	% determinism is semidet rather than failure, and
-	% `cc_multi_equal(X,Y)' is the same as `X=Y' except that it
+    % `cc_multi_equal(X, Y)' is the same as `X=Y' except that it
 	% is cc_multi rather than det.
 
 :- pred semidet_succeed is semidet.
@@ -415,7 +421,7 @@
 :- some [T] pred has_type(T::unused, type_desc__type_desc::in) is det.
 
 	% type_name(Type) returns the name of the specified type
-	% (e.g. type_name(type_of([2,3])) = "list:list(int)").
+    % (e.g. type_name(type_of([2, 3])) = "list:list(int)").
 	% Any equivalence types will be fully expanded.
 	% Builtin types (those defined in builtin.m) will
 	% not have a module qualifier.
@@ -428,7 +434,7 @@
 	%	of the corresponding type arguments to `TypeCtor',
 	%	and `TypeCtor' is not an equivalence type.
 	%
-	% For example, type_ctor_and_args(type_of([2,3]), TypeCtor,
+    % For example, type_ctor_and_args(type_of([2, 3]), TypeCtor,
 	% TypeArgs) will bind `TypeCtor' to a representation of the
 	% type constructor list/1, and will bind `TypeArgs' to the list
 	% `[Int]', where `Int' is a representation of the type `int'.
@@ -457,7 +463,7 @@
 
 	% type_ctor_name(TypeCtor) returns the name of specified
 	% type constructor.
-	% (e.g. type_ctor_name(type_ctor(type_of([2,3]))) = "list").
+    % (e.g. type_ctor_name(type_ctor(type_of([2, 3]))) = "list").
 	%
 :- func type_ctor_name(type_desc__type_ctor_desc) = string.
 
@@ -469,7 +475,7 @@
 
 	% type_ctor_arity(TypeCtor) returns the arity of specified
 	% type constructor.
-	% (e.g. type_ctor_arity(type_ctor(type_of([2,3]))) = 1).
+    % (e.g. type_ctor_arity(type_ctor(type_of([2, 3]))) = 1).
 	%
 :- func type_ctor_arity(type_desc__type_ctor_desc) = int.
 
@@ -803,11 +809,11 @@
 % pair(X, Y, X-Y).
 
 fst(X-_Y) = X.
-fst(P,X) :-
+fst(P, X) :-
 	X = fst(P).
 
 snd(_X-Y) = Y.
-snd(P,X) :-
+snd(P, X) :-
 	X = snd(P).
 
 maybe_pred(Pred, X, Y) :-
@@ -818,84 +824,80 @@
 	).
 
 %-----------------------------------------------------------------------------%
-
-/*
-** This section defines builtin_aggregate/4 which takes a closure of type
-** pred(T) in which the remaining argument is output, and backtracks over
-** solutions for this, using the second argument to aggregate them however the
-** user wishes.  This is basically a generalization of solutions/2.
-*/
+%
+% This section defines builtin_aggregate/4 which takes a closure of type
+% pred(T) in which the remaining argument is output, and backtracks over
+% solutions for this, using the second argument to aggregate them however the
+% user wishes.  This is basically a generalization of solutions/2.
 
 :- pred builtin_aggregate(pred(T), pred(T, U, U), U, U).
 :- mode builtin_aggregate(pred(out) is multi, pred(in, in, out) is det,
-	in, out) is det. /* really cc_multi */
+    in, out) is det. % really cc_multi
 :- mode builtin_aggregate(pred(out) is multi, pred(in, di, uo) is det,
-	di, uo) is det. /* really cc_multi */
+    di, uo) is det.  % really cc_multi
 :- mode builtin_aggregate(pred(out) is multi, pred(in, in, out) is cc_multi,
-	in, out) is det. /* really cc_multi */
+    in, out) is det. % really cc_multi
 :- mode builtin_aggregate(pred(out) is multi, pred(in, di, uo) is cc_multi,
-	di, uo) is det. /* really cc_multi */
+    di, uo) is det.  % really cc_multi
 :- mode builtin_aggregate(pred(muo) is multi, pred(mdi, di, uo) is det,
-	di, uo) is det. /* really cc_multi */
+    di, uo) is det.  % really cc_multi
 :- mode builtin_aggregate(pred(out) is nondet, pred(in, di, uo) is det,
-	di, uo) is det. /* really cc_multi */
+    di, uo) is det.  % really cc_multi
 :- mode builtin_aggregate(pred(out) is nondet, pred(in, di, uo) is cc_multi,
-	di, uo) is det. /* really cc_multi */
+    di, uo) is det.  % really cc_multi
 :- mode builtin_aggregate(pred(out) is nondet, pred(in, in, out) is det,
-	in, out) is det. /* really cc_multi */
+    in, out) is det. % really cc_multi
 :- mode builtin_aggregate(pred(out) is nondet, pred(in, in, out) is cc_multi,
-	in, out) is det. /* really cc_multi */
+    in, out) is det. % really cc_multi
 :- mode builtin_aggregate(pred(muo) is nondet, pred(mdi, di, uo) is det,
-	di, uo) is det. /* really cc_multi */
+    di, uo) is det.  % really cc_multi
 
-/*
-** If we're doing heap reclamation on failure, then
-** in order to implement any sort of code that requires terms to survive
-** backtracking, we need to (deeply) copy them out of the heap and into some
-** other area before backtracking.  The obvious thing to do then is just call
-** the generator predicate, let it run to completion, and copy its result into
-** another memory area (call it the solutions heap) before forcing
-** backtracking.  When we get the next solution, we do the same, this time
-** passing the previous collection (which is still on the solutions heap) to
-** the collector predicate.  If the result of this operation contains the old
-** collection as a part, then the deep copy operation is smart enough
-** not to copy again.  So this could be pretty efficient.
-**
-** But what if the collector predicate does something that copies the previous
-** collection?  Then on each solution, we'll copy the previous collection to
-** the heap, and then deep copy it back to the solution heap.  This means
-** copying solutions order N**2 times, where N is the number of solutions.  So
-** this isn't as efficient as we hoped.
-**
-** So we use a slightly different approach.  When we find a solution, we deep
-** copy it to the solution heap.  Then, before calling the collector code, we
-** sneakily swap the runtime system's notion of which is the heap and which is
-** the solutions heap.  This ensures that any terms are constructed on the
-** solutions heap.  When this is complete, we swap them back, and force the
-** engine to backtrack to get the next solution.  And so on.  After we've
-** gotten the last solution, we do another deep copy to move the solution back
-** to the 'real' heap, and reset the solutions heap pointer (which of course
-** reclaims all the garbage of the collection process).
-**
-** Note that this will work with recursive calls to builtin_aggregate as
-** well.  If the recursive invocation occurs in the generator pred, there can
-** be no problem because by the time the generator succeeds, the inner
-** do_ call will have completed, copied its result from the solutions heap,
-** and reset the solutions heap pointer.  If the recursive invocation happens
-** in the collector pred, then it will happen when the heap and solutions heap
-** are 'swapped.'  This will work out fine, because the real heap isn't needed
-** while the collector pred is executing, and by the time the nested do_ is
-** completed, the 'real' heap pointer will have been reset.
-**
-** If the collector predicate throws an exception while they are swapped,
-** then the code for builtin_throw/1 will unswap the heaps.
-** So we don't need to create our own exception handlers to here to
-** cover that case.
-**
-** If we're not doing heap reclamation on failure (as is currently the
-** case when using conservative GC), then all of the heap-swapping
-** and copying operations are no-ops, so we get a "zero-copy" solution.
-*/
+% If we're doing heap reclamation on failure, then
+% in order to implement any sort of code that requires terms to survive
+% backtracking, we need to (deeply) copy them out of the heap and into some
+% other area before backtracking.  The obvious thing to do then is just call
+% the generator predicate, let it run to completion, and copy its result into
+% another memory area (call it the solutions heap) before forcing
+% backtracking.  When we get the next solution, we do the same, this time
+% passing the previous collection (which is still on the solutions heap) to
+% the collector predicate.  If the result of this operation contains the old
+% collection as a part, then the deep copy operation is smart enough
+% not to copy again.  So this could be pretty efficient.
+%
+% But what if the collector predicate does something that copies the previous
+% collection?  Then on each solution, we'll copy the previous collection to
+% the heap, and then deep copy it back to the solution heap.  This means
+% copying solutions order N**2 times, where N is the number of solutions.  So
+% this isn't as efficient as we hoped.
+%
+% So we use a slightly different approach.  When we find a solution, we deep
+% copy it to the solution heap.  Then, before calling the collector code, we
+% sneakily swap the runtime system's notion of which is the heap and which is
+% the solutions heap.  This ensures that any terms are constructed on the
+% solutions heap.  When this is complete, we swap them back, and force the
+% engine to backtrack to get the next solution.  And so on.  After we've
+% gotten the last solution, we do another deep copy to move the solution back
+% to the 'real' heap, and reset the solutions heap pointer (which of course
+% reclaims all the garbage of the collection process).
+%
+% Note that this will work with recursive calls to builtin_aggregate as
+% well.  If the recursive invocation occurs in the generator pred, there can
+% be no problem because by the time the generator succeeds, the inner
+% do_ call will have completed, copied its result from the solutions heap,
+% and reset the solutions heap pointer.  If the recursive invocation happens
+% in the collector pred, then it will happen when the heap and solutions heap
+% are 'swapped.'  This will work out fine, because the real heap isn't needed
+% while the collector pred is executing, and by the time the nested do_ is
+% completed, the 'real' heap pointer will have been reset.
+%
+% If the collector predicate throws an exception while they are swapped,
+% then the code for builtin_throw/1 will unswap the heaps.
+% So we don't need to create our own exception handlers to here to
+% cover that case.
+%
+% If we're not doing heap reclamation on failure (as is currently the
+% case when using conservative GC), then all of the heap-swapping
+% and copying operations are no-ops, so we get a "zero-copy" solution.
 
 % Note that the code for builtin_aggregate is very similar to the code
 % for do_while (below).
@@ -912,14 +914,13 @@
 	impure new_mutvar(Accumulator0, Mutvar),
 
 	(
-		% Get a solution
+        % Get a solution.
 		GeneratorPred(Answer0),
 
-		% Check that the generator didn't leave any
-		% delayed goals outstanding
+        % Check that the generator didn't leave any delayed goals outstanding.
 		impure check_for_floundering(TrailPtr),
 
-		% Update the accumulator
+        % Update the accumulator.
 		% /* MutVar := CollectorPred(MutVar) */
 		impure swap_heap_and_solutions_heap,
 		impure partial_deep_copy(HeapPtr, Answer0, Answer),
@@ -935,16 +936,13 @@
 		% There are no more solutions.
 		impure end_all_soln_neg_context_no_more,
 
-		% So now we just need to copy the final value
-		% of the accumulator from the solutions heap
-		% back onto the ordinary heap, and then we can
-		% reset the solutions heap pointer.
-		% We also need to discard the trail ticket
-		% created by get_registers/3.
+        % So now we just need to copy the final value of the accumulator
+        % from the solutions heap back onto the ordinary heap, and then we can
+        % reset the solutions heap pointer. We also need to discard the trail
+        % ticket created by get_registers/3.
 		% /* Accumulator := MutVar */
 		impure get_mutvar(Mutvar, Accumulator1),
-		impure partial_deep_copy(SolutionsHeapPtr, Accumulator1,
-			Accumulator),
+        impure partial_deep_copy(SolutionsHeapPtr, Accumulator1, Accumulator),
 		impure reset_solutions_heap(SolutionsHeapPtr),
 		impure discard_trail_ticket
 	).
@@ -976,8 +974,8 @@
 		impure set_mutvar(Mutvar, Acc1),
 		impure swap_heap_and_solutions_heap,
 
-		% if More = yes, then backtrack for the next solution.
-		% if More = no, then we're done.
+        % If More = yes, then backtrack for the next solution.
+        % If More = no, then we're done.
 		More = no,
 		impure end_all_soln_neg_context_more
 	;
@@ -1033,13 +1031,11 @@
 :- type heap_ptr == private_builtin__heap_pointer.
 :- type trail_ptr ---> trail_ptr(c_pointer).
 
-%
 % Save the state of the Mercury heap and trail registers,
 % for later use in partial_deep_copy/3 and reset_solutions_heap/1.
 % Note that this allocates a trail ticket;
 % you need to dispose of it properly when you're finished with it,
 % e.g. by calling discard_trail_ticket/0.
-%
 :- impure pred get_registers(heap_ptr::out, heap_ptr::out, trail_ptr::out)
 	is det.
 
@@ -1114,8 +1110,7 @@
 	[will_not_call_mercury, thread_safe],
 "
 #if MR_USE_TRAIL
-	mercury.runtime.Errors.SORRY(
-		""foreign code for check_for_floundering"");
+    mercury.runtime.Errors.SORRY(""foreign code for check_for_floundering"");
 #endif
 ").
 
@@ -1145,8 +1140,7 @@
 	[will_not_call_mercury, thread_safe],
 "
 #if MR_USE_TRAIL
-	mercury.runtime.Errors.SORRY(
-		""foreign code for discard_trail_ticket"");
+    mercury.runtime.Errors.SORRY(""foreign code for discard_trail_ticket"");
 #endif
 ").
 
@@ -1230,9 +1224,9 @@
   		OldVar, NewVal, TypeInfo_for_T)				\\
   	do {								\\
 		MR_save_transient_hp();					\\
-		NewVal = MR_deep_copy(OldVal, (MR_TypeInfo) TypeInfo_for_T,\\
+        NewVal = MR_deep_copy(OldVal, (MR_TypeInfo) TypeInfo_for_T,     \\
 			(const MR_Word *) SolutionsHeapPtr,		\\
-			MR_ENGINE(MR_eng_solutions_heap_zone)->MR_zone_top);\\
+            MR_ENGINE(MR_eng_solutions_heap_zone)->MR_zone_top);        \\
 		MR_restore_transient_hp();				\\
 	} while (0)
 #endif
@@ -1307,12 +1301,12 @@
 	NewVal = OldVal;
 ").
 
-%
-% reset_solutions_heap(SolutionsHeapPtr):
-%	Reset the solutions heap pointer to the specified value,
-%	thus deallocating everything allocated on the solutions
-%	heap since that value was obtained via get_registers/3.
-%
+    % reset_solutions_heap(SolutionsHeapPtr):
+    %
+    % Reset the solutions heap pointer to the specified value,
+    % thus deallocating everything allocated on the solutions
+    % heap since that value was obtained via get_registers/3.
+    %
 :- impure pred reset_solutions_heap(heap_ptr::in) is det.
 
 :- pragma foreign_proc("C", 
@@ -1328,10 +1322,8 @@
 	reset_solutions_heap(_SolutionsHeapPtr::in),
 	[will_not_call_mercury, thread_safe],
 "
-	//
 	// For the IL back-end, we don't have a separate `solutions heap'.
 	// Hence this operation is a NOP.
-	//
 ").
 
 :- pragma foreign_proc("Java", 
@@ -1426,7 +1418,7 @@
 	[will_not_call_mercury, thread_safe],
 "
 	MR_offset_incr_hp_msg(Ref, MR_SIZE_SLOT_SIZE, MR_SIZE_SLOT_SIZE + 1,
-		MR_PROC_LABEL, ""std_util:mutvar/1"");
+        MR_PROC_LABEL, ""std_util.mutvar/1"");
 	MR_define_size_slot(0, Ref, 1);
 	* (MR_Word *) Ref = X;
 ").
@@ -1435,7 +1427,7 @@
 	[will_not_call_mercury, thread_safe],
 "
 	MR_offset_incr_hp_msg(Ref, MR_SIZE_SLOT_SIZE, MR_SIZE_SLOT_SIZE + 1,
-		MR_PROC_LABEL, ""std_util:mutvar/1"");
+        MR_PROC_LABEL, ""std_util.mutvar/1"");
 	MR_define_size_slot(0, Ref, 1);
 	* (MR_Word *) Ref = X;
 ").
@@ -1570,45 +1562,65 @@
 :- pragma foreign_proc("C",
 	semidet_succeed, 
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"SUCCESS_INDICATOR = MR_TRUE;").
+"
+    SUCCESS_INDICATOR = MR_TRUE;
+").
 :- pragma foreign_proc("C",
 	semidet_fail,
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"SUCCESS_INDICATOR = MR_FALSE;").
+"
+    SUCCESS_INDICATOR = MR_FALSE;
+").
 :- pragma foreign_proc("C",
 	cc_multi_equal(X::in, Y::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"Y = X;").
+"
+    Y = X;
+").
 :- pragma foreign_proc("C",
 	cc_multi_equal(X::di, Y::uo),
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"Y = X;").
+"
+    Y = X;
+").
 
 :- pragma foreign_proc("C#",
 	semidet_succeed, 
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"SUCCESS_INDICATOR = true;").
+"
+    SUCCESS_INDICATOR = true;
+").
 :- pragma foreign_proc("C#",
 	semidet_fail, 
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"SUCCESS_INDICATOR = false;").
+"
+    SUCCESS_INDICATOR = false;
+").
 :- pragma foreign_proc("C#",
 	cc_multi_equal(X::in, Y::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"Y = X;").
+"
+    Y = X;
+").
 :- pragma foreign_proc("C#",
 	cc_multi_equal(X::di, Y::uo),
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"Y = X;").
+"
+    Y = X;
+").
 
 :- pragma foreign_proc("Java",
 	cc_multi_equal(X::in, Y::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"Y = X;").
+"
+    Y = X;
+").
 :- pragma foreign_proc("Java",
 	cc_multi_equal(X::di, Y::uo),
 	[will_not_call_mercury, thread_safe, promise_pure],
-	"Y = X;").
+"
+    Y = X;
+").
 
 % We can't just use "true" and "fail" here, because that provokes warnings
 % from determinism analysis, and the library is compiled with --halt-at-warn.
@@ -1632,8 +1644,8 @@
 
 	% We call the constructor for univs `univ_cons' to avoid ambiguity
 	% with the univ/1 function which returns a univ.
-:- type univ --->
-	some [T] univ_cons(T).
+:- type univ
+    --->    some [T] univ_cons(T).
 
 univ_to_type(Univ, X) :- type_to_univ(X, Univ).
 
@@ -1790,10 +1802,12 @@
 
 argument_cc(Term, Index, MaybeArgumentUniv) :-
 	deconstruct__arg_cc(Term, Index, MaybeArgument),
-	( MaybeArgument = arg(Argument),
+    (
+        MaybeArgument = arg(Argument),
 		type_to_univ(Argument, ArgumentUniv),
 		MaybeArgumentUniv = yes(ArgumentUniv)
-	; MaybeArgument = no_arg,
+    ;
+        MaybeArgument = no_arg,
 		MaybeArgumentUniv = no
 	).
 
Index: store.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/store.m,v
retrieving revision 1.51
diff -u -b -r1.51 store.m
Index: svarray.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svarray.m,v
retrieving revision 1.2
diff -u -b -r1.2 svarray.m
--- svarray.m	25 Jan 2005 02:21:27 -0000	1.2
+++ svarray.m	17 Oct 2005 05:53:25 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
Index: svbag.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svbag.m,v
retrieving revision 1.2
diff -u -b -r1.2 svbag.m
--- svbag.m	16 Jun 2005 04:08:05 -0000	1.2
+++ svbag.m	17 Oct 2005 05:54:08 -0000
@@ -1,3 +1,5 @@
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
 %---------------------------------------------------------------------------%
 % Copyright (C) 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
@@ -87,9 +89,10 @@
 	%
 :- pred svbag__delete_all(T::in, bag(T)::in, bag(T)::out) is det.
 
-	% svbag__subtract(Bag0, SubBag, Bag)
-	% subtracts SubBag from Bag0 to produce Bag
-	% each element in SubBag is removed from Bag0 to produce Bag.
+    % svbag__subtract(Bag0, SubBag, Bag):
+    %
+    % Subtracts SubBag from Bag0 to produce Bag.
+    % Each element in SubBag is removed from Bag0 to produce Bag.
 	% If an element exists in SubBag, but not in Bag, then that
 	% element is not removed.
 	% e.g. svbag__subtract({1, 1, 2, 2, 3 }, {1, 1, 2, 3, 3, 3}, {2}).
Index: svbimap.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svbimap.m,v
retrieving revision 1.1
diff -u -b -r1.1 svbimap.m
--- svbimap.m	6 Jan 2005 05:08:15 -0000	1.1
+++ svbimap.m	17 Oct 2005 05:53:28 -0000
@@ -1,3 +1,5 @@
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
 %---------------------------------------------------------------------------%
 % Copyright (C) 2004 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
Index: sveqvclass.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/sveqvclass.m,v
retrieving revision 1.2
diff -u -b -r1.2 sveqvclass.m
--- sveqvclass.m	25 Jan 2005 02:21:27 -0000	1.2
+++ sveqvclass.m	17 Oct 2005 07:30:42 -0000
@@ -1,4 +1,6 @@
-%---------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
Index: svmap.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svmap.m,v
retrieving revision 1.3
diff -u -b -r1.3 svmap.m
--- svmap.m	16 Jun 2005 04:08:05 -0000	1.3
+++ svmap.m	17 Oct 2005 05:54:29 -0000
@@ -1,3 +1,5 @@
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
 %---------------------------------------------------------------------------%
 % Copyright (C) 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
Index: svmulti_map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svmulti_map.m,v
retrieving revision 1.1
diff -u -b -r1.1 svmulti_map.m
--- svmulti_map.m	24 Feb 2005 14:11:14 -0000	1.1
+++ svmulti_map.m	17 Oct 2005 05:53:34 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
Index: svqueue.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svqueue.m,v
retrieving revision 1.4
diff -u -b -r1.4 svqueue.m
--- svqueue.m	16 Jun 2005 04:08:05 -0000	1.4
+++ svqueue.m	17 Oct 2005 05:54:46 -0000
@@ -1,3 +1,5 @@
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
 %---------------------------------------------------------------------------%
 % Copyright (C) 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
@@ -89,4 +91,3 @@
 
 svqueue__get_from_back(Elem, Queue0, Queue) :-
 	queue__get_from_back(Queue0, Elem, Queue).
-
Index: svrelation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svrelation.m,v
retrieving revision 1.2
diff -u -b -r1.2 svrelation.m
--- svrelation.m	16 Jun 2005 04:08:05 -0000	1.2
+++ svrelation.m	17 Oct 2005 05:53:38 -0000
@@ -1,3 +1,5 @@
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
 %---------------------------------------------------------------------------%
 % Copyright (C) 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
Index: svset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/svset.m,v
retrieving revision 1.4
diff -u -b -r1.4 svset.m
--- svset.m	16 Jun 2005 04:08:05 -0000	1.4
+++ svset.m	17 Oct 2005 05:53:40 -0000
@@ -1,3 +1,5 @@
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
 %---------------------------------------------------------------------------%
 % Copyright (C) 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
Index: table_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/table_builtin.m,v
retrieving revision 1.48
diff -u -b -r1.48 table_builtin.m
--- table_builtin.m	22 Sep 2005 06:17:28 -0000	1.48
+++ table_builtin.m	17 Oct 2005 05:56:35 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1998-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
Index: term_size_prof_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/term_size_prof_builtin.m,v
retrieving revision 1.4
diff -u -b -r1.4 term_size_prof_builtin.m
--- term_size_prof_builtin.m	28 Apr 2005 07:56:56 -0000	1.4
+++ term_size_prof_builtin.m	17 Oct 2005 05:58:01 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 2003, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -22,11 +24,13 @@
 	% The cost of the operation is independent of the size of Term;
 	% if Term points to the heap, it looks up the size stored at the
 	% starts of the cell.
+    %
 :- pred measure_size(T::in, int::out) is det.
 
 	% measure_size_acc(Term, Size0, Size): similar to measure_size,
 	% but instead of returning just the size of term, it returns the
 	% size plus Size0.
+    %
 :- pred measure_size_acc(T::in, int::in, int::out) is det.
 
 	% increment_size(Term, Incr): Term must be a term on the heap
@@ -36,12 +40,14 @@
 	% by Incr, the sum of the sizes of the terms bound to those arguments.
 	% This is what increment_size does. It is impure because it updates
 	% Term destructively.
+    %
 :- impure pred increment_size(T::in, int::in) is det.
 
 	% This function is exactly like int__plus, and is also implemented
 	% as a builtin. It is duplicated in this module because only predicates
 	% and functions in builtin modules like this one are immune to dead
 	% procedure elimination.
+    %
 :- func term_size_plus(int, int) = int.
 
 	% We want to take measurements only of the top-level invocations of
@@ -49,7 +55,9 @@
 	% invocations. This type says whether we are already executing the
 	% relevant procedure. Its definition should be kept in sync with
 	% MR_ComplexityIsActive in runtime/mercury_term_size.h.
-:- type complexity_is_active ---> is_inactive ; is_active.
+:- type complexity_is_active
+    --->    is_inactive
+    ;       is_active.
 
 	% For each procedure in the complexity experiment, we can take
 	% measurements for many different top-level invocations. Values
Index: term_to_xml.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/term_to_xml.m,v
retrieving revision 1.8
diff -u -b -r1.8 term_to_xml.m
Index: time.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/time.m,v
retrieving revision 1.48
diff -u -b -r1.48 time.m
--- time.m	19 Jun 2005 17:52:25 -0000	1.48
+++ time.m	17 Oct 2005 06:08:27 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Originally written in 1999 by Tomas By <T.By at dcs.shef.ac.uk>
 % "Feel free to use this code or parts of it any way you want."
 %
@@ -32,8 +34,8 @@
 	% The `tms' type holds information about the amount of processor
 	% time that a process and its child processes have consumed.
 	%
-:- type tms --->
-	tms(
+:- type tms
+    --->    tms(
 		clock_t,	% tms_utime: user time
 		clock_t,	% tms_stime: system time
 		clock_t,	% tms_cutime: user time of children
@@ -51,8 +53,8 @@
 	% components are identical is equivalent to comparison of
 	% the times those `tm' values represent.
 	%
-:- type tm --->
-	tm(
+:- type tm
+    --->    tm(
 		tm_year	:: int,		% Year (number since 1900)
 		tm_mon	:: int,		% Month (number since January, 0-11)
 		tm_mday	:: int,		% MonthDay (1-31)
@@ -72,52 +74,50 @@
 	% Some of the procedures in this module throw this type
 	% as an exception if they can't obtain a result.
 	%
-:- type time_error --->
-	time_error(string).	% Error message
+:- type time_error
+    --->    time_error(string). % Error message
 
 %-----------------------------------------------------------------------------%
 
-	% time__clock(Result, IO_state, IO_state):
-	%	Returns the elapsed processor time (number of clock
-	%	ticks). The base time is arbitrary but doesn't change
-	%	within a single process.
-	%	If the time cannot be obtained, this procedure
-	%	will throw a time_error exception.
-	%	To obtain a time in seconds, divide Result by
-	%	`time__clocks_per_sec'.
+    % time__clock(Result, !IO):
+    %
+    % Returns the elapsed processor time (number of clock ticks). The base time
+    % is arbitrary but doesn't change within a single process. If the time
+    % cannot be obtained, this procedure will throw a time_error exception.
+    % To obtain a time in seconds, divide Result by `time__clocks_per_sec'.
 	%
 :- pred time__clock(clock_t::out, io::di, io::uo) is det.
 
 	% time__clocks_per_sec:
-	%	Returns the number of "clocks" per second as defined by
-	%	CLOCKS_PER_SEC.  A `clock_t' value returned by `time__clock' can
-	%	be divided by this value to obtain a time in seconds.
-	%	Note that the value of this function does not necessarily
-	%	reflect the actual clock precision; it just indicates the
+    %
+    % Returns the number of "clocks" per second as defined by CLOCKS_PER_SEC.
+    % A `clock_t' value returned by `time__clock' can be divided by this value
+    % to obtain a time in seconds. Note that the value of this function does
+    % not necessarily reflect the actual clock precision; it just indicates the
 	%	scaling factor for the results of time__clock.
 	%
 :- func time__clocks_per_sec = int.
 
 %-----------------------------------------------------------------------------%
 
-	% time__time(Result, IO_state, IO_state):
-	%	Returns the current (simple) calendar time.
-	%	If the time cannot be obtained, this procedure
-	%	will throw a time_error exception.
+    % time__time(Result, !IO):
+    %
+    % Returns the current (simple) calendar time. If the time cannot be
+    % obtained, this procedure will throw a time_error exception.
 	%
 :- pred time__time(time_t::out, io::di, io::uo) is det.
 
 %-----------------------------------------------------------------------------%
 
-	% time__times(ProcessorTime, ElapsedRealTime, IO_state, IO_state)
+    % time__times(ProcessorTime, ElapsedRealTime, !IO):
+    %
 	%	(POSIX)
-	%	Returns the processor time information in the `tms'
-	%	value, and the elapsed real time relative to an
-	%	arbitrary base in the `clock_t' value.
-	%	To obtain a time in seconds, divide the result by
-	%	`time__clk_tck'.
-	%	If the time cannot be obtained, this procedure
-	%	will throw a time_error exception.
+    %
+    % Returns the processor time information in the `tms' value, and the
+    % elapsed real time relative to an arbitrary base in the `clock_t' value.
+    % To obtain a time in seconds, divide the result by `time__clk_tck'.
+    % If the time cannot be obtained, this procedure will throw a time_error
+    % exception.
 	%
 	%	On non-POSIX systems that do not support this functionality,
 	%	this procedure may simply always throw an exception.
@@ -125,10 +125,10 @@
 :- pred time__times(tms::out, clock_t::out, io::di, io::uo) is det.
 
 	% time__clk_tck:
+    %
 	%	Returns the number of "clock ticks" per second as defined by
-	%	sysconf(_SC_CLK_TCK).  A `clock_t' value returned by
-	%	`time__times' can be divided by this value to obtain a time in
-	%	seconds.
+    % sysconf(_SC_CLK_TCK). A `clock_t' value returned by `time__times'
+    % can be divided by this value to obtain a time in seconds.
 	%
 	%	On non-POSIX systems that do not support this functionality,
 	%	this procedure may simply always throw an exception.
@@ -138,43 +138,46 @@
 %-----------------------------------------------------------------------------%
 
 	% time__difftime(Time1, Time0) = Diff:
-	%	Computes the number of seconds elapsed between
-	%	`Time1' and `Time0'.
+    %
+    % Computes the number of seconds elapsed between `Time1' and `Time0'.
 	%
 :- func time__difftime(time_t, time_t) = float.
 
 	% time__localtime(Time) = TM:
-	%	Converts the calendar time `Time' to a broken-down
-	%	representation, expressed relative to the user's
-	%	specified time zone.
+    %
+    % Converts the calendar time `Time' to a broken-down representation,
+    % expressed relative to the user's specified time zone.
 	%
 :- func time__localtime(time_t) = tm.
 
 	% time__gmtime(Time) = TM:
-	%	Converts the calendar time `Time' to a broken-down
-	%	representation, expressed as UTC (Universal Coordinated Time).
+    %
+    % Converts the calendar time `Time' to a broken-down representation,
+    % expressed as UTC (Universal Coordinated Time).
 	%
 :- func time__gmtime(time_t) = tm.
 
 	% time__mktime(TM) = Time:
+    %
 	%	Converts the broken-down local time value to calendar time.
-	%	It also normalises the value by filling in day of
-	%	week and day of year based on the other components.
+    % It also normalises the value by filling in day of week and day of year
+    % based on the other components.
 	%
 :- func time__mktime(tm) = time_t.
 
 %-----------------------------------------------------------------------------%
 
 	% time__asctime(TM) = String:
-	% 	Converts the broken-down time value `TM' to a string
-	% 	in a standard format.
+    %
+    % Converts the broken-down time value `TM' to a string in a standard
+    % format.
 	%
 :- func time__asctime(tm) = string.
 
 	% time__ctime(Time) = String:
-	% 	Converts the calendar time value `Time' to a string
-	% 	in a standard format.
-	%	(ie same as "asctime (localtime (<time>))")
+    %
+    % Converts the calendar time value `Time' to a string in a standard format
+    % (i.e. same as "asctime (localtime (<time>))").
 	%
 :- func time__ctime(time_t) = string.
 
@@ -238,9 +241,6 @@
 
 %-----------------------------------------------------------------------------%
 
-%:- pred time__clock(clock_t, io__state, io__state).
-%:- mode time__clock(out, di, uo) is det.
-
 time__clock(Result, !IO) :-
 	time__c_clock(Ret, !IO),
 	( Ret = -1 ->
@@ -515,7 +515,7 @@
 		Min::out, Sec::out, YD::out, WD::out, N::out),
 	[will_not_call_mercury, promise_pure],
 "{
-	struct tm* p;
+    struct tm   *p;
 	time_t t;
 
 	t = Time;
@@ -625,7 +625,7 @@
 		Min::out, Sec::out, YD::out, WD::out, N::out),
 	[will_not_call_mercury, promise_pure],
 "{
-	struct tm* p;
+    struct tm   *p;
 	time_t t;
 
 	t = Time;
@@ -808,6 +808,7 @@
 "
 /*
 ** getDSTSavings():
+**
 **	This method uses reflection to retrieve and call the getDSTSavings()
 **	method for a given TimeZone object.
 **
Index: tree234.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/tree234.m,v
retrieving revision 1.49
diff -u -b -r1.49 tree234.m
Index: unsafe.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/unsafe.m,v
retrieving revision 1.2
diff -u -b -r1.2 unsafe.m
--- unsafe.m	15 Dec 2004 06:57:41 -0000	1.2
+++ unsafe.m	17 Oct 2005 06:04:33 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1997, 2004 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -7,18 +9,16 @@
 % Author: fjh
 % Stability: low
 %-----------------------------------------------------------------------------%
-
-/*
-** WARNING: the procedures defined in this module are non-logical.
-**          They may have side effects, they may violate type safety,
-**	    they may interfere with certain memory management strategies,
-**	    and in general they may do lots of nasty things.
-**	    They may not work with future release of the Mercury compiler,
-**	    or with other Mercury implementations.
-**          Use only as a last resort, and only with great care!
-**
-** You have been warned.
-*/
+%
+% WARNING: the procedures defined in this module are non-logical.
+% They may have side effects, they may violate type safety,
+% they may interfere with certain memory management strategies,
+% and in general they may do lots of nasty things.
+% They may not work with future release of the Mercury compiler,
+% or with other Mercury implementations.
+% Use only as a last resort, and only with great care!
+%
+% You have been warned.
 
 %-----------------------------------------------------------------------------%
 
@@ -26,24 +26,22 @@
 :- interface.
 :- import_module io.
 
-/*
-** unsafe_perform_io/1 performs I/O, in an unsafe manner.
-** It can be used to call a goal that does I/O or has
-** side effects from a context where you do not have an io__state.
-** It can be useful for printf-style debugging.
-** But backtracking over a call to `unsafe_perform_io'
-** can be very dangerous indeed, because with certain
-** memory allocation policies it can result in dangling pointers.
-*/
+    % unsafe_perform_io/1 performs I/O, in an unsafe manner.
+    % It can be used to call a goal that does I/O or has
+    % side effects from a context where you do not have an io__state.
+    % It can be useful for printf-style debugging.
+    % But backtracking over a call to `unsafe_perform_io'
+    % can be very dangerous indeed, because with certain
+    % memory allocation policies it can result in dangling pointers.
+    %
 :- impure pred unsafe_perform_io(pred(io__state, io__state)).
 :- mode unsafe_perform_io(pred(di, uo) is det) is det.
 :- mode unsafe_perform_io(pred(di, uo) is cc_multi) is det.
 
-/*
-** The function unsafe_promise_ground/1 can be used to assert to the
-** compiler that a particular value of inst `any' is in fact ground.
-** The assertion is *not* checked.  If it is false, all hell may break out.
-*/
+    % The function unsafe_promise_ground/1 can be used to assert to the
+    % compiler that a particular value of inst `any' is in fact ground.
+    % The assertion is *not* checked.  If it is false, all hell may break out.
+    %
 :- func unsafe_promise_ground(T::in(any)) = (T::out) is det.
 
 %-----------------------------------------------------------------------------%
@@ -84,6 +82,7 @@
 :- pragma export(call_io_pred(pred(di, uo) is cc_multi, di, uo),
 		"call_io_pred_cc_multi").
 
-call_io_pred(P) --> P.
+call_io_pred(P, !IO) :-
+    P(!IO).
 
 %-----------------------------------------------------------------------------%
Index: varset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/varset.m,v
retrieving revision 1.74
diff -u -b -r1.74 varset.m
--- varset.m	16 Jun 2005 04:08:06 -0000	1.74
+++ varset.m	17 Oct 2005 06:06:03 -0000
@@ -1,4 +1,6 @@
 %---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
 % Copyright (C) 1993-2000,2002-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -242,6 +244,7 @@
 
 	% Returns the highest numbered variable returned from this varset's
 	% var_supply.
+    %
 :- func varset__max_var(varset(T)) = var(T).
 
 %-----------------------------------------------------------------------------%
@@ -257,7 +260,8 @@
 :- import_module set.
 :- import_module string.
 
-:- type varset(T)	--->	varset(
+:- type varset(T)
+    --->    varset(
 					var_supply	:: var_supply(T),
 					var_names	:: map(var(T), string),
 					var_values	:: map(var(T), term(T))
@@ -566,24 +570,18 @@
 %-----------------------------------------------------------------------------%
 
 varset__squash(OldVarSet, KeptVars, NewVarSet, Subst) :-
-	%
 	% Create a new varset with the same number of variables. 
-	%
 	list__length(KeptVars, NumVars),
 	varset__init(NewVarSet0),
 	varset__new_vars(NewVarSet0, NumVars, 
 		NewVars0, NewVarSet1),
-	%
-	% We need to sort the fresh variables, to
-	% ensure that the substitution that we create below
-	% does not alter the relative ordering of the variables
-	%
+
+    % We need to sort the fresh variables, to ensure that the substitution
+    % that we create below does not alter the relative ordering of the
+    % variables.
 	list__sort(NewVars0, NewVars),
 
-	%
-	% Copy the variable names across from the old
-	% varset to the new varset.
-	%
+    % Copy the variable names across from the old varset to the new varset.
 	varset__var_name_list(OldVarSet, VarNames),
 	map__from_corresponding_lists(KeptVars, NewVars, Subst),
 	copy_var_names(VarNames, Subst, NewVarSet1, NewVarSet).
@@ -603,9 +601,9 @@
 %-----------------------------------------------------------------------------%
 
 varset__coerce(A, B) :-
-	% Normally calls to this predicate should only be
-	% generated by the compiler, but type coercion by 
-	% copying was taking about 3% of the compiler's runtime.
+    % Normally calls to this predicate should only be generated by the
+    % compiler, but type coercion by copying was taking about 3% of the
+    % compiler's runtime.
 	private_builtin__unsafe_type_cast(A, B).
 
 %-----------------------------------------------------------------------------%
Index: version_hash_table.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/version_hash_table.m,v
retrieving revision 1.2
diff -u -b -r1.2 version_hash_table.m
--------------------------------------------------------------------------
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