[m-rev.] diff: convert deep profiler to 4-space indentation

Julien Fischer juliensf at cs.mu.OZ.AU
Tue Nov 8 19:11:54 AEDT 2005


Estimated hours taken: 1.5
Branches: main

Convert the rest of the deep profiler to four-space indentation.
There are no changes to any algorithms (other than introducing state
variables in a few spots).

Remove an old bug workaround.

deep_profiler/*.m:
	Convert to four-space indentation where that has not already
        been done.

	Fix some bad line breaks.

	Use state variables in a few places.

	Reposition comments according to our current coding standard.

deep_profiler/Mercury.options:
	Remove some old bug workarounds.

Julien.

Index: Mercury.options
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/Mercury.options,v
retrieving revision 1.7
diff -u -b -r1.7 Mercury.options
--- Mercury.options	17 Oct 2005 12:41:36 -0000	1.7
+++ Mercury.options	8 Nov 2005 08:04:38 -0000
@@ -25,16 +25,13 @@
 MCFLAGS-array_util =	--no-optimize-duplicate-calls
 MCFLAGS-callgraph = 	--no-optimize-duplicate-calls
 MCFLAGS-canonical =	--no-optimize-duplicate-calls
-# Compiling at -O0 is a due to an assertion failure in
-# rotd-2005-10-05.  It can be removed when that is fixed.
-# Also for exclude.m.
-MCFLAGS-cliques = 	--no-optimize-duplicate-calls -O0
+MCFLAGS-cliques = 	--no-optimize-duplicate-calls
 MCFLAGS-dense_bitset = 	--no-optimize-duplicate-calls
-MCFLAGS-exclude = 	--no-optimize-duplicate-calls -O0
-MCFLAGS-html_format = 	--no-optimize-duplicate-calls --no-optimize-unused-args
+MCFLAGS-exclude = 	--no-optimize-duplicate-calls
+MCFLAGS-html_format = 	--no-optimize-duplicate-calls
 MCFLAGS-measurements = 	--no-optimize-duplicate-calls
-MCFLAGS-profile = 	--no-optimize-duplicate-calls --no-optimize-unused-args
-MCFLAGS-query = 	--no-optimize-duplicate-calls --no-optimize-unused-args
+MCFLAGS-profile = 	--no-optimize-duplicate-calls
+MCFLAGS-query = 	--no-optimize-duplicate-calls
 MCFLAGS-read_profile = 	--no-optimize-duplicate-calls
-MCFLAGS-startup = 	--no-optimize-duplicate-calls --no-optimize-unused-args
+MCFLAGS-startup = 	--no-optimize-duplicate-calls
 MCFLAGS-top_procs = 	--no-optimize-duplicate-calls
Index: array_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/array_util.m,v
retrieving revision 1.7
diff -u -b -r1.7 array_util.m
--- array_util.m	23 Jun 2005 08:21:27 -0000	1.7
+++ array_util.m	8 Nov 2005 06:37:27 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -17,17 +19,16 @@

 %-----------------------------------------------------------------------------%

-	% Perform a mode cast on the given array, making the compiler believe
-	% that the ground array is unique. Should be used only if the only use
-	% of the old value is as input to the upcoming destructive operation
-	% that needs the array to be unique. Otherwise, calling this function
-	% is dangerous.
+    % Perform a mode cast on the given array, making the compiler believe that
+    % the ground array is unique. Should be used only if the only use of the
+    % old value is as input to the upcoming destructive operation that needs
+    % the array to be unique. Otherwise, calling this function is dangerous.
 	%
 :- func u(T) = T.
 :- mode (u(in) = array_uo) is det.

-	% Performs a foldl on all the elements of the given array,
-	% starting at index 1.
+    % Performs a foldl on all the elements of the given array, starting at
+    % index 1.
 	%
 :- pred array_foldl_from_1(pred(int, T, U, U), array(T), U, U).
 :- mode array_foldl_from_1(pred(in, in, di, uo) is det, in, di, uo) is det.
@@ -35,8 +36,8 @@
 	array_di, array_uo) is det.
 :- mode array_foldl_from_1(pred(in, in, in, out) is det, in, in, out) is det.

-	% Performs a foldl on all the elements of the given array,
-	% starting at index 0.
+    % Performs a foldl on all the elements of the given array, starting at
+    % index 0.
 	%
 :- pred array_foldl_from_0(pred(int, T, U, U), array(T), U, U).
 :- mode array_foldl_from_0(pred(in, in, di, uo) is det, in, di, uo) is det.
@@ -44,9 +45,8 @@
 	array_di, array_uo) is det.
 :- mode array_foldl_from_0(pred(in, in, in, out) is det, in, in, out) is det.

-	% Performs a foldl on all the elements of the given array
-	% between the two index values given by the first two arguments,
-	% both inclusive.
+    % Performs a foldl on all the elements of the given array between the two
+    % index values given by the first two arguments, both inclusive.
 	%
 :- pred array_foldl(int, int, pred(int, T, U, U), array(T), U, U).
 :- mode array_foldl(in, in, pred(in, in, di, uo) is det, in, di, uo) is det.
@@ -54,8 +54,8 @@
 	array_di, array_uo) is det.
 :- mode array_foldl(in, in, pred(in, in, in, out) is det, in, in, out) is det.

-	% Performs a foldl2 on all the elements of the given array,
-	% starting at index 1.
+    % Performs a foldl2 on all the elements of the given array, starting at
+    % index 1.
 	%
 :- pred array_foldl2_from_1(pred(int, T, U, U, V, V), array(T), U, U, V, V).
 :- mode array_foldl2_from_1(pred(in, in, di, uo, di, uo) is det,
@@ -70,9 +70,8 @@
 :- mode array_foldl2_from_1(pred(in, in, in, out, in, out) is det,
 	in, in, out, in, out) is det.

-	% Performs a foldl2 on all the elements of the given array
-	% between the two index values given by the first two arguments,
-	% both inclusive.
+    % Performs a foldl2 on all the elements of the given array between the two
+    % index values given by the first two arguments, both inclusive.
 	%
 :- pred array_foldl2(int, int, pred(int, T, U, U, V, V), array(T), U, U, V, V).
 :- mode array_foldl2(in, in, pred(in, in, di, uo, di, uo) is det, in,
@@ -88,30 +87,30 @@
 :- mode array_foldl2(in, in, pred(in, in, in, out, in, out) is det, in,
 	in, out, in, out) is det.

-	% Performs the same computation as list__foldl; the only difference
-	% is that the accumulator is an array and has an array mode.
+    % Performs the same computation as list__foldl; the only difference is
+    % that the accumulator is an array and has an array mode.
 	%
 :- pred array_list_foldl(pred(T, array(U), array(U)), list(T),
 	array(U), array(U)).
 :- mode array_list_foldl(pred(in, array_di, array_uo) is det, in,
 	array_di, array_uo) is det.

-	% Performs the same computation as list__foldl2; the only difference
-	% is that the accumulators are arrays and have array modes.
+    % Performs the same computation as list__foldl2; the only difference is
+    % that the accumulators are arrays and have array modes.
 	%
 :- pred array_list_foldl2(pred(T, array(U), array(U), array(V), array(V)),
 	list(T), array(U), array(U), array(V), array(V)).
 :- mode array_list_foldl2(pred(in, array_di, array_uo, array_di, array_uo)
 	is det, in, array_di, array_uo, array_di, array_uo) is det.

-	% Performs a map on all the elements of the given array,
-	% starting at index 0.
+    % Performs a map on all the elements of the given array, starting at index
+    % 0.
 	%
 :- pred array_map_from_0(pred(T, T), array(T), array(T)).
 :- mode array_map_from_0(pred(in, out) is det, array_di, array_uo) is det.

-	% Performs a map on all the elements of the given array,
-	% starting at index 1.
+    % Performs a map on all the elements of the given array, starting at index
+    % 1.
 	%
 :- pred array_map_from_1(pred(T, T), array(T), array(T)).
 :- mode array_map_from_1(pred(in, out) is det, array_di, array_uo) is det.
Index: callgraph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/callgraph.m,v
retrieving revision 1.6
diff -u -b -r1.6 callgraph.m
--- callgraph.m	23 Jun 2005 08:21:27 -0000	1.6
+++ callgraph.m	8 Nov 2005 06:39:29 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -51,11 +53,12 @@
 find_cliques(InitDeep, BottomUpPDPtrCliqueList) :-
 	make_graph(InitDeep, Graph),
 	topological_sort(Graph, TopDownPDICliqueList),
-		% Turn each of the sets of PDIs into a list of PDPtrs.
-		% We use foldl here because the list may be very long
-		% and map runs out of stack space, and we want the final list
-		% in reverse order anyway because the propagation algorithm
-		% works bottom up.
+    %
+    % Turn each of the sets of PDIs into a list of PDPtrs.  We use foldl here
+    % because the list may be very long and map runs out of stack space, and
+    % we want the final list in reverse order anyway because the propagation
+    % algorithm works bottom up.
+    %
 	list__foldl(accumulate_pdptr_lists, TopDownPDICliqueList,
 		[], BottomUpPDPtrCliqueList).

@@ -83,8 +86,8 @@

 make_graph(InitDeep, Graph) :-
 	init(Graph0),
-	array_foldl_from_1(add_pd_arcs(InitDeep),
-		InitDeep ^ init_proc_dynamics, Graph0, Graph).
+    array_foldl_from_1(add_pd_arcs(InitDeep), InitDeep ^ init_proc_dynamics,
+        Graph0, Graph).

 :- pred add_pd_arcs(initial_deep::in, int::in, proc_dynamic::in,
 	graph::in, graph::out) is det.
@@ -130,17 +133,18 @@
 make_clique_indexes(NPDs, CliqueList, Cliques, CliqueIndex) :-
 	Cliques = array(CliqueList),
 	array__init(NPDs, clique_ptr(-1), CliqueIndex0),
-		% For each clique, add entries to the CliqueIndex array,
-		% which maps every proc_dynamic_ptr back to the clique
-		% to which it belongs.
+    %
+    % For each clique, add entries to the CliqueIndex array, which maps every
+    % proc_dynamic_ptr back to the clique to which it belongs.
+    %
 	array_foldl_from_1(index_clique, Cliques, CliqueIndex0, CliqueIndex).

 :- pred index_clique(int::in, list(proc_dynamic_ptr)::in,
 	array(clique_ptr)::array_di, array(clique_ptr)::array_uo) is det.

 index_clique(CliqueNum, CliqueMembers, !CliqueIndex) :-
-	array_list_foldl(index_clique_member(CliqueNum),
-		CliqueMembers, !CliqueIndex).
+    array_list_foldl(index_clique_member(CliqueNum), CliqueMembers,
+        !CliqueIndex).

 :- pred index_clique_member(int::in, proc_dynamic_ptr::in,
 	array(clique_ptr)::array_di, array(clique_ptr)::array_uo) is det.
Index: canonical.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/canonical.m,v
retrieving revision 1.7
diff -u -b -r1.7 canonical.m
--- canonical.m	23 Jun 2005 08:21:27 -0000	1.7
+++ canonical.m	8 Nov 2005 07:58:14 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -35,6 +37,7 @@
 :- import_module require.
 :- import_module set.
 :- import_module std_util.
+:- import_module string.
 :- import_module svarray.
 :- import_module svmap.

@@ -93,12 +96,10 @@
 		map__values(ProcMap1, PDsList1),
 		list__filter(two_or_more, PDsList1, ToMergePDsList1),
 		( ToMergePDsList1 = [_ | _] ->
-			complete_clique(!.InitDeep, !.Redirect,
-				ProcMap1, ProcMap, Clique),
+            complete_clique(!.InitDeep, !.Redirect, ProcMap1, ProcMap, Clique),
 			map__values(ProcMap, PDsList),
 			list__filter(two_or_more, PDsList, ToMergePDsList),
-			list__foldl2(merge_proc_dynamics_ignore_chosen(
-				MergeInfo, Clique),
+            list__foldl2(merge_proc_dynamics_ignore_chosen(MergeInfo, Clique),
 				ToMergePDsList, !InitDeep, !Redirect)
 		;
 			true
@@ -115,7 +116,7 @@
 	% find set of proc_statics in the CliquePDs
 	% for all (first order) calls in CliquePDs, if call is to a procedure
 	%	that CliquePDs contains a call to, add its PD to the set
-
+    %
 :- pred complete_clique(initial_deep::in, redirect::in,
 	map(proc_static_ptr, list(proc_dynamic_ptr))::in,
 	map(proc_static_ptr, list(proc_dynamic_ptr))::out,
@@ -124,8 +125,7 @@
 complete_clique(InitDeep, Redirect, !ProcMap, Clique) :-
 	map__values(!.ProcMap, PDsList0),
 	list__foldl(insert_pds, PDsList0, set__init, Clique0),
-	complete_clique_pass(InitDeep, Redirect, Clique0, !ProcMap, no,
-		AddedPD),
+    complete_clique_pass(InitDeep, Redirect, Clique0, !ProcMap, no, AddedPD),
 	(
 		AddedPD = yes,
 		complete_clique(InitDeep, Redirect, !ProcMap, Clique)
@@ -191,8 +191,7 @@
 		list__filter(valid_call_site_dynamic_ptr_raw(
 			InitDeep ^ init_call_site_dynamics), CSDPtrs,
 			ValidCSDPtrs),
-		list__map(extract_csdptr_callee(InitDeep), ValidCSDPtrs,
-			CalleePDPtrs),
+        list__map(extract_csdptr_callee(InitDeep), ValidCSDPtrs, CalleePDPtrs),
 		CalleePDPtrSet = set__list_to_set(CalleePDPtrs),
 		set__intersect(CalleePDPtrSet, Clique, Common),
 		( set__empty(Common) ->
@@ -203,8 +202,8 @@
 				!:AddedPD = no
 			;
 				set__to_sorted_list(NewMembers, NewMemberList),
-				list__foldl(cluster_pds_by_ps(InitDeep),
-					NewMemberList, !ProcMap),
+                list__foldl(cluster_pds_by_ps(InitDeep), NewMemberList,
+                    !ProcMap),
 				!:AddedPD = yes
 			)
 		),
@@ -234,13 +233,11 @@
 	ProcDynamics0 = !.InitDeep ^ init_proc_dynamics,
 	list__filter(valid_proc_dynamic_ptr_raw(ProcDynamics0),
 		CandidatePDPtrs, ValidPDPtrs, InvalidPDPtrs),
-	require(unify(InvalidPDPtrs, []),
-		"merge_proc_dynamics: invalid pdptrs"),
+    require(unify(InvalidPDPtrs, []), "merge_proc_dynamics: invalid pdptrs"),
 	( ValidPDPtrs = [PrimePDPtr | RestPDPtrs] ->
 		record_pd_redirect(RestPDPtrs, PrimePDPtr, !Redirect),
 		lookup_proc_dynamics(ProcDynamics0, PrimePDPtr, PrimePD0),
-		list__map(lookup_proc_dynamics(ProcDynamics0),
-			RestPDPtrs, RestPDs),
+        list__map(lookup_proc_dynamics(ProcDynamics0), RestPDPtrs, RestPDs),
 		list__map(extract_pd_sites, RestPDs, RestSites),
 		PrimeSites0 = PrimePD0 ^ pd_sites,
 		array__max(PrimeSites0, MaxSiteNum),
@@ -249,14 +246,14 @@
 			!InitDeep, !Redirect),
 		PrimePD = PrimePD0 ^ pd_sites := PrimeSites,
 		ProcDynamics1 = !.InitDeep ^ init_proc_dynamics,
-		update_proc_dynamics(PrimePDPtr, PrimePD,
-			u(ProcDynamics1), ProcDynamics),
+        update_proc_dynamics(PrimePDPtr, PrimePD, u(ProcDynamics1),
+            ProcDynamics),
 		!:InitDeep = !.InitDeep ^ init_proc_dynamics := ProcDynamics,
 		ChosenPDPtr = PrimePDPtr
 	;
-		% This could happen when merging the callees of CSDs
-		% representing special calls, but only before we added callcode
-		% to the unify/compare routines of builtin types.
+        % This could happen when merging the callees of CSDs representing
+        % special calls, but only before we added callcode to the
+        % unify/compare routines of builtin types.
 		% ChosenPDPtr = proc_dynamic_ptr(0),
 		error("merge_proc_dynamics: no valid pdptrs")
 	).
@@ -378,13 +375,11 @@
 		ChosenCSDPtr = call_site_dynamic_ptr(0)
 	;
 		ValidCSDPtrs = [FirstCSDPtr | LaterCSDPtrs],
-		lookup_call_site_dynamics(CallSiteDynamics0, FirstCSDPtr,
-			FirstCSD0),
+        lookup_call_site_dynamics(CallSiteDynamics0, FirstCSDPtr, FirstCSD0),
 		FirstCSD = FirstCSD0 ^ csd_caller := ParentPDPtr,
 		update_call_site_dynamics(FirstCSDPtr, FirstCSD,
 			u(CallSiteDynamics0), CallSiteDynamics),
-		!:InitDeep = !.InitDeep ^ init_call_site_dynamics
-			:= CallSiteDynamics,
+        !:InitDeep = !.InitDeep ^ init_call_site_dynamics := CallSiteDynamics,
 		(
 			LaterCSDPtrs = []
 		;
@@ -412,11 +407,13 @@
 	% clique in the final configuration
 	( callee_in_clique(InitDeep0, Clique, PrimeCSDPtr) ->
 		require(unify(NotInClique, []),
-			"merge_proc_dynamic_normal_slot: prime in clique, others not in clique"),
+            "merge_proc_dynamic_normal_slot: prime in clique, " ++
+                "others not in clique"),
 		MergeChildren = no
 	;
 		require(unify(InClique, []),
-			"merge_proc_dynamic_normal_slot: prime not in clique, others in clique"),
+            "merge_proc_dynamic_normal_slot: prime not in clique, " ++
+                "others in clique"),
 		MergeChildren = yes
 	),
 	record_csd_redirect(RestCSDPtrs, PrimeCSDPtr, Redirect0, Redirect1),
@@ -439,16 +436,14 @@
 		merge_call_site_dynamics_descendants(MergeInfo,
 			PrimeCSDPtr, RestCSDPtrs, ChosenPDPtr,
 			InitDeep1, InitDeep2, Redirect1, Redirect),
-		% We must ensure that PrimeCSDPtr ^ csd_callee
-		% is updated to reflect the chosen merged ProcDynamic.
+        % We must ensure that PrimeCSDPtr ^ csd_callee is updated to reflect
+        % the chosen merged ProcDynamic.
 		CallSiteDynamics2 = InitDeep2 ^ init_call_site_dynamics,
-		lookup_call_site_dynamics(CallSiteDynamics2, PrimeCSDPtr,
-			PrimeCSD2),
+        lookup_call_site_dynamics(CallSiteDynamics2, PrimeCSDPtr, PrimeCSD2),
 		PrimeCSD = PrimeCSD2 ^ csd_callee := ChosenPDPtr,
 		update_call_site_dynamics(PrimeCSDPtr, PrimeCSD,
 			u(CallSiteDynamics2), CallSiteDynamics),
-		InitDeep = InitDeep2 ^ init_call_site_dynamics
-			:= CallSiteDynamics
+        InitDeep = InitDeep2 ^ init_call_site_dynamics := CallSiteDynamics
 	).

 :- pred merge_call_site_dynamics_descendants(merge_info::in,
@@ -461,8 +456,8 @@
 	CallSiteDynamics = !.InitDeep ^ init_call_site_dynamics,
 	lookup_call_site_dynamics(CallSiteDynamics, PrimeCSDPtr, PrimeCSD),
 	extract_csd_callee(PrimeCSD, PrimeCSDCallee),
-	list__map(lookup_call_site_dynamics(CallSiteDynamics),
-		RestCSDPtrs, RestCSDs),
+    list__map(lookup_call_site_dynamics(CallSiteDynamics), RestCSDPtrs,
+        RestCSDs),
 	list__map(extract_csd_callee, RestCSDs, RestCSDCallees),
 	PDPtrs = [PrimeCSDCallee | RestCSDCallees],
 	list__foldl(union_cliques(MergeInfo), PDPtrs, set__init, CliqueUnion),
@@ -474,14 +469,13 @@

 union_cliques(MergeInfo, PDPtr, !CliqueUnion) :-
 	( PDPtr = proc_dynamic_ptr(0) ->
-		% This can happen with calls to the unify/compare preds
-		% of builtin types.
+        % This can happen with calls to the unify/compare preds of builtin
+        % types.
 		true
 	;
-		lookup_clique_index(MergeInfo ^ merge_clique_index, PDPtr,
-			CliquePtr),
-		lookup_clique_members(MergeInfo ^ merge_clique_members,
-			CliquePtr, Members),
+        lookup_clique_index(MergeInfo ^ merge_clique_index, PDPtr, CliquePtr),
+        lookup_clique_members(MergeInfo ^ merge_clique_members, CliquePtr,
+            Members),
 		set__insert_list(!.CliqueUnion, Members, !:CliqueUnion)
 	).

@@ -619,8 +613,7 @@
 			PSPtr = proc_static_ptr(0)
 		),
 		( map__search(!.ProcMap, PSPtr, CSDPtrs0) ->
-			svmap.det_update(PSPtr, [CSDPtr | CSDPtrs0],
-				!ProcMap)
+            svmap.det_update(PSPtr, [CSDPtr | CSDPtrs0], !ProcMap)
 		;
 			svmap.det_insert(PSPtr, [CSDPtr], !ProcMap)
 		)
@@ -716,15 +709,14 @@
 	;
 		array__lookup(!.CSDredirect, CurOld, Redirect0),
 		( Redirect0 = call_site_dynamic_ptr(0) ->
-			svarray.set(CurOld, call_site_dynamic_ptr(CurNew),
-				!CSDredirect),
-			compact_csd_redirect(CurOld + 1, CurNew + 1,
-				MaxOld, NumNew, !CSDredirect)
-		;
-			% Since this CSD is being redirected, its slot is
-			% available for another (non-redirected) CSD.
-			compact_csd_redirect(CurOld + 1, CurNew,
-				MaxOld, NumNew, !CSDredirect)
+            svarray.set(CurOld, call_site_dynamic_ptr(CurNew), !CSDredirect),
+            compact_csd_redirect(CurOld + 1, CurNew + 1, MaxOld, NumNew,
+                !CSDredirect)
+        ;
+            % Since this CSD is being redirected, its slot is available for
+            % another (non-redirected) CSD.
+            compact_csd_redirect(CurOld + 1, CurNew, MaxOld, NumNew,
+                !CSDredirect)
 		)
 	).

@@ -738,15 +730,14 @@
 	;
 		array__lookup(!.PDredirect, CurOld, Redirect0),
 		( Redirect0 = proc_dynamic_ptr(0) ->
-			svarray.set(CurOld, proc_dynamic_ptr(CurNew),
-				!PDredirect),
-			compact_pd_redirect(CurOld + 1, CurNew + 1,
-				MaxOld, NumNew, !PDredirect)
+            svarray.set(CurOld, proc_dynamic_ptr(CurNew), !PDredirect),
+            compact_pd_redirect(CurOld + 1, CurNew + 1, MaxOld, NumNew,
+                !PDredirect)
 		;
 			% Since this PD is being redirected, its slot is
 			% available for another (non-redirected) PD.
-			compact_pd_redirect(CurOld + 1, CurNew,
-				MaxOld, NumNew, !PDredirect)
+            compact_pd_redirect(CurOld + 1, CurNew, MaxOld, NumNew,
+                !PDredirect)
 		)
 	).

@@ -784,16 +775,14 @@
 merge_profiles(InitDeeps, MaybeMergedInitDeep) :-
 	( InitDeeps = [FirstInitDeep | LaterInitDeeps] ->
 		( all_compatible(FirstInitDeep, LaterInitDeeps) ->
-			do_merge_profiles(FirstInitDeep, LaterInitDeeps,
-				MergedInitDeep),
+            do_merge_profiles(FirstInitDeep, LaterInitDeeps, MergedInitDeep),
 			MaybeMergedInitDeep = ok(MergedInitDeep)
 		;
 			MaybeMergedInitDeep =
 				error("profiles are not from the same executable")
 		)
 	;
-		MaybeMergedInitDeep =
-			error("merge_profiles: empty list of profiles")
+        MaybeMergedInitDeep = error("merge_profiles: empty list of profiles")
 	).

 :- pred all_compatible(initial_deep::in, list(initial_deep)::in) is semidet.
@@ -812,12 +801,10 @@
 	extract_init_proc_statics(BaseInitDeep, BaseProcStatics),
 	list__map(extract_init_call_site_statics, OtherInitDeeps,
 		OtherCallSiteStatics),
-	list__map(extract_init_proc_statics, OtherInitDeeps,
-		OtherProcStatics),
+    list__map(extract_init_proc_statics, OtherInitDeeps, OtherProcStatics),
 	array_match_elements(1, BaseMaxCSS, BaseCallSiteStatics,
 		OtherCallSiteStatics),
-	array_match_elements(1, BaseMaxPS, BaseProcStatics,
-		OtherProcStatics).
+    array_match_elements(1, BaseMaxPS, BaseProcStatics, OtherProcStatics).

 :- pred do_merge_profiles(initial_deep::in, list(initial_deep)::in,
 	initial_deep::out) is det.
@@ -869,8 +856,7 @@
 		!ConcatCallSiteDynamics, !ConcatProcDynamics).
 concatenate_profiles([InitDeep | InitDeeps], PrevMaxCSD, PrevMaxPD,
 		!ConcatCallSiteDynamics, !ConcatProcDynamics) :-
-	concatenate_profile(InitDeep,
-		PrevMaxCSD, PrevMaxPD, NextMaxCSD, NextMaxPD,
+    concatenate_profile(InitDeep, PrevMaxCSD, PrevMaxPD, NextMaxCSD, NextMaxPD,
 		!ConcatCallSiteDynamics, !ConcatProcDynamics),
 	concatenate_profiles(InitDeeps, NextMaxCSD, NextMaxPD,
 		!ConcatCallSiteDynamics, !ConcatProcDynamics).
@@ -911,8 +897,8 @@
 	).

 :- pred concatenate_profile_pds(int::in, int::in, int::in, int::in,
-	proc_dynamics::in,
-	proc_dynamics::array_di, proc_dynamics::array_uo) is det.
+    proc_dynamics::in, proc_dynamics::array_di, proc_dynamics::array_uo)
+    is det.

 concatenate_profile_pds(Cur, Max, PrevMaxCSD, PrevMaxPD, ProcDynamics,
 		!ConcatProcDynamics) :-
@@ -939,8 +925,7 @@
 		array__lookup(!.Sites, Cur, Slot0),
 		(
 			Slot0 = normal(CSDPtr0),
-			concat_call_site_dynamic_ptr(PrevMaxCSD,
-				CSDPtr0, CSDPtr),
+            concat_call_site_dynamic_ptr(PrevMaxCSD, CSDPtr0, CSDPtr),
 			Slot = normal(CSDPtr)
 		;
 			Slot0 = multi(IsZeroed, CSDPtrs0),
Index: cliques.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/cliques.m,v
retrieving revision 1.5
diff -u -b -r1.5 cliques.m
--- cliques.m	24 Mar 2005 01:10:27 -0000	1.5
+++ cliques.m	8 Nov 2005 07:58:36 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -9,6 +11,7 @@
 % This module allows you build a description of a directed graph (represented
 % as a set of arcs between nodes identified by dense small integers) and then
 % find the strongly connected components (cliques) of that graph.
+%-----------------------------------------------------------------------------%

 :- module cliques.

@@ -19,20 +22,27 @@
 :- import_module list.
 :- import_module set.

+%-----------------------------------------------------------------------------%
+
 	% Create a graph with no edges.
+    %
 :- pred init(graph::out) is det.

 	% Add an arc from one node to another.
+    %
 :- pred add_arc(graph::in, int::in, int::in, graph::out) is det.

 	% Perform a topological sort on the graph. Each set of integers in the
-	% resulting list gives the ids of the nodes in a clique. The list
-	% contains the cliques in top-down order: if there is an arc from
-	% node A to node B and the two nodes are not in the same clique,
-	% then the clique containing node A will be before the clique
-	% containing node B.
+    % resulting list gives the ids of the nodes in a clique. The list contains
+    % the cliques in top-down order: if there is an arc from node A to node B
+    % and the two nodes are not in the same clique, then the clique containing
+    % node A will be before the clique containing node B.
+    %
 :- pred topological_sort(graph::in, list(set(int))::out) is det.

+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+
 :- implementation.

 :- import_module array_util.
@@ -45,6 +55,8 @@
 % :- import_module string.
 % :- import_module unsafe.

+%-----------------------------------------------------------------------------%
+
 :- type graph
 	--->	graph(
 			int,
@@ -53,6 +65,8 @@

 :- type visit == dense_bitset.

+%-----------------------------------------------------------------------------%
+
 init(graph(1, Array)) :-
 	% The initial array size doesn't really matter.
 	array__init(16, set__init, Array).
@@ -156,10 +170,11 @@
 	),
 	tsort(Nodes, InvGraph, Visit1, TSort1, TSort).

-% Return a list containing all the nodes of the graph. The list is effectively
-% computed by randomly breaking all cycles, doing a pre-order traversal of
-% the resulting trees, and concatenating the resulting lists in a random order.
-
+    % Return a list containing all the nodes of the graph. The list is
+    % effectively computed by randomly breaking all cycles, doing a pre-order
+    % traversal of the resulting trees, and concatenating the resulting lists
+    % in a random order.
+    %
 :- pred dfs_graph(graph::in, list(int)::out) is det.

 dfs_graph(Graph, Dfs) :-
@@ -176,13 +191,14 @@
 	dfs([Node], Graph, Visit0, Dfs0, Visit, Dfs1),
 	dfs_graph_2(Nodes, Graph, Visit, Dfs1, Dfs).

-% dfs(NodeList, Graph, Visit0, Dfs0, Visit, Dfs):
-% For every node in NodeList, add the node and all its successors to the front
-% of Dfs0, giving Dfs. The descendants of a node will in general be after that
-% node in Dfs. The only situation where that may not be the case is when two
-% nodes are descendants of each other. We detect such situations by passing
-% along the set of nodes that have been visited already.
-
+    % dfs(NodeList, Graph, Visit0, Dfs0, Visit, Dfs):
+    % For every node in NodeList, add the node and all its successors to the
+    % front of Dfs0, giving Dfs. The descendants of a node will in general be
+    % after that node in Dfs. The only situation where that may not be the
+    % case is when two nodes are descendants of each other. We detect such
+    % situations by passing along the set of nodes that have been visited
+    % already.
+    %
 :- pred dfs(list(int)::in, graph::in, visit::array_di, list(int)::in,
 	visit::array_uo, list(int)::out) is det.

@@ -279,3 +295,7 @@
 %
 % write_clique(Nodes, !IO) :-
 % 	io__write_list(Nodes, "\n", io__write_int, !IO).
+%
+%----------------------------------------------------------------------------%
+:- end_module cliques.
+%----------------------------------------------------------------------------%
Index: conf.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/conf.m,v
retrieving revision 1.6
diff -u -b -r1.6 conf.m
--- conf.m	23 Jun 2005 08:21:28 -0000	1.6
+++ conf.m	8 Nov 2005 07:58:45 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -16,8 +18,10 @@

 :- import_module io.

-	% Given a pathname, return a shell command that will create
-	% a named pipe with that pathname.
+%-----------------------------------------------------------------------------%
+
+    % Given a pathname, return a shell command that will create a named pipe
+    % with that pathname.
 	%
 :- func make_pipe_cmd(string) = string.

Index: dense_bitset.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/dense_bitset.m,v
retrieving revision 1.3
diff -u -b -r1.3 dense_bitset.m
--- dense_bitset.m	24 Mar 2005 01:10:27 -0000	1.3
+++ dense_bitset.m	8 Nov 2005 07:58:55 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001, 2003, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -11,6 +13,8 @@
 % of integers.
 %
 % We should think about replacing this module with library/bitmap.m.
+%
+%-----------------------------------------------------------------------------%

 :- module dense_bitset.

@@ -19,6 +23,8 @@
 :- import_module array.
 :- import_module int.

+%-----------------------------------------------------------------------------%
+
 % XXX should be abstract type; it is exported only as a workaround.
 :- type dense_bitset == array(int).

@@ -51,11 +57,16 @@
 :- mode foldl(pred(in, array_di, array_uo) is det, array_ui,
 		array_di, array_uo) is det.

+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+
 :- implementation.

 :- import_module list.
 :- import_module require.

+%-----------------------------------------------------------------------------%
+
 init = array([0]).

 member(I, A) :-
@@ -97,9 +108,9 @@
 		C1 = insert(C0, I)
 	), A, B, C).

-foldl(P, A0, Acc0, Acc) :-
+foldl(P, A0, !Acc) :-
 	max(A0, Max),
-	foldl1(0, Max, P, A0, Acc0, Acc).
+    foldl1(0, Max, P, A0, !Acc).

 :- pred foldl1(int, int, pred(int, T, T), dense_bitset, T, T).
 :- mode foldl1(in, in, pred(in, in, out) is det, array_ui, in, out) is det.
@@ -107,12 +118,12 @@
 :- mode foldl1(in, in, pred(in, array_di, array_uo) is det, array_ui,
 		array_di, array_uo) is det.

-foldl1(Min, Max, P, A0, Acc0, Acc) :-
+foldl1(Min, Max, P, A0, !Acc) :-
 	( Min =< Max ->
-		foldl2(0, Min, P, A0, Acc0, Acc1),
-		foldl1(Min + 1, Max, P, A0, Acc1, Acc)
+        foldl2(0, Min, P, A0, !Acc),
+        foldl1(Min + 1, Max, P, A0, !Acc)
 	;
-		Acc = Acc0
+        true
 	).

 :- pred foldl2(int, int, pred(int, T, T), dense_bitset, T, T).
@@ -121,22 +132,28 @@
 :- mode foldl2(in, in, pred(in, array_di, array_uo) is det, array_ui,
 		array_di, array_uo) is det.

-foldl2(B, W, P, A0, Acc0, Acc) :-
+foldl2(B, W, P, A0, !Acc) :-
 	( B =< 31 ->
 		lookup(A0, W, Word),
 		( (1 << B) /\ Word \= 0 ->
 			I = B + W * 32,
-			call(P, I, Acc0, Acc1)
+            P(I, !Acc)
 		;
-			Acc1 = Acc0
+            true
 		),
-		foldl2(B + 1, W, P, A0, Acc1, Acc)
+        foldl2(B + 1, W, P, A0, !Acc)
 	;
-		Acc = Acc0
+        true
 	).

 :- func word(int) = int.
+
 word(I) = I // 32.

 :- func bit(int) = int.
+
 bit(I) = (1 << (I /\ 31)).
+
+%-----------------------------------------------------------------------------%
+:- end_module dense_bitset.
+%-----------------------------------------------------------------------------%
Index: dump.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/dump.m,v
retrieving revision 1.2
diff -u -b -r1.2 dump.m
--- dump.m	8 Jun 2005 12:58:35 -0000	1.2
+++ dump.m	8 Nov 2005 06:48:29 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -22,13 +24,12 @@

 	% dump_initial_deep(ProfStats, Restrict, DumpCSDs, DumpPDs,
 	%	DumpCSSs, DumpPSs, InitialDeep, !IO):
-	% Dump selected parts of InitialDeep to standard output. The array
-	% of call site dynamics, proc dynamics, call site statics and proc
-	% statics is dumped if the corresponding Dump bool is "yes". If
-	% Restrict is "yes", then the only the elements of the static arrays
-	% that will be dumped are the ones that are referred to from the
-	% dynamic arrays. The statistics and the root node are dumped if
-	% ProfStats is "yes".
+    % Dump selected parts of InitialDeep to standard output. The array of call
+    % site dynamics, proc dynamics, call site statics and proc statics is
+    % dumped if the corresponding Dump bool is "yes". If Restrict is "yes",
+    % then the only the elements of the static arrays that will be dumped are
+    % the ones that are referred to from the dynamic arrays. The statistics
+    % and the root node are dumped if ProfStats is "yes".
 	%
 :- pred dump_initial_deep(bool::in, bool::in, bool::in, bool::in, bool::in,
 	bool::in, initial_deep::in, io::di, io::uo) is det.
@@ -55,8 +56,7 @@
 	InitialDeep = initial_deep(Stats, InitRoot, CSDs, PDs, CSSs, PSs),
 	(
 		Restrict = yes,
-		get_static_ptrs_from_dynamic_procs(PDs, PSs,
-			UsedPSs, UsedCSSs),
+        get_static_ptrs_from_dynamic_procs(PDs, PSs, UsedPSs, UsedCSSs),
 		Restriction = these(UsedPSs, UsedCSSs)
 	;
 		Restrict = no,
@@ -106,7 +106,8 @@
 :- pred get_static_ptrs_from_dynamic_procs(proc_dynamics::in, proc_statics::in,
 	set(proc_static_ptr)::out, set(call_site_static_ptr)::out) is det.

-get_static_ptrs_from_dynamic_procs(ProcDynamics, ProcStatics, PS_Ptrs, CSS_Ptrs) :-
+get_static_ptrs_from_dynamic_procs(ProcDynamics, ProcStatics, PS_Ptrs,
+        CSS_Ptrs) :-
 	array_foldl2_from_1(get_static_ptrs_from_dynamic_proc(ProcStatics),
 		ProcDynamics, set.init, PS_Ptrs, set.init, CSS_Ptrs).

@@ -114,7 +115,8 @@
 	proc_dynamic::in, set(proc_static_ptr)::in, set(proc_static_ptr)::out,
 	set(call_site_static_ptr)::in, set(call_site_static_ptr)::out) is det.

-get_static_ptrs_from_dynamic_proc(ProcStatics, _, ProcDynamic, !PS_Ptrs, !CSS_Ptrs) :-
+get_static_ptrs_from_dynamic_proc(ProcStatics, _, ProcDynamic, !PS_Ptrs,
+        !CSS_Ptrs) :-
 	ProcDynamic = proc_dynamic(ProcStaticPtr, _PDSites),
 	svset.insert(ProcStaticPtr, !PS_Ptrs),
 	lookup_proc_statics(ProcStatics, ProcStaticPtr, ProcStatic),
@@ -294,8 +296,7 @@
 			Kind, LineNum, GoalPath),
 		ContainerPSPtr = proc_static_ptr(ContainerPSI),
 		io.format("css%d:\n", [i(Index)], !IO),
-		io.format("\tcss_container\t= ps%d\n", [i(ContainerPSI)],
-			!IO),
+        io.format("\tcss_container\t= ps%d\n", [i(ContainerPSI)], !IO),
 		io.format("\tcss_slot_num\t= <%d>\n", [i(SlotNum)], !IO),
 		io.format("\tcss_line_num\t= <%d>\n", [i(LineNum)], !IO),
 		io.format("\tcss_goal_path\t= <%s>\n", [s(GoalPath)], !IO),
Index: exclude.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/exclude.m,v
retrieving revision 1.5
diff -u -b -r1.5 exclude.m
--- exclude.m	23 Jun 2005 08:21:28 -0000	1.5
+++ exclude.m	8 Nov 2005 08:01:40 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -35,6 +37,8 @@
 % following the ancestors of the supplied call_site_dynamic_ptr until it
 % arrives at a procedure which is not excluded.

+%-----------------------------------------------------------------------------%
+
 :- module exclude.

 :- interface.
@@ -86,6 +90,7 @@
 					% which are exported from the
 					% module.

+%-----------------------------------------------------------------------------%

 read_exclude_file(FileName, Deep, Res, !IO) :-
 	io__open_input(FileName, Res0, !IO),
@@ -132,8 +137,7 @@
 		->
 			Spec = exclude_spec(ModuleName, ExclType),
 			RevSpecs1 = [Spec | RevSpecs0],
-			read_exclude_lines(FileName, InputStream, RevSpecs1,
-				Res, !IO)
+            read_exclude_lines(FileName, InputStream, RevSpecs1, Res, !IO)
 		;
 			Msg = string__format(
 				"file %s contains badly formatted line: %s",
@@ -153,16 +157,14 @@
 	maybe_error(set(exclude_spec))::out) is det.

 validate_exclude_lines(FileName, Specs, Deep, Res) :-
-	list__filter(has_valid_module_name(Deep), Specs,
-		ValidSpecs, InvalidSpecs),
+    list__filter(has_valid_module_name(Deep), Specs, ValidSpecs, InvalidSpecs),
 	(
 		InvalidSpecs = [],
 		set__list_to_set(ValidSpecs, ModuleSpecSet),
 		Res = ok(ModuleSpecSet)
 	;
 		InvalidSpecs = [_ | _],
-		InvalidModuleNames = list__map(spec_to_module_name,
-			InvalidSpecs),
+        InvalidModuleNames = list__map(spec_to_module_name, InvalidSpecs),
 		BadNames = string__join_list(", ", InvalidModuleNames),
 		Msg = string__format("file %s contains bad module names: %s",
 			[s(FileName), s(BadNames)]),
@@ -199,10 +201,8 @@
 			)
 		->
 			deep_lookup_clique_index(Deep, PDPtr, CliquePtr),
-			deep_lookup_clique_parents(Deep, CliquePtr,
-				EntryCSDPtr),
-			CSDPtr = apply_contour_exclusion(Deep, ExcludedSpecs,
-				EntryCSDPtr)
+            deep_lookup_clique_parents(Deep, CliquePtr, EntryCSDPtr),
+            CSDPtr = apply_contour_exclusion(Deep, ExcludedSpecs, EntryCSDPtr)
 		;
 			CSDPtr = CSDPtr0
 		)
Index: html_format.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/html_format.m,v
retrieving revision 1.10
diff -u -b -r1.10 html_format.m
--- html_format.m	24 Aug 2005 07:04:56 -0000	1.10
+++ html_format.m	8 Nov 2005 08:02:06 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -8,6 +10,7 @@
 %
 % This module contains code that sets the format of the HTML tables
 % we generate for individual queries.
+%
 %-----------------------------------------------------------------------------%

 :- module html_format.
@@ -74,13 +77,15 @@
 :- type two_id_line_group	== line_group(two_id, two_id_sub_lines).
 :- type one_two_id_line_group	== line_group(one_id, two_id_sub_lines).

-	% This function takes a context description (which may be empty)
-	% and a HTML string describing all fields in a row but the first,
-	% and returns the HTML for the full row.
+    % This function takes a context description (which may be empty) and a
+    % HTML string describing all fields in a row but the first, and returns
+    % the HTML for the full row.
+    %
 :- func add_context(string, line_group(one_id, LL)) = line_group(two_id, LL).

-	% This adds the context from the line group to the HTML as the first
-	% field of the resulting line group.
+    % This adds the context from the line group to the HTML as the first field
+    % of the resulting line group.
+    %
 :- func add_self_context(line_group(one_id, LL)) = line_group(two_id, LL).

 :- func add_ranks(list(line_group(one_id, LL))) = list(line_group(two_id, LL)).
@@ -125,8 +130,8 @@

 :- func plural(int) = string.

-	% Convert any special characters in a string into appropriate
-	% HTML escapes.
+    % Convert any special characters in a string into appropriate HTML
+    % escapes.
 	%
 :- func escape_html_string(string) = string.

@@ -219,9 +224,11 @@
 	).

 :- func even_background = string.
-:- func odd_background = string.

 even_background = "rgb(255, 255, 240)".
+
+:- func odd_background = string.
+
 odd_background =  "rgb(240, 240, 255)".

 %-----------------------------------------------------------------------------%
@@ -731,8 +738,7 @@

 %-----------------------------------------------------------------------------%

-:- type update_criteria_func ==
-	(func(order_criteria) = string).
+:- type update_criteria_func == (func(order_criteria) = string).

 :- type update_cost_criteria_func ==
 	(func(cost_kind, include_descendants, measurement_scope) = string).
@@ -745,15 +751,15 @@
 		Criteria = by_context,
 		Criteria1 = by_name,
 		Msg1 = "Sort by name",
-		Criteria2 = by_cost(default_cost_kind,
-			default_incl_desc, default_scope),
+        Criteria2 =
+            by_cost(default_cost_kind, default_incl_desc, default_scope),
 		Msg2 = "Sort by cost"
 	;
 		Criteria = by_name,
 		Criteria1 = by_context,
 		Msg1 = "Sort by context",
-		Criteria2 = by_cost(default_cost_kind,
-			default_incl_desc, default_scope),
+        Criteria2 =
+            by_cost(default_cost_kind, default_incl_desc, default_scope),
 		Msg2 = "Sort by cost"
 	;
 		Criteria = by_cost(_, _, _),
@@ -772,9 +778,7 @@
 	;
 		ToggleRest = ""
 	),
-	HTML =
-		"Toggle ordering criteria:\n" ++
-		Toggle1 ++ Toggle2 ++ ToggleRest.
+    HTML = "Toggle ordering criteria:\n" ++ Toggle1 ++ Toggle2 ++ ToggleRest.

 :- func toggle_cost_criteria(cost_kind, include_descendants, measurement_scope,
 	update_cost_criteria_func) = string.
@@ -947,10 +951,10 @@

 %-----------------------------------------------------------------------------%

-% The predicates fields_header, table_width and own_and_desc_to_html
-% all make decisions about what columns each row in the table will have.
-% They therefore have similar control structures, and a change in one
-% may require changes in the others as well.
+% The predicates fields_header, table_width and own_and_desc_to_html all make
+% decisions about what columns each row in the table will have.  They
+% therefore have similar control structures, and a change in one may require
+% changes in the others as well.

 fields_header(Pref, IdFields, TotalsDisp, WrapFunc) = HTML :-
 	Fields = Pref ^ pref_fields,
@@ -1343,20 +1347,19 @@
 %-----------------------------------------------------------------------------%

 add_context(Context, LineGroup0) = LineGroup :-
-	LineGroup0 = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML0, LaterLines),
-	HTML = string__format("<TD CLASS=id>%s</TD>%s",
-		[s(Context), s(HTML0)]),
-	LineGroup = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML, LaterLines).
+    LineGroup0 =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML0, LaterLines),
+    HTML = string__format("<TD CLASS=id>%s</TD>%s", [s(Context), s(HTML0)]),
+    LineGroup =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML, LaterLines).

 add_self_context(LineGroup0) = LineGroup :-
-	LineGroup0 = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML0, LaterLines),
+    LineGroup0 =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML0, LaterLines),
 	HTML = string__format("<TD CLASS=id>%s:%d</TD>%s",
 		[s(FileName), i(LineNumber), s(HTML0)]),
-	LineGroup = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML, LaterLines).
+    LineGroup =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML, LaterLines).

 add_ranks(LineGroups0) = add_ranks_2(1, LineGroups0).

@@ -1365,19 +1368,19 @@

 add_ranks_2(_Rank, []) = [].
 add_ranks_2(Rank, [LineGroup0 | LineGroups0]) = [LineGroup | LineGroups] :-
-	LineGroup0 = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML0, LaterLines),
-	HTML = string__format("<TD CLASS=id>%d</TD>%s",
-		[i(Rank), s(HTML0)]),
-	LineGroup = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML, LaterLines),
+    LineGroup0 =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML0, LaterLines),
+    HTML = string__format("<TD CLASS=id>%d</TD>%s", [i(Rank), s(HTML0)]),
+    LineGroup =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML, LaterLines),
 	LineGroups = add_ranks_2(Rank + 1, LineGroups0).

 line_to_one_id_subline_group(LineGroup0) = LineGroup :-
-	LineGroup0 = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML, unit),
-	LineGroup = line_group(FileName, LineNumber, Name, Own, Desc,
-		HTML, sub_lines(one_id, [])).
+    LineGroup0 =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML, unit),
+    LineGroup =
+        line_group(FileName, LineNumber, Name, Own, Desc, HTML,
+            sub_lines(one_id, [])).

 line_to_two_id_subline_group(LineGroup0) = LineGroup :-
 	LineGroup0 = line_group(FileName, LineNumber, Name, Own, Desc,
@@ -1762,8 +1765,9 @@
 		Assumed = no
 	).

-	% The number of ticks per sec to assume if the profiling data file
-	% does not record the actual tick rate.
+    % The number of ticks per sec to assume if the profiling data file does
+    % not record the actual tick rate.
+    %
 :- func default_ticks_per_sec = int.

 default_ticks_per_sec = 100.
@@ -1975,8 +1979,7 @@
 special_html_char('<', "<").
 special_html_char('>', ">").

-:- pred insert(list(T), list(T), list(T)).
-:- mode insert(in, out, in) is det.
+:- pred insert(list(T)::in, list(T)::out, list(T)::in) is det.

 insert(NewChars, Chars, Chars0) :-
 	list__append(NewChars, Chars0, Chars).
Index: interface.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/interface.m,v
retrieving revision 1.10
diff -u -b -r1.10 interface.m
--- interface.m	24 Aug 2005 07:04:57 -0000	1.10
+++ interface.m	8 Nov 2005 08:03:40 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -39,6 +41,8 @@
 % the same time. This is essential, because we have no other mechanism to
 % ensure that the URLs we embed in the HTML pages we generate will be
 % recognized and correctly parsed by the CGI program.
+%
+%-----------------------------------------------------------------------------%

 :- module interface.

@@ -49,6 +53,8 @@
 :- import_module io.
 :- import_module std_util.

+%-----------------------------------------------------------------------------%
+
 	% These functions derive the names of auxiliary files (or parts
 	% thereof) from the name of the profiling data file being explored.
 	% The auxiliary files are:
@@ -65,7 +71,7 @@
 	% - the names of the files containing the web page responses;
 	% - the name of the file containing contour exclusion information
 	%   (see exclude.m).
-
+    %
 :- func to_server_pipe_name(string) = string.
 :- func from_server_pipe_name(string) = string.
 :- func server_startup_name(string) = string.
@@ -80,29 +86,31 @@
 	%	Write the term Term to ToFileName, making it is new contents.
 	%	If Debug is `yes', write it to the file `/tmp/.send_term'
 	%	as well.
-:- pred send_term(string::in, bool::in, T::in,
-	io::di, io::uo) is det.
+    %
+:- pred send_term(string::in, bool::in, T::in, io::di, io::uo) is det.

 	% send_string(ToFileName, Debug, Str):
 	%	Write the string Str to ToFileName, making it is new contents.
 	%	If Debug is `yes', write it to the file `/tmp/.send_string'
 	%	as well.
-:- pred send_string(string::in, bool::in, string::in,
-	io::di, io::uo) is det.
+    %
+:- pred send_string(string::in, bool::in, string::in, io::di, io::uo) is det.

 	% recv_term(FromFileName, Debug, Term):
 	%	Read the contents of FromFileName, which should be a single
 	%	Mercury term. If Debug is `yes', write the result of the read
 	%	to the file `/tmp/.recv_term' as well.
-:- pred recv_term(string::in, bool::in, T::out,
-	io::di, io::uo) is det.
+    %
+:- pred recv_term(string::in, bool::in, T::out, io::di, io::uo) is det.

 	% recv_string(FromFileName, Debug, Str):
 	%	Read the contents of FromFileName, and return it as Str.
 	%	If Debug is `yes', write the result of the read to the file
 	%	`/tmp/.recv_string' as well.
-:- pred recv_string(string::in, bool::in, string::out,
-	io::di, io::uo) is det.
+    %
+:- pred recv_string(string::in, bool::in, string::out, io::di, io::uo) is det.
+
+%-----------------------------------------------------------------------------%

 :- type resp
 	--->	html(string).
@@ -121,10 +129,11 @@
 	;	proc_callers(int, caller_groups, int)
 	;	modules
 	;	module(string)
-	;	top_procs(display_limit,
-			cost_kind, include_descendants, measurement_scope)
-
-		% The commands below are for debugging.
+    ;       top_procs(display_limit, cost_kind, include_descendants,
+                measurement_scope)
+    %
+    % The following commands are for debugging.
+    %
 	;	proc_static(int)
 	;	proc_dynamic(int)
 	;	call_site_static(int)
@@ -149,11 +158,14 @@
 	;	self_and_desc.

 :- type display_limit
-	--->	rank_range(int, int)	% rank_range(M, N): display procedures
+    --->    rank_range(int, int)
+                    % rank_range(M, N): display procedures
 					% with rank M to N, both inclusive.
-	;	threshold(float).	% threshold(Percent): display
+
+    ;       threshold(float).
+                    % threshold(Percent): display
 					% procedures whose cost is at least
-					% Fraction% of the whole program's
+                    % Fraction of the whole program's
 					% cost.

 :- type preferences
@@ -259,6 +271,8 @@
 		inactive_modules :: inactive_status
 	).

+%-----------------------------------------------------------------------------%
+
 :- func default_preferences = preferences.

 :- func default_fields = fields.
@@ -283,18 +297,20 @@
 :- func url_component_to_maybe_pref(string) = maybe(preferences).

 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

 :- implementation.

 :- import_module conf.
 :- import_module util.

-:- import_module char.
 :- import_module list.
 :- import_module require.
 :- import_module set.
 :- import_module string.

+%-----------------------------------------------------------------------------%
+
 default_preferences =
 	preferences(
 		default_fields,
@@ -369,7 +385,7 @@
 	% This mangling scheme ensures that (a) the mangled filename doesn't
 	% contain any slashes, and (b) two different original filenames will
 	% always yield different mangled filenames.
-
+    %
 :- func filename_mangle_2(list(char)) = list(char).

 filename_mangle_2([]) = [].
Index: io_combinator.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/io_combinator.m,v
retrieving revision 1.4
diff -u -b -r1.4 io_combinator.m
--- io_combinator.m	23 Jun 2005 08:21:28 -0000	1.4
+++ io_combinator.m	8 Nov 2005 07:19:52 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1993-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: mdprof_cgi.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/mdprof_cgi.m,v
retrieving revision 1.11
diff -u -b -r1.11 mdprof_cgi.m
--- mdprof_cgi.m	23 Jun 2005 08:21:28 -0000	1.11
+++ mdprof_cgi.m	8 Nov 2005 07:23:04 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -62,8 +64,7 @@
 	(
 		MaybeQueryString = yes(QueryString0),
 		getopt__process_options(
-			option_ops_multi(short, long, defaults),
-			[], _, MaybeOptions),
+            option_ops_multi(short, long, defaults), [], _, MaybeOptions),
 		(
 			MaybeOptions = ok(Options)
 		;
@@ -73,8 +74,7 @@
 		split(QueryString0, query_separator_char, Pieces),
 		( Pieces = [CmdStr, PrefStr, FileName] ->
 			Cmd = url_component_to_cmd(CmdStr, menu),
-			process_query(Cmd, yes(PrefStr), FileName,
-				Options, !IO)
+            process_query(Cmd, yes(PrefStr), FileName, Options, !IO)
 		; Pieces = [CmdStr, FileName] ->
 			Cmd = url_component_to_cmd(CmdStr, menu),
 			process_query(Cmd, no, FileName, Options, !IO)
@@ -243,9 +243,9 @@
 		io__write_string("mdprof internal error: bad fifo count", !IO)
 	).

-% Handle the given query using the existing server. Delete the mutex and want
-% files when we get out of the critical region.
-
+    % Handle the given query using the existing server. Delete the mutex and
+    % want files when we get out of the critical region.
+    %
 :- pred handle_query_from_existing_server(cmd::in, preferences::in,
 	string::in, string::in, string::in, string::in, option_table::in,
 	io::di, io::uo) is det.
@@ -267,9 +267,9 @@
 		io__remove_file(ResponseFileName, _, !IO)
 	).

-% Handle the given query and then become the new server. Delete the mutex
-% and want files when we get out of the critical region.
-
+    % Handle the given query and then become the new server. Delete the mutex
+    % and want files when we get out of the critical region.
+    %
 :- pred handle_query_from_new_server(cmd::in, preferences::in, string::in,
 	string::in, string::in, string::in, string::in, string::in,
 	option_table::in, io::di, io::uo) is cc_multi.
@@ -346,9 +346,9 @@
 		io__format("error reading data file: %s\n", [s(Error)], !IO)
 	).

-	% Become the new server. Delete the mutex and want files
-	% when we get out of the critical region.
-
+    % Become the new server. Delete the mutex and want files when we get out
+    % of the critical region.
+    %
 :- pred start_server(option_table::in, string::in, string::in,
 	maybe(io__output_stream)::in, string::in, string::in, deep::in,
 	io::di, io::uo) is cc_multi.
@@ -599,8 +599,7 @@
 	;	in_parent
 	;	fork_failed.

-:- pred detach_process(detach_process_result::out,
-	io::di, io::uo) is cc_multi.
+:- pred detach_process(detach_process_result::out, io::di, io::uo) is cc_multi.

 detach_process(Result, !IO) :-
 	raw_detach_process(ResCode, !IO),
@@ -612,17 +611,17 @@
 		Result = in_child(child_has_parent)
 	).

-% Raw_detach_process performs a fork.
-%
-% If the fork succeeds, the result returned by detach_process is:
-%
-% - a positive number in the parent, and
-% - zero in the child.
-%
-% If the fork fails, the result returned by detach_process is:
-%
-% - a negative number in the parent (there is no child process).
-
+    % Raw_detach_process performs a fork.
+    %
+    % If the fork succeeds, the result returned by detach_process is:
+    %
+    % - a positive number in the parent, and
+    % - zero in the child.
+    %
+    % If the fork fails, the result returned by detach_process is:
+    %
+    % - a negative number in the parent (there is no child process).
+    %
 :- pred raw_detach_process(int::out, io::di, io::uo) is cc_multi.

 :- pragma foreign_proc("C",
Index: mdprof_dump.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/mdprof_dump.m,v
retrieving revision 1.2
diff -u -b -r1.2 mdprof_dump.m
--- mdprof_dump.m	23 Jun 2005 08:21:29 -0000	1.2
+++ mdprof_dump.m	8 Nov 2005 07:24:29 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -10,6 +12,7 @@
 % of a deep profiling data file (Deep.data file) for the purpose of debugging
 % the deep profiler or the part of the Mercury runtime that generates Deep.data
 % files.
+%
 %-----------------------------------------------------------------------------%

 :- module mdprof_dump.
@@ -114,7 +117,7 @@

 %----------------------------------------------------------------------------%
 %
-% Option processing.
+% Option processing
 %

 :- type option
Index: measurements.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/measurements.m,v
retrieving revision 1.7
diff -u -b -r1.7 measurements.m
--- measurements.m	24 Aug 2005 07:04:57 -0000	1.7
+++ measurements.m	8 Nov 2005 08:05:14 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -8,6 +10,8 @@
 %
 % This module defines the data structures that store deep profiling
 % measurements and the operations on them.
+%
+%-----------------------------------------------------------------------------%

 :- module measurements.

Index: profile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/profile.m,v
retrieving revision 1.8
diff -u -b -r1.8 profile.m
--- profile.m	23 Jun 2005 08:21:29 -0000	1.8
+++ profile.m	8 Nov 2005 07:35:48 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -168,8 +170,7 @@
 			css_container	:: proc_static_ptr,
 					   % the containing procedure
 			css_slot_num	:: int,
-					   % slot number in the
-					   % containing procedure
+                               % slot number in the containing procedure
 			css_kind	:: call_site_kind_and_callee,
 			css_line_num	:: int,
 			css_goal_path	:: string
@@ -190,7 +191,8 @@
 			user_arity		:: int,
 			user_mode		:: int
 		)
-	;	uci_pred(
+    ;
+            uci_pred(
 			uci_type_name		:: string,
 			uci_type_module		:: string,
 			uci_def_module		:: string,
@@ -439,6 +441,8 @@
 :- import_module int.
 :- import_module require.

+%-----------------------------------------------------------------------------%
+
 decl_module(ProcId) = DeclModule :-
 	(
 		ProcId = user_defined(_, DeclModule, _, _, _, _)
Index: query.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/query.m,v
retrieving revision 1.9
diff -u -b -r1.9 query.m
--- query.m	24 Aug 2005 07:04:57 -0000	1.9
+++ query.m	8 Nov 2005 07:48:00 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2003, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -63,8 +65,7 @@
 		;
 			Msg = "unknown exception"
 		),
-		HTML =
-			string__format(
+        HTML = string__format(
 				"<H3>AN EXCEPTION HAS OCCURRED: %s</H3>\n",
 				[s(Msg)])
 	).
@@ -91,12 +92,10 @@
 	RootCliquePtr = clique_ptr(RootCliqueNum),
 	(
 		MaybePercent = yes(Percent),
-		HTML = chase_the_action(Cmd, RootCliqueNum,
-			Pref, Deep, Percent)
+        HTML = chase_the_action(Cmd, RootCliqueNum, Pref, Deep, Percent)
 	;
 		MaybePercent = no,
-		generate_clique_page(Cmd, RootCliqueNum, Pref, Deep, HTML,
-			100, _)
+        generate_clique_page(Cmd, RootCliqueNum, Pref, Deep, HTML, 100, _)
 	).
 exec(Cmd, Pref, Deep, HTML, !IO) :-
 	Cmd = clique(CliqueNum),
@@ -138,8 +137,7 @@
 exec(Cmd, Pref, Deep, HTML, !IO) :-
 	Cmd = module(ModuleName),
 	( map__search(Deep ^ module_data, ModuleName, ModuleData) ->
-		HTML = generate_module_page(Cmd, ModuleName, ModuleData,
-			Pref, Deep)
+        HTML = generate_module_page(Cmd, ModuleName, ModuleData, Pref, Deep)
 	;
 		HTML =
 			page_banner(Cmd, Pref) ++
@@ -292,8 +290,7 @@
 	array__to_list(CSDPtrArray, CSDPtrs),
 	list__foldl(append_csdi_to_string, CSDPtrs, "", CSDI_HTML),
 	list__length(CSDPtrs, CSDPtrCount),
-	HTML = string__format("multi(%d): [", [i(CSDPtrCount)])
-		++ CSDI_HTML ++ "]".
+    HTML = string.format("multi(%d): [", [i(CSDPtrCount)]) ++ CSDI_HTML ++ "]".

 :- pred append_csdi_to_string(call_site_dynamic_ptr::in,
 	string::in, string::out) is det.
@@ -659,8 +656,7 @@
 	HTML = string.format("<TD><A HREF=""%s"">%s</A></TD>\n",
 		[s(deep_cmd_pref_to_url(Pref, Deep, module(ModuleName))),
 			s(ModuleName)]),
-	LineGroup = line_group(ModuleName, 0, ModuleName, Own, Desc,
-		HTML, unit).
+    LineGroup = line_group(ModuleName, 0, ModuleName, Own, Desc, HTML, unit).

 %-----------------------------------------------------------------------------%

@@ -764,19 +760,15 @@
 			HTML = "",
 			Cutoff = yes
 		;
-			deep_lookup_clique_index(Deep, EntryPDPtr,
-				EntryCliquePtr),
+            deep_lookup_clique_index(Deep, EntryPDPtr, EntryCliquePtr),
 			ThisLine = call_site_dynamic_to_html(Pref, Deep,
-				ancestor_display, yes(EntryCliquePtr),
-				EntryCSDPtr),
-			ThisHTML = two_id_line_to_html(Pref, Deep,
-				totals_meaningful, ThisLine),
+                ancestor_display, yes(EntryCliquePtr), EntryCSDPtr),
+            ThisHTML = two_id_line_to_html(Pref, Deep, totals_meaningful,
+                ThisLine),
 			clique_ancestors_to_html(Pref, Deep, AncestorLimit - 1,
 				RespectLimit, EntryCliquePtr,
 				AncestorHTML, Cutoff),
-			HTML =
-				AncestorHTML ++
-				ThisHTML
+            HTML = AncestorHTML ++ ThisHTML
 		)
 	;
 		% we have reached the parent of root
@@ -909,13 +901,13 @@
 		is_inactive(Own)
 	),
 	deep_lookup_ps_desc(Deep, PSPtr, Desc),
-	LineGroup = proc_total_to_html(Pref, Deep, Bold, Prefix,
-		PSPtr, Own, Desc).
+    LineGroup = proc_total_to_html(Pref, Deep, Bold, Prefix, PSPtr, Own, Desc).

 :- func lookup_proc_total_to_two_id_line(preferences, deep, bool, string,
 	proc_static_ptr) = two_id_line.

-lookup_proc_total_to_two_id_line(Pref, Deep, Bold, Prefix, PSPtr) = LineGroup :-
+lookup_proc_total_to_two_id_line(Pref, Deep, Bold, Prefix, PSPtr)
+        = LineGroup :-
 	deep_lookup_ps_own(Deep, PSPtr, Own),
 	deep_lookup_ps_desc(Deep, PSPtr, Desc),
 	LineGroup = proc_total_to_two_id_line(Pref, Deep, Bold, Prefix,
@@ -1003,8 +995,7 @@
 		ActionPtrs = []
 	;
 		deep_lookup_call_site_dynamics(Deep, CSDPtr, CSD),
-		deep_lookup_clique_index(Deep, CSD ^ csd_callee,
-			CalleeCliquePtr),
+        deep_lookup_clique_index(Deep, CSD ^ csd_callee, CalleeCliquePtr),
 		( CalleeCliquePtr = CallerCliquePtr ->
 			ActionPtrs = []
 		;
@@ -1322,12 +1313,10 @@
 :- func downward_summary_display = call_site_display.

 ancestor_display =
-	call_site_display(call_context, caller_proc_name,
-		caller_clique, always).
+    call_site_display(call_context, caller_proc_name, caller_clique, always).

 upward_display =
-	call_site_display(call_context, caller_proc_name,
-		callee_clique, always).
+    call_site_display(call_context, caller_proc_name, callee_clique, always).

 downward_display =
 	call_site_display(call_context, callee_proc_name,
@@ -1435,17 +1424,16 @@
 	io::di, io::uo) is det.

 proc_callers_to_html(Pref, Deep, PSPtr, CallerGroups, BunchNum0, MaybePage,
-		IO0, IO) :-
+        !IO) :-
 	deep_lookup_proc_callers(Deep, PSPtr, CallerCSDPtrs),
 	(
 		Pref ^ pref_contour = no_contour,
 		CallerCSDPtrPairs = list__map(pair_self, CallerCSDPtrs),
-		IO = IO0,
 		MaybeErrorMsg = no
 	;
 		Pref ^ pref_contour = apply_contour,
 		read_exclude_file(contour_file_name(Deep ^ data_file_name),
-			Deep, Result, IO0, IO),
+            Deep, Result, !IO),
 		(
 			Result = ok(ExcludeSpec),
 			CallerCSDPtrPairs = list__map(
@@ -1468,7 +1456,7 @@
 	LinkProc   = "Group callers by procedure",
 	LinkModule = "Group callers by module",
 	LinkClique = "Group callers by clique",
-	BunchSize = 100,	% don't display more lines than this,
+    BunchSize = 100,    % Don't display more lines than this,
 				% to avoid quadratic behaviour in Netscape.
 	(
 		CallerGroups = group_by_call_site,
@@ -1654,7 +1642,8 @@
 		HTML = string__format("<H3>The %d %ss calling %s:</H3>",
 			[i(NumLines), s(Parent), s(WrappedProcName)])
 	; BunchNum = 1 ->
-		HTML = string__format("<H3>There are %d %ss calling %s, showing first %d:</H3>",
+        HTML = string__format(
+            "<H3>There are %d %ss calling %s, showing first %d:</H3>",
 			[i(NumLines), s(Parent), s(WrappedProcName),
 			i(BunchSize)])
 	;
@@ -1665,7 +1654,8 @@
 		;
 			Last = Last0
 		),
-		HTML = string__format("<H3>There are %d %ss calling %s, showing %d to %d:</H3>",
+        HTML = string__format(
+            "<H3>There are %d %ss calling %s, showing %d to %d:</H3>",
 			[i(NumLines), s(Parent), s(WrappedProcName),
 			i(First), i(Last)])
 	).
@@ -1752,8 +1742,7 @@
 accumulate_csds_by_call_site(Deep, GroupCSDPtr - CostCSDPtr, Map0) = Map :-
 	deep_lookup_call_site_static_map(Deep, GroupCSDPtr, GroupCSSPtr),
 	( map__search(Map0, GroupCSSPtr, CostCSDPtrs0) ->
-		map__det_update(Map0, GroupCSSPtr, [CostCSDPtr | CostCSDPtrs0],
-			Map)
+        map__det_update(Map0, GroupCSSPtr, [CostCSDPtr | CostCSDPtrs0], Map)
 	;
 		map__det_insert(Map0, GroupCSSPtr, [CostCSDPtr], Map)
 	).
@@ -1767,8 +1756,7 @@
 	deep_lookup_call_site_statics(Deep, GroupCSSPtr, GroupCSS),
 	GroupPSPtr = GroupCSS ^ css_container,
 	( map__search(Map0, GroupPSPtr, CostCSDPtrs0) ->
-		map__det_update(Map0, GroupPSPtr, [CostCSDPtr | CostCSDPtrs0],
-			Map)
+        map__det_update(Map0, GroupPSPtr, [CostCSDPtr | CostCSDPtrs0], Map)
 	;
 		map__det_insert(Map0, GroupPSPtr, [CostCSDPtr], Map)
 	).
@@ -1784,8 +1772,8 @@
 	deep_lookup_proc_statics(Deep, GroupPSPtr, GroupPS),
 	GroupModuleName = GroupPS ^ ps_decl_module,
 	( map__search(Map0, GroupModuleName, CostCSDPtrs0) ->
-		map__det_update(Map0, GroupModuleName,
-			[CostCSDPtr | CostCSDPtrs0], Map)
+        map__det_update(Map0, GroupModuleName, [CostCSDPtr | CostCSDPtrs0],
+            Map)
 	;
 		map__det_insert(Map0, GroupModuleName, [CostCSDPtr], Map)
 	).
@@ -1799,8 +1787,7 @@
 	CallerPDPtr = GroupCSD ^ csd_caller,
 	deep_lookup_clique_index(Deep, CallerPDPtr, CliquePtr),
 	( map__search(Map0, CliquePtr, CostCSDPtrs0) ->
-		map__det_update(Map0, CliquePtr, [CostCSDPtr | CostCSDPtrs0],
-			Map)
+        map__det_update(Map0, CliquePtr, [CostCSDPtr | CostCSDPtrs0], Map)
 	;
 		map__det_insert(Map0, CliquePtr, [CostCSDPtr], Map)
 	).
@@ -1863,8 +1850,7 @@
 	deep_lookup_proc_statics(Deep, PSPtr, PS),
 	CSSPtrsArray = PS ^ ps_sites,
 	array__to_list(CSSPtrsArray, CSSPtrs),
-	CallSiteGroups = list__map(call_site_summary_to_html(Pref, Deep),
-		CSSPtrs),
+    CallSiteGroups = list__map(call_site_summary_to_html(Pref, Deep), CSSPtrs),
 	SortedCallSiteGroups = sort_line_groups(Pref ^ pref_criteria,
 		CallSiteGroups),
 	BodyHTMLs = list__map(
Index: timeout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/timeout.m,v
retrieving revision 1.13
diff -u -b -r1.13 timeout.m
--- timeout.m	23 Jun 2005 08:21:29 -0000	1.13
+++ timeout.m	8 Nov 2005 07:49:29 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -33,13 +35,11 @@

 	% Add the given file name to the list of files to be cleaned up.
 	%
-:- pred register_file_for_cleanup(string::in, io::di, io::uo)
-	is det.
+:- pred register_file_for_cleanup(string::in, io::di, io::uo) is det.

 	% Remove the given file name from the list of files to be cleaned up.
 	%
-:- pred unregister_file_for_cleanup(string::in, io::di, io::uo)
-	is det.
+:- pred unregister_file_for_cleanup(string::in, io::di, io::uo) is det.

 	% Remove all file names from the list of files to be cleaned up.
 	%
@@ -50,9 +50,9 @@
 :- pred delete_cleanup_files(io::di, io::uo) is det.

 	% Set up signal handlers for all the signals we can catch.
-	% The three strings specify the name of the mutex file,
-	% the name of the directory containing the `want' files,
-	% and the prefix of the names of the `want' files.
+    % The three strings specify the name of the mutex file, the name of the
+    % directory containing the `want' files, and the prefix of the names of
+    % the `want' files.
 	%
 :- pred setup_signals(string::in, string::in, string::in,
 	io::di, io::uo) is det.
Index: top_procs.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/top_procs.m,v
retrieving revision 1.5
diff -u -b -r1.5 top_procs.m
--- top_procs.m	24 Aug 2005 07:04:57 -0000	1.5
+++ top_procs.m	8 Nov 2005 07:52:21 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -28,12 +30,12 @@
 :- func find_top_procs(cost_kind, include_descendants, measurement_scope,
 	display_limit, deep) = maybe_error(list(int)).

-	% A line group consists of a first line, and optionally a group of
-	% later lines. The first line is structured as a sequence of fields,
-	% which may have one or two id fields but must have all the measurement
-	% fields demanded by the current preferences. The later lines must all
-	% be full rows.
-
+    % A line group consists of a first line, and optionally a group of later
+    % lines. The first line is structured as a sequence of fields, which may
+    % have one or two id fields but must have all the measurement fields
+    % demanded by the current preferences. The later lines must all be full
+    % rows.
+    %
 :- type line_group(FL, LL)
 	--->	line_group(
 			group_filename		:: string,
@@ -77,22 +79,18 @@
 		PSIs0 = 1 .. MaxProcStatic,
 		deep_lookup_proc_dynamics(Deep, Deep ^ root, RootPD),
 		RootPD ^ pd_proc_static = proc_static_ptr(RootPSI),
-		list__filter(filter_top_procs(Deep, RootPSI, FilterPred),
-			PSIs0, PSIs),
-		SortPred = (pred(PSI1::in, PSI2::in, ComparisonResult::out)
-				is det :-
-			ComparisonResult = compare_procs_fallback(RawSortFunc,
-				Deep, PSI1, PSI2)
+        list.filter(filter_top_procs(Deep, RootPSI, FilterPred), PSIs0, PSIs),
+        SortPred = (pred(PSI1::in, PSI2::in, ComparisonResult::out) is det :-
+            ComparisonResult =
+                compare_procs_fallback(RawSortFunc, Deep, PSI1, PSI2)
 		),
 		list__sort(SortPred, PSIs, DescendingPSIs),
 		(
 			Limit = rank_range(First, Last),
 			(
-				list__drop(First - 1, DescendingPSIs,
-					RemainingPSIs)
+                list__drop(First - 1, DescendingPSIs, RemainingPSIs)
 			->
-				list__take_upto(Last - First + 1,
-					RemainingPSIs, TopPSIs),
+                list__take_upto(Last - First + 1, RemainingPSIs, TopPSIs),
 				MaybeTopPSIs = ok(TopPSIs)
 			;
 				MaybeTopPSIs = ok([])
@@ -103,15 +101,13 @@
 				ThresholdCompatible, RawThresholdPred),
 			(
 				ThresholdCompatible = no,
-				MaybeTopPSIs =
-					error("bad threshold specification")
+                MaybeTopPSIs = error("bad threshold specification")
 			;
 				ThresholdCompatible = yes,
 				ThresholdPred = (pred(PSI::in) is semidet :-
 					RawThresholdPred(Deep, Threshold, PSI)
 				),
-				list__takewhile(ThresholdPred, DescendingPSIs,
-					TopPSIs, _),
+                list__takewhile(ThresholdPred, DescendingPSIs, TopPSIs, _),
 				MaybeTopPSIs = ok(TopPSIs)
 			)
 		)
@@ -599,10 +595,9 @@
 		Criteria = by_cost(Measurement, InclDesc, Scope),
 		(
 			Measurement = calls,
-			% We ignore the setting of InclDesc because
-			% calls are not inherited from descendants,
-			% and we ignore the setting of Scope because
-			% sorting on "calls per call" is not useful.
+            % We ignore the setting of InclDesc because calls are not
+            % inherited from descendants, and we ignore the setting of Scope
+            % because sorting on "calls per call" is not useful.
 			CompFunc = compare_line_groups_by_calls
 		;
 			Measurement = redos,
Index: util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/util.m,v
retrieving revision 1.4
diff -u -b -r1.4 util.m
--- util.m	23 Jun 2005 08:21:29 -0000	1.4
+++ util.m	8 Nov 2005 07:53:24 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001, 2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -18,10 +20,10 @@

 %-----------------------------------------------------------------------------%

-	% split(Str, Char, Pieces): splits Str into pieces at every occurrence
-	% of Char, and returns the pieces in order. No piece will contain Char.
-	% If two Chars occur in a row, split will return the empty string as
-	% the piece between them.
+    % split(Str, Char, Pieces): splits Str into pieces at every occurrence of
+    % Char, and returns the pieces in order. No piece will contain Char.  If
+    % two Chars occur in a row, split will return the empty string as the piece
+    % between them.
 	%
 :- pred split(string::in, char::in, list(string)::out) is det.

@@ -53,9 +55,9 @@

 	% find_split_char(Chars, SplitChar, Before, After):
 	% If SplitChar occurs in Chars, it returns all the characters in Chars
-	% before the first occurrence of SplitChar in Chars in Before, and all
-	% the characters after the first occurrence of SplitChar in Chars in
-	% After. The first occurrence of SplitChar itself is not returned.
+    % before the first occurrence of SplitChar in Chars in Before, and all the
+    % characters after the first occurrence of SplitChar in Chars in After. The
+    % first occurrence of SplitChar itself is not returned.
 	%
 :- pred find_split_char(list(char)::in, char::in,
 	list(char)::out, list(char)::out) is semidet.

--------------------------------------------------------------------------
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