`__' as module qualifier

Fergus Henderson fjh at cs.mu.oz.au
Sun Feb 23 03:55:14 AEDT 1997


Hi,

For review by anyone who feels like it (I don't mind if no-one reviews this).

Estimated hours: 6

Enable the code to treat `__' as an alternative syntax for module
qualification, after fixing various places in the compiler where
we use `__' in ways that are incompatible with this.

compiler/prog_io.m:
compiler/prog_io_goal.m:
	Uncomment the code to handle `__' as module qualification.

compiler/intermod.m:
compiler/hlds_module.m:
compiler/modecheck_unify.m:
	Fix bugs in the handling of module qualified higher-order terms.

compiler/*.m:
	s/hlds__/hlds_/g
	[The diff below doesn't include all of these changes --
	they're very boring.  I did the change using a `sed' script.]

compiler/passes_aux.m:
	s/process__/process_/g

compiler/pragma_c_gen.m:
compiler/code_gen.m:
	s/code_gen__/pragma_c_gen__/ for the predicates defined in
	pragma_c_gen.m (this ought to have been done when the code
	was first moved from code_gen.m to pragma_c_gen.m).

compiler/llds.m:
	s/llds__proc_id/llds_proc_id/g
	The reason for this was to avoid ambiguity between proc_id
	in hlds_pred.m and llds__proc_id in llds.m.

compiler/quantification.m:
compiler/make_hlds.m:
compiler/mercury_to_c.m:
	s/goal_vars/quantification__goal_vars/g
	The reason for this was to avoid ambiguity between goal_vars
	in quantification.m and goal_util__goal_vars in goal_util.m.

compiler/dupelim.m:
compiler/optimize.m:
	s/dupelim__main/dupelim_main/g
	The reason for this change is that a program can only
	have one main/2 predicate.

compiler/prog_io_dcg.m:
	Remove the old "temporary hack" to strip off and ignore
	io__gc_call/1, since the new handling of `__' broke it.
	It was only useful for optimizing NU-Prolog performance,
	which we don't care about anymore.

compiler/mercury_compile.m:
compiler/modules.m:
compiler/intermod.m:
compiler/prog_io.m:
	Remove occurrences of io__gc_call.

compiler/llds_out.m:
compiler/base_type_info.m:
	Ensure that we properly handle the special hacks in mercury_builtin
	where predicates from other modules (e.g. term__context_init)
	are defined in mercury_builtin because they are needed for
	type_to_term and term_to_type.  llds_out.m: don't put
	`mercury_builtin' in the mangled names for those symbols.
	base_type_info.m: handle types whose status is "imported"
	in their own module.

Index: prog_io.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_io.m,v
retrieving revision 1.153
diff -u -r1.153 prog_io.m
--- prog_io.m	1997/02/22 08:26:29	1.153
+++ prog_io.m	1997/02/22 11:20:08
@@ -305,19 +305,11 @@
 
 %-----------------------------------------------------------------------------%
 
-	% The loop is arranged somewhat carefully: we want it to
-	% be tail recursive, and we want to do a small garbage collection
-	% after we have read each item to minimize memory usage
-	% and improve cache locality.  So each iteration calls
-	% read_item(MaybeItem) - which does all the work for a single item -
-	% via io__gc_call/1, which calls the goal with garbage collection.
-	% This manual garbage collection won't be strictly necessary
-	% when (if) we implement automatic garbage collection, but
-	% it will probably still improve performance.
-	%
-	% Note: the following will NOT be tail recursive with our
-	% implementation unless the compiler is smart enough to inline
-	% read_items_loop_2.
+	% The code below was carefully optimized to run efficiently
+	% in NU-Prolog.  We used to call read_item(MaybeItem) -
+	% which does all the work for a single item -
+	% via io__gc_call/1, which called the goal with garbage collection.
+	% But optimizing for NU-Prolog is no longer a big priority...
 
 :- pred read_items_loop(string, string, message_list, item_list, module_error, 
 			message_list, item_list, module_error, 
@@ -326,7 +318,7 @@
 
 read_items_loop(ModuleName, SourceFileName, Msgs1, Items1, Error1,
 		Msgs, Items, Error) -->
-	io__gc_call(read_item(ModuleName, SourceFileName, MaybeItem)),
+	read_item(ModuleName, SourceFileName, MaybeItem),
  	read_items_loop_2(MaybeItem, ModuleName, SourceFileName,
 			Msgs1, Items1, Error1, Msgs, Items, Error).
 
@@ -338,8 +330,6 @@
 			io__state, io__state).
 :- mode read_items_loop_2(in, in, in, in, in, in, out, out, out, di, uo) is det.
 
-:- pragma(inline, read_items_loop_2/11).
-
 % do a switch on the type of the next item
 
 read_items_loop_2(eof, _ModuleName, _SourceFileName, Msgs, Items, Error,
@@ -1812,9 +1802,6 @@
         ( 
             Term = term__functor(term__atom(Name), [], _Context3)
         ->
-/********
-Don't allow `__' as an alternative to `:', because
-we don't yet support qualification on constructors (e.g. term__variable).
 	    (
 		string__sub_string_search(Name, "__", LeftLength),
 		LeftLength > 0
@@ -1825,7 +1812,6 @@
 		string__right(Name, RightLength, Name2),
 		Result = ok(qualified(Module, Name2))
 	    ;
-********/
 	        (
 		    DefaultModName = ""
 	        ->
@@ -1833,9 +1819,7 @@
 	        ;
 		    Result = ok(qualified(DefaultModName, Name))
 	        )
-/********
 	    )
-********/
         ;
             Result = error("symbol name specifier expected", Term)
         )
Index: prog_io_goal.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_io_goal.m,v
retrieving revision 1.2
diff -u -r1.2 prog_io_goal.m
--- prog_io_goal.m	1997/02/22 08:26:37	1.2
+++ prog_io_goal.m	1997/02/22 08:31:04
@@ -357,10 +357,6 @@
             Term = term__functor(term__atom(Name), Args, _Context4)
         ->
 	    (
-/**********
-Don't allow `__' as an alternative to `:',
-because we don't yet support qualification of constructors,
-e.g. `term__variable(_)'.
 		string__sub_string_search(Name, "__", LeftLength),
 		LeftLength > 0
 	    ->
@@ -379,7 +375,6 @@
 		    Result = error("module qualifier (name before `__') in definition does not match preceding `:- module' declaration", Term)
 		)
 	    ;
-**********/
 		DefaultModName = ""
 	    ->
             	Result = ok(unqualified(Name), Args)
Index: intermod.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/intermod.m,v
retrieving revision 1.16
diff -u -r1.16 intermod.m
--- intermod.m	1997/02/20 03:04:23	1.16
+++ intermod.m	1997/02/22 13:45:12
@@ -335,7 +335,7 @@
 
 	% Go over the goal of an exported proc looking for proc decls, types,
 	% insts and modes that we need to write to the optfile.
-:- pred intermod__traverse_goal(hlds__goal::in, hlds__goal::out, bool::out,
+:- pred intermod__traverse_goal(hlds_goal::in, hlds_goal::out, bool::out,
 			intermod_info::in, intermod_info::out) is det.
 
 intermod__traverse_goal(conj(Goals0) - Info, conj(Goals) - Info, DoWrite) -->
@@ -403,7 +403,7 @@
 			pragma_c_code(A,B,C,D,E,F,G) - Info, yes) --> [].
 
 
-:- pred intermod__traverse_list_of_goals(hlds__goals::in, hlds__goals::out,
+:- pred intermod__traverse_list_of_goals(hlds_goals::in, hlds_goals::out,
 		bool::out, intermod_info::in, intermod_info::out) is det.
 
 intermod__traverse_list_of_goals([], [], yes) --> [].
@@ -532,23 +532,18 @@
 		intermod_info_add_proc(PredId, DoWrite)
 	;
 		intermod_info_get_var_types(VarTypes),
-		{
-			Functor0 = cons(qualified(Module, PredName), Arity),
-			predicate_table_search_sym(PredTable,
-				qualified(Module, PredName), [PredId])
-		;
-			Functor0 = cons(unqualified(PredName), Arity),
-			map__lookup(VarTypes, LVar, LVarType),
-			type_is_higher_order(LVarType,
-				PredOrFunc, PredArgTypes),
-			get_pred_id_and_proc_id(PredName, Arity, PredOrFunc,
-				PredArgTypes, ModuleInfo, PredId, _ProcId),
-			module_info_pred_info(ModuleInfo, PredId, PredInfo),
-			pred_info_module(PredInfo, Module)
-		}
+		{ Functor0 = cons(PredName, Arity) },
+		{ map__lookup(VarTypes, LVar, LVarType) },
+		{ type_is_higher_order(LVarType, PredOrFunc, PredArgTypes) }
 	->
 			% The unification creates a higher-order pred constant.
-		{ Functor = cons(qualified(Module, PredName), Arity) },
+		{ get_pred_id_and_proc_id(PredName, Arity, PredOrFunc,
+			PredArgTypes, ModuleInfo, PredId, _ProcId) },
+		{ module_info_pred_info(ModuleInfo, PredId, PredInfo) },
+		{ pred_info_module(PredInfo, Module) },
+		{ unqualify_name(PredName, UnqualPredName) },
+		{ QualifiedPredName = qualified(Module, UnqualPredName) },
+		{ Functor = cons(QualifiedPredName, Arity) },
 		intermod_info_add_proc(PredId, DoWrite)
 	;
 		{ Functor = Functor0 },
@@ -598,7 +593,7 @@
 		{ list__length(Args, Arity) },
 		{ ModeId = Name - Arity },
 		{ map__lookup(ModeTable, ModeId, ModeDefn) },
-		{ ModeDefn = hlds__mode_defn(_,_,_,_,_, Status) },
+		{ ModeDefn = hlds_mode_defn(_,_,_,_,_, Status) },
 		( { Status = local } ->
 			intermod_info_get_modes(ModesToExport0),
 			{ set__insert(ModesToExport0, ModeId,
@@ -642,7 +637,7 @@
 		{ list__length(InstArgs, Arity) },
 		{ InstId = Name - Arity },
 		{ map__lookup(UserInstTable, InstId, InstDefn) },
-		{ InstDefn = hlds__inst_defn(_,_,_,_,_, Status) },
+		{ InstDefn = hlds_inst_defn(_,_,_,_,_, Status) },
 		( { Status = local } ->
 			intermod_info_get_insts(InstsToExport0),
 			{ set__insert(InstsToExport0, InstId,
@@ -770,7 +765,7 @@
 intermod__write_modes(ModuleInfo, ModeTable, [ModeId | Modes]) -->
 	{ ModeId = SymName - _Arity },
 	{ map__lookup(ModeTable, ModeId, ModeDefn) },
-	{ ModeDefn = hlds__mode_defn(Varset, Args, eqv_mode(Mode),
+	{ ModeDefn = hlds_mode_defn(Varset, Args, eqv_mode(Mode),
 							_, Context, _) },
 	mercury_output_mode_defn(
 			Varset,
@@ -787,7 +782,7 @@
 	io__write_char(':'),
 	{ Inst = SymName - _Arity },
 	{ map__lookup(UserInstTable, Inst, InstDefn) },
-	{ InstDefn = hlds__inst_defn(Varset, Args, Body, _, Context, _) },
+	{ InstDefn = hlds_inst_defn(Varset, Args, Body, _, Context, _) },
 	(
 		{ Body = eqv_inst(Inst2) },
 		mercury_output_inst_defn(
@@ -1246,10 +1241,8 @@
 	maybe_write_string(VeryVerbose, "% done.\n"),
 
 	{ string__append(Import, ".opt", FileName) },
-        io__gc_call(
-		prog_io__read_module(FileName, Import, yes,
-				ModuleError, Messages, Items1)
-        ),
+	prog_io__read_module(FileName, Import, yes,
+			ModuleError, Messages, Items1),
 	update_error_status(FileName, ModuleError, Messages, Error0, Error1),
 	{ list__append(Items0, Items1, Items2) },
 	read_optimization_interfaces(Imports, Items2, Items, Error1, Error).
Index: hlds_module.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_module.m,v
retrieving revision 1.15
diff -u -r1.15 hlds_module.m
--- hlds_module.m	1997/01/20 03:27:17	1.15
+++ hlds_module.m	1997/02/22 13:38:42
@@ -27,7 +27,7 @@
 
 :- implementation.
 
-:- import_module hlds_data, hlds_out, prog_data, shapes.
+:- import_module hlds_data, hlds_out, prog_data, prog_util, shapes.
 :- import_module require, int, string, list, map, set, std_util.
 
 %-----------------------------------------------------------------------------%
@@ -74,7 +74,7 @@
 					string,		% type name
 					int,		% type arity
 					import_status,	% of the type
-					hlds__type_defn % defn of type
+					hlds_type_defn % defn of type
 				).
 
 	% This structure contains information needed to create
@@ -760,24 +760,24 @@
 :- type dependency_graph	== relation(pred_proc_id).
 :- type dependency_info.
 
-:- pred hlds__dependency_info_init(dependency_info).
-:- mode hlds__dependency_info_init(out) is det.
+:- pred hlds_dependency_info_init(dependency_info).
+:- mode hlds_dependency_info_init(out) is det.
 
-:- pred hlds__dependency_info_get_dependency_graph(dependency_info, 
+:- pred hlds_dependency_info_get_dependency_graph(dependency_info, 
 	dependency_graph).
-:- mode hlds__dependency_info_get_dependency_graph(in, out) is det.
+:- mode hlds_dependency_info_get_dependency_graph(in, out) is det.
 
-:- pred hlds__dependency_info_get_dependency_ordering(dependency_info, 
+:- pred hlds_dependency_info_get_dependency_ordering(dependency_info, 
 	dependency_ordering).
-:- mode hlds__dependency_info_get_dependency_ordering(in, out) is det.
+:- mode hlds_dependency_info_get_dependency_ordering(in, out) is det.
 
-:- pred hlds__dependency_info_set_dependency_graph(dependency_info,
+:- pred hlds_dependency_info_set_dependency_graph(dependency_info,
 	dependency_graph, dependency_info).
-:- mode hlds__dependency_info_set_dependency_graph(in, in, out) is det.
+:- mode hlds_dependency_info_set_dependency_graph(in, in, out) is det.
 
-:- pred hlds__dependency_info_set_dependency_ordering(dependency_info,
+:- pred hlds_dependency_info_set_dependency_ordering(dependency_info,
 	dependency_ordering, dependency_info).
-:- mode hlds__dependency_info_set_dependency_ordering(in, in, out) is det.
+:- mode hlds_dependency_info_set_dependency_ordering(in, in, out) is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -793,23 +793,23 @@
 			unit
 		).
 
-hlds__dependency_info_init(DepInfo) :-
+hlds_dependency_info_init(DepInfo) :-
 	DepInfo = dependency_info(DepRel, DepOrd, Unused, unit, unit, unit),
 	relation__init(DepRel),
 	DepOrd = [],
 	set__init(Unused).
 
-hlds__dependency_info_get_dependency_graph(DepInfo, DepRel) :-
+hlds_dependency_info_get_dependency_graph(DepInfo, DepRel) :-
 	DepInfo = dependency_info(DepRel, _, _, _, _, _).
 
-hlds__dependency_info_get_dependency_ordering(DepInfo, DepOrd) :-
+hlds_dependency_info_get_dependency_ordering(DepInfo, DepOrd) :-
 	DepInfo = dependency_info(_, DepOrd, _, _, _, _).
 
-hlds__dependency_info_set_dependency_graph(DepInfo0, DepRel, DepInfo) :-
+hlds_dependency_info_set_dependency_graph(DepInfo0, DepRel, DepInfo) :-
 	DepInfo0 = dependency_info(_, B, C, D, E, F),
 	DepInfo = dependency_info(DepRel, B, C, D, E, F).
 
-hlds__dependency_info_set_dependency_ordering(DepInfo0, DepRel, DepInfo) :-
+hlds_dependency_info_set_dependency_ordering(DepInfo0, DepRel, DepInfo) :-
 	DepInfo0 = dependency_info(A, _, C, D, E, F),
 	DepInfo = dependency_info(A, DepRel, C, D, E, F).
 
@@ -1016,10 +1016,10 @@
 :- pred predicate_arity(module_info, pred_id, arity).
 :- mode predicate_arity(in, in, out) is det.
 
-	% Get the pred_id and proc_id matching a lambda expression with
+	% Get the pred_id and proc_id matching a higher-order term with
 	% the given argument types, aborting with an error if none is
 	% found.
-:- pred get_pred_id_and_proc_id(string, arity, pred_or_func, list(type),
+:- pred get_pred_id_and_proc_id(sym_name, arity, pred_or_func, list(type),
 				module_info, pred_id, proc_id).
 :- mode get_pred_id_and_proc_id(in, in, in, in, in, out, out) is det.
 
@@ -1428,14 +1428,15 @@
 				Func_N_Index, Func_NA_Index, Func_MNA_Index).
 
 
-get_pred_id_and_proc_id(Name, Arity, PredOrFunc, PredArgTypes, ModuleInfo,
+get_pred_id_and_proc_id(SymName, Arity, PredOrFunc, PredArgTypes, ModuleInfo,
 			PredId, ProcId) :-
+	unqualify_name(SymName, Name),
 	list__length(PredArgTypes, PredArity),
 	TotalArity is Arity + PredArity,
 	module_info_get_predicate_table(ModuleInfo, PredicateTable),
 	(
-	    predicate_table_search_pf_name_arity(PredicateTable,
-		PredOrFunc, Name, TotalArity, PredIds)
+	    predicate_table_search_pf_sym_arity(PredicateTable,
+		PredOrFunc, SymName, TotalArity, PredIds)
 	->
 	    (
 		PredIds = [PredId0]
Index: modecheck_unify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modecheck_unify.m,v
retrieving revision 1.9
diff -u -r1.9 modecheck_unify.m
--- modecheck_unify.m	1997/02/17 01:26:51	1.9
+++ modecheck_unify.m	1997/02/22 13:44:05
@@ -24,7 +24,7 @@
 
 	% Modecheck a unification
 :- pred modecheck_unification( var, unify_rhs, unification, unify_context,
-			hlds__goal_info, how_to_check_goal, hlds__goal_expr,
+			hlds_goal_info, how_to_check_goal, hlds_goal_expr,
 			mode_info, mode_info).
 :- mode modecheck_unification(in, in, in, in, in, in, out,
 			mode_info_di, mode_info_uo) is det.
@@ -32,7 +32,7 @@
 	% Work out what kind of unification a var-var unification is.
 :- pred categorize_unify_var_var(mode, mode, is_live, is_live, var, var,
 			determinism, unify_context, map(var, type), mode_info,
-			hlds__goal_expr, mode_info).
+			hlds_goal_expr, mode_info).
 :- mode categorize_unify_var_var(in, in, in, in, in, in, in, in, in,
 			mode_info_di, out, mode_info_uo) is det.
 
@@ -40,7 +40,7 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module llds, prog_data, type_util, module_qual, instmap.
+:- import_module llds, prog_data, prog_util, type_util, module_qual, instmap.
 :- import_module hlds_module, hlds_goal, hlds_pred, hlds_data, hlds_out.
 :- import_module mode_debug, mode_util, mode_info, modes, mode_errors.
 :- import_module inst_match, unify_proc, code_util, unique_modes.
@@ -242,40 +242,18 @@
 		mode_info_set_var_types(VarTypes, ModeInfo1, ModeInfo2),
 
 		%
-		% Build up the hlds__goal_expr for the call that will form
+		% Build up the hlds_goal_expr for the call that will form
 		% the lambda goal
 		%
-		(
-			PName = unqualified(UnqualPName),
-			get_pred_id_and_proc_id(UnqualPName, Arity, PredOrFunc,
-				PredArgTypes, ModuleInfo0, PredId, ProcId),
-			module_info_pred_info(ModuleInfo0, PredId, PredInfo),
-			pred_info_module(PredInfo, PredModule),
-			QualifiedPName = qualified(PredModule, UnqualPName)
-		;
-			PName = qualified(PredModule, UnqualName),
-			QualifiedPName = PName,
-			(
-				predicate_table_search_sym(PredTable,
-					PName, [PredId0]),
-				module_info_pred_info(ModuleInfo0, PredId0,
-					PredInfo),
-				pred_info_procids(PredInfo, [ProcId0])
-			->
-				ProcId = ProcId0,
-				PredId = PredId0
-			;
-				string__int_to_string(Arity, ArStr),
-				string__append_list([
-					"sorry, not implemented: ",
-					"taking address of ", "\n`",
-					PredModule, ":", UnqualName, "/",
-					ArStr, "' with multiple modes.\n",
-					"(use an explicit lambda expression instead)"],
-					Message),
-				error(Message)
-			)
-		),
+
+		get_pred_id_and_proc_id(PName, Arity, PredOrFunc,
+			PredArgTypes, ModuleInfo0, PredId, ProcId),
+
+		% module-qualify the pred name (is this necessary?)
+		module_info_pred_info(ModuleInfo0, PredId, PredInfo),
+		pred_info_module(PredInfo, PredModule),
+		unqualify_name(PName, UnqualPName),
+		QualifiedPName = qualified(PredModule, UnqualPName),
 
 		CallUnifyContext = call_unify_context(X0,
 				functor(ConsId, ArgVars0), UnifyContext),
@@ -498,7 +476,7 @@
 	).
 
 :- pred modecheck_unify_functor(var, (type), cons_id, list(var), unification,
-			pair(list(hlds__goal)), pair(mode), list(var),
+			pair(list(hlds_goal)), pair(mode), list(var),
 			unification,
 			mode_info, mode_info).
 :- mode modecheck_unify_functor(in, in, in, in, in, out, out, out, out,
@@ -628,8 +606,8 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred modecheck_higher_order_func_call(var, list(var), var, hlds__goal_info,
-		hlds__goal_expr, mode_info, mode_info).
+:- pred modecheck_higher_order_func_call(var, list(var), var, hlds_goal_info,
+		hlds_goal_expr, mode_info, mode_info).
 :- mode modecheck_higher_order_func_call(in, in, in, in, out,
 		mode_info_di, mode_info_uo) is det.
 
@@ -660,7 +638,7 @@
 	% into separate unifications by introducing fresh variables here.
 
 :- pred split_complicated_subunifies(unification, list(var),
-			unification, list(var), pair(list(hlds__goal)),
+			unification, list(var), pair(list(hlds_goal)),
 			mode_info, mode_info).
 :- mode split_complicated_subunifies(in, in, out, out, out,
 			mode_info_di, mode_info_uo) is det.
@@ -689,7 +667,7 @@
 	).
 
 :- pred split_complicated_subunifies_2(list(var), list(uni_mode),
-			list(var), list(uni_mode), pair(list(hlds__goal)),
+			list(var), list(uni_mode), pair(list(hlds_goal)),
 			mode_info, mode_info).
 :- mode split_complicated_subunifies_2(in, in, out, out, out,
 		mode_info_di, mode_info_uo) is semidet.
Index: passes_aux.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/passes_aux.m,v
retrieving revision 1.14
diff -u -r1.14 passes_aux.m
--- passes_aux.m	1997/01/20 03:27:46	1.14
+++ passes_aux.m	1997/02/22 09:54:43
@@ -94,39 +94,39 @@
 
 process_all_nonimported_procs(Task, ModuleInfo0, ModuleInfo) -->
 	{ module_info_predids(ModuleInfo0, PredIds) },
-	process__nonimported_procs_in_preds(PredIds, Task, _,
+	process_nonimported_procs_in_preds(PredIds, Task, _,
 		ModuleInfo0, ModuleInfo).
 
 process_all_nonimported_procs(Task0, Task, ModuleInfo0, ModuleInfo) -->
 	{ module_info_predids(ModuleInfo0, PredIds) },
-	process__nonimported_procs_in_preds(PredIds, Task0, Task,
+	process_nonimported_procs_in_preds(PredIds, Task0, Task,
 		ModuleInfo0, ModuleInfo).
 
-:- pred process__nonimported_procs_in_preds(list(pred_id), task(T), task(T),
+:- pred process_nonimported_procs_in_preds(list(pred_id), task(T), task(T),
 	module_info, module_info, io__state, io__state).
-:- mode process__nonimported_procs_in_preds(in, task, out(task), in, out,
+:- mode process_nonimported_procs_in_preds(in, task, out(task), in, out,
 	di, uo) is det.
 
-process__nonimported_procs_in_preds([], Task, Task, ModuleInfo, ModuleInfo)
+process_nonimported_procs_in_preds([], Task, Task, ModuleInfo, ModuleInfo)
 		--> [].
-process__nonimported_procs_in_preds([PredId | PredIds], Task0, Task,
+process_nonimported_procs_in_preds([PredId | PredIds], Task0, Task,
 		ModuleInfo0, ModuleInfo) -->
 	{ module_info_preds(ModuleInfo0, PredTable) },
 	{ map__lookup(PredTable, PredId, PredInfo) },
 	{ pred_info_non_imported_procids(PredInfo, ProcIds) },
-	process__nonimported_procs(ProcIds, PredId, Task0, Task1,
+	process_nonimported_procs(ProcIds, PredId, Task0, Task1,
 		ModuleInfo0, ModuleInfo1),
-	process__nonimported_procs_in_preds(PredIds, Task1, Task,
+	process_nonimported_procs_in_preds(PredIds, Task1, Task,
 		ModuleInfo1, ModuleInfo).
 
-:- pred process__nonimported_procs(list(proc_id), pred_id, task(T), task(T),
+:- pred process_nonimported_procs(list(proc_id), pred_id, task(T), task(T),
 	module_info, module_info, io__state, io__state).
-:- mode process__nonimported_procs(in, in, task, out(task), in, out, di, uo)
+:- mode process_nonimported_procs(in, in, task, out(task), in, out, di, uo)
 	is det.
 
-process__nonimported_procs([], _PredId, Task, Task,
+process_nonimported_procs([], _PredId, Task, Task,
 		ModuleInfo, ModuleInfo, State, State).
-process__nonimported_procs([ProcId | ProcIds], PredId, Task0, Task,
+process_nonimported_procs([ProcId | ProcIds], PredId, Task0, Task,
 		ModuleInfo0, ModuleInfo, State0, State) :-
 
 	module_info_preds(ModuleInfo0, Preds0),
@@ -183,7 +183,7 @@
 	map__set(Preds0, PredId, Pred, Preds),
 	module_info_set_preds(ModuleInfo8, Preds, ModuleInfo9),
 
-	process__nonimported_procs(ProcIds, PredId, Task1, Task,
+	process_nonimported_procs(ProcIds, PredId, Task1, Task,
 		ModuleInfo9, ModuleInfo, State9, State).
 
 write_pred_progress_message(Message, PredId, ModuleInfo) -->
Index: pragma_c_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.5
diff -u -r1.5 pragma_c_gen.m
--- pragma_c_gen.m	1997/02/09 04:04:05	1.5
+++ pragma_c_gen.m	1997/02/22 10:08:31
@@ -25,16 +25,16 @@
 :- import_module llds, code_info.
 :- import_module list, std_util.
 
-:- pred code_gen__generate_pragma_c_code(code_model::in, string::in,
+:- pred pragma_c_gen__generate_pragma_c_code(code_model::in, string::in,
 	may_call_mercury::in, pred_id::in, proc_id::in, list(var)::in,
-	list(maybe(string))::in, hlds__goal_info::in, code_tree::out,
+	list(maybe(string))::in, hlds_goal_info::in, code_tree::out,
 	code_info::in, code_info::out) is det.
 
-:- pred code_gen__generate_backtrack_pragma_c_code(code_model::in, string::in,
-	may_call_mercury::in, pred_id::in, proc_id::in, list(var)::in,
-	list(maybe(string))::in, list(pair(var, string))::in, list(string)::in,
-	hlds__goal_info::in, code_tree::out, code_info::in, code_info::out)
-	is erroneous.
+:- pred pragma_c_gen__generate_backtrack_pragma_c_code(code_model::in,
+	string::in, may_call_mercury::in, pred_id::in, proc_id::in,
+	list(var)::in, list(maybe(string))::in, list(pair(var, string))::in,
+	list(string)::in, hlds_goal_info::in, code_tree::out,
+	code_info::in, code_info::out) is erroneous.
 
 %---------------------------------------------------------------------------%
 
@@ -87,7 +87,7 @@
 %	will be preserved, so if we're using conservative gc,
 %	there is nothing that needs restoring.
 
-code_gen__generate_pragma_c_code(CodeModel, C_Code, MayCallMercury,
+pragma_c_gen__generate_pragma_c_code(CodeModel, C_Code, MayCallMercury,
 		PredId, ProcId, Args, Names, _GoalInfo, Code) -->
 	% First we need to get a list of input and output arguments
 	code_info__get_pred_proc_arginfo(PredId, ProcId, ArgInfo),
@@ -213,9 +213,9 @@
 		ArgNames).
 
 make_c_arg_list_2([], [_ | _], _, _) :-
-	error("code_gen:make_c_arg_list_2 - length mismatch").
+	error("pragma_c_gen:make_c_arg_list_2 - length mismatch").
 make_c_arg_list_2([_ | _], [], _, _) :-
-	error("code_gen:make_c_arg_list_2 - length mismatch").
+	error("pragma_c_gen:make_c_arg_list_2 - length mismatch").
 
 :- pred get_c_arg_list_vars(list(c_arg)::in, list(var)::out) is det.
 
@@ -345,7 +345,8 @@
 
 %---------------------------------------------------------------------------%
 
-code_gen__generate_backtrack_pragma_c_code(_, _, _, _, _, _, _, _, _, _, _) -->
+pragma_c_gen__generate_backtrack_pragma_c_code(_, _, _, _, _, _, _, _, _,
+		_, _) -->
 	{ error("nondet pragma_c_codes not yet implemented") }.
 
 %---------------------------------------------------------------------------%
Index: code_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_gen.m,v
retrieving revision 1.20
diff -u -r1.20 code_gen.m
--- code_gen.m	1997/01/27 07:44:51	1.20
+++ code_gen.m	1997/02/22 10:35:00
@@ -46,7 +46,7 @@
 
 		% This predicate generates code for a goal.
 
-:- pred code_gen__generate_goal(code_model, hlds__goal, code_tree,
+:- pred code_gen__generate_goal(code_model, hlds_goal, code_tree,
 						code_info, code_info).
 :- mode code_gen__generate_goal(in, in, out, in, out) is det.
 
@@ -212,7 +212,7 @@
 		% construct a c_procedure structure with all the information
 	{ Proc = c_procedure(Name, Arity, ProcId, Instructions) }.
 
-:- pred generate_category_code(code_model, hlds__goal, code_tree, maybe(int),
+:- pred generate_category_code(code_model, hlds_goal, code_tree, maybe(int),
 				code_info, code_info).
 :- mode generate_category_code(in, in, out, out, in, out) is det.
 
@@ -642,7 +642,7 @@
 % Note of course, that with a conjunction, state information
 % flows directly from one conjunct to the next.
 
-:- pred code_gen__generate_goals(hlds__goals, code_model, code_tree,
+:- pred code_gen__generate_goals(hlds_goals, code_model, code_tree,
 							code_info, code_info).
 :- mode code_gen__generate_goals(in, in, out, in, out) is det.
 
@@ -661,7 +661,7 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred code_gen__generate_det_goal_2(hlds__goal_expr, hlds__goal_info,
+:- pred code_gen__generate_det_goal_2(hlds_goal_expr, hlds_goal_info,
 					code_tree, code_info, code_info).
 :- mode code_gen__generate_det_goal_2(in, in, out, in, out) is det.
 
@@ -737,7 +737,7 @@
 		PredId, ModeId, Args, ArgNames, Extra), GoalInfo, Instr) -->
 	(
 		{ Extra = none },
-		code_gen__generate_pragma_c_code(model_det, C_Code,
+		pragma_c_gen__generate_pragma_c_code(model_det, C_Code,
 			MayCallMercury, PredId, ModeId, Args, ArgNames,
 			GoalInfo, Instr)
 	;
@@ -747,7 +747,7 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred code_gen__generate_semi_goal_2(hlds__goal_expr, hlds__goal_info,
+:- pred code_gen__generate_semi_goal_2(hlds_goal_expr, hlds_goal_info,
 					code_tree, code_info, code_info).
 :- mode code_gen__generate_semi_goal_2(in, in, out, in, out) is det.
 
@@ -821,7 +821,7 @@
 		PredId, ModeId, Args, ArgNameMap, Extra), GoalInfo, Instr) -->
 	(
 		{ Extra = none },
-		code_gen__generate_pragma_c_code(model_semi, C_Code,
+		pragma_c_gen__generate_pragma_c_code(model_semi, C_Code,
 			MayCallMercury, PredId, ModeId, Args, ArgNameMap,
 			GoalInfo, Instr)
 	;
@@ -832,7 +832,7 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-:- pred code_gen__generate_negation(code_model, hlds__goal, code_tree,
+:- pred code_gen__generate_negation(code_model, hlds_goal, code_tree,
 	code_info, code_info).
 :- mode code_gen__generate_negation(in, in, out, in, out) is det.
 
@@ -890,7 +890,7 @@
 	),
 	code_info__pop_resume_point_vars.
 
-:- pred code_gen__generate_negation_general(code_model, hlds__goal,
+:- pred code_gen__generate_negation_general(code_model, hlds_goal,
 	set(var), resume_locs, code_tree, code_info, code_info).
 :- mode code_gen__generate_negation_general(in, in, in, in, out, in, out)
 	is det.
@@ -952,7 +952,7 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-:- pred code_gen__generate_non_goal_2(hlds__goal_expr, hlds__goal_info,
+:- pred code_gen__generate_non_goal_2(hlds_goal_expr, hlds_goal_info,
 					code_tree, code_info, code_info).
 :- mode code_gen__generate_non_goal_2(in, in, out, in, out) is det.
 
@@ -1002,14 +1002,14 @@
 		% is completed, and even then we must wait until that compiler
 		% is installed on all our machines.
 		% { error("nondet pragma has empty extras field") }
-		code_gen__generate_pragma_c_code(model_semi, C_Code,
+		pragma_c_gen__generate_pragma_c_code(model_semi, C_Code,
 			MayCallMercury, PredId, ModeId, Args, ArgNameMap,
 			GoalInfo, Instr)
 	;
 		{ Extra = extra_pragma_info(SavedVars, LabelNames) },
-		code_gen__generate_backtrack_pragma_c_code(model_semi, C_Code,
-			MayCallMercury, PredId, ModeId, Args, ArgNameMap,
-			SavedVars, LabelNames, GoalInfo, Instr)
+		pragma_c_gen__generate_backtrack_pragma_c_code(model_semi,
+			C_Code, MayCallMercury, PredId, ModeId, Args,
+			ArgNameMap, SavedVars, LabelNames, GoalInfo, Instr)
 	).
 
 %---------------------------------------------------------------------------%
Index: llds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds.m,v
retrieving revision 1.199
diff -u -r1.199 llds.m
--- llds.m	1997/01/29 00:47:40	1.199
+++ llds.m	1997/02/22 10:01:32
@@ -74,11 +74,11 @@
 	--->	c_procedure(
 			string,			% predicate name
 			int,			% arity
-			llds__proc_id,		% mode number
+			llds_proc_id,		% mode number
 			list(instruction)	% the code for this procedure
 		).
 
-:- type llds__proc_id	==	int.
+:- type llds_proc_id	==	int.
 
 	% the code for `pragma export' is generated directly as strings
 	% by export.m.
Index: quantification.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/quantification.m,v
retrieving revision 1.46
diff -u -r1.46 quantification.m
--- quantification.m	1997/01/27 07:45:33	1.46
+++ quantification.m	1997/02/22 11:26:39
@@ -38,13 +38,13 @@
 :- import_module list, set, term.
 
 :- pred implicitly_quantify_clause_body(list(var),
-		hlds__goal, varset, map(var, type),
-		hlds__goal, varset, map(var, type), list(quant_warning)).
+		hlds_goal, varset, map(var, type),
+		hlds_goal, varset, map(var, type), list(quant_warning)).
 :- mode implicitly_quantify_clause_body(in, in, in, in, out, out, out, out)
 	is det.
 
-:- pred implicitly_quantify_goal(hlds__goal, varset, map(var, type), set(var),
-		hlds__goal, varset, map(var, type), list(quant_warning)).
+:- pred implicitly_quantify_goal(hlds_goal, varset, map(var, type), set(var),
+		hlds_goal, varset, map(var, type), list(quant_warning)).
 :- mode implicitly_quantify_goal(in, in, in, in, out, out, out, out) is det.
 
 :- pred requantify_proc(proc_info, proc_info) is det.
@@ -57,11 +57,11 @@
 :- type quant_warning
 	--->	warn_overlap(list(var), term__context).
 
-	% goal_vars(Goal, Vars):
+	% quantification__goal_vars(Goal, Vars):
 	%	Vars is the set of variables that are free (unquantified)
 	%	in Goal.
-:- pred goal_vars(hlds__goal, set(var)).
-:- mode goal_vars(in, out) is det.
+:- pred quantification__goal_vars(hlds_goal, set(var)).
+:- mode quantification__goal_vars(in, out) is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -140,7 +140,7 @@
 	quantification__get_warnings(Warnings0, QuantInfo, _),
 	list__reverse(Warnings0, Warnings).
 
-:- pred implicitly_quantify_goal(hlds__goal, hlds__goal,
+:- pred implicitly_quantify_goal(hlds_goal, hlds_goal,
 					quant_info, quant_info).
 :- mode implicitly_quantify_goal(in, out, in, out) is det.
 
@@ -153,7 +153,7 @@
 		% If there are any variables that are local to the goal
 		% which we have come across before, then we rename them
 		% apart.
-		{ goal_vars(Goal0 - GoalInfo0, GoalVars0) },
+		{ quantification__goal_vars(Goal0 - GoalInfo0, GoalVars0) },
 		{ set__difference(GoalVars0, NonLocalVars, LocalVars) },
 		{ set__intersect(SeenVars, LocalVars, RenameVars) },
 		{ \+ set__empty(RenameVars) }
@@ -166,8 +166,8 @@
 	),
 	{ goal_info_set_nonlocals(GoalInfo1, NonLocalVars, GoalInfo) }.
 
-:- pred implicitly_quantify_goal_2(hlds__goal_expr, term__context,
-				hlds__goal_expr, quant_info, quant_info).
+:- pred implicitly_quantify_goal_2(hlds_goal_expr, term__context,
+				hlds_goal_expr, quant_info, quant_info).
 :- mode implicitly_quantify_goal_2(in, in, out, in, out) is det.
 
 	% we retain explicit existential quantifiers in the source code,
@@ -263,7 +263,7 @@
 		{ goal_util__rename_var_list(Vars0, no, RenameMap, Vars) }
 	),
 	{ set__insert_list(QuantVars, Vars, QuantVars1) },
-	{ goal_vars(Then1, VarsThen, LambdaVarsThen) },
+	{ quantification__goal_vars(Then1, VarsThen, LambdaVarsThen) },
 	{ set__union(OutsideVars, VarsThen, OutsideVars1) },
 	{ set__union(LambdaOutsideVars, LambdaVarsThen, LambdaOutsideVars1) },
 	quantification__set_quant_vars(QuantVars1),
@@ -381,7 +381,7 @@
 	quantification__set_outside(OutsideVars0),
 	quantification__set_nonlocals(NonLocals).
 
-:- pred implicitly_quantify_conj(list(hlds__goal), list(hlds__goal), 
+:- pred implicitly_quantify_conj(list(hlds_goal), list(hlds_goal), 
 					quant_info, quant_info).
 :- mode implicitly_quantify_conj(in, out, in, out) is det.
 
@@ -389,8 +389,8 @@
 	{ get_vars(Goals0, FollowingVarsList) },
 	implicitly_quantify_conj_2(Goals0, FollowingVarsList, Goals).
 
-:- pred implicitly_quantify_conj_2(list(hlds__goal), list(pair(set(var))),
-			list(hlds__goal), quant_info, quant_info).
+:- pred implicitly_quantify_conj_2(list(hlds_goal), list(pair(set(var))),
+			list(hlds_goal), quant_info, quant_info).
 :- mode implicitly_quantify_conj_2(in, in, out, in, out) is det.
 
 implicitly_quantify_conj_2([], _, []) -->
@@ -421,7 +421,7 @@
 	quantification__set_outside(OutsideVars),
 	quantification__set_nonlocals(NonLocalVars).
 
-:- pred implicitly_quantify_disj(list(hlds__goal), list(hlds__goal), 
+:- pred implicitly_quantify_disj(list(hlds_goal), list(hlds_goal), 
 					quant_info, quant_info).
 :- mode implicitly_quantify_disj(in, out, in, out) is det.
 
@@ -475,14 +475,14 @@
 	% and the second contains following variables that
 	% occur in lambda goals.
 
-:- pred get_vars(list(hlds__goal), list(pair(set(var)))).
+:- pred get_vars(list(hlds_goal), list(pair(set(var)))).
 :- mode get_vars(in, out) is det.
 
 get_vars([], []).
 get_vars([_Goal | Goals], [Set - LambdaSet | SetPairs]) :-
 	get_vars_2(Goals, Set, LambdaSet, SetPairs).
 
-:- pred get_vars_2(list(hlds__goal), set(var), set(var), list(pair(set(var)))).
+:- pred get_vars_2(list(hlds_goal), set(var), set(var), list(pair(set(var)))).
 :- mode get_vars_2(in, out, out, out) is det.
 
 get_vars_2([], Set, LambdaSet, []) :-
@@ -490,18 +490,18 @@
 	set__init(LambdaSet).
 get_vars_2([Goal | Goals], Set, LambdaSet, SetPairList) :-
 	get_vars_2(Goals, Set0, LambdaSet0, SetPairList0),
-	goal_vars(Goal, Set1, LambdaSet1),
+	quantification__goal_vars(Goal, Set1, LambdaSet1),
 	set__union(Set0, Set1, Set),
 	set__union(LambdaSet0, LambdaSet1, LambdaSet),
 	SetPairList = [Set0 - LambdaSet0 | SetPairList0].
 
-:- pred goal_list_vars_2(list(hlds__goal), set(var), set(var),
+:- pred goal_list_vars_2(list(hlds_goal), set(var), set(var),
 			set(var), set(var)).
 :- mode goal_list_vars_2(in, in, in, out, out) is det.
 
 goal_list_vars_2([], Set, LambdaSet, Set, LambdaSet).
 goal_list_vars_2([Goal - _GoalInfo| Goals], Set0, LambdaSet0, Set, LambdaSet) :-
-	goal_vars_2(Goal, Set0, LambdaSet0, Set1, LambdaSet1),
+	quantification__goal_vars_2(Goal, Set0, LambdaSet0, Set1, LambdaSet1),
 	goal_list_vars_2(Goals, Set1, LambdaSet1, Set, LambdaSet).
 
 :- pred case_list_vars_2(list(case), set(var), set(var), set(var), set(var)).
@@ -510,81 +510,88 @@
 case_list_vars_2([], Set, LambdaSet, Set, LambdaSet).
 case_list_vars_2([case(_Cons, Goal - _GoalInfo)| Cases], Set0, LambdaSet0,
 			Set, LambdaSet) :-
-	goal_vars_2(Goal, Set0, LambdaSet0, Set1, LambdaSet1),
+	quantification__goal_vars_2(Goal, Set0, LambdaSet0, Set1, LambdaSet1),
 	case_list_vars_2(Cases, Set1, LambdaSet1, Set, LambdaSet).
 
-	% goal_vars(Goal, Vars):
+	% quantification__goal_vars(Goal, Vars):
 	%	Vars is the set of variables that occur free (unquantified)
 	%	in Goal.
-goal_vars(Goal, BothSet) :-
-	goal_vars(Goal, NonLambdaSet, LambdaSet),
+quantification__goal_vars(Goal, BothSet) :-
+	quantification__goal_vars(Goal, NonLambdaSet, LambdaSet),
 	set__union(NonLambdaSet, LambdaSet, BothSet).
 
-	% goal_vars(Goal, NonLambdaSet, LambdaSet):
+	% quantification__goal_vars(Goal, NonLambdaSet, LambdaSet):
 	%	Set is the set of variables that occur free (unquantified)
 	%	in Goal, not counting occurrences in lambda expressions.
 	%	LambdaSet is the set of variables that occur free (unquantified)
 	%	in lambda expressions in Goal.
-:- pred goal_vars(hlds__goal, set(var), set(var)).
-:- mode goal_vars(in, out, out) is det.
+:- pred quantification__goal_vars(hlds_goal, set(var), set(var)).
+:- mode quantification__goal_vars(in, out, out) is det.
 
-goal_vars(Goal - _GoalInfo, Set, LambdaSet) :-
+quantification__goal_vars(Goal - _GoalInfo, Set, LambdaSet) :-
 	set__init(Set0),
 	set__init(LambdaSet0),
-	goal_vars_2(Goal, Set0, LambdaSet0, Set, LambdaSet).
+	quantification__goal_vars_2(Goal, Set0, LambdaSet0, Set, LambdaSet).
 
-:- pred goal_vars_2(hlds__goal_expr, set(var), set(var), set(var), set(var)).
-:- mode goal_vars_2(in, in, in, out, out) is det.
+:- pred quantification__goal_vars_2(hlds_goal_expr, set(var), set(var),
+		set(var), set(var)).
+:- mode quantification__goal_vars_2(in, in, in, out, out) is det.
 
-goal_vars_2(unify(A, B, _, _, _), Set0, LambdaSet0, Set, LambdaSet) :-
+quantification__goal_vars_2(unify(A, B, _, _, _), Set0, LambdaSet0,
+		Set, LambdaSet) :-
 	set__insert(Set0, A, Set1),
 	quantification__unify_rhs_vars(B, Set1, LambdaSet0, Set, LambdaSet).
 
-goal_vars_2(higher_order_call(PredVar, ArgVars, _, _, _), Set0, LambdaSet,
-			Set, LambdaSet) :-
+quantification__goal_vars_2(higher_order_call(PredVar, ArgVars, _, _, _),
+		Set0, LambdaSet, Set, LambdaSet) :-
 	set__insert_list(Set0, [PredVar | ArgVars], Set).
 
-goal_vars_2(call(_, _, ArgVars, _, _, _), Set0, LambdaSet, Set, LambdaSet) :-
+quantification__goal_vars_2(call(_, _, ArgVars, _, _, _), Set0, LambdaSet,
+		Set, LambdaSet) :-
 	set__insert_list(Set0, ArgVars, Set).
 
-goal_vars_2(conj(Goals), Set0, LambdaSet0, Set, LambdaSet) :-
+quantification__goal_vars_2(conj(Goals), Set0, LambdaSet0, Set, LambdaSet) :-
 	goal_list_vars_2(Goals, Set0, LambdaSet0, Set, LambdaSet).
 
-goal_vars_2(disj(Goals, _), Set0, LambdaSet0, Set, LambdaSet) :-
+quantification__goal_vars_2(disj(Goals, _), Set0, LambdaSet0, Set, LambdaSet) :-
 	goal_list_vars_2(Goals, Set0, LambdaSet0, Set, LambdaSet).
 
-goal_vars_2(switch(Var, _Det, Cases, _), Set0, LambdaSet0, Set, LambdaSet) :-
+quantification__goal_vars_2(switch(Var, _Det, Cases, _), Set0, LambdaSet0,
+		Set, LambdaSet) :-
 	set__insert(Set0, Var, Set1),
 	case_list_vars_2(Cases, Set1, LambdaSet0, Set, LambdaSet).
 
-goal_vars_2(some(Vars, Goal), Set0, LambdaSet0, Set, LambdaSet) :-
-	goal_vars(Goal, Set1, LambdaSet1),
+quantification__goal_vars_2(some(Vars, Goal), Set0, LambdaSet0,
+		Set, LambdaSet) :-
+	quantification__goal_vars(Goal, Set1, LambdaSet1),
 	set__delete_list(Set1, Vars, Set2),
 	set__delete_list(LambdaSet1, Vars, LambdaSet2),
 	set__union(Set0, Set2, Set),
 	set__union(LambdaSet0, LambdaSet2, LambdaSet).
 
-goal_vars_2(not(Goal - _GoalInfo), Set0, LambdaSet0, Set, LambdaSet) :-
-	goal_vars_2(Goal, Set0, LambdaSet0, Set, LambdaSet).
+quantification__goal_vars_2(not(Goal - _GoalInfo), Set0, LambdaSet0,
+		Set, LambdaSet) :-
+	quantification__goal_vars_2(Goal, Set0, LambdaSet0, Set, LambdaSet).
 
-goal_vars_2(if_then_else(Vars, A, B, C, _), Set0, LambdaSet0, Set, LambdaSet) :-
-		% This code does the following:
-		%     Set = Set0 + ( (vars(A) + vars(B)) \ Vars ) + vars(C)
-		% where `+' is set union and `\' is relative complement.
-	goal_vars(A, Set1, LambdaSet1),
-	goal_vars(B, Set2, LambdaSet2),
+quantification__goal_vars_2(if_then_else(Vars, A, B, C, _), Set0, LambdaSet0,
+		Set, LambdaSet) :-
+	% This code does the following:
+	%     Set = Set0 + ( (vars(A) + vars(B)) \ Vars ) + vars(C)
+	% where `+' is set union and `\' is relative complement.
+	quantification__goal_vars(A, Set1, LambdaSet1),
+	quantification__goal_vars(B, Set2, LambdaSet2),
 	set__union(Set1, Set2, Set3),
 	set__union(LambdaSet1, LambdaSet2, LambdaSet3),
 	set__delete_list(Set3, Vars, Set4),
 	set__delete_list(LambdaSet3, Vars, LambdaSet4),
 	set__union(Set0, Set4, Set5),
 	set__union(LambdaSet0, LambdaSet4, LambdaSet5),
-	goal_vars(C, Set6, LambdaSet6),
+	quantification__goal_vars(C, Set6, LambdaSet6),
 	set__union(Set5, Set6, Set),
 	set__union(LambdaSet5, LambdaSet6, LambdaSet).
 
-goal_vars_2(pragma_c_code(_, _, _, _, ArgVars, _, _), Set0, LambdaSet,
-		Set, LambdaSet) :-
+quantification__goal_vars_2(pragma_c_code(_, _, _, _, ArgVars, _, _),
+		Set0, LambdaSet, Set, LambdaSet) :-
 	set__insert_list(Set0, ArgVars, Set).
 
 :- pred quantification__unify_rhs_vars(unify_rhs, set(var), set(var),
@@ -598,7 +605,7 @@
 	set__insert_list(Set0, ArgVars, Set).
 quantification__unify_rhs_vars(lambda_goal(_PredOrFunc, LambdaVars, _Modes,
 		_Detism, Goal), Set, LambdaSet0, Set, LambdaSet) :-
-	goal_vars(Goal, GoalVars),
+	quantification__goal_vars(Goal, GoalVars),
 	set__delete_list(GoalVars, LambdaVars, GoalVars1),
 	set__union(LambdaSet0, GoalVars1, LambdaSet).
 
@@ -622,7 +629,7 @@
 %	Apply RenameMap to Goal0 giving Goal.
 
 :- pred quantification__rename_apart(set(var), map(var, var),
-				hlds__goal, hlds__goal, quant_info, quant_info).
+				hlds_goal, hlds_goal, quant_info, quant_info).
 :- mode quantification__rename_apart(in, out, in, out, in, out) is det.
 
 quantification__rename_apart(RenameSet, RenameMap, Goal0, Goal) -->
Index: make_hlds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/make_hlds.m,v
retrieving revision 1.221
diff -u -r1.221 make_hlds.m
--- make_hlds.m	1997/02/20 03:04:21	1.221
+++ make_hlds.m	1997/02/22 11:27:09
@@ -37,7 +37,7 @@
 :- mode parse_tree_to_hlds(in, in, out, out, out, di, uo) is det.
 
 :- pred create_atomic_unification(var, unify_rhs, term__context,
-			unify_main_context, unify_sub_contexts, hlds__goal).
+			unify_main_context, unify_sub_contexts, hlds_goal).
 :- mode create_atomic_unification(in, in, in, in, in, out) is det.
 
 :- pred add_new_proc(pred_info, arity, list(mode), maybe(list(is_live)),
@@ -589,7 +589,7 @@
 			Cond, Context, Status, Insts) -->
 	{ list__length(Args, Arity) },
 	(
-		{ I = hlds__inst_defn(VarSet, Args, eqv_inst(Body), Cond,
+		{ I = hlds_inst_defn(VarSet, Args, eqv_inst(Body), Cond,
 					Context, Status) },
 		{ user_inst_table_insert(Insts0, Name - Arity, I, Insts1) }
 	->
@@ -597,7 +597,7 @@
 	;
 		{ Insts = Insts0 },
 		% If abstract insts are implemented, this will need to change
-		% to update the hlds__inst_defn to the non-abstract inst.
+		% to update the hlds_inst_defn to the non-abstract inst.
 		( { Status = opt_imported } ->
 			[]
 		;
@@ -605,7 +605,7 @@
 			%	 module_info_incr_errors
 			{ user_inst_table_get_inst_defns(Insts, InstDefns) },
 			{ map__lookup(InstDefns, Name - Arity, OrigI) },
-			{ OrigI = hlds__inst_defn(_, _, _, _,
+			{ OrigI = hlds_inst_defn(_, _, _, _,
 						OrigContext, _) },
 			multiple_def_error(Name, Arity, "inst",
 					Context, OrigContext)
@@ -632,7 +632,7 @@
 			Cond, Context, Status, Modes) -->
 	{ list__length(Args, Arity) },
 	(
-		{ I = hlds__mode_defn(VarSet, Args, eqv_mode(Body), Cond,
+		{ I = hlds_mode_defn(VarSet, Args, eqv_mode(Body), Cond,
 			Context, Status) },
 		{ mode_table_insert(Modes0, Name - Arity, I, Modes1) }
 	->
@@ -644,7 +644,7 @@
 		;
 			{ mode_table_get_mode_defns(Modes, ModeDefns) },
 			{ map__lookup(ModeDefns, Name - Arity, OrigI) },
-			{ OrigI = hlds__mode_defn(_, _, _, _,
+			{ OrigI = hlds_mode_defn(_, _, _, _,
 						OrigContext, _) },
 			% XXX we should record each error using
 			% 	module_info_incr_errors
@@ -653,7 +653,7 @@
 		)
 	).
 
-:- pred mode_name_args(mode_defn, sym_name, list(inst_param), hlds__mode_body).
+:- pred mode_name_args(mode_defn, sym_name, list(inst_param), hlds_mode_body).
 :- mode mode_name_args(in, out, out, out) is det.
 
 mode_name_args(eqv_mode(Name, Args, Body), Name, Args, eqv_mode(Body)).
@@ -861,7 +861,7 @@
 	module_info_set_shape_info(Module0, Shape_Info, Module).
 
 :- pred add_special_preds(module_info, tvarset, type, type_id, 
-		hlds__type_body, term__context, import_status, module_info).
+		hlds_type_body, term__context, import_status, module_info).
 :- mode add_special_preds(in, in, in, in, in, in, in, out) is det.
 
 add_special_preds(Module0, TVarSet, Type, TypeId,
@@ -876,7 +876,7 @@
 	).
 	
 :- pred convert_type_defn(type_defn, globals,
-			sym_name, list(type_param), hlds__type_body).
+			sym_name, list(type_param), hlds_type_body).
 :- mode convert_type_defn(in, in, out, out, out) is det.
 
 convert_type_defn(du_type(Name, Args, Body), Globals, Name, Args,
@@ -894,7 +894,7 @@
 ctors_add([Name - Args | Rest], TypeId, Context, Ctors0, Ctors) -->
 	{ make_cons_id(Name, Args, TypeId, ConsId) },
 	{ assoc_list__values(Args, Types) },
-	{ ConsDefn = hlds__cons_defn(Types, TypeId, Context) },
+	{ ConsDefn = hlds_cons_defn(Types, TypeId, Context) },
 	( %%% some [ConsDefns0]
 		{ map__search(Ctors0, ConsId, ConsDefns0) }
 	->
@@ -904,7 +904,7 @@
 	),
 	(
 		{ list__member(OtherConsDefn, ConsDefns1) },
-		{ OtherConsDefn = hlds__cons_defn(_, TypeId, _) }
+		{ OtherConsDefn = hlds_cons_defn(_, TypeId, _) }
 	->
 		% XXX we should record each error using module_info_incr_errors
 		io__stderr_stream(StdErr),
@@ -1123,7 +1123,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pred add_special_pred_list(list(special_pred_id),
-			module_info, tvarset, type, type_id, hlds__type_body,
+			module_info, tvarset, type, type_id, hlds_type_body,
 			term__context, import_status,
 			module_info).
 :- mode add_special_pred_list(in, in, in, in, in, in, in, in, out) is det.
@@ -1137,7 +1137,7 @@
 		TVarSet, Type, TypeId, Body, Context, Status, Module).
 
 :- pred add_special_pred(special_pred_id,
-			module_info, tvarset, type, type_id, hlds__type_body,
+			module_info, tvarset, type, type_id, hlds_type_body,
 			term__context, import_status,
 			module_info).
 :- mode add_special_pred(in, in, in, in, in, in, in, in, out) is det.
@@ -1838,7 +1838,7 @@
 	% an underscore, or about variables which do start with an underscore
 	% but occur more than once.
 	%
-:- pred maybe_warn_singletons(varset, pred_call_id, hlds__goal,
+:- pred maybe_warn_singletons(varset, pred_call_id, hlds_goal,
 				io__state, io__state).
 :- mode maybe_warn_singletons(in, in, in, di, uo) is det.
 
@@ -1851,7 +1851,7 @@
 		[]
 	).
 
-:- pred warn_singletons_in_goal(hlds__goal, set(var), varset, pred_call_id,
+:- pred warn_singletons_in_goal(hlds_goal, set(var), varset, pred_call_id,
 				io__state, io__state).
 :- mode warn_singletons_in_goal(in, in, in, in, di, uo) is det.
 
@@ -1859,7 +1859,7 @@
 	warn_singletons_in_goal_2(Goal, GoalInfo, QuantVars, VarSet,
 		PredCallId).
 
-:- pred warn_singletons_in_goal_2(hlds__goal_expr, hlds__goal_info, set(var),
+:- pred warn_singletons_in_goal_2(hlds_goal_expr, hlds_goal_info, set(var),
 				varset, pred_call_id, io__state, io__state).
 :- mode warn_singletons_in_goal_2(in, in, in, in, in, di, uo) is det.
 
@@ -1885,7 +1885,7 @@
 	% warn if any quantified variables occur only in the quantifier
 	%
 	( { Vars \= [] } ->
-		{ goal_vars(SubGoal, SubGoalVars) },
+		{ quantification__goal_vars(SubGoal, SubGoalVars) },
 		{ goal_info_get_context(GoalInfo, Context) },
 		{ set__init(EmptySet) },
 		warn_singletons(Vars, EmptySet, SubGoalVars, VarSet, Context,
@@ -1903,8 +1903,8 @@
 	% or the "then" part of the if-then-else
 	%
 	( { Vars \= [] } ->
-		{ goal_vars(Cond, CondVars) },
-		{ goal_vars(Then, ThenVars) },
+		{ quantification__goal_vars(Cond, CondVars) },
+		{ quantification__goal_vars(Then, ThenVars) },
 		{ set__union(CondVars, ThenVars, CondThenVars) },
 		{ goal_info_get_context(GoalInfo, Context) },
 		{ set__init(EmptySet) },
@@ -1944,7 +1944,7 @@
 	warn_singletons_in_pragma_c_code(C_Code, ArgNames, Context, 
 		PredCallId).
 
-:- pred warn_singletons_in_goal_list(list(hlds__goal), set(var), varset,
+:- pred warn_singletons_in_goal_list(list(hlds_goal), set(var), varset,
 				pred_call_id, io__state, io__state).
 :- mode warn_singletons_in_goal_list(in, in, in, in, di, uo) is det.
 
@@ -1963,7 +1963,7 @@
 	warn_singletons_in_goal(Goal, QuantVars, VarSet, CallPredId),
 	warn_singletons_in_cases(Cases, QuantVars, VarSet, CallPredId).
 
-:- pred warn_singletons_in_unify(var, unify_rhs, hlds__goal_info, set(var),
+:- pred warn_singletons_in_unify(var, unify_rhs, hlds_goal_info, set(var),
 			varset, pred_call_id, io__state, io__state).
 :- mode warn_singletons_in_unify(in, in, in, in, in, in, di, uo) is det.
 
@@ -2235,7 +2235,7 @@
 
 :- pred clauses_info_add_clause(clauses_info::in, pred_id::in, 
 		list(proc_id)::in, varset::in, tvarset::in, list(term)::in,
-		goal::in, term__context::in, hlds__goal::out, varset::out,
+		goal::in, term__context::in, hlds_goal::out, varset::out,
 		tvarset::out, clauses_info::out, list(quant_warning)::out,
 		qual_info::in, qual_info::out,
 		io__state::di, io__state::uo) is det.
@@ -2261,11 +2261,11 @@
 % Add the pragma_c_code goal to the clauses_info for this procedure.
 % To do so, we must also insert unifications between the variables in the
 % pragma c_code declaration and the head vars of the pred. Also return the
-% hlds__goal.
+% hlds_goal.
 
 :- pred clauses_info_add_pragma_c_code(clauses_info, may_call_mercury,
 	pred_id, proc_id, varset, list(pragma_var), string, term__context,
-	maybe(pair(list(string))), clauses_info, hlds__goal,
+	maybe(pair(list(string))), clauses_info, hlds_goal,
 	qual_info, qual_info, io__state, io__state) is det.
 :- mode clauses_info_add_pragma_c_code(in, in, in, in, in, in, in, in, in,
 	out, out, in, out, di, uo) is det.
@@ -2326,7 +2326,7 @@
 %-----------------------------------------------------------------------------
 
 :- pred transform(substitution, list(var), list(term), goal, varset,
-			term__context, hlds__goal, varset, list(quant_warning),
+			term__context, hlds_goal, varset, list(quant_warning),
 			qual_info, qual_info, io__state, io__state).
 :- mode transform(in, in, in, in, in, in, out, out, out,
 			in, out, di, uo) is det.
@@ -2344,14 +2344,14 @@
 %-----------------------------------------------------------------------------%
 
 	% Convert goals from the prog_data `goal' structure into the
-	% hlds `hlds__goal' structure.  At the same time, convert
+	% hlds `hlds_goal' structure.  At the same time, convert
 	% it to super-homogeneous form by unravelling all the complex
 	% unifications, and annotate those unifications with a unify_context
 	% so that we can still give good error messages.
 	% And also at the same time, apply the given substitution to
 	% the goal, to rename it apart from the other clauses.
 
-:- pred transform_goal(goal, varset, substitution, hlds__goal, varset,
+:- pred transform_goal(goal, varset, substitution, hlds_goal, varset,
 			qual_info, qual_info, io__state, io__state).
 :- mode transform_goal(in, in, in, out, out, in, out, di, uo) is det.
 
@@ -2362,7 +2362,7 @@
 	{ goal_info_set_context(GoalInfo0, Context, GoalInfo1) }.
 
 :- pred transform_goal_2(goal_expr, term__context, varset, substitution,
-		hlds__goal, varset, qual_info, qual_info, io__state, io__state).
+		hlds_goal, varset, qual_info, qual_info, io__state, io__state).
 :- mode transform_goal_2(in, in, in, in, out, out, in, out, di, uo) is det.
 
 transform_goal_2(fail, _, VarSet, _, disj([], Empty) - GoalInfo, VarSet,
@@ -2511,7 +2511,7 @@
 		).
 
 :- pred insert_arg_unifications(list(var), list(term),
-		term__context, arg_context, hlds__goal, varset, hlds__goal,
+		term__context, arg_context, hlds_goal, varset, hlds_goal,
 		varset, qual_info, qual_info, io__state, io__state).
 :- mode insert_arg_unifications(in, in, in, in, in, in, out, out,
 		in, out, di, uo) is det.
@@ -2531,8 +2531,8 @@
 	).
 
 :- pred insert_arg_unifications_2(list(var), list(term),
-		term__context, arg_context, int, list(hlds__goal), varset,
-		list(hlds__goal), varset, qual_info, qual_info,
+		term__context, arg_context, int, list(hlds_goal), varset,
+		list(hlds_goal), varset, qual_info, qual_info,
 		io__state, io__state).
 :- mode insert_arg_unifications_2(in, in, in, in, in, in, in, out,
 		out, in, out, di, uo) is det.
@@ -2569,7 +2569,7 @@
 	% than before the goal.
 
 :- pred append_arg_unifications(list(var), list(term),
-		term__context, arg_context, hlds__goal, varset, hlds__goal,
+		term__context, arg_context, hlds_goal, varset, hlds_goal,
 		varset, qual_info, qual_info, io__state, io__state).
 :- mode append_arg_unifications(in, in, in, in, in, in,
 		out, out, in, out, di, uo) is det.
@@ -2589,8 +2589,8 @@
 	).
 
 :- pred append_arg_unifications_2(list(var), list(term),
-	term__context, arg_context, int, list(hlds__goal), varset,
-	list(hlds__goal), varset, qual_info, qual_info, io__state, io__state).
+	term__context, arg_context, int, list(hlds_goal), varset,
+	list(hlds_goal), varset, qual_info, qual_info, io__state, io__state).
 :- mode append_arg_unifications_2(in, in, in, in, in, in, in,
 	out, out, in, out, di, uo) is det.
 
@@ -2668,7 +2668,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pred unravel_unification(term, term, term__context,
-		unify_main_context, unify_sub_contexts, varset, hlds__goal,
+		unify_main_context, unify_sub_contexts, varset, hlds_goal,
 		varset, qual_info, qual_info, io__state, io__state).
 :- mode unravel_unification(in, in, in, in, in, in, out, out,
 		in, out, di, uo) is det.
@@ -2874,7 +2874,7 @@
 	{ list__append(ConjList0, ConjList1, ConjList) },
 	{ conj_list_to_goal(ConjList, GoalInfo, Goal) }.
 
-	% create the hlds__goal for a unification which cannot be
+	% create the hlds_goal for a unification which cannot be
 	% further simplified, filling in all the as yet
 	% unknown slots with dummy values
 
@@ -2994,8 +2994,8 @@
 % 	Goal is a tree of conjuncts.  Flatten it into a list (applying Subst),
 %	append Conj0, and return the result in Conj.
 
-:- pred get_conj(goal, substitution, list(hlds__goal), varset,
-	list(hlds__goal), varset, qual_info, qual_info, io__state, io__state).
+:- pred get_conj(goal, substitution, list(hlds_goal), varset,
+	list(hlds_goal), varset, qual_info, qual_info, io__state, io__state).
 :- mode get_conj(in, in, in, in, out, out, in, out, di, uo) is det.
 
 get_conj(Goal, Subst, Conj0, VarSet0, Conj, VarSet, Info0, Info) -->
@@ -3016,8 +3016,8 @@
 % 	Goal is a tree of disjuncts.  Flatten it into a list (applying Subst)
 %	append Disj0, and return the result in Disj.
 
-:- pred get_disj(goal, substitution, list(hlds__goal), varset,
-	list(hlds__goal), varset, qual_info, qual_info, io__state, io__state).
+:- pred get_disj(goal, substitution, list(hlds_goal), varset,
+	list(hlds_goal), varset, qual_info, qual_info, io__state, io__state).
 :- mode get_disj(in, in, in, in, out, out, in, out, di, uo) is det.
 
 get_disj(Goal, Subst, Disj0, VarSet0, Disj, VarSet, Info0, Info) -->
Index: mercury_to_c.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_c.m,v
retrieving revision 1.21
diff -u -r1.21 mercury_to_c.m
--- mercury_to_c.m	1997/01/27 07:45:20	1.21
+++ mercury_to_c.m	1997/02/22 11:26:56
@@ -289,7 +289,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred c_gen_predeclare_labels(hlds__goal, c_gen_info, io__state, io__state).
+:- pred c_gen_predeclare_labels(hlds_goal, c_gen_info, io__state, io__state).
 :- mode c_gen_predeclare_labels(in, in, di, uo) is det.
 
 	% XXX this should traverse the goal and count how many function labels
@@ -461,13 +461,13 @@
 	),
 	mercury_output_var(Var, VarSet, no).
 
-:- pred c_gen_local_var_decls(int, hlds__goal, varset, map(var, type),
+:- pred c_gen_local_var_decls(int, hlds_goal, varset, map(var, type),
 				list(var),
 				io__state, io__state).
 :- mode c_gen_local_var_decls(in, in, in, in, in, di, uo) is det.
 
 c_gen_local_var_decls(Indent, Goal, VarSet, VarTypes, HeadVars) -->
-	{ goal_vars(Goal, Vars0) },
+	{ quantification__goal_vars(Goal, Vars0) },
 	{ set__to_sorted_list(Vars0, Vars) },
 	{ list__delete_elems(Vars, HeadVars, LocalVars) },
 	c_gen_local_var_decls_2(LocalVars, VarSet, VarTypes, Indent).
@@ -488,7 +488,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred c_gen_goal(hlds__goal, int, c_gen_info, c_gen_info,
+:- pred c_gen_goal(hlds_goal, int, c_gen_info, c_gen_info,
 				io__state, io__state).
 :- mode c_gen_goal(in, in, in, out, di, uo) is det.
 
@@ -512,7 +512,7 @@
 	),
 	c_gen_goal_2(Goal, Indent, CGenInfo0, CGenInfo).
 
-:- pred c_gen_goal_2(hlds__goal_expr, int, c_gen_info, c_gen_info,
+:- pred c_gen_goal_2(hlds_goal_expr, int, c_gen_info, c_gen_info,
 					io__state, io__state).
 :- mode c_gen_goal_2(in, in, in, out, di, uo) is det.
 
@@ -792,7 +792,7 @@
 c_gen_var_modes([_|_], [], _) -->
 	{ error("c_gen_var_modes: length mis-match") }.
 
-:- pred c_gen_conj(list(hlds__goal), int, c_gen_info, c_gen_info,
+:- pred c_gen_conj(list(hlds_goal), int, c_gen_info, c_gen_info,
 				io__state, io__state).
 :- mode c_gen_conj(in, in, in, out, di, uo) is det.
 
@@ -801,7 +801,7 @@
 	c_gen_goal(Goal, Indent, CGenInfo0, CGenInfo1),
 	c_gen_conj(Goals, Indent, CGenInfo1, CGenInfo).
 
-:- pred c_gen_disj(list(hlds__goal), c_label_func, int, c_gen_info, c_gen_info,
+:- pred c_gen_disj(list(hlds_goal), c_label_func, int, c_gen_info, c_gen_info,
 				io__state, io__state).
 :- mode c_gen_disj(in, in, in, in, out, di, uo) is det.
 
Index: dupelim.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/dupelim.m,v
retrieving revision 1.17
diff -u -r1.17 dupelim.m
--- dupelim.m	1997/01/21 05:04:56	1.17
+++ dupelim.m	1997/02/22 15:07:49
@@ -16,9 +16,9 @@
 
 :- import_module list, llds.
 
-:- pred dupelim__main(list(instruction), list(instruction)).
-% :- mode dupelim__main(di, uo) is det.
-:- mode dupelim__main(in, out) is det.
+:- pred dupelim_main(list(instruction), list(instruction)).
+% :- mode dupelim_main(di, uo) is det.
+:- mode dupelim_main(in, out) is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -30,7 +30,7 @@
 
 :- type block == pair(label, list(instruction)).
 
-dupelim__main(Instrs0, Instrs) :-
+dupelim_main(Instrs0, Instrs) :-
 	map__init(Seqmap0),
 	map__init(Replmap0),
 	opt_util__skip_to_next_label(Instrs0, Initial, Instrs1),
Index: optimize.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/optimize.m,v
retrieving revision 1.4
diff -u -r1.4 optimize.m
--- optimize.m	1997/01/11 08:51:16	1.4
+++ optimize.m	1997/02/22 15:09:37
@@ -185,7 +185,7 @@
 		;
 			[]
 		),
-		{ dupelim__main(Instrs4, Instrs) },
+		{ dupelim_main(Instrs4, Instrs) },
 		( { Instrs = Instrs4 } ->
 			[]
 		;
Index: prog_io_dcg.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_io_dcg.m,v
retrieving revision 1.2
diff -u -r1.2 prog_io_dcg.m
--- prog_io_dcg.m	1997/02/22 08:26:33	1.2
+++ prog_io_dcg.m	1997/02/22 11:06:50
@@ -117,13 +117,6 @@
 :- mode parse_dcg_goal_2(in, in, in, in, in, in, out, out, out, out)
 				is semidet.
 
-	% The following is a temporary and gross hack to strip out
-	% calls to `io__gc_call', since the mode checker can't handle
-	% them yet.
-parse_dcg_goal_2("io__gc_call", [Goal0],
-		_, VarSet0, N0, Var0, Goal, VarSet, N, Var) :-
-	parse_dcg_goal(Goal0, VarSet0, N0, Var0, Goal, VarSet, N, Var).
-
 	% Ordinary goal inside { curly braces }.
 parse_dcg_goal_2("{}", [G], _, VarSet0, N, Var,
 		Goal, VarSet, N, Var) :-
Index: mercury_compile.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_compile.m,v
retrieving revision 1.30
diff -u -r1.30 mercury_compile.m
--- mercury_compile.m	1997/02/02 13:03:08	1.30
+++ mercury_compile.m	1997/02/22 11:10:59
@@ -142,8 +142,7 @@
 	maybe_write_string(Verbose, "% Parsing `"),
 	maybe_write_string(Verbose, ModuleName),
 	maybe_write_string(Verbose, ".m' and imported interfaces...\n"),
-	io__gc_call(read_mod(ModuleName, ".m", "Reading module", yes,
-			Items0, Error)),
+	read_mod(ModuleName, ".m", "Reading module", yes, Items0, Error),
 	globals__io_lookup_bool_option(statistics, Stats),
 	maybe_report_stats(Stats),
 
@@ -1518,7 +1517,7 @@
 	maybe_flush_output(Verbose),
 	io__tell(DumpFile, Res),
 	( { Res = ok } ->
-		io__gc_call(mercury_to_c__gen_hlds(0, HLDS)),
+		mercury_to_c__gen_hlds(0, HLDS),
 		io__told,
 		maybe_write_string(Verbose, " done.\n"),
 		maybe_report_stats(Stats)
@@ -1882,7 +1881,7 @@
 	maybe_flush_output(Verbose),
 	io__tell(DumpFile, Res),
 	( { Res = ok } ->
-		io__gc_call(hlds_out__write_hlds(0, HLDS)),
+		hlds_out__write_hlds(0, HLDS),
 		io__told,
 		maybe_write_string(Verbose, " done.\n"),
 		maybe_report_stats(Stats)
Index: modules.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modules.m,v
retrieving revision 1.30
diff -u -r1.30 modules.m
--- modules.m	1997/02/16 23:48:59	1.30
+++ modules.m	1997/02/22 11:11:47
@@ -1093,12 +1093,12 @@
 
 read_dependencies(Module, Search, InterfaceDeps, ImplementationDeps, 
 		FactTableDeps, Error) -->
-	io__gc_call(read_mod_ignore_errors(Module, ".m",
-			"Getting dependencies for module", Search, Items0, Error)),
+	read_mod_ignore_errors(Module, ".m",
+		"Getting dependencies for module", Search, Items0, Error),
 	( { Items0 = [], Error = fatal } ->
-		io__gc_call(read_mod_ignore_errors(Module, ".int", 
+		read_mod_ignore_errors(Module, ".int", 
 		    "Getting dependencies for module interface", Search, 
-		    Items, _Error))
+		    Items, _Error)
 	;
 		{ Items = Items0 }
 	),
@@ -1204,11 +1204,9 @@
 		process_module_interfaces(Imports, IndirectImports0,
 					Module0, Module)
 	;
-		io__gc_call(
-			read_mod_interface(Import,
-				"Reading interface for module", yes, 
-				LongIntItems1, Error1)
-		),
+		read_mod_interface(Import,
+			"Reading interface for module", yes, 
+			LongIntItems1, Error1),
 		% strip off the `:- interface' declaration at the start, if any
 		{
 			LongIntItems1 = [ FirstItem | LongIntItems2 ],
@@ -1269,11 +1267,9 @@
 	->
 		process_module_short_interfaces(Imports, Ext, Module0, Module)
 	;
-		io__gc_call(
-			read_mod_short_interface(Import, Ext,
+		read_mod_short_interface(Import, Ext,
 				"Reading short interface for module", yes,
-					ShortIntItems1, Error1)
-		),
+				ShortIntItems1, Error1),
 		% strip off the `:- interface' declaration at the start, if any
 		{
 			ShortIntItems1 = [ FirstItem | ShortIntItems2 ],
Index: llds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds_out.m,v
retrieving revision 1.37
diff -u -r1.37 llds_out.m
--- llds_out.m	1997/02/17 03:47:32	1.37
+++ llds_out.m	1997/02/22 15:24:18
@@ -2188,7 +2188,17 @@
 		llds_out__maybe_qualify_name(DeclaringModule, Name0,
 			LabelName0)
 	),
-	( DefiningModule \= DeclaringModule ->
+	(
+		% if this is a specialized version of a predicate
+		% defined in some other module, then it needs both
+		% module prefixes
+		DefiningModule \= DeclaringModule,
+		% but we don't do that for "mercury_builtin",
+		% because that would give the wrong results
+		% for the definitions of term__context_init etc.
+		% in mercury_builtin.m.
+		DefiningModule \= "mercury_builtin"
+	->
 		string__append_list([DefiningModule, "__", LabelName0],
 			LabelName1)
 	;
Index: base_type_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/base_type_info.m,v
retrieving revision 1.7
diff -u -r1.7 base_type_info.m
--- base_type_info.m	1997/02/18 02:50:53	1.7
+++ base_type_info.m	1997/02/22 16:36:27
@@ -132,7 +132,15 @@
 		PredAddrArgs),
 	ArityArg = yes(const(int_const(TypeArity))),
 	( 	
-		( Status = exported ; Status = abstract_exported )
+		( Status = exported ; Status = abstract_exported
+		; Status = imported 	% XXX this is a hack to make it work
+					% for `term__context', which is defined
+					% in mercury_builtin.m, but whose
+					% base_type_info is generated in
+					% term.m.  Apart from special cases
+					% in mercury_builtin.m, this should
+					% never happen.
+		)
 	->
 		Exported = yes
 	;


-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list