[m-rev.] diff: clean up goal_form.m

Julien Fischer juliensf at students.cs.mu.OZ.AU
Tue Feb 17 14:43:11 AEDT 2004


Estimated hours taken: 0.2
Branches: main

Clean up goal_form.m.  This diff doesn't change any algorithms.

compiler/goal_form.m:
	Use predmode syntax throughout.

	Make dividing dashed-lines a uniform length.

	Add an end_module declaration.

Julien.


Index: goal_form.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_form.m,v
retrieving revision 1.6
diff -u -r1.6 goal_form.m
--- goal_form.m	20 Oct 2003 07:29:05 -0000	1.6
+++ goal_form.m	17 Feb 2004 03:35:40 -0000
@@ -2,15 +2,14 @@
 % Copyright (C) 2002-2003 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.
-%---------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
 %
 % A module that provides functions that check whether goals fulfill
 % particular criteria.
 %
 % Main authors: conway, zs.
 %
-%---------------------------------------------------------------------------%
-%---------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%

 :- module hlds__goal_form.

@@ -23,39 +22,31 @@
 :- import_module list.

 	% Succeeds if the goal cannot loop forever.
-:- pred goal_cannot_loop(module_info, hlds_goal).
-:- mode goal_cannot_loop(in, in) is semidet.
+:- pred goal_cannot_loop(module_info::in, hlds_goal::in) is semidet.

 	% Succeeds if the goal cannot loop forever or throw an exception.
-:- pred goal_cannot_loop_or_throw(hlds_goal).
-:- mode goal_cannot_loop_or_throw(in) is semidet.
+:- pred goal_cannot_loop_or_throw(hlds_goal::in) is semidet.

 	% Succeeds if the goal can loop forever.
-:- pred goal_can_loop(module_info, hlds_goal).
-:- mode goal_can_loop(in, in) is semidet.
+:- pred goal_can_loop(module_info::in, hlds_goal::in) is semidet.

 	% Succeeds if the goal can loop forever or throw an exception.
-:- pred goal_can_loop_or_throw(hlds_goal).
-:- mode goal_can_loop_or_throw(in) is semidet.
+:- pred goal_can_loop_or_throw(hlds_goal::in) is semidet.

 	% contains_only_builtins(G) is true if G is a leaf procedure,
 	% i.e. control does not leave G to call another procedure, even if
 	% that procedure is a complicated unification.

-:- pred contains_only_builtins(hlds_goal).
-:- mode contains_only_builtins(in) is semidet.
+:- pred contains_only_builtins(hlds_goal::in) is semidet.

-:- pred contains_only_builtins_expr(hlds_goal_expr).
-:- mode contains_only_builtins_expr(in) is semidet.
+:- pred contains_only_builtins_expr(hlds_goal_expr::in) is semidet.

-:- pred contains_only_builtins_list(list(hlds_goal)).
-:- mode contains_only_builtins_list(in) is semidet.
+:- pred contains_only_builtins_list(list(hlds_goal)::in) is semidet.

 	% goal_is_flat(Goal) is true if Goal does not contain
 	% any branched structures (ie if-then-else or disjunctions or
 	% switches.)
-:- pred goal_is_flat(hlds_goal).
-:- mode goal_is_flat(in) is semidet.
+:- pred goal_is_flat(hlds_goal::in) is semidet.

 	% Determine whether a goal might allocate some heap space,
 	% i.e. whether it contains any construction unifications
@@ -98,7 +89,8 @@
 :- pred count_recursive_calls(hlds_goal::in, pred_id::in, proc_id::in,
 	int::out, int::out) is det.

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

 :- implementation.

@@ -121,15 +113,14 @@
 goal_cannot_loop_or_throw(Goal) :-
 	goal_cannot_loop_aux(no, Goal).

-:- pred goal_cannot_loop_aux(maybe(module_info), hlds_goal).
-:- mode goal_cannot_loop_aux(in, in) is semidet.
+:- pred goal_cannot_loop_aux(maybe(module_info)::in, hlds_goal::in) is semidet.

 goal_cannot_loop_aux(MaybeModuleInfo, Goal) :-
 	Goal = GoalExpr - _,
 	goal_cannot_loop_expr(MaybeModuleInfo, GoalExpr).

-:- pred goal_cannot_loop_expr(maybe(module_info), hlds_goal_expr).
-:- mode goal_cannot_loop_expr(in, in) is semidet.
+:- pred goal_cannot_loop_expr(maybe(module_info)::in, hlds_goal_expr::in)
+	is semidet.

 goal_cannot_loop_expr(MaybeModuleInfo, conj(Goals)) :-
 	list__member(Goal, Goals) =>
@@ -203,8 +194,7 @@
 	).
 		% Complicated unifies are _non_builtin_

-:- pred contains_only_builtins_cases(list(case)).
-:- mode contains_only_builtins_cases(in) is semidet.
+:- pred contains_only_builtins_cases(list(case)::in) is semidet.

 contains_only_builtins_cases([]).
 contains_only_builtins_cases([case(_ConsId, Goal)|Cases]) :-
@@ -221,8 +211,7 @@
 goal_is_flat(Goal - _GoalInfo) :-
 	goal_is_flat_expr(Goal).

-:- pred goal_is_flat_expr(hlds_goal_expr).
-:- mode goal_is_flat_expr(in) is semidet.
+:- pred goal_is_flat_expr(hlds_goal_expr::in) is semidet.

 goal_is_flat_expr(conj(Goals)) :-
 	goal_is_flat_list(Goals).
@@ -235,8 +224,7 @@
 goal_is_flat_expr(unify(_, _, _, _, _)).
 goal_is_flat_expr(foreign_proc(_, _, _, _, _, _, _)).

-:- pred goal_is_flat_list(list(hlds_goal)).
-:- mode goal_is_flat_list(in) is semidet.
+:- pred goal_is_flat_list(list(hlds_goal)::in) is semidet.

 goal_is_flat_list([]).
 goal_is_flat_list([Goal|Goals]) :-
@@ -512,4 +500,6 @@
 		int__max(Max0, Max1, Max)
 	).

+%-----------------------------------------------------------------------------%
+:- end_module goal_form.
 %-----------------------------------------------------------------------------%

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