[m-rev.] [reuse] diff: print aliasing info in .opt

Nancy Mazur Nancy.Mazur at cs.kuleuven.ac.be
Sat Mar 24 01:12:02 AEDT 2001


Hi,


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


Estimated hours taken: 2
Branches: reuse

Provide correct output of aliasing information in the opt-files 
for the user-declared aliasing info in foreign-code pragma's. 
This required extending the aliasing type with a typevarset
(instead of trying to thread it through), and further minor
changes. 

make_hlds.m:
	Also thread type-varset through to the point where
	the aliasing-information is being renamed. Rename
	the type-varset. 

mercury_to_mercury.m:
	When outputting pragma-foreign-attributes, also use 
	the prog-varset. This is needed in order to print the
	aliasing-information. 

pa_alias_as.m:
pa_datastruct.m:
pa_selector.m:
	Provide predicates for correctly transforming aliasing
	information into a string. 

prog_data.m:
	Extend the aliasing information with a typevariable-set. 

prog_io_pragma.m:
	Record type-varset information when reading in aliasing-info. 


Index: make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.347.2.12
diff -u -r1.347.2.12 make_hlds.m
--- make_hlds.m	2001/03/22 10:06:43	1.347.2.12
+++ make_hlds.m	2001/03/23 14:04:50
@@ -4103,7 +4103,8 @@
 	% Add the code for this `pragma import' to the clauses_info
 	%
 	clauses_info_add_pragma_foreign_code(Clauses0, Purity, Attributes,
-		PredId, ProcId, VarSet, PragmaVars, ArgTypes, PragmaImpl,
+		PredId, ProcId, VarSet, PragmaVars, ArgTypes, 
+		varset__init, PragmaImpl,
 		Context, PredOrFunc, qualified(PredModule, PredName),
 		Arity, Clauses, ModuleInfo0, ModuleInfo, Info0, Info),
 
@@ -4214,11 +4215,12 @@
 						ModuleInfo1, ProcId) }
 		->
 			{ pred_info_clauses_info(PredInfo1, Clauses0) },
-			{ pred_info_arg_types(PredInfo1, ArgTypes) },
+			{ pred_info_arg_types(PredInfo1, TVarSet, _, 
+					ArgTypes) }, 
 			{ pred_info_get_purity(PredInfo1, Purity) },
 			clauses_info_add_pragma_foreign_code(
 				Clauses0, Purity, Attributes, PredId,
-				ProcId, VarSet, PVars, ArgTypes,
+				ProcId, VarSet, PVars, ArgTypes, TVarSet, 
 				PragmaImpl, Context, PredOrFunc,
 				PredName, Arity, Clauses, ModuleInfo1,
 				ModuleInfo2, Info0, Info),
@@ -5238,13 +5240,15 @@
 :- pred clauses_info_add_pragma_foreign_code(
 	clauses_info::in, purity::in, pragma_foreign_code_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,
+	list(type)::in, tvarset::in, 
+	pragma_foreign_code_impl::in, prog_context::in,
 	pred_or_func::in, sym_name::in, arity::in, clauses_info::out,
 	module_info::in, module_info::out, qual_info::in,
 	qual_info::out, io__state::di, io__state::uo) is det.
 
 clauses_info_add_pragma_foreign_code(ClausesInfo0, Purity, Attributes0, PredId,
-		ModeId, PVarSet, PVars, OrigArgTypes, PragmaImpl0, Context,
+		ModeId, PVarSet, PVars, OrigArgTypes, TVarSet, 
+		PragmaImpl0, Context,
 		PredOrFunc, PredName, Arity, ClausesInfo, ModuleInfo0,
 		ModuleInfo, Info0, Info) -->
 	globals__io_lookup_foreign_language_option(backend_foreign_language,
@@ -5319,7 +5323,7 @@
 		% variables. 
 		aliasing(Attributes, Aliasing0), 
 		rename_aliasing(Aliasing0, Args0, HeadVars, OrigArgTypes, 
-			Aliasing), 
+			TVarSet, Aliasing), 
 		set_aliasing(Attributes, Aliasing, Attributes1), 
 
 			% build the pragma_c_code
@@ -5354,22 +5358,26 @@
 	).
 
 :- pred rename_aliasing(aliasing::in, list(prog_var)::in, 
-	list(prog_var)::in, list(type)::in, aliasing::out) is det.
+	list(prog_var)::in, list(type)::in, tvarset::in, aliasing::out) is det.
 rename_aliasing(ActualAliasing, ActualHVs, FormalHVs, FormalTypes, 
-			FormalAliasing):- 
-	ActualAliasing = aliasing(MaybeActualTypes, ActualAlias),
+			TVarSet, FormalAliasing):- 
+	ActualAliasing = aliasing(MaybeActualTypes, _, ActualAlias),
 	map__from_corresponding_lists(ActualHVs, FormalHVs, VarMapping), 
 	pa_alias_as__rename(VarMapping, ActualAlias, Alias0), 
 	(
 		MaybeActualTypes = yes(ActualTypes)
 	->
 		pa_alias_as__rename_types(ActualTypes, FormalTypes, 
-				Alias0, FormalAlias)
+				Alias0, FormalAlias),
+		term__vars_list(FormalTypes, FormalTVars), 
+		set__list_to_set(FormalTVars, TSet), 
+		varset__select(TVarSet, TSet, FormalVarSet) 
 	;
-		FormalAlias = Alias0
+		FormalAlias = Alias0,
+		FormalVarSet = varset__init
 	), 
 	% NB: MaybeActualTypes are not needed after this renaming
-	FormalAliasing = aliasing(no, FormalAlias). 
+	FormalAliasing = aliasing(yes(FormalTypes), FormalVarSet, FormalAlias). 
 		
 
 :- pred allocate_vars_for_saved_vars(list(string), list(pair(prog_var, string)),
Index: mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.174.2.8
diff -u -r1.174.2.8 mercury_to_mercury.m
--- mercury_to_mercury.m	2001/02/20 10:15:19	1.174.2.8
+++ mercury_to_mercury.m	2001/03/23 14:04:54
@@ -2290,7 +2290,7 @@
 		io__write_string(")")
 	),
 	io__write_string(", "),
-	mercury_output_pragma_foreign_attributes(Attributes),
+	mercury_output_pragma_foreign_attributes(Attributes, VarSet),
 	io__write_string(", "),
 	(
 		{ PragmaCode = ordinary(C_Code, _) },
@@ -2475,7 +2475,11 @@
 		io__write_string(")")
 	),
 	io__write_string(", "),
-	mercury_output_pragma_foreign_attributes(Attributes),
+		% The varset (varset__init) could be erronuously used
+		% when outputting aliasing-information. But, since
+		% it's impossible to provide aliasing information for
+		% pragma-imports, the problem will never occur. 
+	mercury_output_pragma_foreign_attributes(Attributes, varset__init),
 	io__write_string(", """),
 	io__write_string(C_Function),
 	io__write_string(""").\n").
@@ -2578,13 +2582,14 @@
 %-----------------------------------------------------------------------------%
 
 :- pred mercury_output_pragma_foreign_attributes(
-		pragma_foreign_code_attributes, io__state, io__state).
-:- mode mercury_output_pragma_foreign_attributes(in, di, uo) is det.
+		pragma_foreign_code_attributes, 
+		prog_varset, io__state, io__state).
+:- mode mercury_output_pragma_foreign_attributes(in, in, di, uo) is det.
 
-mercury_output_pragma_foreign_attributes(Attributes) -->
+mercury_output_pragma_foreign_attributes(Attributes, VarSet) -->
 	% This is one case where it is a bad idea to use field
 	% accessors.  
-	{ attributes_to_strings(Attributes, AttrStrings) },
+	{ attributes_to_strings(Attributes, VarSet, AttrStrings) },
 	io__write_string("["),
 	io__write_list(AttrStrings, ", ", io__write_string),
 	io__write_string("]").
Index: pa_alias_as.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_alias_as.m,v
retrieving revision 1.1.2.19
diff -u -r1.1.2.19 pa_alias_as.m
--- pa_alias_as.m	2001/03/23 10:41:29	1.1.2.19
+++ pa_alias_as.m	2001/03/23 14:04:54
@@ -15,7 +15,7 @@
 %-- import_module 
 
 % library modules
-:- import_module set, list, map, string, int.
+:- import_module set, list, map, string, int, varset.
 :- import_module io, term, std_util.
 
 % compiler modules
@@ -169,11 +169,11 @@
 :- pred parse_read_aliases_from_single_term(term(T), alias_as).
 :- mode parse_read_aliases_from_single_term(in, out) is det.
 
-:- pred parse_user_declared_aliases(term, aliasing).
-:- mode parse_user_declared_aliases(in, out) is semidet.
+:- pred parse_user_declared_aliases(term, varset, aliasing).
+:- mode parse_user_declared_aliases(in, in, out) is semidet.
 
-:- pred to_user_declared_aliases(aliasing, string). 
-:- mode to_user_declared_aliases(in, out) is det.
+:- pred to_user_declared_aliases(aliasing, prog_varset, string). 
+:- mode to_user_declared_aliases(in, in, out) is det.
 
 	% Live = live(IN_USE,LIVE_0,ALIASES).
 	% compute the live-set based upon an initial IN_USE set, 
@@ -202,6 +202,7 @@
 % compiler modules
 :- import_module pa_alias, pa_util, pa_sr_util.
 :- import_module pa_alias_set.
+:- import_module mercury_to_mercury.
 
 %-----------------------------------------------------------------------------%
 %-- type definitions 
@@ -556,7 +557,7 @@
 		MaybeModes, Types, Alias):-
 	(
 		aliasing(Attrs, UserDefinedAlias), 
-		UserDefinedAlias = aliasing(_, UserAlias),
+		UserDefinedAlias = aliasing(_, _, UserAlias),
 		UserAlias \= top(_)
 	->
 		Alias = UserAlias
@@ -864,28 +865,34 @@
 %-----------------------------------------------------------------------------%
 
 parse_user_declared_aliases(term__functor(term__atom("no_aliasing"), [], _),
-                Aliasing):-
+		_VarSet, Aliasing):-
         pa_alias_as__init(BottomAlias),
-	Aliasing = aliasing(no, BottomAlias). 
+	Aliasing = aliasing(no, varset__init, BottomAlias). 
 parse_user_declared_aliases(term__functor(term__atom("unknown_aliasing"), 
-				[], Context), Aliasing):-
+				[], Context), _VarSet, Aliasing):-
 	format_context(Context, ContextString), 
 	string__append_list(["user declared top (", ContextString, ")"], Msg),
         pa_alias_as__top(Msg, TopAlias), 
-	Aliasing = aliasing(no, TopAlias). 
+	Aliasing = aliasing(no, varset__init, TopAlias). 
 parse_user_declared_aliases(term__functor(term__atom("alias"), 
-		[TypesTerm,AliasTerm], _), Aliasing):-
+		[TypesTerm,AliasTerm], _), VarSet, Aliasing):-
 	(
 		TypesTerm = term__functor(term__atom("yes"), 
 					ListTypesTerms, _), 
+		term__vars_list(ListTypesTerms, TypeVars), 
+		set__list_to_set(TypeVars, SetTypeVars), 
+		varset__select(VarSet, SetTypeVars, TypeVarSet0),
+		varset__coerce(TypeVarSet0, TypeVarSet),
+		
 		list__map(term__coerce, ListTypesTerms, Types), 
 		MaybeTypes = yes(Types)
 	;
 		TypesTerm = term__functor(term__atom("no"),[],_), 
-		MaybeTypes = no
+		MaybeTypes = no,
+		varset__init(TypeVarSet) 
 	), 
 	parse_user_declared_aliases_2(AliasTerm, AliasAs), 
-	Aliasing = aliasing(MaybeTypes, AliasAs). 
+	Aliasing = aliasing(MaybeTypes, TypeVarSet, AliasAs). 
 
 :- pred format_context(term__context::in, string::out) is det.
 format_context(Context, String):- 
@@ -978,10 +985,61 @@
 		error("(pa_alias_as) parse_user_datastruct: wrong datastructure description -- should be cel/2")
 	).
 
+		
+to_user_declared_aliases(aliasing(_, _, bottom), _, "no_aliasing"). 
+to_user_declared_aliases(aliasing(_, _, top(_)), _, "unknown_aliasing").
+% to_user_declared_aliases(aliasing(_, _, real_as(_)), _, "alias(no, [])"). 
+% to_user_declared_aliases(aliasing(MaybeTypes, real_as(_)), 
+%				ProgVarSet, String):- 
+to_user_declared_aliases( aliasing(MaybeTypes, TypeVarSet, real_as(AliasSet)), 
+		ProgVarSet, String):-
+	(
+		MaybeTypes = yes(Types) 
+	->
+		mercury_type_list_to_string(TypeVarSet, Types, TypesString0),
+		string__append_list(["yes(", TypesString0, ")"], 
+			TypesString)
+	;
+		TypesString = "no"
+	), 
+	pa_alias_set__to_pair_alias_list(AliasSet, AliasList), 
+	alias_list_to_user_declared_aliases(AliasList, 
+			ProgVarSet, TypeVarSet, AliasString0), 
+	string__append_list(["[",AliasString0,"]"], AliasString), 
+
+	string__append_list(["alias(", TypesString, ", ", 
+			AliasString, ")"], String).
+
+:- pred alias_list_to_user_declared_aliases(list(alias)::in, 
+		prog_varset::in, tvarset::in, string::out) is det. 
+alias_list_to_user_declared_aliases([], _, _, ""). 
+alias_list_to_user_declared_aliases([Alias|Rest], ProgVarSet, TypeVarSet,
+		String):- 
+	alias_to_user_declared_alias(Alias, ProgVarSet, TypeVarSet, 
+			AliasString), 
+	(
+		Rest = []
+	->
+		String = AliasString
+	; 
+		alias_list_to_user_declared_aliases(Rest, ProgVarSet, 
+				TypeVarSet, RestString), 
+		string__append_list([AliasString, ", ", RestString], 
+				String)
+	).
+
+:- pred alias_to_user_declared_alias(alias::in, prog_varset::in,
+		tvarset::in, string::out) is det.
+alias_to_user_declared_alias(Alias, ProgVarSet, TypeVarSet, String):- 
+	Alias = Data0 - Data1, 
+	pa_datastruct__to_user_declared(Data0, ProgVarSet, TypeVarSet, 
+			Data0String), 
+	pa_datastruct__to_user_declared(Data1, ProgVarSet, TypeVarSet,
+			Data1String),
+	string__append_list([Data0String, " - ", Data1String],
+			String). 
+		
 		
-to_user_declared_aliases(aliasing(_, bottom), "no_aliasing"). 
-to_user_declared_aliases(aliasing(_, top(_)), "unknown_aliasing").
-to_user_declared_aliases(aliasing(_, real_as(_)), "alias([])"). 
 
 %-----------------------------------------------------------------------------%
 
Index: pa_datastruct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_datastruct.m,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 pa_datastruct.m
--- pa_datastruct.m	2001/03/23 10:41:29	1.1.2.6
+++ pa_datastruct.m	2001/03/23 14:04:54
@@ -91,6 +91,9 @@
 :- pred print(datastruct, proc_info, pred_info, io__state, io__state).
 :- mode print(in, in, in, di, uo) is det.
 
+:- pred to_user_declared(datastruct, prog_varset, tvarset, string). 
+:- mode to_user_declared(in, in, in, out) is det.
+
 	% Parsing routines
 :- pred parse_term(term(T), datastruct).
 :- mode parse_term(in, out) is det.
@@ -174,6 +177,14 @@
 	{ pred_info_typevarset(PredInfo, TypeVarSet) }, 
 	pa_selector__print(SEL, TypeVarSet),
 	io__write_string(")").
+
+to_user_declared(Data, ProgVarSet, TypeVarSet, String):- 
+	Data = cel(ProgVar, Selector), 
+	varset__lookup_name(ProgVarSet, ProgVar, ProgName), 
+	pa_selector__to_user_declared(Selector, TypeVarSet, 
+			SelectorString), 
+	string__append_list(["cel(", ProgName, ", ", SelectorString, ")"], 
+		String). 
 
 parse_term(TERM, Data) :- 
    (
Index: pa_selector.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_selector.m,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 pa_selector.m
--- pa_selector.m	2001/03/23 10:41:30	1.1.2.7
+++ pa_selector.m	2001/03/23 14:04:55
@@ -82,6 +82,7 @@
 
 :- pred print(selector::in, tvarset::in, 
 		io__state::di, io__state::uo) is det. 
+:- pred to_user_declared(selector::in, tvarset::in, string::out) is det. 
 
 :- pred parse_term(term(T), selector).
 :- mode parse_term(in, out) is det.
@@ -184,6 +185,36 @@
 	mercury_output_term(Type, ProgVarSet, bool__no), 
 	io__write_string(")").
 
+to_user_declared(Selector, TVarSet, String):- 
+	(
+		Selector = []
+	-> 
+		String = "[]"
+	; 
+		to_user_declared_2(Selector, TVarSet, String2), 
+		string__append_list(["[", String2, "]"], String)
+	). 
+
+:- pred to_user_declared_2(selector::in, tvarset::in, string::out) is det.
+
+to_user_declared_2([], _, "").
+to_user_declared_2([First | Rest], TVarSet, String):- 
+	us_to_user_declared(First, TVarSet, FirstString), 
+	(
+		Rest = []
+	->
+		String = FirstString
+	;
+		to_user_declared_2(Rest, TVarSet, RestString), 
+		string__append_list([FirstString, ", ", RestString], 
+			String)
+	). 
+
+:- pred us_to_user_declared(unit_sel::in, tvarset::in, string::out) is det.
+us_to_user_declared(us(_,_), _, _):- 
+	require__error("(pa_selector) us_to_user_declared: only type-selectors are allowed in user-alias-declaration.").
+us_to_user_declared(ts(Type), TVarSet, String):- 
+	mercury_type_to_string(TVarSet, Type, String). 
 
 parse_term(TERM, SEL):- 
 	(
Index: prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.58.2.9
diff -u -r1.58.2.9 prog_data.m
--- prog_data.m	2001/03/22 10:06:50	1.58.2.9
+++ prog_data.m	2001/03/23 14:04:57
@@ -600,6 +600,7 @@
 	---> 	aliasing(maybe(list(type)), % this is only needed when the
 					    % user expresses aliases in terms
 					    % of type-variables.
+			 tvarset, 
 			 pa_alias_as__alias_as). 
 
 :- type pragma_var    
@@ -975,7 +976,7 @@
 	% 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,
-		list(string)::out) is det.
+		prog_varset::in, list(string)::out) is det.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -995,7 +996,7 @@
 	attributes(Language, may_call_mercury, not_thread_safe, 
 		not_tabled_for_io, Aliasing)):-
 	pa_alias_as__top("Default top", TopAlias), 
-	Aliasing = aliasing(no, TopAlias).
+	Aliasing = aliasing(no, varset__init, TopAlias).
 
 may_call_mercury(Attrs, Attrs ^ may_call_mercury).
 
@@ -1022,7 +1023,7 @@
 set_aliasing(Attrs0, TabledForIo, Attrs) :-
 	Attrs = Attrs0 ^ aliasing := TabledForIo.
 
-attributes_to_strings(Attrs, StringList) :-
+attributes_to_strings(Attrs, ProgVarSet, StringList) :-
 	% We ignore Lang because it isn't an attribute that you can put
 	% in the attribute list -- the foreign language specifier string
 	% is at the start of the pragma.
@@ -1049,7 +1050,7 @@
 		TabledForIO = not_tabled_for_io,
 		TabledForIOStr = "not_tabled_for_io"
 	),
-	to_user_declared_aliases(Aliasing, AliasingStr), 
+	to_user_declared_aliases(Aliasing, ProgVarSet, AliasingStr), 
 	StringList = [MayCallMercuryStr, ThreadSafeStr, TabledForIOStr,
 			AliasingStr].
 
Index: prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.23.2.8
diff -u -r1.23.2.8 prog_io_pragma.m
--- prog_io_pragma.m	2001/03/22 10:06:51	1.23.2.8
+++ prog_io_pragma.m	2001/03/23 14:04:58
@@ -218,7 +218,7 @@
             PTerms6 = [PredAndVarsTerm, FlagsTerm,
 		    FieldsTerm, FirstTerm, LaterTerm, SharedTerm],
 	    ( parse_pragma_foreign_code_attributes_term(
-	    		ForeignLanguage, FlagsTerm, Flags) ->
+	    		ForeignLanguage, FlagsTerm, VarSet, Flags) ->
 	        ( parse_pragma_keyword("local_vars", FieldsTerm, Fields,
 			FieldsContext) ->
 	            ( parse_pragma_keyword("first_code", FirstTerm, First,
@@ -295,12 +295,12 @@
 		CodeTerm = term__functor(term__string(Code), [], Context)
 	    ->
 		( parse_pragma_foreign_code_attributes_term(ForeignLanguage, 
-			FlagsTerm, Flags) ->
+			FlagsTerm, VarSet, Flags) ->
 		    parse_pragma_foreign_code(ModuleName, Flags,
 			PredAndVarsTerm, ordinary(Code, yes(Context)),
 			VarSet, Res)
 	        ; parse_pragma_foreign_code_attributes_term(ForeignLanguage,
-			PredAndVarsTerm, Flags) ->
+			PredAndVarsTerm, VarSet, Flags) ->
 		    % XXX we should issue a warning; this syntax is deprecated
 		    % We will continue to accept this if c_code is used, but
 		    % not with foreign_code
@@ -421,7 +421,7 @@
             PTerms6 = [PredAndVarsTerm, FlagsTerm,
 		    FieldsTerm, FirstTerm, LaterTerm, SharedTerm],
 	    ( parse_pragma_foreign_code_attributes_term(
-	    		ForeignLanguage, FlagsTerm, Flags) ->
+	    		ForeignLanguage, FlagsTerm, VarSet, Flags) ->
 	        ( parse_pragma_keyword("local_vars", FieldsTerm, Fields,
 			FieldsContext) ->
 	            ( parse_pragma_keyword("first_code", FirstTerm, First,
@@ -498,12 +498,12 @@
 		CodeTerm = term__functor(term__string(Code), [], Context)
 	    ->
 		( parse_pragma_foreign_code_attributes_term(ForeignLanguage, 
-			FlagsTerm, Flags) ->
+			FlagsTerm, VarSet, Flags) ->
 		    parse_pragma_foreign_code(ModuleName, Flags,
 			PredAndVarsTerm, ordinary(Code, yes(Context)),
 			VarSet, Res)
 	        ; parse_pragma_foreign_code_attributes_term(ForeignLanguage,
-			PredAndVarsTerm, Flags) ->
+			PredAndVarsTerm, VarSet, Flags) ->
 		    % XXX we should issue a warning; this syntax is deprecated
 		    % We will continue to accept this if c_code is used, but
 		    % not with foreign_code
@@ -607,14 +607,14 @@
 
 
 parse_pragma_type(ModuleName, "import", PragmaTerms,
-			ErrorTerm, _VarSet, Result) :-
+			ErrorTerm, VarSet, Result) :-
 		% XXX we assume all imports are C
 	ForeignLanguage = c,
 	(
 	    (
 		PragmaTerms = [PredAndModesTerm, FlagsTerm, FunctionTerm],
 		( parse_pragma_foreign_code_attributes_term(ForeignLanguage,
-				FlagsTerm, Flags) ->
+				FlagsTerm, VarSet, Flags) ->
 			FlagsResult = ok(Flags)
 		;
 			FlagsResult = error("invalid second argument in `:- pragma import/3' declaration -- expecting foreign code attribute or list of attributes'",
@@ -1178,12 +1178,13 @@
 	;	collected_aliasing(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.
+		varset, pragma_foreign_code_attributes).
+:- mode parse_pragma_foreign_code_attributes_term(in, in, in, out) is semidet.
 
-parse_pragma_foreign_code_attributes_term(ForeignLanguage, Term, Attributes) :-
+parse_pragma_foreign_code_attributes_term(ForeignLanguage, 
+		Term, VarSet, Attributes) :-
 	default_attributes(ForeignLanguage, Attributes0),
-	parse_pragma_foreign_code_attributes_term0(Term, AttrList),
+	parse_pragma_foreign_code_attributes_term0(Term, VarSet, 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
@@ -1232,12 +1233,12 @@
 	).
 
 :- 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.
+		varset, list(collected_pragma_foreign_code_attribute)).
+:- mode parse_pragma_foreign_code_attributes_term0(in, in, out) is semidet.
 
-parse_pragma_foreign_code_attributes_term0(Term, Flags) :-
+parse_pragma_foreign_code_attributes_term0(Term, VarSet, Flags) :-
 	(
-		parse_single_pragma_foreign_code_attribute(Term, Flag)
+		parse_single_pragma_foreign_code_attribute(Term, VarSet, Flag)
 	->
 		Flags = [Flag]
 	;
@@ -1247,23 +1248,25 @@
 		;
 			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_code_attribute(Hd,
+							VarSet, Flag),
+			parse_pragma_foreign_code_attributes_term0(Tl, 
+							VarSet, Flags0)
 		)
 	).
 
-:- pred parse_single_pragma_foreign_code_attribute(term,
+:- pred parse_single_pragma_foreign_code_attribute(term, varset, 
 		collected_pragma_foreign_code_attribute).
-:- mode parse_single_pragma_foreign_code_attribute(in, out) is semidet.
+:- mode parse_single_pragma_foreign_code_attribute(in, in, out) is semidet.
 
-parse_single_pragma_foreign_code_attribute(Term, Flag) :-
+parse_single_pragma_foreign_code_attribute(Term, VarSet, Flag) :-
 	( parse_may_call_mercury(Term, MayCallMercury) ->
 		Flag = may_call_mercury(MayCallMercury)
 	; parse_threadsafe(Term, ThreadSafe) ->
 		Flag = thread_safe(ThreadSafe)
 	; parse_tabled_for_io(Term, TabledForIo) ->
 		Flag = tabled_for_io(TabledForIo)
-	; parse_aliasing(Term, Aliasing) ->
+	; parse_aliasing(Term, VarSet, Aliasing) ->
 		Flag = collected_aliasing(Aliasing)
 	;
 		fail
@@ -1297,11 +1300,11 @@
 parse_tabled_for_io(term__functor(term__atom("not_tabled_for_io"), [], _),
 	not_tabled_for_io).
 
-:- pred parse_aliasing(term, aliasing).
-:- mode parse_aliasing(in, out) is semidet.
+:- pred parse_aliasing(term, varset, aliasing).
+:- mode parse_aliasing(in, in, out) is semidet.
 
-parse_aliasing(Term, Aliasing):- 
-	pa_alias_as__parse_user_declared_aliases(Term, Aliasing). 
+parse_aliasing(Term, VarSet, Aliasing):- 
+	pa_alias_as__parse_user_declared_aliases(Term, VarSet, Aliasing). 
 
 % parse a pragma foreign_code declaration
 

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