[m-rev.] for review: rename foreign_code to foreign_proc in the compiler

Tyson Dowd trd at cs.mu.OZ.AU
Mon Apr 2 17:19:24 AEST 2001


Hi,

===================================================================


Estimated hours taken: 4.0
Branches: main

Rename foreign_code as foreign_proc where appropriate in the compiler.
The rationale for this change is that it makes maintaining the code much
simpler because it is clear whether `foreign' refers to a slab of code
(foreign_code) or a procedure (foreign_proc).

:- type pragma_foreign_code_attributes 
:- type pragma_foreign_proc_attributes

The functors for pragma_type
	foreign(Lang, BodyCode)
	foreign(Attributes, Name, PredOrFunc, Vars, Varset, Impl)
become
	foreign_code(Lang, BodyCode)
	foreign_proc(Attributes, Name, PredOrFunc, Vars, Varset, Impl)

And the HLDS goal `pragma_foreign_code' becomes `foreign_proc'.

compiler/*.m:
	Update the compiler to use the new names.


Index: compiler/add_trail_ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/add_trail_ops.m,v
retrieving revision 1.1
diff -u -r1.1 add_trail_ops.m
--- compiler/add_trail_ops.m	2000/12/13 12:12:52	1.1
+++ compiler/add_trail_ops.m	2001/03/30 05:48:57
@@ -252,7 +252,7 @@
 goal_expr_add_trail_ops(unify(A,B,C,D,E), GI, unify(A,B,C,D,E) - GI) --> [].
 
 goal_expr_add_trail_ops(PragmaForeign, GoalInfo, Goal) -->
-	{ PragmaForeign = pragma_foreign_code(_,_,_,_,_,_,Impl) },
+	{ PragmaForeign = foreign_proc(_,_,_,_,_,_,Impl) },
 	( { Impl = nondet(_,_,_,_,_,_,_,_,_) } ->
 		% XXX Implementing trailing for nondet pragma foreign_code
 		% via transformation is difficult, because there's nowhere
Index: compiler/assertion.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.11
diff -u -r1.11 assertion.m
--- compiler/assertion.m	2001/03/05 10:30:59	1.11
+++ compiler/assertion.m	2001/03/30 05:48:47
@@ -548,8 +548,8 @@
 	equal_goals(IfA, IfB, Subst1, Subst2),
 	equal_goals(ThenA, ThenB, Subst2, Subst3),
 	equal_goals(ElseA, ElseB, Subst3, Subst).
-equal_goals(pragma_foreign_code(Attribs, PredId, _, VarsA, _, _, _) - _,
-		pragma_foreign_code(Attribs, PredId, _, VarsB, _, _, _) -
+equal_goals(foreign_proc(Attribs, PredId, _, VarsA, _, _, _) - _,
+		foreign_proc(Attribs, PredId, _, VarsB, _, _, _) -
 			_, Subst0, Subst) :-
 	equal_vars(VarsA, VarsB, Subst0, Subst).
 equal_goals(par_conj(GoalAs, _) - _, par_conj(GoalBs, _) - _, Subst0, Subst) :-
@@ -652,8 +652,8 @@
 assertion__normalise_goal(call(A,B,C,D,E,F) - GI, call(A,B,C,D,E,F) - GI).
 assertion__normalise_goal(generic_call(A,B,C,D) - GI, generic_call(A,B,C,D)-GI).
 assertion__normalise_goal(unify(A,B,C,D,E) - GI, unify(A,B,C,D,E) - GI).
-assertion__normalise_goal(pragma_foreign_code(A,B,C,D,E,F,G) - GI,
-		pragma_foreign_code(A,B,C,D,E,F,G) - GI).
+assertion__normalise_goal(foreign_proc(A,B,C,D,E,F,G) - GI,
+		foreign_proc(A,B,C,D,E,F,G) - GI).
 assertion__normalise_goal(conj(Goals0) - GI, conj(Goals) - GI) :-
 	assertion__normalise_conj(Goals0, Goals).
 assertion__normalise_goal(switch(A,B,Case0s,D) - GI, switch(A,B,Cases,D)-GI) :-
@@ -728,7 +728,7 @@
 	{ goal_info_get_context(GoalInfo, Context) },
 	assertion__in_interface_check_unify_rhs(RHS, Var, Context,
 			PredInfo, Module0, Module).
-assertion__in_interface_check(pragma_foreign_code(_,PredId,_,_,_,_,_) - 
+assertion__in_interface_check(foreign_proc(_,PredId,_,_,_,_,_) - 
 		GoalInfo, _PredInfo, Module0, Module) -->
 	{ module_info_pred_info(Module0, PredId, PragmaPredInfo) },
 	{ pred_info_import_status(PragmaPredInfo, ImportStatus) },
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.59
diff -u -r1.59 bytecode_gen.m
--- compiler/bytecode_gen.m	2001/02/19 02:05:57	1.59
+++ compiler/bytecode_gen.m	2001/03/30 05:48:15
@@ -279,7 +279,7 @@
 			tree(ElseCode,
 			     EndofIfCode))))))
 	;
-		GoalExpr = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr = foreign_proc(_, _, _, _, _, _, _),
 		Code = node([not_supported]),
 		ByteInfo = ByteInfo0
 	;
Index: compiler/code_aux.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_aux.m,v
retrieving revision 1.61
diff -u -r1.61 code_aux.m
--- compiler/code_aux.m	2000/11/23 04:32:28	1.61
+++ compiler/code_aux.m	2001/03/30 05:48:08
@@ -200,7 +200,7 @@
 code_aux__goal_is_flat_2(generic_call(_, _, _, _)).
 code_aux__goal_is_flat_2(call(_, _, _, _, _, _)).
 code_aux__goal_is_flat_2(unify(_, _, _, _, _)).
-code_aux__goal_is_flat_2(pragma_foreign_code(_, _, _, _, _, _, _)).
+code_aux__goal_is_flat_2(foreign_proc(_, _, _, _, _, _, _)).
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.94
diff -u -r1.94 code_gen.m
--- compiler/code_gen.m	2001/02/19 02:05:57	1.94
+++ compiler/code_gen.m	2001/04/01 06:43:40
@@ -734,7 +734,7 @@
 		{ code_info__resume_point_stack_addr(OutsideResumePoint,
 			OutsideResumeAddress) },
 		(
-			{ Goal = pragma_foreign_code(_, _, _, _, _, _,
+			{ Goal = foreign_proc(_, _, _, _, _, _,
 				PragmaCode) - _},
 			{ PragmaCode = nondet(Fields, FieldsContext,
 				_,_,_,_,_,_,_) }
@@ -1143,7 +1143,7 @@
 		call_gen__generate_builtin(CodeModel, PredId, ProcId, Args,
 			Code)
 	).
-code_gen__generate_goal_2(pragma_foreign_code(Attributes,
+code_gen__generate_goal_2(foreign_proc(Attributes,
 		PredId, ModeId, Args, ArgNames, OrigArgTypes, PragmaCode),
 		GoalInfo, CodeModel, Instr) -->
 	( 
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.129
diff -u -r1.129 code_util.m
--- compiler/code_util.m	2000/11/23 04:32:32	1.129
+++ compiler/code_util.m	2001/03/30 05:47:44
@@ -475,12 +475,12 @@
 	;
 		May = no
 	).
-	% We cannot safely say that a C code fragment does not allocate memory
-	% without knowing all the #defined macros that expand to incr_hp and
-	% variants thereof.
-	% XXX although you could make it an attribute of the C code and
+	% We cannot safely say that a foreign code fragment does not
+	% allocate memory without knowing all the #defined macros that
+	% expand to incr_hp and variants thereof.
+	% XXX although you could make it an attribute of the foreign code and
 	% trust the programmer
-code_util__goal_may_allocate_heap_2(pragma_foreign_code(_,_,_,_,_,_,_), yes).
+code_util__goal_may_allocate_heap_2(foreign_proc(_,_,_,_,_,_,_), yes).
 code_util__goal_may_allocate_heap_2(some(_Vars, _, Goal), May) :-
 	code_util__goal_may_allocate_heap(Goal, May).
 code_util__goal_may_allocate_heap_2(not(Goal), May) :-
@@ -544,11 +544,11 @@
 code_util__goal_may_alloc_temp_frame_2(generic_call(_, _, _, _), no).
 code_util__goal_may_alloc_temp_frame_2(call(_, _, _, _, _, _), no).
 code_util__goal_may_alloc_temp_frame_2(unify(_, _, _, _, _), no).
-	% We cannot safely say that a C code fragment does not allocate
+	% We cannot safely say that a foreign code fragment does not allocate
 	% temporary nondet frames without knowing all the #defined macros
 	% that expand to mktempframe and variants thereof. The performance
 	% impact of being too conservative is probably not too bad.
-code_util__goal_may_alloc_temp_frame_2(pragma_foreign_code(_,_,_,_,_,_,_),
+code_util__goal_may_alloc_temp_frame_2(foreign_proc(_,_,_,_,_,_,_),
 		yes).
 code_util__goal_may_alloc_temp_frame_2(some(_Vars, _, Goal), May) :-
 	Goal = _ - GoalInfo,
@@ -811,7 +811,7 @@
 code_util__count_recursive_calls_2(unify(_, _, _, _, _), _, _, 0, 0).
 code_util__count_recursive_calls_2(generic_call(_, _, _, _), _, _,
 		0, 0).
-code_util__count_recursive_calls_2(pragma_foreign_code(_, _, _, _, _, _, _),
+code_util__count_recursive_calls_2(foreign_proc(_, _, _, _, _, _, _),
 		_, _, 0, 0).
 code_util__count_recursive_calls_2(call(CallPredId, CallProcId, _, _, _, _),
 		PredId, ProcId, Count, Count) :-
Index: compiler/cse_detection.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/cse_detection.m,v
retrieving revision 1.68
diff -u -r1.68 cse_detection.m
--- compiler/cse_detection.m	2000/12/08 06:50:13	1.68
+++ compiler/cse_detection.m	2001/03/30 05:46:53
@@ -213,8 +213,8 @@
 	instmap::in, cse_info::in, cse_info::out, bool::out,
 	hlds_goal_expr::out) is det.
 
-detect_cse_in_goal_2(pragma_foreign_code(A,B,C,D,E,F,G), _, _, CseInfo,
-	CseInfo, no, pragma_foreign_code(A,B,C,D,E,F,G)).
+detect_cse_in_goal_2(foreign_proc(A,B,C,D,E,F,G), _, _, CseInfo,
+	CseInfo, no, foreign_proc(A,B,C,D,E,F,G)).
 
 detect_cse_in_goal_2(generic_call(A,B,C,D), _, _, CseInfo, CseInfo,
 	no, generic_call(A,B,C,D)).
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.63
diff -u -r1.63 dead_proc_elim.m
--- compiler/dead_proc_elim.m	2000/11/17 17:47:00	1.63
+++ compiler/dead_proc_elim.m	2001/03/30 05:46:42
@@ -485,7 +485,7 @@
 		NewNotation = yes(1),
 		map__set(Needed0, proc(PredId, ProcId), NewNotation, Needed)
 	).
-dead_proc_elim__examine_expr(pragma_foreign_code(_, PredId, ProcId, _, 
+dead_proc_elim__examine_expr(foreign_proc(_, PredId, ProcId, _, 
 		_, _, _), _CurrProc, Queue0, Queue, Needed0, Needed) :-
 	queue__put(Queue0, proc(PredId, ProcId), Queue),
 	map__set(Needed0, proc(PredId, ProcId), no, Needed).
@@ -881,7 +881,7 @@
 	pre_modecheck_examine_goal(Goal).
 pre_modecheck_examine_goal(call(_, _, _, _, _, PredName) - _) -->
 	dead_pred_info_add_pred_name(PredName).
-pre_modecheck_examine_goal(pragma_foreign_code(_, _, _, _, _, _, _) - _) -->
+pre_modecheck_examine_goal(foreign_proc(_, _, _, _, _, _, _) - _) -->
 	[].
 pre_modecheck_examine_goal(unify(_, Rhs, _, _, _) - _) -->
 	pre_modecheck_examine_unify_rhs(Rhs).
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.19
diff -u -r1.19 deforest.m
--- compiler/deforest.m	2001/03/27 05:23:05	1.19
+++ compiler/deforest.m	2001/03/30 05:46:30
@@ -201,7 +201,7 @@
 	deforest__cases(Var, Cases0, Cases).
 
 deforest__goal(Goal, Goal) -->
-	{ Goal = pragma_foreign_code(_, _, _, _, _, _, _) - _ }.
+	{ Goal = foreign_proc(_, _, _, _, _, _, _) - _ }.
 
 deforest__goal(Goal, Goal) -->
 	{ Goal = generic_call(_, _, _, _) - _ }.
Index: compiler/dependency_graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.51
diff -u -r1.51 dependency_graph.m
--- compiler/dependency_graph.m	2001/02/27 21:42:55	1.51
+++ compiler/dependency_graph.m	2001/03/30 05:46:21
@@ -346,9 +346,9 @@
 	    DepGraph0 = DepGraph
 	).
 
-% There can be no dependencies within a pragma_foreign_code
+% There can be no dependencies within a foreign_proc
 dependency_graph__add_arcs_in_goal_2(
-	pragma_foreign_code(_, _, _, _, _, _, _), _, DepGraph, DepGraph).
+	foreign_proc(_, _, _, _, _, _, _), _, DepGraph, DepGraph).
 
 dependency_graph__add_arcs_in_goal_2(bi_implication(LHS, RHS), Caller, 
 		DepGraph0, DepGraph) :-
@@ -737,7 +737,7 @@
 	).
 process_aditi_goal(_IsNeg, generic_call(_, _, _, _) - _, 
 		Map, Map) --> [].
-process_aditi_goal(_IsNeg, pragma_foreign_code(_, _, _, _, _, _, _) - _,
+process_aditi_goal(_IsNeg, foreign_proc(_, _, _, _, _, _, _) - _,
 		Map, Map) --> [].
 process_aditi_goal(_, bi_implication(_, _) - _, _, _) -->
 	% these should have been expanded out by now
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.148
diff -u -r1.148 det_analysis.m
--- compiler/det_analysis.m	2000/11/17 17:47:03	1.148
+++ compiler/det_analysis.m	2001/03/30 05:45:45
@@ -642,10 +642,10 @@
 		Goal, Det, Msgs).
 
 	% pragma foregin_codes are handled in the same way as predicate calls
-det_infer_goal_2(pragma_foreign_code(Attributes, PredId, ProcId,
+det_infer_goal_2(foreign_proc(Attributes, PredId, ProcId,
 			Args, ArgNameMap, OrigArgTypes, PragmaCode), 
 		GoalInfo, _, SolnContext, DetInfo, _, _,
-		pragma_foreign_code(Attributes, PredId, ProcId, Args,
+		foreign_proc(Attributes, PredId, ProcId, Args,
 			ArgNameMap, OrigArgTypes, PragmaCode),
 		Detism, Msgs) :-
 	det_info_get_module_info(DetInfo, ModuleInfo),
Index: compiler/det_report.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.65
diff -u -r1.65 det_report.m
--- compiler/det_report.m	2000/12/06 05:52:04	1.65
+++ compiler/det_report.m	2001/03/30 05:45:34
@@ -640,7 +640,7 @@
 	det_diagnose_goal(Goal, InternalDesired, SwitchContext, DetInfo,
 		Diagnosed).
 
-det_diagnose_goal_2(pragma_foreign_code(_, _, _, _, _, _, _), GoalInfo,
+det_diagnose_goal_2(foreign_proc(_, _, _, _, _, _, _), GoalInfo,
 		Desired, _, _, _, yes) -->
 	{ goal_info_get_context(GoalInfo, Context) },
 	prog_out__write_context(Context),
Index: compiler/dnf.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dnf.m,v
retrieving revision 1.42
diff -u -r1.42 dnf.m
--- compiler/dnf.m	2000/11/17 17:47:05	1.42
+++ compiler/dnf.m	2001/04/01 06:44:11
@@ -238,7 +238,7 @@
 		NewPredIds = NewPredIds0,
 		Goal = Goal0
 	;
-		GoalExpr0 = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr0 = foreign_proc(_, _, _, _, _, _, _),
 		ModuleInfo = ModuleInfo0,
 		NewPredIds = NewPredIds0,
 		Goal = Goal0
@@ -473,7 +473,7 @@
 		IsAtomic = no
 	).
 dnf__is_atomic_expr(_, _, _, if_then_else(_, _, _, _, _), no).
-dnf__is_atomic_expr(_, _, _, pragma_foreign_code(_, _, _, _, _, _, _), yes).
+dnf__is_atomic_expr(_, _, _, foreign_proc(_, _, _, _, _, _, _), yes).
 dnf__is_atomic_expr(_, _, _, bi_implication(_, _), no).
 
 :- pred dnf__free_of_nonatomic(hlds_goal::in,
@@ -512,7 +512,7 @@
 	dnf__free_of_nonatomic(Cond, NonAtomic),
 	dnf__free_of_nonatomic(Then, NonAtomic),
 	dnf__free_of_nonatomic(Else, NonAtomic).
-dnf__free_of_nonatomic(pragma_foreign_code(_, _, _, _, _, _, _) - _,
+dnf__free_of_nonatomic(foreign_proc(_, _, _, _, _, _, _) - _,
 		_NonAtomic).
 
 :- pred dnf__goals_free_of_nonatomic(list(hlds_goal)::in,
Index: compiler/excess.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/excess.m,v
retrieving revision 1.35
diff -u -r1.35 excess.m
--- compiler/excess.m	2000/11/17 17:47:06	1.35
+++ compiler/excess.m	2001/03/30 05:45:19
@@ -134,7 +134,7 @@
 		Goal = GoalExpr0 - GoalInfo0,
 		ElimVars = ElimVars0
 	;
-		GoalExpr0 = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr0 = foreign_proc(_, _, _, _, _, _, _),
 		Goal = GoalExpr0 - GoalInfo0,
 		ElimVars = ElimVars0
 	;
Index: compiler/follow_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_code.m,v
retrieving revision 1.60
diff -u -r1.60 follow_code.m
--- compiler/follow_code.m	2000/11/17 17:47:08	1.60
+++ compiler/follow_code.m	2001/03/30 05:45:12
@@ -122,8 +122,8 @@
 
 move_follow_code_in_goal_2(unify(A,B,C,D,E), unify(A,B,C,D,E), _, R, R).
 
-move_follow_code_in_goal_2(pragma_foreign_code(A,B,C,D,E,F,G), 
-			pragma_foreign_code(A,B,C,D,E,F,G), _, R, R).
+move_follow_code_in_goal_2(foreign_proc(A,B,C,D,E,F,G), 
+			foreign_proc(A,B,C,D,E,F,G), _, R, R).
 
 move_follow_code_in_goal_2(bi_implication(_, _), _, _, _, _) :-
 	% these should have been expanded out by now
Index: compiler/follow_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_vars.m,v
retrieving revision 1.60
diff -u -r1.60 follow_vars.m
--- compiler/follow_vars.m	2000/11/23 04:32:35	1.60
+++ compiler/follow_vars.m	2001/04/01 06:44:31
@@ -202,9 +202,9 @@
 		FollowVarsMap = FollowVarsMap0
 	).
 
-find_follow_vars_in_goal_expr(pragma_foreign_code(A,B,C,D,E,F,G),
+find_follow_vars_in_goal_expr(foreign_proc(A,B,C,D,E,F,G),
 		_, _ModuleInfo, FollowVarsMap, NextNonReserved,
-		pragma_foreign_code(A,B,C,D,E,F,G),
+		foreign_proc(A,B,C,D,E,F,G),
 		FollowVarsMap, NextNonReserved).
 
 find_follow_vars_in_goal_expr(bi_implication(_,_), _, _, _, _, _, _, _) :-
Index: compiler/foreign.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.2
diff -u -r1.2 foreign.m
--- compiler/foreign.m	2000/11/23 04:32:36	1.2
+++ compiler/foreign.m	2001/01/30 02:30:06
@@ -51,9 +51,9 @@
 	% this interface may change.
 :- pred foreign__extrude_pragma_implementation(foreign_language,
 		list(pragma_var), sym_name, pred_or_func, prog_context,
-		module_info, pragma_foreign_code_attributes,
+		module_info, pragma_foreign_proc_attributes,
 		pragma_foreign_code_impl, 
-		module_info, pragma_foreign_code_attributes,
+		module_info, pragma_foreign_proc_attributes,
 		pragma_foreign_code_impl).
 :- mode foreign__extrude_pragma_implementation(in, in, in, in, in,
 		in, in, in, out, out, out) is det.
Index: compiler/goal_path.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_path.m,v
retrieving revision 1.12
diff -u -r1.12 goal_path.m
--- compiler/goal_path.m	2000/11/23 04:32:18	1.12
+++ compiler/goal_path.m	2001/03/30 05:44:56
@@ -88,8 +88,8 @@
 fill_expr_slots(call(A,B,C,D,E,F), _, _, _, call(A,B,C,D,E,F)).
 fill_expr_slots(generic_call(A,B,C,D), _, _, _, generic_call(A,B,C,D)).
 fill_expr_slots(unify(A,B,C,D,E), _, _, _, unify(A,B,C,D,E)).
-fill_expr_slots(pragma_foreign_code(A,B,C,D,E,F,G), _, _, _,
-		pragma_foreign_code(A,B,C,D,E,F,G)).
+fill_expr_slots(foreign_proc(A,B,C,D,E,F,G), _, _, _,
+		foreign_proc(A,B,C,D,E,F,G)).
 fill_expr_slots(bi_implication(_, _), _, _, _, _) :-
 	% these should have been expanded out by now
 	error("fill_expr_slots: unexpected bi_implication").
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.67
diff -u -r1.67 goal_util.m
--- compiler/goal_util.m	2000/11/17 17:47:11	1.67
+++ compiler/goal_util.m	2001/04/01 06:46:29
@@ -373,8 +373,8 @@
 	goal_util__rename_unify_rhs(TermR0, Must, Subn, TermR),
 	goal_util__rename_unify(Unify0, Must, Subn, Unify).
 
-goal_util__name_apart_2(pragma_foreign_code(A,B,C,Vars0,E,F,G), Must, Subn,
-		pragma_foreign_code(A,B,C,Vars,E,F,G)) :-
+goal_util__name_apart_2(foreign_proc(A,B,C,Vars0,E,F,G), Must, Subn,
+		foreign_proc(A,B,C,Vars,E,F,G)) :-
 	goal_util__rename_var_list(Vars0, Must, Subn, Vars).
 
 goal_util__name_apart_2(bi_implication(LHS0, RHS0), Must, Subn,
@@ -610,7 +610,7 @@
 	goal_util__goal_vars_2(B, Set2, Set3),
 	goal_util__goal_vars_2(C, Set3, Set).
 
-goal_util__goal_vars_2(pragma_foreign_code(_, _, _, ArgVars, _, _, _),
+goal_util__goal_vars_2(foreign_proc(_, _, _, ArgVars, _, _, _),
 		Set0, Set) :-
 	set__insert_list(Set0, ArgVars, Set).
 
@@ -754,7 +754,7 @@
 goal_expr_size(call(_, _, _, _, _, _), 1).
 goal_expr_size(generic_call(_, _, _, _), 1).
 goal_expr_size(unify(_, _, _, _, _), 1).
-goal_expr_size(pragma_foreign_code(_, _, _, _, _, _, _), 1).
+goal_expr_size(foreign_proc(_, _, _, _, _, _, _), 1).
 goal_expr_size(bi_implication(LHS, RHS), Size) :-
 	goal_size(LHS, Size1),
 	goal_size(RHS, Size2),
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.83
diff -u -r1.83 higher_order.m
--- compiler/higher_order.m	2000/12/11 04:52:24	1.83
+++ compiler/higher_order.m	2001/03/30 05:44:41
@@ -500,7 +500,7 @@
 	traverse_goal_2(Goal0, Goal).
 
 traverse_goal_2(Goal, Goal) -->
-	{ Goal = pragma_foreign_code(_, _, _, _, _, _, _) - _ }.
+	{ Goal = foreign_proc(_, _, _, _, _, _, _) - _ }.
 
 traverse_goal_2(Goal, Goal) -->
 	{ Goal = unify(_, _, _, Unify, _) - _ },
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.85
diff -u -r1.85 hlds_goal.m
--- compiler/hlds_goal.m	2001/03/13 12:40:09	1.85
+++ compiler/hlds_goal.m	2001/03/30 05:22:21
@@ -160,22 +160,22 @@
 					% information.
 		)
 
-		% Foreign code from a pragma foreign_code(...) decl.
+		% Foreign code from a pragma foreign_proc(...) decl.
 
-	;	pragma_foreign_code(
-			pragma_foreign_code_attributes,
+	;	foreign_proc(
+			pragma_foreign_proc_attributes,
 			pred_id,	% The called predicate
 			proc_id, 	% The mode of the predicate
 			list(prog_var),	% The (Mercury) argument variables
 			list(maybe(pair(string, mode))),
-					% C variable names and the original
-					% mode declaration for each of the
-					% arguments. A no for a particular 
-					% argument means that it is not used
-					% by the C code.  (In particular, the
-					% type_info variables introduced by
-					% polymorphism.m might be represented
-					% in this way).
+					% Foreign variable names and the
+					% original mode declaration for each
+					% of the arguments. A no for a
+					% particular argument means that it is
+					% not used by the foreign code.  (In
+					% particular, the type_info variables
+					% introduced by polymorphism.m might
+					% be represented in this way).
 			list(type),	% The original types of the arguments.
 					% (With inlining, the actual types may
 					% be instances of the original types.)
@@ -1519,7 +1519,7 @@
 		;	no
 		)
 	;
-		GoalExpr = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr = foreign_proc(_, _, _, _, _, _, _),
 		HasForeign = yes
 	;
 		GoalExpr = par_conj(Goals, _),
@@ -1550,7 +1550,7 @@
 goal_is_atomic(generic_call(_,_,_,_)).
 goal_is_atomic(call(_,_,_,_,_,_)).
 goal_is_atomic(unify(_,_,_,_,_)).
-goal_is_atomic(pragma_foreign_code(_,_,_,_,_,_,_)).
+goal_is_atomic(foreign_proc(_,_,_,_,_,_,_)).
 
 %-----------------------------------------------------------------------------%
 
@@ -1645,7 +1645,7 @@
 set_goal_contexts_2(_, Goal, Goal) :-
 	Goal = unify(_, _, _, _, _).
 set_goal_contexts_2(_, Goal, Goal) :-
-	Goal = pragma_foreign_code(_, _, _, _, _, _, _).
+	Goal = foreign_proc(_, _, _, _, _, _, _).
 set_goal_contexts_2(Context, bi_implication(LHS0, RHS0),
 		bi_implication(LHS, RHS)) :-
 	set_goal_contexts(Context, LHS0, LHS),
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.256
diff -u -r1.256 hlds_out.m
--- compiler/hlds_out.m	2001/03/27 05:23:05	1.256
+++ compiler/hlds_out.m	2001/03/30 05:44:24
@@ -1569,11 +1569,11 @@
 		[]
 	).
 
-hlds_out__write_goal_2(pragma_foreign_code(Attributes, _, _, ArgVars,
+hlds_out__write_goal_2(foreign_proc(Attributes, _, _, ArgVars,
 		ArgNames, _, PragmaCode), _, _, _, Indent, Follow, _) -->
 	{ foreign_language(Attributes, ForeignLang) },
 	hlds_out__write_indent(Indent),
-	io__write_string("$pragma_foreign_code( /* "),
+	io__write_string("$pragma_foreign_proc( /* "),
 	io__write_string(foreign_language_string(ForeignLang)),
 	io__write_string(" */ ["),
 	hlds_out__write_varnum_list(ArgVars),
Index: compiler/inlining.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inlining.m,v
retrieving revision 1.98
diff -u -r1.98 inlining.m
--- compiler/inlining.m	2001/03/27 05:23:08	1.98
+++ compiler/inlining.m	2001/04/01 06:46:51
@@ -631,8 +631,8 @@
 		unify(A, B, C, D, E) - GoalInfo) --> [].
 
 inlining__inlining_in_goal(
-		pragma_foreign_code(A, B, C, D, E, F, G) - GoalInfo,
-		pragma_foreign_code(A, B, C, D, E, F, G) - GoalInfo) --> [].
+		foreign_proc(A, B, C, D, E, F, G) - GoalInfo,
+		foreign_proc(A, B, C, D, E, F, G) - GoalInfo) --> [].
 
 inlining__inlining_in_goal(bi_implication(_, _) - _, _) -->
 	% these should have been expanded out by now
@@ -890,7 +890,7 @@
 	proc_info_goal(ProcInfo, CalledGoal),
 	\+ (
 		HighLevelCode = no,
-		CalledGoal = pragma_foreign_code(_,_,_,_,_,_,_) - _,
+		CalledGoal = foreign_proc(_,_,_,_,_,_,_) - _,
 		proc_info_interface_determinism(ProcInfo, Detism),
 		( Detism = nondet ; Detism = multidet )
 	),
@@ -901,7 +901,7 @@
 	globals__get_target(Globals, Target),
 	(
 		(
-		CalledGoal = pragma_foreign_code(ForeignAttributes,
+		CalledGoal = foreign_proc(ForeignAttributes,
 			_,_,_,_,_,_) - _,
 		foreign_language(ForeignAttributes, ForeignLanguage)
 		)
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.95
diff -u -r1.95 intermod.m
--- compiler/intermod.m	2001/03/27 05:23:08	1.95
+++ compiler/intermod.m	2001/04/01 06:47:09
@@ -503,8 +503,8 @@
 
 	% Inlineable exported pragma_foreign_code goals can't use any
 	% non-exported types, so we just write out the clauses. 
-intermod__traverse_goal(pragma_foreign_code(A,B,C,D,E,F,G) - Info,
-		pragma_foreign_code(A,B,C,D,E,F,G) - Info, yes) --> [].
+intermod__traverse_goal(foreign_proc(A,B,C,D,E,F,G) - Info,
+		foreign_proc(A,B,C,D,E,F,G) - Info, yes) --> [].
 
 intermod__traverse_goal(bi_implication(_, _) - _, _, _) -->
 	% these should have been expanded out by now
@@ -1721,13 +1721,13 @@
 			{ Goal = conj(Goals) - _ },
 			{ list__filter(
 				lambda([X::in] is semidet, (
-				    X = pragma_foreign_code(_,_,_,_,_,_,_) - _
+				    X = foreign_proc(_,_,_,_,_,_,_) - _
 				)),
 				Goals, [ForeignCodeGoal]) },
-			{ ForeignCodeGoal = pragma_foreign_code(Attributes,
+			{ ForeignCodeGoal = foreign_proc(Attributes,
 				_, _, Vars, Names, _, PragmaCode) - _ }
 		;
-			{ Goal = pragma_foreign_code(Attributes,
+			{ Goal = foreign_proc(Attributes,
 				_, _, Vars, Names, _, PragmaCode) - _ }
 		)
 	->	
@@ -1742,7 +1742,7 @@
 
 :- pred intermod__write_foreign_clauses(proc_table::in, list(proc_id)::in, 
 		pred_or_func::in, pragma_foreign_code_impl::in,
-		pragma_foreign_code_attributes::in, list(prog_var)::in,
+		pragma_foreign_proc_attributes::in, list(prog_var)::in,
 		prog_varset::in, list(maybe(pair(string, mode)))::in,
 		sym_name::in, io__state::di, io__state::uo) is det.
 
Index: compiler/lambda.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.71
diff -u -r1.71 lambda.m
--- compiler/lambda.m	2001/02/01 06:43:40	1.71
+++ compiler/lambda.m	2001/03/30 05:43:42
@@ -276,8 +276,8 @@
 lambda__process_goal_2(call(A,B,C,D,E,F), GoalInfo,
 			call(A,B,C,D,E,F) - GoalInfo) -->
 	[].
-lambda__process_goal_2(pragma_foreign_code(A,B,C,D,E,F,G), GoalInfo,
-			pragma_foreign_code(A,B,C,D,E,F,G) - GoalInfo) -->
+lambda__process_goal_2(foreign_proc(A,B,C,D,E,F,G), GoalInfo,
+			foreign_proc(A,B,C,D,E,F,G) - GoalInfo) -->
 	[].
 lambda__process_goal_2(bi_implication(_, _), _, _) -->
 	% these should have been expanded out by now
Index: compiler/lco.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.15
diff -u -r1.15 lco.m
--- compiler/lco.m	2000/11/17 17:47:32	1.15
+++ compiler/lco.m	2001/03/30 05:43:34
@@ -91,8 +91,8 @@
 
 lco_in_goal_2(unify(A,B,C,D,E), _ModuleInfo, unify(A,B,C,D,E)).
 
-lco_in_goal_2(pragma_foreign_code(A,B,C,D,E,F,G), _,
-		pragma_foreign_code(A,B,C,D,E,F,G)).
+lco_in_goal_2(foreign_proc(A,B,C,D,E,F,G), _,
+		foreign_proc(A,B,C,D,E,F,G)).
 
 lco_in_goal_2(bi_implication(_, _), _, _) :-
 	% these should have been expanded out by now
Index: compiler/live_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/live_vars.m,v
retrieving revision 1.96
diff -u -r1.96 live_vars.m
--- compiler/live_vars.m	2000/12/06 06:05:06	1.96
+++ compiler/live_vars.m	2001/03/30 05:43:25
@@ -349,7 +349,7 @@
 		true
 	).
 
-build_live_sets_in_goal_2(pragma_foreign_code(Attributes,
+build_live_sets_in_goal_2(foreign_proc(Attributes,
 		PredId, ProcId, Args, _, _, _),
 		Liveness, NondetLiveness0, ResumeVars0, LiveSets0,
 		GoalInfo, AllocData,
Index: compiler/liveness.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.116
diff -u -r1.116 liveness.m
--- compiler/liveness.m	2001/03/02 02:05:55	1.116
+++ compiler/liveness.m	2001/04/01 06:45:20
@@ -396,9 +396,9 @@
 detect_liveness_in_goal_2(unify(_,_,_,_,_), _, _, _, _, _) :-
 	error("unify in detect_liveness_in_goal_2").
 
-detect_liveness_in_goal_2(pragma_foreign_code(_,_,_,_,_,_,_),
+detect_liveness_in_goal_2(foreign_proc(_,_,_,_,_,_,_),
 		_, _, _, _, _) :-
-	error("pragma_foreign_code in detect_liveness_in_goal_2").
+	error("foreign_proc in detect_liveness_in_goal_2").
 
 detect_liveness_in_goal_2(bi_implication(_, _), _, _, _, _, _) :-
 	error("bi_implication in detect_liveness_in_goal_2").
@@ -634,9 +634,9 @@
 detect_deadness_in_goal_2(unify(_,_,_,_,_), _, _, _, _, _, _) :-
 	error("unify in detect_deadness_in_goal_2").
 
-detect_deadness_in_goal_2(pragma_foreign_code(_, _, _, _, _, _, _),
+detect_deadness_in_goal_2(foreign_proc(_, _, _, _, _, _, _),
 		_, _, _, _, _, _) :-
-	error("pragma_foreign_code in detect_deadness_in_goal_2").
+	error("foreign_proc in detect_deadness_in_goal_2").
 
 detect_deadness_in_goal_2(bi_implication(_, _), _, _, _, _, _, _) :-
 	error("bi_implication in detect_deadness_in_goal_2").
@@ -840,7 +840,7 @@
 update_liveness_expr(call(_, _, _, _, _, _), _, _, Liveness, Liveness).
 update_liveness_expr(generic_call(_, _, _, _), _, _, Liveness, Liveness).
 update_liveness_expr(unify(_, _, _, _, _), _, _, Liveness, Liveness).
-update_liveness_expr(pragma_foreign_code(_, _, _, _, _, _, _), _, _,
+update_liveness_expr(foreign_proc(_, _, _, _, _, _, _), _, _,
 		Liveness, Liveness).
 update_liveness_expr(conj(Goals), _, LiveInfo, Liveness0, Liveness) :-
 	update_liveness_conj(Goals, LiveInfo, Liveness0, Liveness).
@@ -1013,7 +1013,7 @@
 		BornVars = BornVars0,
 		DelayedDead = DelayedDead0
 	;
-		GoalExpr0 = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr0 = foreign_proc(_, _, _, _, _, _, _),
 		GoalExpr = GoalExpr0,
 		GoalInfo = GoalInfo0,
 		BornVars = BornVars0,
@@ -1341,8 +1341,8 @@
 detect_resume_points_in_goal_2(unify(A,B,C,D,E), _, Liveness, _, _,
 		unify(A,B,C,D,E), Liveness).
 
-detect_resume_points_in_goal_2(pragma_foreign_code(A,B,C,D,E,F,G), _,
-		Liveness, _, _, pragma_foreign_code(A,B,C,D,E,F,G), Liveness).
+detect_resume_points_in_goal_2(foreign_proc(A,B,C,D,E,F,G), _,
+		Liveness, _, _, foreign_proc(A,B,C,D,E,F,G), Liveness).
 
 detect_resume_points_in_goal_2(bi_implication(_, _), _, _, _, _, _, _) :-
 	% these should have been expanded out by now
Index: compiler/magic.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic.m,v
retrieving revision 1.25
diff -u -r1.25 magic.m
--- compiler/magic.m	2000/11/17 17:47:42	1.25
+++ compiler/magic.m	2001/03/30 05:43:03
@@ -1510,9 +1510,9 @@
 	{ error("Sorry, not yet implemented: parallel conjunction in Aditi procedures") }.
 magic__preprocess_goal_2(generic_call(_, _, _, _) - _, _, _, _) -->
 	{ error("Sorry, not yet implemented: higher-order or class-method calls in Aditi procedures") }.
-magic__preprocess_goal_2(pragma_foreign_code(_, _, _, _, _, _, _) -
+magic__preprocess_goal_2(foreign_proc(_, _, _, _, _, _, _) -
 	_, _, _, _) -->
-	{ error("Sorry, not yet implemented: pragma foreign_code calls in Aditi procedures") }.
+	{ error("Sorry, not yet implemented: foreign_proc calls in Aditi procedures") }.
 magic__preprocess_goal_2(conj(Goals0) - GoalInfo, [conj(Goals) - GoalInfo],
 		HOMap0, HOMap) -->
 	magic__preprocess_conj(Goals0, [], Goals, HOMap0, HOMap).
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.366
diff -u -r1.366 make_hlds.m
--- compiler/make_hlds.m	2001/03/27 05:23:09	1.366
+++ compiler/make_hlds.m	2001/03/30 05:42:46
@@ -400,7 +400,7 @@
 		{ Pragma = source_file(_) },
 		{ Module = Module0 }
 	;
-		{ Pragma = foreign(Lang, Body_Code) },
+		{ Pragma = foreign_code(Lang, Body_Code) },
 		{ module_add_foreign_body_code(Lang, Body_Code, Context,
 			Module0, Module) }
 	;
@@ -408,9 +408,9 @@
 		{ module_add_foreign_decl(Lang, C_Header, Context,
 			Module0, Module) }
 	;
-		% Handle pragma foreign decls later on (when we process
+		% Handle pragma foreign procs later on (when we process
 		% clauses).
-		{ Pragma = foreign(_, _, _, _, _, _) },
+		{ Pragma = foreign_proc(_, _, _, _, _, _) },
 		{ Module = Module0 }
 	;	
 		% Handle pragma tabled decls later on (when we process
@@ -693,7 +693,7 @@
 add_item_clause(pragma(Pragma), Status, Status, Context,
 		Module0, Module, Info0, Info) -->
 	(
-		{ Pragma = foreign(Attributes, Pred, PredOrFunc,
+		{ Pragma = foreign_proc(Attributes, Pred, PredOrFunc,
 			Vars, VarSet, PragmaImpl) }
 	->
 		module_add_pragma_foreign_code(Attributes, 
@@ -3770,7 +3770,7 @@
 %	handling of `pragma export' declarations, in export.m.
 
 :- pred module_add_pragma_import(sym_name, pred_or_func, list(mode),
-		pragma_foreign_code_attributes, string, import_status,
+		pragma_foreign_proc_attributes, string, import_status,
 		prog_context, module_info, module_info, qual_info, qual_info,
 		io__state, io__state).
 :- mode module_add_pragma_import(in, in, in, in, in, in, in, in, out,
@@ -3892,7 +3892,7 @@
 %	the c_code for a `pragma import' declaration to a pred_info.
 
 :- pred pred_add_pragma_import(pred_info, pred_id, proc_id,
-		pragma_foreign_code_attributes, string, prog_context, pred_info,
+		pragma_foreign_proc_attributes, string, prog_context, pred_info,
 		module_info, module_info, qual_info, qual_info,
 		io__state, io__state).
 :- mode pred_add_pragma_import(in, in, in, in, in, in, out, in, out, in, out,
@@ -3928,7 +3928,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred module_add_pragma_foreign_code(pragma_foreign_code_attributes,
+:- pred module_add_pragma_foreign_code(pragma_foreign_proc_attributes,
 	sym_name, pred_or_func, list(pragma_var), prog_varset,
 	pragma_foreign_code_impl, import_status, prog_context,
 	module_info, module_info, qual_info, qual_info, io__state,
@@ -4567,7 +4567,7 @@
 	warn_singletons_in_unify(Var, RHS, GoalInfo, QuantVars, VarSet,
 		PredCallId, MI).
 
-warn_singletons_in_goal_2(pragma_foreign_code(Attrs, _, _, _, ArgInfo, _,
+warn_singletons_in_goal_2(foreign_proc(Attrs, _, _, _, ArgInfo, _,
 		PragmaImpl), GoalInfo, _QuantVars, _VarSet, PredCallId, MI) --> 
 	{ goal_info_get_context(GoalInfo, Context) },
 	{ foreign_language(Attrs, Lang) },
@@ -5050,7 +5050,7 @@
 % return the hlds_goal.
 
 :- pred clauses_info_add_pragma_foreign_code(
-	clauses_info::in, purity::in, pragma_foreign_code_attributes::in,
+	clauses_info::in, purity::in, pragma_foreign_proc_attributes::in,
 	pred_id::in, proc_id::in, prog_varset::in, list(pragma_var)::in,
 	list(type)::in, pragma_foreign_code_impl::in, prog_context::in,
 	pred_or_func::in, sym_name::in, arity::in, clauses_info::out,
@@ -5134,7 +5134,7 @@
 		% Put the purity in the goal_info in case
 		% this foreign code is inlined
 		add_goal_info_purity_feature(GoalInfo1, Purity, GoalInfo),
-		HldsGoal0 = pragma_foreign_code(Attributes, PredId, 
+		HldsGoal0 = foreign_proc(Attributes, PredId, 
 			ModeId, Args, ArgInfo, OrigArgTypes, PragmaImpl)
 			- GoalInfo
 		}, 
Index: compiler/mark_static_terms.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mark_static_terms.m,v
retrieving revision 1.5
diff -u -r1.5 mark_static_terms.m
--- compiler/mark_static_terms.m	2000/11/17 17:47:49	1.5
+++ compiler/mark_static_terms.m	2001/03/30 05:42:19
@@ -103,8 +103,8 @@
 	unification_mark_static_terms(Unification0, Unification,
 		SI0, SI).
 
-goal_expr_mark_static_terms(pragma_foreign_code(A,B,C,D,E,F,G),
-		pragma_foreign_code(A,B,C,D,E,F,G), SI, SI).
+goal_expr_mark_static_terms(foreign_proc(A,B,C,D,E,F,G),
+		foreign_proc(A,B,C,D,E,F,G), SI, SI).
 
 goal_expr_mark_static_terms(bi_implication(_, _), _, _, _) :-
 	% these should have been expanded out by now
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.183
diff -u -r1.183 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	2001/03/27 05:23:12	1.183
+++ compiler/mercury_to_mercury.m	2001/03/29 02:04:12
@@ -83,7 +83,7 @@
 :- mode mercury_output_pragma_decl(in, in, in, in, di, uo) is det.
 
 :- pred mercury_output_pragma_foreign_code(
-		pragma_foreign_code_attributes, sym_name,
+		pragma_foreign_proc_attributes, sym_name,
 		pred_or_func, list(pragma_var), prog_varset,
 		pragma_foreign_code_impl, io__state, io__state).
 :- mode mercury_output_pragma_foreign_code(
@@ -350,10 +350,10 @@
 		{ Pragma = foreign_decl(Lang, ForeignHeaderString) },
 		mercury_output_pragma_foreign_decl(Lang, ForeignHeaderString)
 	;
-		{ Pragma = foreign(Lang, Code) }, 
+		{ Pragma = foreign_code(Lang, Code) }, 
 		mercury_output_pragma_foreign_body_code(Lang, Code)
 	;
-		{ Pragma = foreign(Attributes, Pred, PredOrFunc, Vars,
+		{ Pragma = foreign_proc(Attributes, Pred, PredOrFunc, Vars,
 			VarSet, PragmaCode) }, 
 		mercury_output_pragma_foreign_code(Attributes, Pred,
 			PredOrFunc, Vars, VarSet, PragmaCode)
@@ -2247,7 +2247,7 @@
 	).
 
 :- pred mercury_output_pragma_foreign_code_2(
-		pragma_foreign_code_attributes, sym_name,
+		pragma_foreign_proc_attributes, sym_name,
 		pred_or_func, list(pragma_var), prog_varset,
 		pragma_foreign_code_impl, io__state, io__state).
 :- mode mercury_output_pragma_foreign_code_2(
@@ -2255,7 +2255,7 @@
 
 mercury_output_pragma_foreign_code_2(Attributes, PredName, PredOrFunc, Vars0,
 		VarSet, PragmaCode) -->
-	io__write_string(":- pragma foreign_code("),
+	io__write_string(":- pragma foreign_proc("),
 	{ foreign_language(Attributes, Lang) },
 	mercury_output_foreign_language_string(Lang),
 	io__write_string(", "),
@@ -2448,7 +2448,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pred mercury_output_pragma_import(sym_name, pred_or_func, list(mode),
-	pragma_foreign_code_attributes, string, io__state, io__state).
+	pragma_foreign_proc_attributes, string, io__state, io__state).
 :- mode mercury_output_pragma_import(in, in, in, in, in, di, uo) is det.
 
 mercury_output_pragma_import(Name, PredOrFunc, ModeList, Attributes,
@@ -2573,7 +2573,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pred mercury_output_pragma_foreign_attributes(
-		pragma_foreign_code_attributes, io__state, io__state).
+		pragma_foreign_proc_attributes, io__state, io__state).
 :- mode mercury_output_pragma_foreign_attributes(in, di, uo) is det.
 
 mercury_output_pragma_foreign_attributes(Attributes) -->
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.78
diff -u -r1.78 ml_code_gen.m
--- compiler/ml_code_gen.m	2001/02/28 15:59:17	1.78
+++ compiler/ml_code_gen.m	2001/03/30 05:42:10
@@ -2012,7 +2012,7 @@
 	ml_gen_unification(Unification, CodeModel, Context,
 		MLDS_Decls, MLDS_Statements).
 
-ml_gen_goal_expr(pragma_foreign_code(Attributes,
+ml_gen_goal_expr(foreign_proc(Attributes,
                 PredId, ProcId, ArgVars, ArgDatas, OrigArgTypes, PragmaImpl),
 		CodeModel, OuterContext, MLDS_Decls, MLDS_Statements) -->
         (
@@ -2043,7 +2043,7 @@
 	% these should have been expanded out by now
 	{ error("ml_gen_goal_expr: unexpected bi_implication") }.
 
-:- pred ml_gen_nondet_pragma_c_code(code_model, pragma_foreign_code_attributes,
+:- pred ml_gen_nondet_pragma_c_code(code_model, pragma_foreign_proc_attributes,
 		pred_id, proc_id, list(prog_var),
 		list(maybe(pair(string, mode))), list(prog_type), prog_context,
 		string, maybe(prog_context), string, maybe(prog_context),
@@ -2240,7 +2240,7 @@
 	{ MLDS_Decls = ConvDecls }.
 
 :- pred ml_gen_ordinary_pragma_c_code(code_model, 
-		pragma_foreign_code_attributes,
+		pragma_foreign_proc_attributes,
 		pred_id, proc_id, list(prog_var),
 		list(maybe(pair(string, mode))), list(prog_type),
 		string, prog_context,
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.134
diff -u -r1.134 mode_util.m
--- compiler/mode_util.m	2000/11/17 17:47:59	1.134
+++ compiler/mode_util.m	2001/03/30 05:42:00
@@ -1393,8 +1393,8 @@
 	).
 
 recompute_instmap_delta_2(_, 
-		pragma_foreign_code(A, PredId, ProcId, Args, E, F, G), _,
-		pragma_foreign_code(A, PredId, ProcId, Args, E, F, G), 
+		foreign_proc(A, PredId, ProcId, Args, E, F, G), _,
+		foreign_proc(A, PredId, ProcId, Args, E, F, G), 
 		VarTypes, InstMap, InstMapDelta) -->
 	recompute_instmap_delta_call(PredId, ProcId,
 		Args, VarTypes, InstMap, InstMapDelta).
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.251
diff -u -r1.251 modes.m
--- compiler/modes.m	2001/01/17 01:42:08	1.251
+++ compiler/modes.m	2001/04/01 06:46:13
@@ -1269,7 +1269,7 @@
 
 	% to modecheck a pragma_c_code, we just modecheck the proc for 
 	% which it is the goal.
-modecheck_goal_expr(pragma_foreign_code(Attributes, PredId, ProcId0,
+modecheck_goal_expr(foreign_proc(Attributes, PredId, ProcId0,
 		Args0, ArgNameMap, OrigArgTypes, PragmaCode),
 		GoalInfo, Goal) -->
 	mode_checkpoint(enter, "pragma_foreign_code"),
@@ -1283,7 +1283,7 @@
 	modecheck_call_pred(PredId, ProcId0, Args0, DeterminismKnown,
 				ProcId, Args, ExtraGoals),
 
-	{ Pragma = pragma_foreign_code(Attributes, PredId, ProcId,
+	{ Pragma = foreign_proc(Attributes, PredId, ProcId,
 			Args0, ArgNameMap, OrigArgTypes, PragmaCode) },
 	handle_extra_goals(Pragma, ExtraGoals, GoalInfo, Args0, Args,
 			InstMap0, Goal),
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.64
diff -u -r1.64 module_qual.m
--- compiler/module_qual.m	2001/03/27 05:23:14	1.64
+++ compiler/module_qual.m	2001/03/29 02:04:16
@@ -900,10 +900,10 @@
 
 qualify_pragma(source_file(File), source_file(File), Info, Info) --> [].
 qualify_pragma(foreign_decl(L, Code), foreign_decl(L, Code), Info, Info) --> [].
-qualify_pragma(foreign(L, C), foreign(L, C), Info, Info) --> [].
+qualify_pragma(foreign_code(L, C), foreign_code(L, C), Info, Info) --> [].
 qualify_pragma(
-	    foreign(Rec, SymName, PredOrFunc, PragmaVars0, Varset, Code),
-	    foreign(Rec, SymName, PredOrFunc, PragmaVars, Varset, Code), 
+	    foreign_proc(Rec, SymName, PredOrFunc, PragmaVars0, Varset, Code),
+	    foreign_proc(Rec, SymName, PredOrFunc, PragmaVars, Varset, Code), 
 		Info0, Info) -->
 	qualify_pragma_vars(PragmaVars0, PragmaVars, Info0, Info).
 qualify_pragma(tabled(A, B, C, D, MModes0), tabled(A, B, C, D, MModes), 
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.155
diff -u -r1.155 modules.m
--- compiler/modules.m	2001/03/27 05:23:14	1.155
+++ compiler/modules.m	2001/03/29 02:04:16
@@ -1027,8 +1027,8 @@
 % header file, which currently we don't.
 
 pragma_allowed_in_interface(foreign_decl(_, _), no).
-pragma_allowed_in_interface(foreign(_, _), no).
-pragma_allowed_in_interface(foreign(_, _, _, _, _, _), no).
+pragma_allowed_in_interface(foreign_code(_, _), no).
+pragma_allowed_in_interface(foreign_proc(_, _, _, _, _, _), no).
 pragma_allowed_in_interface(inline(_, _), no).
 pragma_allowed_in_interface(no_inline(_, _), no).
 pragma_allowed_in_interface(obsolete(_, _), yes).
@@ -3277,8 +3277,8 @@
 		% do if there is some foreign_code, not just foreign_decls.
 		% Counting foreign_decls here causes problems with
 		% intermodule optimization.
-		(	Pragma = foreign(_Lang, _)
-		;	Pragma = foreign(_, _, _, _, _, _)
+		(	Pragma = foreign_code(_Lang, _)
+		;	Pragma = foreign_proc(_, _, _, _, _, _)
 		;	% XXX `pragma export' should not be treated as
 			% foreign, but currently mlds_to_gcc.m doesn't
 			% handle that declaration, and instead just punts
Index: compiler/pd_cost.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_cost.m,v
retrieving revision 1.10
diff -u -r1.10 pd_cost.m
--- compiler/pd_cost.m	2000/11/17 17:48:27	1.10
+++ compiler/pd_cost.m	2001/03/30 05:41:45
@@ -91,7 +91,7 @@
 	goal_info_get_nonlocals(GoalInfo, NonLocals),
 	pd_cost__unify(NonLocals, Unification, Cost).
 
-pd_cost__goal(pragma_foreign_code(Attributes, _, _, Args, _, _, _) - _,
+pd_cost__goal(foreign_proc(Attributes, _, _, Args, _, _, _) - _,
 		Cost) :-
 	( may_call_mercury(Attributes, will_not_call_mercury) ->
 		Cost1 = 0
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.206
diff -u -r1.206 polymorphism.m
--- compiler/polymorphism.m	2001/02/12 05:14:44	1.206
+++ compiler/polymorphism.m	2001/04/01 06:46:00
@@ -1068,7 +1068,7 @@
 	{ conj_list_to_goal(GoalList, GoalInfo, Goal) }.
 
 polymorphism__process_goal_expr(Goal0, GoalInfo, Goal) -->
-	{ Goal0 = pragma_foreign_code(Attributes, PredId, ProcId,
+	{ Goal0 = foreign_proc(Attributes, PredId, ProcId,
 		ArgVars0, ArgInfo0, OrigArgTypes0, PragmaCode0) },
 	polymorphism__process_call(PredId, ArgVars0, GoalInfo,
 		ArgVars, ExtraVars, CallGoalInfo, ExtraGoals),
@@ -1120,7 +1120,7 @@
 		%
 		% plug it all back together
 		%
-		{ Call = pragma_foreign_code(Attributes, PredId, 
+		{ Call = foreign_proc(Attributes, PredId, 
 			ProcId, ArgVars, ArgInfo, OrigArgTypes, PragmaCode) - 
 			CallGoalInfo },
 		{ list__append(ExtraGoals, [Call], GoalList) },
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.43
diff -u -r1.43 pragma_c_gen.m
--- compiler/pragma_c_gen.m	2001/03/06 05:51:24	1.43
+++ compiler/pragma_c_gen.m	2001/03/16 00:44:49
@@ -29,7 +29,7 @@
 :- import_module list, std_util.
 
 :- pred pragma_c_gen__generate_pragma_c_code(code_model::in,
-	pragma_foreign_code_attributes::in, pred_id::in, proc_id::in,
+	pragma_foreign_proc_attributes::in, pred_id::in, proc_id::in,
 	list(prog_var)::in, list(maybe(pair(string, mode)))::in, list(type)::in,
 	hlds_goal_info::in, pragma_foreign_code_impl::in, code_tree::out,
 	code_info::in, code_info::out) is det.
@@ -332,7 +332,7 @@
 %---------------------------------------------------------------------------%
 
 :- pred pragma_c_gen__ordinary_pragma_c_code(code_model::in,
-	pragma_foreign_code_attributes::in, pred_id::in, proc_id::in,
+	pragma_foreign_proc_attributes::in, pred_id::in, proc_id::in,
 	list(prog_var)::in, list(maybe(pair(string, mode)))::in, list(type)::in,
 	string::in, maybe(prog_context)::in, hlds_goal_info::in,
 	code_tree::out, code_info::in, code_info::out) is det.
@@ -595,7 +595,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pred pragma_c_gen__nondet_pragma_c_code(code_model::in,
-	pragma_foreign_code_attributes::in, pred_id::in, proc_id::in,
+	pragma_foreign_proc_attributes::in, pred_id::in, proc_id::in,
 	list(prog_var)::in, list(maybe(pair(string, mode)))::in, list(type)::in,
 	string::in, maybe(prog_context)::in,
 	string::in, maybe(prog_context)::in,
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.64
diff -u -r1.64 prog_data.m
--- compiler/prog_data.m	2001/03/27 05:23:16	1.64
+++ compiler/prog_data.m	2001/03/30 05:19:02
@@ -147,12 +147,12 @@
 			% header code.
 	--->	foreign_decl(foreign_language, string)
 
-	;	foreign(foreign_language, string)
+	;	foreign_code(foreign_language, string)
 
-	;	foreign(pragma_foreign_code_attributes,
+	;	foreign_proc(pragma_foreign_proc_attributes,
 			sym_name, pred_or_func, list(pragma_var),
 			prog_varset, pragma_foreign_code_impl)
-			% Set of foreign code attributes, eg.:
+			% Set of foreign proc attributes, eg.:
 			%	what language this code is in
 			%	whether or not the code may call Mercury,
 			%	whether or not the code is thread-safe
@@ -181,9 +181,9 @@
 			% C function name.
 
 	;	import(sym_name, pred_or_func, list(mode),
-			pragma_foreign_code_attributes, string)
+			pragma_foreign_proc_attributes, string)
 			% Predname, Predicate/function, Modes,
-			% Set of foreign code attributes, eg.:
+			% Set of foreign proc attributes, eg.:
 			%    whether or not the foreign code may call Mercury,
 			%    whether or not the foreign code is thread-safe
 			% foreign function name.
@@ -522,37 +522,37 @@
 
 		% an abstract type for representing a set of
 		% `pragma_c_code_attribute's.
-:- type pragma_foreign_code_attributes.
+:- type pragma_foreign_proc_attributes.
 
-:- pred default_attributes(foreign_language, pragma_foreign_code_attributes).
+:- pred default_attributes(foreign_language, pragma_foreign_proc_attributes).
 :- mode default_attributes(in, out) is det.
 
-:- pred may_call_mercury(pragma_foreign_code_attributes, may_call_mercury).
+:- pred may_call_mercury(pragma_foreign_proc_attributes, may_call_mercury).
 :- mode may_call_mercury(in, out) is det.
 
-:- pred set_may_call_mercury(pragma_foreign_code_attributes, may_call_mercury,
-		pragma_foreign_code_attributes).
+:- pred set_may_call_mercury(pragma_foreign_proc_attributes, may_call_mercury,
+		pragma_foreign_proc_attributes).
 :- mode set_may_call_mercury(in, in, out) is det.
 
-:- pred thread_safe(pragma_foreign_code_attributes, thread_safe).
+:- pred thread_safe(pragma_foreign_proc_attributes, thread_safe).
 :- mode thread_safe(in, out) is det.
 
-:- pred set_thread_safe(pragma_foreign_code_attributes, thread_safe,
-		pragma_foreign_code_attributes).
+:- pred set_thread_safe(pragma_foreign_proc_attributes, thread_safe,
+		pragma_foreign_proc_attributes).
 :- mode set_thread_safe(in, in, out) is det.
 
-:- pred foreign_language(pragma_foreign_code_attributes, foreign_language).
+:- pred foreign_language(pragma_foreign_proc_attributes, foreign_language).
 :- mode foreign_language(in, out) is det.
 
-:- pred set_foreign_language(pragma_foreign_code_attributes, foreign_language,
-		pragma_foreign_code_attributes).
+:- pred set_foreign_language(pragma_foreign_proc_attributes, foreign_language,
+		pragma_foreign_proc_attributes).
 :- mode set_foreign_language(in, in, out) is det.
 
-:- pred tabled_for_io(pragma_foreign_code_attributes, tabled_for_io).
+:- pred tabled_for_io(pragma_foreign_proc_attributes, tabled_for_io).
 :- mode tabled_for_io(in, out) is det.
 
-:- pred set_tabled_for_io(pragma_foreign_code_attributes, tabled_for_io,
-		pragma_foreign_code_attributes).
+:- pred set_tabled_for_io(pragma_foreign_proc_attributes, tabled_for_io,
+		pragma_foreign_proc_attributes).
 :- mode set_tabled_for_io(in, in, out) is det.
 
 	% For pragma c_code, there are two different calling conventions,
@@ -946,7 +946,7 @@
 	% the pragma (not all attributes have one).
 	% In particular, the foreign language attribute needs to be
 	% handled separately as it belongs at the start of the pragma.
-:- pred attributes_to_strings(pragma_foreign_code_attributes::in,
+:- pred attributes_to_strings(pragma_foreign_proc_attributes::in,
 		list(string)::out) is det.
 
 %-----------------------------------------------------------------------------%
@@ -954,7 +954,7 @@
 
 :- implementation.
 
-:- type pragma_foreign_code_attributes
+:- type pragma_foreign_proc_attributes
 	--->	attributes(
 			foreign_language 	:: foreign_language,
 			may_call_mercury	:: may_call_mercury,
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.29
diff -u -r1.29 prog_io_pragma.m
--- compiler/prog_io_pragma.m	2001/03/27 05:23:16	1.29
+++ compiler/prog_io_pragma.m	2001/03/29 02:04:20
@@ -185,7 +185,7 @@
 			Just_Code_Term = term__functor(term__string(
 				Just_Code), [], _)
 		->
-			Res = ok(pragma(foreign(ForeignLanguage, 
+			Res = ok(pragma(foreign_code(ForeignLanguage, 
 				Just_Code)))
 		;
 			ErrMsg = "-- expected string for foreign code",
@@ -215,7 +215,7 @@
 	Check6 = (func(PTerms6, ForeignLanguage) = Res is semidet :- 
             PTerms6 = [PredAndVarsTerm, FlagsTerm,
 		    FieldsTerm, FirstTerm, LaterTerm, SharedTerm],
-	    ( parse_pragma_foreign_code_attributes_term(
+	    ( parse_pragma_foreign_proc_attributes_term(
 	    		ForeignLanguage, FlagsTerm, Flags) ->
 	        ( parse_pragma_keyword("local_vars", FieldsTerm, Fields,
 			FieldsContext) ->
@@ -271,7 +271,7 @@
 			    	FieldsTerm)
 		)
 	    ;
-		ErrMsg = "-- invalid third argument, expecting foreign code attribute or list of attributes",
+		ErrMsg = "-- invalid third argument, expecting foreign proc attribute or list of attributes",
 		Res = error(string__append(InvalidDeclStr, ErrMsg), FlagsTerm)
 	    )
 	),
@@ -292,12 +292,12 @@
 	    (
 		CodeTerm = term__functor(term__string(Code), [], Context)
 	    ->
-		( parse_pragma_foreign_code_attributes_term(ForeignLanguage, 
+		( parse_pragma_foreign_proc_attributes_term(ForeignLanguage, 
 			FlagsTerm, Flags) ->
 		    parse_pragma_foreign_code(ModuleName, Flags,
 			PredAndVarsTerm, ordinary(Code, yes(Context)),
 			VarSet, Res)
-	        ; parse_pragma_foreign_code_attributes_term(ForeignLanguage,
+	        ; parse_pragma_foreign_proc_attributes_term(ForeignLanguage,
 			PredAndVarsTerm, Flags) ->
 		    % XXX we should issue a warning; this syntax is deprecated
 		    % We will continue to accept this if c_code is used, but
@@ -312,7 +312,7 @@
 		    	    PredAndVarsTerm)
 		    )	
 	        ;
-		    ErrMsg = "-- invalid third argument, expecting a foreign code attribute or list of attributes",
+		    ErrMsg = "-- invalid third argument, expecting a foreign proc attribute or list of attributes",
 		    Res = error(string__append(InvalidDeclStr, ErrMsg), 
 		    	FlagsTerm)
 		)
@@ -418,7 +418,7 @@
 	Check6 = (func(PTerms6, ForeignLanguage) = Res is semidet :- 
             PTerms6 = [PredAndVarsTerm, FlagsTerm,
 		    FieldsTerm, FirstTerm, LaterTerm, SharedTerm],
-	    ( parse_pragma_foreign_code_attributes_term(
+	    ( parse_pragma_foreign_proc_attributes_term(
 	    		ForeignLanguage, FlagsTerm, Flags) ->
 	        ( parse_pragma_keyword("local_vars", FieldsTerm, Fields,
 			FieldsContext) ->
@@ -474,7 +474,7 @@
 			    	FieldsTerm)
 		)
 	    ;
-		ErrMsg = "-- invalid third argument, expecting foreign code attribute or list of attributes",
+		ErrMsg = "-- invalid third argument, expecting foreign proc attribute or list of attributes",
 		Res = error(string__append(InvalidDeclStr, ErrMsg), FlagsTerm)
 	    )
 	),
@@ -495,12 +495,12 @@
 	    (
 		CodeTerm = term__functor(term__string(Code), [], Context)
 	    ->
-		( parse_pragma_foreign_code_attributes_term(ForeignLanguage, 
+		( parse_pragma_foreign_proc_attributes_term(ForeignLanguage, 
 			FlagsTerm, Flags) ->
 		    parse_pragma_foreign_code(ModuleName, Flags,
 			PredAndVarsTerm, ordinary(Code, yes(Context)),
 			VarSet, Res)
-	        ; parse_pragma_foreign_code_attributes_term(ForeignLanguage,
+	        ; parse_pragma_foreign_proc_attributes_term(ForeignLanguage,
 			PredAndVarsTerm, Flags) ->
 		    % XXX we should issue a warning; this syntax is deprecated
 		    % We will continue to accept this if c_code is used, but
@@ -515,7 +515,7 @@
 		    	    PredAndVarsTerm)
 		    )	
 	        ;
-		    ErrMsg = "-- invalid third argument, expecting a foreign code attribute or list of attributes",
+		    ErrMsg = "-- invalid third argument, expecting a foreign proc attribute or list of attributes",
 		    Res = error(string__append(InvalidDeclStr, ErrMsg), 
 		    	FlagsTerm)
 		)
@@ -611,11 +611,11 @@
 	(
 	    (
 		PragmaTerms = [PredAndModesTerm, FlagsTerm, FunctionTerm],
-		( parse_pragma_foreign_code_attributes_term(ForeignLanguage,
+		( parse_pragma_foreign_proc_attributes_term(ForeignLanguage,
 				FlagsTerm, Flags) ->
 			FlagsResult = ok(Flags)
 		;
-			FlagsResult = error("invalid second argument in `:- pragma import/3' declaration -- expecting foreign code attribute or list of attributes'",
+			FlagsResult = error("invalid second argument in `:- pragma import/3' declaration -- expecting a foreign proc attribute or list of attributes'",
 					FlagsTerm)
 	        )
 	    ;
@@ -1092,19 +1092,19 @@
 
 %-----------------------------------------------------------------------------%
 
-:- type collected_pragma_foreign_code_attribute
+:- type collected_pragma_foreign_proc_attribute
 	--->	may_call_mercury(may_call_mercury)
 	;	thread_safe(thread_safe)
 	;	tabled_for_io(tabled_for_io)
 	;	aliasing.
 
-:- pred parse_pragma_foreign_code_attributes_term(foreign_language, term, 
-		pragma_foreign_code_attributes).
-:- mode parse_pragma_foreign_code_attributes_term(in, in, out) is semidet.
+:- pred parse_pragma_foreign_proc_attributes_term(foreign_language, term, 
+		pragma_foreign_proc_attributes).
+:- mode parse_pragma_foreign_proc_attributes_term(in, in, out) is semidet.
 
-parse_pragma_foreign_code_attributes_term(ForeignLanguage, Term, Attributes) :-
+parse_pragma_foreign_proc_attributes_term(ForeignLanguage, Term, Attributes) :-
 	default_attributes(ForeignLanguage, Attributes0),
-	parse_pragma_foreign_code_attributes_term0(Term, AttrList),
+	parse_pragma_foreign_proc_attributes_term0(Term, AttrList),
 	( list__member(may_call_mercury(will_not_call_mercury), AttrList) ->
 		( list__member(may_call_mercury(may_call_mercury), AttrList) ->
 			% XXX an error message would be nice
@@ -1138,13 +1138,13 @@
 		Attributes = Attributes2
 	).
 
-:- pred parse_pragma_foreign_code_attributes_term0(term,
-		list(collected_pragma_foreign_code_attribute)).
-:- mode parse_pragma_foreign_code_attributes_term0(in, out) is semidet.
+:- pred parse_pragma_foreign_proc_attributes_term0(term,
+		list(collected_pragma_foreign_proc_attribute)).
+:- mode parse_pragma_foreign_proc_attributes_term0(in, out) is semidet.
 
-parse_pragma_foreign_code_attributes_term0(Term, Flags) :-
+parse_pragma_foreign_proc_attributes_term0(Term, Flags) :-
 	(
-		parse_single_pragma_foreign_code_attribute(Term, Flag)
+		parse_single_pragma_foreign_proc_attribute(Term, Flag)
 	->
 		Flags = [Flag]
 	;
@@ -1154,16 +1154,16 @@
 		;
 			Term = term__functor(term__atom("."), [Hd, Tl], _),
 			Flags = [Flag|Flags0],
-			parse_single_pragma_foreign_code_attribute(Hd, Flag),
-			parse_pragma_foreign_code_attributes_term0(Tl, Flags0)
+			parse_single_pragma_foreign_proc_attribute(Hd, Flag),
+			parse_pragma_foreign_proc_attributes_term0(Tl, Flags0)
 		)
 	).
 
-:- pred parse_single_pragma_foreign_code_attribute(term,
-		collected_pragma_foreign_code_attribute).
-:- mode parse_single_pragma_foreign_code_attribute(in, out) is semidet.
+:- pred parse_single_pragma_foreign_proc_attribute(term,
+		collected_pragma_foreign_proc_attribute).
+:- mode parse_single_pragma_foreign_proc_attribute(in, out) is semidet.
 
-parse_single_pragma_foreign_code_attribute(Term, Flag) :-
+parse_single_pragma_foreign_proc_attribute(Term, Flag) :-
 	( parse_may_call_mercury(Term, MayCallMercury) ->
 		Flag = may_call_mercury(MayCallMercury)
 	; parse_threadsafe(Term, ThreadSafe) ->
@@ -1217,7 +1217,7 @@
 
 % parse a pragma foreign_code declaration
 
-:- pred parse_pragma_foreign_code(module_name, pragma_foreign_code_attributes,
+:- pred parse_pragma_foreign_code(module_name, pragma_foreign_proc_attributes,
 	term, pragma_foreign_code_impl, varset, maybe1(item)).
 :- mode parse_pragma_foreign_code(in, in, in, in, in, out) is det.
 
@@ -1243,7 +1243,7 @@
 	(
 	    Error = no,
 	    varset__coerce(VarSet0, VarSet),
-	    Result = ok(pragma(foreign(Flags, PredName,
+	    Result = ok(pragma(foreign_proc(Flags, PredName,
 		    PredOrFunc, PragmaVars, VarSet, PragmaImpl)))
 	;
 	    Error = yes(ErrorMessage),
Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.5
diff -u -r1.5 prog_rep.m
--- compiler/prog_rep.m	2001/01/16 15:44:22	1.5
+++ compiler/prog_rep.m	2001/03/30 05:41:32
@@ -201,7 +201,7 @@
 		DetismRep, FilenameRep, LinenoRep, ChangedVarsRep),
 	Rep = atomic_goal_rep(DetismRep, FilenameRep, LinenoRep,
 		ChangedVarsRep, AtomicGoalRep).
-prog_rep__represent_goal_expr(pragma_foreign_code(_,
+prog_rep__represent_goal_expr(foreign_proc(_,
 		_PredId, _, Args, _, _, _),
 		GoalInfo, InstMap0, Info, Rep) :-
 	list__map(term__var_to_int, Args, ArgsRep),
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.29
diff -u -r1.29 purity.m
--- compiler/purity.m	2001/03/27 05:23:18	1.29
+++ compiler/purity.m	2001/03/30 05:41:23
@@ -745,7 +745,7 @@
 	{ worst_purity(Purity1, Purity2, Purity12) },
 	{ worst_purity(Purity12, Purity3, Purity) }.
 compute_expr_purity(Ccode, Ccode, _, _, Purity) -->
-	{ Ccode = pragma_foreign_code(_,PredId,_,_,_,_,_) },
+	{ Ccode = foreign_proc(_,PredId,_,_,_,_,_) },
 	ModuleInfo =^ module_info,
 	{ module_info_preds(ModuleInfo, Preds) },
 	{ map__lookup(Preds, PredId, CalledPredInfo) },
Index: compiler/quantification.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.78
diff -u -r1.78 quantification.m
--- compiler/quantification.m	2000/11/17 17:48:36	1.78
+++ compiler/quantification.m	2001/03/30 05:41:14
@@ -474,8 +474,8 @@
 	{ union(NonLocalVars1, NonLocalVars2, NonLocalVars) },
 	quantification__set_nonlocals(NonLocalVars).
 
-implicitly_quantify_goal_2(pragma_foreign_code(A,B,C,Vars,E,F,G), _,
-		pragma_foreign_code(A,B,C,Vars,E,F,G)) --> 
+implicitly_quantify_goal_2(foreign_proc(A,B,C,Vars,E,F,G), _,
+		foreign_proc(A,B,C,Vars,E,F,G)) --> 
 	implicitly_quantify_atomic_goal(Vars).
 
 implicitly_quantify_goal_2(bi_implication(LHS0, RHS0), Context, Goal) -->
@@ -985,7 +985,7 @@
 	union(Set5, Set6, Set),
 	union(LambdaSet5, LambdaSet6, LambdaSet).
 
-quantification__goal_vars_2(_, pragma_foreign_code(_,_,_, ArgVars, _, _, _),
+quantification__goal_vars_2(_, foreign_proc(_,_,_, ArgVars, _, _, _),
 		Set0, LambdaSet, Set, LambdaSet) :-
 	insert_list(Set0, ArgVars, Set).
 
Index: compiler/rl_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.18
diff -u -r1.18 rl_exprn.m
--- compiler/rl_exprn.m	2000/11/17 17:48:38	1.18
+++ compiler/rl_exprn.m	2001/03/30 05:40:54
@@ -853,8 +853,8 @@
 	{ Code = tree(SwitchCode, node([rl_PROC_label(EndSwitch)])) }.
 rl_exprn__goal(generic_call(_, _, _, _) - _, _, _) -->
 	{ error("rl_exprn__goal: higher-order and class-method calls not yet implemented") }.
-rl_exprn__goal(pragma_foreign_code(_, _, _, _, _, _, _) - _, _, _) -->
-	{ error("rl_exprn__goal: pragma_c_code not yet implemented") }.
+rl_exprn__goal(foreign_proc(_, _, _, _, _, _, _) - _, _, _) -->
+	{ error("rl_exprn__goal: foreign_proc not yet implemented") }.
 rl_exprn__goal(some(_, _, Goal) - _, Fail, Code) -->
 	rl_exprn__goal(Goal, Fail, Code).
 rl_exprn__goal(bi_implication(_, _) - _, _, _) -->
Index: compiler/saved_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/saved_vars.m,v
retrieving revision 1.29
diff -u -r1.29 saved_vars.m
--- compiler/saved_vars.m	2000/11/17 17:48:39	1.29
+++ compiler/saved_vars.m	2001/03/30 05:40:39
@@ -133,7 +133,7 @@
 		Goal = GoalExpr0 - GoalInfo0,
 		SlotInfo = SlotInfo0
 	;
-		GoalExpr0 = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr0 = foreign_proc(_, _, _, _, _, _, _),
 		Goal = GoalExpr0 - GoalInfo0,
 		SlotInfo = SlotInfo0
 	;
@@ -292,7 +292,7 @@
 				IsNonLocal, SlotInfo1, Goals1, SlotInfo),
 			Goals = [NewConstruct, Goal1 | Goals1]
 		;
-			Goal0Expr = pragma_foreign_code(_, _, _, _, _, _, _),
+			Goal0Expr = foreign_proc(_, _, _, _, _, _, _),
 			rename_var(SlotInfo0, Var, _NewVar, Subst, SlotInfo1),
 			goal_util__rename_vars_in_goal(Construct, Subst,
 				NewConstruct),
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.94
diff -u -r1.94 simplify.m
--- compiler/simplify.m	2001/03/27 05:23:18	1.94
+++ compiler/simplify.m	2001/04/01 06:45:52
@@ -1145,7 +1145,7 @@
 	).
 
 simplify__goal_2(Goal0, GoalInfo, Goal, GoalInfo, Info0, Info) :-
-	Goal0 = pragma_foreign_code(_, PredId, ProcId, Args, _, _, _),
+	Goal0 = foreign_proc(_, PredId, ProcId, Args, _, _, _),
 	(
 		simplify_do_calls(Info0),
 		goal_info_is_pure(GoalInfo)
@@ -2293,7 +2293,7 @@
 			Goal = GoalExpr - _,
 			GoalExpr \= call(_, _, _, _, _, _),
 			GoalExpr \= generic_call(_, _, _, _),
-			GoalExpr \= pragma_foreign_code(_, _, _, _, _, _, _)
+			GoalExpr \= foreign_proc(_, _, _, _, _, _, _)
 		)
 	->
 		simplify_info_get_common_info(Info0, CommonInfo0),
Index: compiler/store_alloc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/store_alloc.m,v
retrieving revision 1.75
diff -u -r1.75 store_alloc.m
--- compiler/store_alloc.m	2000/11/17 17:48:42	1.75
+++ compiler/store_alloc.m	2001/03/30 05:40:23
@@ -207,8 +207,8 @@
 store_alloc_in_goal_2(unify(A,B,C,D,E), Liveness, _, _,
 		_, unify(A,B,C,D,E), Liveness).
 
-store_alloc_in_goal_2(pragma_foreign_code(A, B, C, D, E, F, G), Liveness,
-		_, _, _, pragma_foreign_code(A, B, C, D, E, F, G), Liveness).
+store_alloc_in_goal_2(foreign_proc(A, B, C, D, E, F, G), Liveness,
+		_, _, _, foreign_proc(A, B, C, D, E, F, G), Liveness).
 
 store_alloc_in_goal_2(bi_implication(_, _), _, _, _, _, _, _) :-
 	% these should have been expanded out by now
Index: compiler/stratify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.23
diff -u -r1.23 stratify.m
--- compiler/stratify.m	2000/11/17 17:48:43	1.23
+++ compiler/stratify.m	2001/04/01 06:45:42
@@ -178,7 +178,7 @@
 		WholeScc, ThisPredProcId, Error, Module0, Module) -->
 	first_order_check_goal(Goal, GoalInfo, yes, WholeScc, ThisPredProcId,
 		Error, Module0, Module).
-first_order_check_goal(pragma_foreign_code(_Attributes, CPred,
+first_order_check_goal(foreign_proc(_Attributes, CPred,
 			CProc, _, _, _, _), 
 		GoalInfo, Negated, WholeScc, ThisPredProcId, 
 		Error, Module0, Module) -->
@@ -335,7 +335,7 @@
 		ThisPredProcId, HighOrderLoops, Error, Module0, Module) -->
 	higher_order_check_goal(Goal, GoalInfo, yes, WholeScc, ThisPredProcId,
 		HighOrderLoops, Error, Module0, Module).
-higher_order_check_goal(pragma_foreign_code(_IsRec, _, _, _, _, _, _),
+higher_order_check_goal(foreign_proc(_IsRec, _, _, _, _, _, _),
 	_GoalInfo, _Negated, _WholeScc, _ThisPredProcId, _HighOrderLoops, 
 	_, Module, Module) --> [].
 higher_order_check_goal(unify(_Var, _RHS, _Mode, _Uni, _Context), _GoalInfo,
@@ -822,7 +822,7 @@
 		CallsHO) :- 
 	check_goal1(Goal, Calls0, Calls, HasAT0, HasAT, CallsHO0, CallsHO).
 
-check_goal1(pragma_foreign_code(_Attrib, _CPred, _CProc, _, _, _, _),
+check_goal1(foreign_proc(_Attrib, _CPred, _CProc, _, _, _, _),
 		Calls, Calls, HasAT, HasAT, CallsHO, CallsHO).
 
 check_goal1(bi_implication(_, _), _, _, _, _, _, _) :-
@@ -913,7 +913,7 @@
 	get_called_procs(Goal, Calls0, Calls).
 get_called_procs(not(Goal - _GoalInfo), Calls0, Calls) :-
 	get_called_procs(Goal, Calls0, Calls).
-get_called_procs(pragma_foreign_code(_Attrib, _CPred, _CProc,
+get_called_procs(foreign_proc(_Attrib, _CPred, _CProc,
 		_, _, _, _), Calls, Calls).
 get_called_procs(bi_implication(_, _), _, _) :-
 	% these should have been expanded out by now
Index: compiler/switch_detection.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_detection.m,v
retrieving revision 1.94
diff -u -r1.94 switch_detection.m
--- compiler/switch_detection.m	2000/12/08 06:50:17	1.94
+++ compiler/switch_detection.m	2001/03/30 05:40:05
@@ -214,8 +214,8 @@
 		VarTypes, ModuleInfo, switch(Var, CanFail, Cases, SM)) :-
 	detect_switches_in_cases(Cases0, InstMap, VarTypes, ModuleInfo, Cases).
 
-detect_switches_in_goal_2(pragma_foreign_code(A,B,C,D,E,F,G), _, _, _, _,
-		pragma_foreign_code(A,B,C,D,E,F,G)).
+detect_switches_in_goal_2(foreign_proc(A,B,C,D,E,F,G), _, _, _, _,
+		foreign_proc(A,B,C,D,E,F,G)).
 detect_switches_in_goal_2(bi_implication(_, _), _, _, _, _, _) :-
 	% these should have been expanded out by now
 	error("detect_switches_in_goal_2: unexpected bi_implication").
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.28
diff -u -r1.28 table_gen.m
--- compiler/table_gen.m	2001/03/27 05:23:19	1.28
+++ compiler/table_gen.m	2001/03/30 05:39:56
@@ -296,7 +296,7 @@
 		proc_info_goal(ProcInfo0, BodyGoal),
 		some [SubGoal] (
 			goal_contains_goal(BodyGoal, SubGoal),
-			SubGoal = pragma_foreign_code(Attrs, _,_,_,_,_,_)
+			SubGoal = foreign_proc(Attrs, _,_,_,_,_,_)
 				- _,
 			tabled_for_io(Attrs, tabled_for_io)
 		)
Index: compiler/term_traversal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_traversal.m,v
retrieving revision 1.15
diff -u -r1.15 term_traversal.m
--- compiler/term_traversal.m	2000/11/17 17:48:45	1.15
+++ compiler/term_traversal.m	2001/03/30 05:39:47
@@ -183,7 +183,7 @@
 	traverse_goal(Else, Params, Info0, Info2),
 	combine_paths(Info1, Info2, Params, Info).
 
-traverse_goal_2(pragma_foreign_code(_, CallPredId, CallProcId, Args, _,_,_),
+traverse_goal_2(foreign_proc(_, CallPredId, CallProcId, Args, _,_,_),
 		GoalInfo, Params, Info0, Info) :-
 	params_get_module_info(Params, Module),
 	module_info_pred_proc_info(Module, CallPredId, CallProcId, _,
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.298
diff -u -r1.298 typecheck.m
--- compiler/typecheck.m	2001/03/08 06:54:31	1.298
+++ compiler/typecheck.m	2001/03/30 05:39:37
@@ -1074,8 +1074,8 @@
 	typecheck_unification(A, B0, B).
 typecheck_goal_2(switch(_, _, _, _), _) -->
 	{ error("unexpected switch") }.
-typecheck_goal_2(pragma_foreign_code(A, PredId, C, Args, E, F, G), 
-		pragma_foreign_code(A, PredId, C, Args, E, F, G)) -->
+typecheck_goal_2(foreign_proc(A, PredId, C, Args, E, F, G), 
+		foreign_proc(A, PredId, C, Args, E, F, G)) -->
 	% pragma_foreign_codes are automatically generated, so they
 	% will always be type-correct, but we need to do
 	% the type analysis in order to correctly compute the
Index: compiler/unique_modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.70
diff -u -r1.70 unique_modes.m
--- compiler/unique_modes.m	2001/01/17 01:42:12	1.70
+++ compiler/unique_modes.m	2001/03/30 05:39:24
@@ -508,18 +508,18 @@
 
 	% to modecheck a pragma_c_code, we just modecheck the proc for 
 	% which it is the goal.
-unique_modes__check_goal_2(pragma_foreign_code(Attributes,
+unique_modes__check_goal_2(foreign_proc(Attributes,
 		PredId, ProcId0, Args, ArgNameMap, OrigArgTypes, PragmaCode),
 		_GoalInfo, Goal) -->
-	mode_checkpoint(enter, "pragma_c_code"),
+	mode_checkpoint(enter, "foreign_proc"),
 	=(ModeInfo),
 	{ mode_info_get_call_id(ModeInfo, PredId, CallId) },
 	mode_info_set_call_context(call(call(CallId))),
 	unique_modes__check_call(PredId, ProcId0, Args, ProcId),
-	{ Goal = pragma_foreign_code(Attributes, PredId, ProcId, Args,
+	{ Goal = foreign_proc(Attributes, PredId, ProcId, Args,
 			ArgNameMap, OrigArgTypes, PragmaCode) },
 	mode_info_unset_call_context,
-	mode_checkpoint(exit, "pragma_c_code").
+	mode_checkpoint(exit, "foreign_proc").
 
 unique_modes__check_goal_2(bi_implication(_, _), _, _) -->
 	% these should have been expanded out by now
Index: compiler/unneeded_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unneeded_code.m,v
retrieving revision 1.7
diff -u -r1.7 unneeded_code.m
--- compiler/unneeded_code.m	2000/11/17 17:48:52	1.7
+++ compiler/unneeded_code.m	2001/03/30 05:38:39
@@ -616,7 +616,7 @@
 		RefinedGoals = RefinedGoals0,
 		Changed = Changed0
 	;
-		GoalExpr0 = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr0 = foreign_proc(_, _, _, _, _, _, _),
 		Goal = Goal0,
 		unneeded_code__demand_inputs(Goal, ModuleInfo, InstMap0,
 			everywhere, WhereNeededMap0, WhereNeededMap),
@@ -963,7 +963,7 @@
 		Goal = Goal0,
 		RefinedGoals = RefinedGoals0
 	;
-		GoalExpr0 = pragma_foreign_code(_, _, _, _, _, _, _),
+		GoalExpr0 = foreign_proc(_, _, _, _, _, _, _),
 		Goal = Goal0,
 		RefinedGoals = RefinedGoals0
 	;
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.71
diff -u -r1.71 unused_args.m
--- compiler/unused_args.m	2001/03/05 10:31:05	1.71
+++ compiler/unused_args.m	2001/03/30 05:38:23
@@ -436,9 +436,9 @@
 	set_list_vars_used(UseInf0, CallArgs, UseInf1),
 	set_list_vars_used(UseInf1, Args, UseInf).
 
-% handle pragma foreign(...) -
+% handle pragma foreign_proc(...) -
 % only those arguments which have names can be used in the foreign code.
-traverse_goal(_, pragma_foreign_code(_, _, _, Args, Names, _, _),
+traverse_goal(_, foreign_proc(_, _, _, Args, Names, _, _),
 		UseInf0, UseInf) :-
 	assoc_list__from_corresponding_lists(Args, Names, ArgsAndNames),
 	ArgIsUsed = lambda([ArgAndName::in, Arg::out] is semidet, (
@@ -1275,7 +1275,7 @@
 
 fixup_goal_expr(_ModuleInfo, _UnusedVars, _ProcCallInfo, no,
 			GoalExpr - GoalInfo, GoalExpr - GoalInfo) :-
-	GoalExpr = pragma_foreign_code(_, _, _, _, _, _, _).
+	GoalExpr = foreign_proc(_, _, _, _, _, _, _).
 
 fixup_goal_expr(_, _, _, _, bi_implication(_, _) - _, _) :-
 	% these should have been expanded out by now


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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