[m-dev.] diff: function declarations in HLDS dumps

Simon Taylor stayl at cs.mu.OZ.AU
Thu Oct 14 13:39:04 AEST 1999



Estimated hours taken: 0.1

compiler/hlds_out.m:
	Output `:- func' rather than `:- pred' declarations
	for functions in HLDS dumps.


Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.225
diff -u -u -r1.225 hlds_out.m
--- hlds_out.m	1999/09/12 04:26:41	1.225
+++ hlds_out.m	1999/10/14 03:02:30
@@ -697,9 +697,19 @@
 	( { string__contains_char(Verbose, 'C') } ->
 		% Information about predicates is dumped if 'C'
 		% suboption is on.
-		mercury_output_pred_type(TVarSet, ExistQVars,
+		(
+			{ PredOrFunc = predicate },
+			mercury_output_pred_type(TVarSet, ExistQVars,
 				qualified(Module, PredName),
 				ArgTypes, no, Purity, ClassContext, Context)
+		;
+			{ PredOrFunc = function },
+			{ pred_args_to_func_args(ArgTypes, FuncArgTypes,
+				FuncRetType) },
+			mercury_output_func_type(TVarSet, ExistQVars,
+				qualified(Module, PredName), FuncArgTypes,
+				FuncRetType, no, Purity, ClassContext, Context)
+		)
 	;
 		[]
 	),
@@ -2797,9 +2807,21 @@
 
 	hlds_out__write_indent(Indent),
 	{ predicate_name(ModuleInfo, PredId, PredName) },
+	{ pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
 	{ varset__init(ModeVarSet) },
-	mercury_output_pred_mode_decl(ModeVarSet, unqualified(PredName),
-			HeadModes, DeclaredDeterminism, ModeContext),
+	( 
+		{ PredOrFunc = predicate },
+		mercury_output_pred_mode_decl(ModeVarSet,
+			unqualified(PredName), HeadModes,
+			DeclaredDeterminism, ModeContext)
+	;
+		{ PredOrFunc = function },
+		{ pred_args_to_func_args(HeadModes, FuncHeadModes,
+			RetHeadMode) },
+		mercury_output_func_mode_decl(ModeVarSet,
+			unqualified(PredName), FuncHeadModes, RetHeadMode,
+			DeclaredDeterminism, ModeContext)
+	),
 
 	( { MaybeArgLives = yes(ArgLives) } ->
 		hlds_out__write_indent(Indent),
@@ -2821,7 +2843,6 @@
 		hlds_out__write_stack_slots(Indent, StackSlots, VarSet,
 			AppendVarnums),
 		hlds_out__write_indent(Indent),
-		{ pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
 		hlds_out__write_clause_head(ModuleInfo, PredId, VarSet,
 			AppendVarnums, HeadVars, PredOrFunc),
 		io__write_string(" :-\n"),
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list