[m-rev.] diff: simple_call_ids in error_util

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Aug 8 12:32:48 AEST 2005


Allow simple_call_ids to be formatted by the predicates of error_util.m,
and convert the error messages in some submodules of make_hlds.m to use this
capability.

compiler/hlds_pred.m:
compiler/prog_data.m:
	Move the simple_call_id type from hlds_pred to prog_data,
	since error_util shouldn't import any HLDS modules.

compiler/hlds_out.m:
compiler/prog_out.m:
	Move the predicates for printing simple_call_ids from hlds_out to
	prog_out.

	Change prog_out.m to four-space indentation to reduce the number
	of bad line breaks.

	In prog_out.m, move the relevant comments to the interface,
	delete unnecessary module qualifications, and delete some long
	obsolete commented-out code.

compiler/error_util.m:
	Add simple_call_id to the list of format components.

	Change to four-space indentation to reduce the number of bad line
	breaks.

	Conform to the standard format for comments.

compiler/add_pragma.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_warn.m:
	Use the new capability to convert some error reporting code to use
	error_util.

compiler/*.m:
	Conform to the changes above, mostly by deleting now incorrect module
	qualifications.

tests/invalid/*.err_exp:
tests/warnings/*.err_exp:
	Expect the new, better formatted error messages.

tests/invalid/Mmakefile:
	Fix some too-long lines in comments.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/add_aditi.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_aditi.m,v
retrieving revision 1.1
diff -u -b -r1.1 add_aditi.m
--- compiler/add_aditi.m	26 Jul 2005 01:56:20 -0000	1.1
+++ compiler/add_aditi.m	6 Aug 2005 07:54:44 -0000
@@ -572,7 +572,7 @@
         io__nl(!IO),
         prog_out__write_context(Context, !IO),
         io__write_string("  for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, Name/Arity, !IO),
+        write_simple_call_id(PredOrFunc, Name/Arity, !IO),
         io__write_string(" without preceding\n", !IO),
         prog_out__write_context(Context, !IO),
         io__write_string("  `:- pragma base_relation' declaration.\n", !IO),
@@ -590,7 +590,7 @@
         % since they're removed by magic.m.
         prog_out__write_context(Context, !IO),
         io__write_string("In `:- pragma aditi_index' declaration for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, Name/Arity, !IO),
+        write_simple_call_id(PredOrFunc, Name/Arity, !IO),
         io__write_string(":\n", !IO),
         prog_out__write_context(Context, !IO),
         io__write_string("  attribute ", !IO),
Index: compiler/add_clause.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_clause.m,v
retrieving revision 1.2
diff -u -b -r1.2 add_clause.m
--- compiler/add_clause.m	1 Aug 2005 02:43:16 -0000	1.2
+++ compiler/add_clause.m	6 Aug 2005 07:55:08 -0000
@@ -186,7 +186,7 @@
             Status \= opt_imported
         ->
             module_info_incr_errors(!ModuleInfo),
-            CallIdString0 = hlds_out__simple_call_id_to_string(
+            CallIdString0 = simple_call_id_to_string(
                 PredOrFunc - PredName/Arity),
             string__append(CallIdString0, ".", CallIdString),
             ErrorPieces0 = [
Index: compiler/add_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pragma.m,v
retrieving revision 1.1
diff -u -b -r1.1 add_pragma.m
--- compiler/add_pragma.m	26 Jul 2005 01:56:20 -0000	1.1
+++ compiler/add_pragma.m	6 Aug 2005 14:20:34 -0000
@@ -200,10 +200,9 @@
         Pragma = unused_args(PredOrFunc, SymName, Arity, ModeNum,
             UnusedArgs),
         ( ImportStatus \= opt_imported ->
-            prog_out__write_context(Context, !IO),
-            io__write_string("Error: illegal use of pragma `unused_args'.\n",
-                !IO),
-            module_info_incr_errors(!ModuleInfo)
+            module_info_incr_errors(!ModuleInfo),
+            Pieces = [words("Error: illegal use of pragma `unused_args'.")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         ;
             add_pragma_unused_args(PredOrFunc, SymName, Arity, ModeNum,
                 UnusedArgs, Context, !ModuleInfo, !IO)
@@ -211,10 +210,9 @@
     ;
         Pragma = exceptions(PredOrFunc, SymName, Arity, ModeNum, ThrowStatus),
         ( ImportStatus \= opt_imported ->
-            prog_out.write_context(Context, !IO),
-            io.write_string("Error: illegal use of pragma `exceptions'.\n",
-                !IO),
-            module_info_incr_errors(!ModuleInfo)
+            module_info_incr_errors(!ModuleInfo),
+            Pieces = [words("Error: illegal use of pragma `exceptions'.")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         ;
             add_pragma_exceptions(PredOrFunc, SymName, Arity, ModeNum,
                 ThrowStatus, Context, !ModuleInfo, !IO)
@@ -381,8 +379,7 @@
         !IO) :-
     TypeCtor = TypeName - TypeArity,
     module_info_types(!.ModuleInfo, Types0),
-    TypeStr = error_util__describe_sym_name_and_arity(
-        TypeName / TypeArity),
+    TypeStr = error_util__describe_sym_name_and_arity(TypeName / TypeArity),
     ErrorPieces1 = [
         words("In"),
         fixed("`pragma reserve_tag'"),
@@ -402,14 +399,13 @@
                 )
             )
         ->
-            error_util__write_error_pieces(Context, 0, ErrorPieces1, !IO),
+            write_error_pieces(Context, 0, ErrorPieces1, !IO),
             ErrorPieces2 = [
                 words("error: `reserve_tag' declaration must"),
                 words("have the same visibility as the"),
                 words("type definition.")
             ],
-            error_util__write_error_pieces_not_first_line(Context, 0,
-                ErrorPieces2, !IO),
+            write_error_pieces_not_first_line(Context, 0, ErrorPieces2, !IO),
             io__set_exit_status(1, !IO),
             module_info_incr_errors(!ModuleInfo)
 
@@ -424,14 +420,14 @@
                 % optimization...
                 TypeStatus \= opt_imported
             ->
-                error_util__write_error_pieces(Context, 0, ErrorPieces1, !IO),
+                write_error_pieces(Context, 0, ErrorPieces1, !IO),
                 ErrorPieces2 = [
                     words("warning: multiple"),
                     fixed("`pragma reserved_tag'"),
                     words("declarations for the same type.")
                 ],
-                error_util__write_error_pieces_not_first_line(Context, 0,
-                    ErrorPieces2, !IO)
+                write_error_pieces_not_first_line(Context, 0, ErrorPieces2,
+                    !IO)
             ;
                 true
             ),
@@ -450,25 +446,23 @@
             map__set(Types0, TypeCtor, TypeDefn, Types),
             module_info_set_types(Types, !ModuleInfo)
         ;
-            error_util__write_error_pieces(Context, 0, ErrorPieces1, !IO),
+            write_error_pieces(Context, 0, ErrorPieces1, !IO),
             ErrorPieces2 = [
                 words("error:"),
                 fixed(TypeStr),
                 words("is not a discriminated union type.")
             ],
-            error_util__write_error_pieces_not_first_line(Context, 0,
-                ErrorPieces2, !IO),
+            write_error_pieces_not_first_line(Context, 0, ErrorPieces2, !IO),
             io__set_exit_status(1, !IO),
             module_info_incr_errors(!ModuleInfo)
         )
     ;
-        error_util__write_error_pieces(Context, 0, ErrorPieces1, !IO),
+        write_error_pieces(Context, 0, ErrorPieces1, !IO),
         ErrorPieces2 = [
             words("error: undefined type"),
             fixed(TypeStr ++ ".")
         ],
-        error_util__write_error_pieces_not_first_line(Context, 0, ErrorPieces2,
-            !IO),
+        write_error_pieces_not_first_line(Context, 0, ErrorPieces2, !IO),
         io__set_exit_status(1, !IO),
         module_info_incr_errors(!ModuleInfo)
     ).
@@ -493,10 +487,10 @@
             UnusedArgInfo),
         module_info_set_unused_arg_info(UnusedArgInfo, !ModuleInfo)
     ;
-        prog_out__write_context(Context, !IO),
-        io__write_string("Internal compiler error: " ++
-            "unknown predicate in `pragma unused_args'.\n", !IO),
-        module_info_incr_errors(!ModuleInfo)
+        module_info_incr_errors(!ModuleInfo),
+        Pieces = [words("Internal compiler error: "),
+            words("unknown predicate in `pragma unused_args'.")],
+        write_error_pieces(Context, 0, Pieces, !IO)
     ).
 
 %-----------------------------------------------------------------------------%
@@ -857,62 +851,52 @@
 :- pred report_subst_existq_tvars(pred_info::in, prog_context::in,
     list(tvar)::in, io::di, io::uo) is det.
 
-report_subst_existq_tvars(PredInfo0, Context, SubExistQVars, !IO) :-
-    report_pragma_type_spec(PredInfo0, Context, !IO),
-    prog_out__write_context(Context, !IO),
-    io__write_string("  error: the substitution includes the existentially\n",
-        !IO),
-    prog_out__write_context(Context, !IO),
-    io__write_string("  quantified type ", !IO),
-    pred_info_typevarset(PredInfo0, TVarSet),
-    report_variables(SubExistQVars, TVarSet, !IO),
-    io__write_string(".\n", !IO).
+report_subst_existq_tvars(PredInfo, Context, SubExistQVars, !IO) :-
+    pred_info_typevarset(PredInfo, TVarSet),
+    Pieces = report_pragma_type_spec(PredInfo) ++
+        [words("error: the substitution includes"),
+        words("the existentially quantified type"),
+        words(report_variables(SubExistQVars, TVarSet)), suffix(".")],
+    write_error_pieces(Context, 0, Pieces, !IO).
 
 :- pred report_recursive_subst(pred_info::in, prog_context::in, tvarset::in,
     list(tvar)::in, io::di, io::uo) is det.
 
-report_recursive_subst(PredInfo0, Context, TVarSet, RecursiveVars, !IO) :-
-    report_pragma_type_spec(PredInfo0, Context, !IO),
-    prog_out__write_context(Context, !IO),
-    io__write_string("  error: ", !IO),
-    report_variables(RecursiveVars, TVarSet, !IO),
+report_recursive_subst(PredInfo, Context, TVarSet, RecursiveVars, !IO) :-
     ( RecursiveVars = [_] ->
-        io__write_string(" occurs\n", !IO)
+        Occurs = "occurs"
     ;
-        io__write_string(" occur\n", !IO)
+        Occurs = "occur"
     ),
-    prog_out__write_context(Context, !IO),
-    io__write_string("  on both sides of the substitution.\n", !IO).
+    Pieces = report_pragma_type_spec(PredInfo) ++
+        [words("error:"), words(report_variables(RecursiveVars, TVarSet)),
+        words(Occurs), words("on both sides of the substitution.")],
+    write_error_pieces(Context, 0, Pieces, !IO).
 
 :- pred report_multiple_subst_vars(pred_info::in, prog_context::in,
     tvarset::in, list(tvar)::in, io::di, io::uo) is det.
 
-report_multiple_subst_vars(PredInfo0, Context, TVarSet, MultiSubstVars, !IO) :-
-    report_pragma_type_spec(PredInfo0, Context, !IO),
-    prog_out__write_context(Context, !IO),
-    io__write_string("  error: ", !IO),
-    report_variables(MultiSubstVars, TVarSet, !IO),
+report_multiple_subst_vars(PredInfo, Context, TVarSet, MultiSubstVars, !IO) :-
     ( MultiSubstVars = [_] ->
-        io__write_string(" has ", !IO)
+        Has = "has"
     ;
-        io__write_string(" have ", !IO)
+        Has = "have"
     ),
-    io__write_string("multiple replacement types.\n", !IO).
+    Pieces = report_pragma_type_spec(PredInfo) ++
+        [words("error:"), words(report_variables(MultiSubstVars, TVarSet)),
+        words(Has), words("multiple replacement types.")],
+    write_error_pieces(Context, 0, Pieces, !IO).
 
 :- pred report_unknown_vars_to_subst(pred_info::in, prog_context::in,
     tvarset::in, list(tvar)::in, io::di, io::uo) is det.
 
-report_unknown_vars_to_subst(PredInfo0, Context, TVarSet, UnknownVars, !IO) :-
-    report_pragma_type_spec(PredInfo0, Context, !IO),
-    prog_out__write_context(Context, !IO),
-    io__write_string("  error: ", !IO),
-    report_variables(UnknownVars, TVarSet, !IO),
+report_unknown_vars_to_subst(PredInfo, Context, TVarSet, UnknownVars, !IO) :-
+    PredOrFunc = pred_info_is_pred_or_func(PredInfo),
     ( UnknownVars = [_] ->
-        io__write_string(" does not ", !IO)
+        DoesNot = "does not"
     ;
-        io__write_string(" do not ", !IO)
+        DoesNot = "do not"
     ),
-    PredOrFunc = pred_info_is_pred_or_func(PredInfo0),
     (
         PredOrFunc = predicate,
         Decl = "`:- pred'"
@@ -920,37 +904,36 @@
         PredOrFunc = function,
         Decl = "`:- func'"
     ),
-    io__write_string("occur in the ", !IO),
-    io__write_string(Decl, !IO),
-    io__write_string(" declaration.\n", !IO).
-
-:- pred report_pragma_type_spec(pred_info::in, term__context::in,
-    io::di, io::uo) is det.
-
-report_pragma_type_spec(PredInfo0, Context, !IO) :-
-    Module = pred_info_module(PredInfo0),
-    Name = pred_info_name(PredInfo0),
-    Arity = pred_info_orig_arity(PredInfo0),
-    PredOrFunc = pred_info_is_pred_or_func(PredInfo0),
-    prog_out__write_context(Context, !IO),
-    io__write_string("In `:- pragma type_spec' declaration for ", !IO),
-    hlds_out__write_simple_call_id(PredOrFunc,
-        qualified(Module, Name)/Arity, !IO),
-    io__write_string(":\n", !IO).
+    Pieces = report_pragma_type_spec(PredInfo) ++
+        [words("error:"), words(report_variables(UnknownVars, TVarSet)),
+        words(DoesNot), words("occur in the"), fixed(Decl),
+        words("declaration.")],
+    write_error_pieces(Context, 0, Pieces, !IO).
+
+:- func report_pragma_type_spec(pred_info) = list(format_component).
+
+report_pragma_type_spec(PredInfo) = Pieces :-
+    Module = pred_info_module(PredInfo),
+    Name = pred_info_name(PredInfo),
+    Arity = pred_info_orig_arity(PredInfo),
+    PredOrFunc = pred_info_is_pred_or_func(PredInfo),
+    Pieces = [words("In `:- pragma type_spec' declaration for"),
+        simple_call_id(PredOrFunc - qualified(Module, Name)/Arity),
+        suffix(":"), nl].
 
-:- pred report_variables(list(tvar)::in, tvarset::in, io::di, io::uo) is det.
+:- func report_variables(list(tvar), tvarset) = string.
 
-report_variables(SubExistQVars, VarSet, !IO) :-
+report_variables(SubExistQVars, VarSet) = Str :-
+    VarsStr = mercury_vars_to_string(SubExistQVars, VarSet, no),
     ( SubExistQVars = [_] ->
-        io__write_string("variable `", !IO)
+        Str = "variable `" ++ VarsStr ++ "'"
     ;
-        io__write_string("variables `", !IO)
-    ),
-    mercury_output_vars(SubExistQVars, VarSet, no, !IO),
-    io__write_string("'", !IO).
+        Str = "variables `" ++ VarsStr ++ "'"
+    ).
 
     % Check that the mode list for a `:- pragma type_spec' declaration
     % specifies a known procedure.
+    %
 :- pred handle_pragma_type_spec_modes(sym_name::in, arity::in,
     prog_context::in, maybe(list(mode))::in, list(proc_id)::out,
     proc_table::in, proc_table::out, bool::out,
@@ -1030,22 +1013,17 @@
                 module_info_set_preds(PredTable, !ModuleInfo)
             ;
                 module_info_incr_errors(!ModuleInfo),
-                prog_out__write_context(Context, !IO),
-                io.write_string(
-                    "Error: `:- pragma termination2_info' " ++
-                    "declaration for undeclared mode of ", !IO),
-                hlds_out.write_simple_call_id(PredOrFunc,
-                    SymName/Arity, !IO),
-                io.write_string(".\n", !IO)
+                Pieces = [words("Error: `:- pragma termination2_info'"),
+                    words("declaration for undeclared mode of"),
+                    simple_call_id(PredOrFunc - SymName/Arity), suffix(".")],
+                write_error_pieces(Context, 0, Pieces, !IO)
             )
         ;
-            prog_out.write_context(Context, !IO),
-            io.write_string("Error: ambiguous predicate name ", !IO),
-            hlds_out.write_simple_call_id(PredOrFunc, SymName/Arity, !IO),
-            io.nl(!IO),
-            prog_out.write_context(Context, !IO),
-            io.write_string("  in `pragma termination2_info'.\n", !IO),
-            module_info_incr_errors(!ModuleInfo)
+            module_info_incr_errors(!ModuleInfo),
+            Pieces = [words("Error: ambiguous predicate name"),
+                simple_call_id(PredOrFunc - SymName/Arity),
+                words("in"), fixed("`pragma termination2_info'.")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         )
     ;
         % XXX This happens in `.trans_opt' files sometimes --
@@ -1093,20 +1071,17 @@
                 module_info_set_preds(PredTable, !ModuleInfo)
             ;
                 module_info_incr_errors(!ModuleInfo),
-                prog_out__write_context(Context, !IO),
-                io__write_string("Error: `:- pragma termination_info' ", !IO),
-                io__write_string("declaration for undeclared mode of ", !IO),
-                hlds_out__write_simple_call_id(PredOrFunc, SymName/Arity, !IO),
-                io__write_string(".\n", !IO)
+                Pieces = [words("Error: `:- pragma termination_info'"),
+                    words("declaration for undeclared mode of"),
+                    simple_call_id(PredOrFunc - SymName/Arity), suffix(".")],
+                write_error_pieces(Context, 0, Pieces, !IO)
             )
         ;
-            prog_out__write_context(Context, !IO),
-            io__write_string("Error: ambiguous predicate name ", !IO),
-            hlds_out__write_simple_call_id(PredOrFunc, SymName/Arity, !IO),
-            io__nl(!IO),
-            prog_out__write_context(Context, !IO),
-            io__write_string("  in `pragma termination_info'.\n", !IO),
-            module_info_incr_errors(!ModuleInfo)
+            module_info_incr_errors(!ModuleInfo),
+            Pieces = [words("Error: ambiguous predicate name"),
+                simple_call_id(PredOrFunc - SymName/Arity),
+                words("in"), fixed("`pragma termination_info'.")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         )
     ;
         % XXX This happens in `.trans_opt' files sometimes --
@@ -1127,7 +1102,7 @@
     (
         VeryVerbose = yes,
         io__write_string("% Processing `:- pragma import' for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
+        write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
         io__write_string("...\n", !IO)
     ;
         VeryVerbose = no
@@ -1139,8 +1114,7 @@
     module_info_get_predicate_table(!.ModuleInfo, PredicateTable0),
     (
         predicate_table_search_pf_sym_arity(PredicateTable0,
-            is_fully_qualified, PredOrFunc, PredName,
-            Arity, [PredId0])
+            is_fully_qualified, PredOrFunc, PredName, Arity, [PredId0])
     ->
         PredId = PredId0
     ;
@@ -1162,20 +1136,15 @@
     ),
     ( pred_info_is_imported(PredInfo1) ->
         module_info_incr_errors(!ModuleInfo),
-        prog_out__write_context(Context, !IO),
-        io__write_string("Error: `:- pragma import' ", !IO),
-        io__write_string("declaration for imported ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
-        io__write_string(".\n", !IO)
+        Pieces = [words("Error: `:- pragma import' declaration for imported"),
+            simple_call_id(PredOrFunc - PredName/Arity), suffix(".")],
+        write_error_pieces(Context, 0, Pieces, !IO)
     ; pred_info_clause_goal_type(PredInfo1) ->
         module_info_incr_errors(!ModuleInfo),
-        prog_out__write_context(Context, !IO),
-        io__write_string("Error: `:- pragma import' declaration ", !IO),
-        io__write_string("for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
-        io__write_string("\n", !IO),
-        prog_out__write_context(Context, !IO),
-        io__write_string("  with preceding clauses.\n", !IO)
+        Pieces = [words("Error: `:- pragma import' declaration for"),
+            simple_call_id(PredOrFunc - PredName/Arity),
+            words("with preceding clauses.")],
+        write_error_pieces(Context, 0, Pieces, !IO)
     ;
         pred_info_update_goal_type(pragmas, PredInfo1, PredInfo2),
             % Add the pragma declaration to the proc_info for this procedure.
@@ -1193,12 +1162,10 @@
             module_info_set_predicate_table(PredicateTable, !ModuleInfo)
         ;
             module_info_incr_errors(!ModuleInfo),
-            prog_out__write_context(Context, !IO),
-            io__write_string("Error: `:- pragma import' ", !IO),
-            io__write_string("declaration for undeclared mode ", !IO),
-            io__write_string("of ", !IO),
-            hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
-            io__write_string(".\n", !IO)
+            Pieces = [words("Error: `:- pragma import' declaration"),
+                words("for undeclared mode of"),
+                simple_call_id(PredOrFunc - PredName/Arity), suffix(".")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         )
     ).
 
@@ -1264,7 +1231,7 @@
     (
         VeryVerbose = yes,
         io__write_string("% Processing `:- pragma foreign_proc' for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
+        write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
         io__write_string("...\n", !IO)
     ;
         VeryVerbose = no
@@ -1337,13 +1304,11 @@
             pred_info_is_imported(!.PredInfo)
         ->
             module_info_incr_errors(!ModuleInfo),
-            prog_out__write_context(Context, !IO),
-            io__write_string("Error: `:- pragma foreign_proc' " ++
-                "(or `pragma c_code')\n", !IO),
-            prog_out__write_context(Context, !IO),
-            io__write_string("declaration for imported ", !IO),
-            hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
-            io__write_string(".\n", !IO)
+            Pieces = [words("Error: `:- pragma foreign_proc'"),
+                words("(or `pragma c_code')"),
+                words("declaration for imported"),
+                simple_call_id(PredOrFunc - PredName/Arity), suffix(".")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         ;
                 % Don't add clauses for foreign languages other
                 % than the ones we can generate code for.
@@ -1378,13 +1343,10 @@
                     !.ModuleInfo, !IO)
             ;
                 module_info_incr_errors(!ModuleInfo),
-                prog_out__write_context(Context, !IO),
-                io__write_string("Error: `:- pragma foreign_proc' ", !IO),
-                io__write_string("declaration for undeclared mode ", !IO),
-                io__write_string("of ", !IO),
-                hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity,
-                    !IO),
-                io__write_string(".\n", !IO)
+                Pieces = [words("Error: `:- pragma foreign_proc' declaration"),
+                    words("for undeclared mode of"),
+                    simple_call_id(PredOrFunc - PredName/Arity), suffix(".")],
+                write_error_pieces(Context, 0, Pieces, !IO)
             )
         )
     ).
@@ -1396,13 +1358,12 @@
     module_info_get_predicate_table(!.ModuleInfo, PredicateTable0),
     EvalMethodS = eval_method_to_string(EvalMethod),
 
-    % Find out if we are tabling a predicate or a function
     (
         MaybePredOrFunc = yes(PredOrFunc0),
         PredOrFunc = PredOrFunc0,
 
             % Lookup the pred declaration in the predicate table.
-            % (If it's not there, print an error message and insert
+        % (If it is not there, print an error message and insert
             % a dummy declaration for the predicate.)
         (
             predicate_table_search_pf_sym_arity(PredicateTable0,
@@ -1414,45 +1375,39 @@
             module_info_name(!.ModuleInfo, ModuleName),
             string__format("`:- pragma %s' declaration",
                 [s(EvalMethodS)], Message1),
-
-            preds_add_implicit_report_error(ModuleName, PredOrFunc,
-                PredName, Arity, Status, no, Context,
-                user(PredName), Message1, PredId, !ModuleInfo,
-                !IO),
+            preds_add_implicit_report_error(ModuleName, PredOrFunc, PredName,
+                Arity, Status, no, Context, user(PredName), Message1, PredId,
+                !ModuleInfo, !IO),
             PredIds = [PredId]
         )
     ;
         MaybePredOrFunc = no,
         (
             predicate_table_search_sym_arity(PredicateTable0,
-                is_fully_qualified, PredName,
-                Arity, PredIds0)
+                is_fully_qualified, PredName, Arity, PredIds0)
         ->
             PredIds = PredIds0
         ;
             module_info_name(!.ModuleInfo, ModuleName),
             string__format("`:- pragma %s' declaration",
                 [s(EvalMethodS)], Message1),
-
-            preds_add_implicit_report_error(ModuleName,
-                predicate, PredName, Arity, Status, no,
-                Context, user(PredName), Message1, PredId,
+            preds_add_implicit_report_error(ModuleName, predicate, PredName,
+                Arity, Status, no, Context, user(PredName), Message1, PredId,
                 !ModuleInfo, !IO),
             PredIds = [PredId]
         )
     ),
-    list__foldl2(module_add_pragma_tabled_2(EvalMethod, PredName,
-        Arity, MaybePredOrFunc, MaybeModes, Context),
+    list__foldl2(
+        module_add_pragma_tabled_2(EvalMethod, PredName, Arity,
+            MaybePredOrFunc, MaybeModes, Context),
         PredIds, !ModuleInfo, !IO).
 
 :- pred module_add_pragma_tabled_2(eval_method::in, sym_name::in, int::in,
     maybe(pred_or_func)::in, maybe(list(mode))::in, prog_context::in,
-    pred_id::in, module_info::in, module_info::out,
-    io::di, io::uo) is det.
+    pred_id::in, module_info::in, module_info::out, io::di, io::uo) is det.
 
 module_add_pragma_tabled_2(EvalMethod0, PredName, Arity0, MaybePredOrFunc,
         MaybeModes, Context, PredId, !ModuleInfo, !IO) :-
-
     ( EvalMethod0 = eval_minimal(_) ->
         globals__io_lookup_bool_option(use_minimal_model_own_stacks,
             OwnStacks, !IO),
@@ -1467,12 +1422,10 @@
         EvalMethod = EvalMethod0
     ),
 
-        % Lookup the pred_info for this pred,
+    % Lookup the pred_info for this pred.
     module_info_get_predicate_table(!.ModuleInfo, PredicateTable),
     predicate_table_get_preds(PredicateTable, Preds),
     map__lookup(Preds, PredId, PredInfo0),
-
-    % Find out if we are tabling a predicate or a function
     (
         MaybePredOrFunc = yes(PredOrFunc0),
         PredOrFunc = PredOrFunc0
@@ -1482,17 +1435,17 @@
     ),
     adjust_func_arity(PredOrFunc, Arity0, Arity),
 
-        % print out a progress message
     EvalMethodS = eval_method_to_string(EvalMethod),
     globals__io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
-    ( VeryVerbose = yes ->
+    (
+        VeryVerbose = yes,
         io__write_string("% Processing `:- pragma ", !IO),
         io__write_string(EvalMethodS, !IO),
         io__write_string("' for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
+        write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
         io__write_string("...\n", !IO)
     ;
-        true
+        VeryVerbose = no
     ),
 
     % Issue a warning if this predicate/function has a pragma inline
@@ -1500,20 +1453,15 @@
     pred_info_get_markers(PredInfo0, Markers),
     globals.io_lookup_bool_option(warn_table_with_inline, WarnInline, !IO),
     ( check_marker(Markers, inline), WarnInline = yes ->
-        PredNameStr = hlds_out.simple_call_id_to_string(PredOrFunc,
-            PredName/Arity),
-        TablePragmaStr = string.format("`:- pragma %s'",
-            [s(EvalMethodS)]),
+        TablePragmaStr = string.format("`:- pragma %s'", [s(EvalMethodS)]),
         InlineWarning = [
-            words("Warning: "), fixed(PredNameStr),
-            words("has a"), nl, fixed(TablePragmaStr),
+            words("Warning: "), simple_call_id(PredOrFunc - PredName/Arity),
+            words("has a"), fixed(TablePragmaStr),
             words("declaration but also has a"),
-            fixed("`:- pragma inline'"),
-            words("declaration."), nl,
+            fixed("`:- pragma inline'"), words("declaration."), nl,
             words("This inline pragma will be ignored"),
             words("since tabled predicates cannot be inlined."), nl,
-            words("You can use the"),
-            fixed("`--no-warn-table-with-inline'"),
+            words("You can use the"), fixed("`--no-warn-table-with-inline'"),
             words("option to suppress this warning.")
         ],
         error_util.report_warning(Context, 0, InlineWarning, !IO)
@@ -1522,14 +1470,13 @@
     ),
     ( pred_info_is_imported(PredInfo0) ->
         module_info_incr_errors(!ModuleInfo),
-        prog_out__write_context(Context, !IO),
-        io__write_string("Error: `:- pragma ", !IO),
-        io__write_string(EvalMethodS, !IO),
-        io__write_string("' declaration for imported ", !IO),
-        hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity, !IO),
-        io__write_string(".\n", !IO)
+        Pieces1 = [words("Error: "),
+            fixed("`:- pragma " ++ EvalMethodS ++ "'"),
+            words("declaration for imported"),
+            simple_call_id(PredOrFunc - PredName/Arity), suffix(".")],
+        write_error_pieces(Context, 0, Pieces1, !IO)
     ;
-        % do we have to make sure the tabled preds are stratified?
+        % Do we have to make sure the tabled preds are stratified?
         ( eval_method_needs_stratification(EvalMethod) = yes ->
             module_info_stratified_preds(!.ModuleInfo, StratPredIds0),
             set__insert(StratPredIds0, PredId, StratPredIds),
@@ -1538,14 +1485,14 @@
             true
         ),
 
-        % add the eval model to the proc_info for this procedure
+        % Add the eval model to the proc_info for this procedure.
         pred_info_procedures(PredInfo0, Procs0),
         map__to_assoc_list(Procs0, ExistingProcs),
         (
             MaybeModes = yes(Modes),
             (
-                get_procedure_matching_argmodes(ExistingProcs,
-                    Modes, !.ModuleInfo, ProcId)
+                get_procedure_matching_argmodes(ExistingProcs, Modes,
+                    !.ModuleInfo, ProcId)
             ->
                 map__lookup(Procs0, ProcId, ProcInfo0),
                 proc_info_set_eval_method(EvalMethod, ProcInfo0, ProcInfo),
@@ -1554,29 +1501,23 @@
                 module_info_set_pred_info(PredId, PredInfo, !ModuleInfo)
             ;
                 module_info_incr_errors(!ModuleInfo),
-                prog_out__write_context(Context, !IO),
-                io__write_string("Error: `:- pragma ", !IO),
-                io__write_string(EvalMethodS, !IO),
-                io__write_string("' declaration for " ++
-                    "undeclared mode of ", !IO),
-                hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity,
-                    !IO),
-                io__write_string(".\n", !IO)
+                Pieces2 = [words("Error:"),
+                    fixed("`:- pragma " ++ EvalMethodS ++ "'"),
+                    words("declaration for undeclared mode of"),
+                    simple_call_id(PredOrFunc - PredName/Arity), suffix(".")],
+                write_error_pieces(Context, 0, Pieces2, !IO)
             )
         ;
             MaybeModes = no,
             (
                 ExistingProcs = [],
                 module_info_incr_errors(!ModuleInfo),
-                prog_out__write_context(Context, !IO),
-                io__write_string("Error: `:- pragma ", !IO),
-                io__write_string(EvalMethodS, !IO),
-                io__write_string("' declaration for\n", !IO),
-                prog_out__write_context(Context, !IO),
-                io__write_string("  ", !IO),
-                hlds_out__write_simple_call_id(PredOrFunc, PredName/Arity,
-                    !IO),
-                io__write_string(" with no declared modes.\n", !IO)
+                Pieces3 = [words("Error: "),
+                    fixed("`:- pragma " ++ EvalMethodS ++ "'"),
+                    words("declaration for"),
+                    simple_call_id(PredOrFunc - PredName/Arity),
+                    words("with no declared modes.")],
+                write_error_pieces(Context, 0, Pieces3, !IO)
             ;
                 ExistingProcs = [_ | _],
                 set_eval_method_list(ExistingProcs, Context, PredOrFunc,
@@ -1608,7 +1549,7 @@
         % the evaluation method.
         OldEvalMethodStr = eval_method_to_string(OldEvalMethod),
         EvalMethodStr = eval_method_to_string(EvalMethod),
-        Name = hlds_out.simple_call_id_to_string(PredOrFunc, PredNameAndArity),
+        Name = simple_call_id_to_string(PredOrFunc, PredNameAndArity),
         ErrorMsg = [words("Error:"), fixed(Name), words("has both"),
             fixed(OldEvalMethodStr), words("and"), fixed(EvalMethodStr),
             words("pragmas specified."),
@@ -1622,6 +1563,7 @@
     ),
     set_eval_method_list(Rest, Context, PredOrFunc, PredNameAndArity,
         EvalMethod, !Procs, !ModuleInfo, !IO).
+
     % Extract the modes from the list of pragma_vars.
     %
 :- pred pragma_get_modes(list(pragma_var)::in, list(mode)::out) is det.
@@ -1697,13 +1639,10 @@
         ;
             PredIDs1 = [_ | _],     % >1 predicate found
             io__set_exit_status(1, !IO),
-            prog_out__write_context(Context, !IO),
-            io__write_string("In pragma fact_table for `", !IO),
-            prog_out__write_sym_name_and_arity(Pred/Arity, !IO),
-            io__write_string("':\n", !IO),
-            prog_out__write_context(Context, !IO),
-            io__write_string("  error: " ++
-                "ambiguous predicate/function name.\n", !IO)
+            Pieces = [words("In pragma fact_table for"),
+                sym_name_and_arity(Pred/Arity), suffix(":"), nl,
+                words("error: ambiguous predicate/function name.")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         )
     ;
         undefined_pred_or_func_error(Pred, Arity, Context,
@@ -1850,27 +1789,22 @@
 
     (
         MultipleArgs = [_ | _],
-        prog_out__write_context(Context, !IO),
-        io__write_string("In `:- pragma foreign_proc' declaration for ", !IO),
+        io__set_exit_status(1, !IO),
         adjust_func_arity(PredOrFunc, OrigArity, Arity),
-        hlds_out__write_simple_call_id(PredOrFunc - PredName/OrigArity, !IO),
-        io__write_string(":\n", !IO),
-        prog_out__write_context(Context, !IO),
-        io__write_string("  error: ", !IO),
+        Pieces1 = [words("In `:- pragma foreign_proc' declaration for"),
+            simple_call_id(PredOrFunc - PredName/OrigArity), suffix(":"), nl],
         (
             MultipleArgs = [MultipleArg],
-            io__write_string("variable `", !IO),
-            mercury_output_var(MultipleArg, PVarSet, no, !IO),
-            io__write_string("' occurs multiple times\n", !IO)
+            Pieces2 = [words("error: variable `" ++
+                mercury_var_to_string(MultipleArg, PVarSet, no) ++
+                "' occurs multiple times in the argument list.")]
         ;
             MultipleArgs = [_, _ | _],
-            io__write_string("variables `", !IO),
-            mercury_output_vars(MultipleArgs, PVarSet, no, !IO),
-            io__write_string("' occur multiple times\n", !IO)
-        ),
-        prog_out__write_context(Context, !IO),
-        io__write_string("  in the argument list.\n", !IO),
-        io__set_exit_status(1, !IO)
+            Pieces2 = [words("error: variables `" ++
+                mercury_vars_to_string(MultipleArgs, PVarSet, no) ++
+                "' occur multiple times in the argument list.")]
+        ),
+        write_error_pieces(Context, 0, Pieces1 ++ Pieces2, !IO)
     ;
         MultipleArgs = [],
             % build the pragma_c_code
@@ -1878,10 +1812,9 @@
         goal_info_set_context(GoalInfo0, Context, GoalInfo1),
         % Put the purity in the goal_info in case this foreign code is inlined.
         add_goal_info_purity_feature(GoalInfo1, Purity, GoalInfo),
-        make_foreign_args(HeadVars, ArgInfo, OrigArgTypes,
-            ForeignArgs),
-        HldsGoal0 = foreign_proc(Attributes, PredId, ProcId,
-            ForeignArgs, [], PragmaImpl) - GoalInfo,
+        make_foreign_args(HeadVars, ArgInfo, OrigArgTypes, ForeignArgs),
+        HldsGoal0 = foreign_proc(Attributes, PredId, ProcId, ForeignArgs, [],
+            PragmaImpl) - GoalInfo,
         map__init(EmptyVarTypes),
         implicitly_quantify_clause_body(HeadVars, _Warnings,
             HldsGoal0, HldsGoal, VarSet0, VarSet, EmptyVarTypes, _),
Index: compiler/error_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/error_util.m,v
retrieving revision 1.39
diff -u -b -r1.39 error_util.m
--- compiler/error_util.m	23 May 2005 02:17:11 -0000	1.39
+++ compiler/error_util.m	6 Aug 2005 11:05:20 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1997-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -68,50 +70,59 @@
 				% the sym_name, followed by '/' and the arity,
 				% all surrounded by `' quotes.
 	
-	;	nl		% Insert a line break if there has been text
-				% output since the last line break.
-	
-	;	pred_or_func(pred_or_func).
+    ;       pred_or_func(pred_or_func)
 				% Output the string "predicate" or "function"
 				% as appropriate.
 
+    ;       simple_call_id(simple_call_id)
+                            % Output the identity of the given call.
+
+    ;       nl.             % Insert a line break if there has been text
+                            % output since the last line break.
+
 :- type format_components == list(format_component).
 
 	% Convert a list of strings into a list of format_components
 	% separated by commas, with the last two elements separated by `and'.
+    %
 :- func list_to_pieces(list(string)) = list(format_component).
 
 	% Convert a list of lists of format_components into a list of
-	% format_components separated by commas, with the last two
-	% elements separated by `and'.
+    % format_components separated by commas, with the last two elements
+    % separated by `and'.
+    %
 :- func component_lists_to_pieces(list(list(format_component))) =
 	list(format_component).
 
 	% Convert a list of format_components into a list of format_components
 	% separated by commas, with the last two elements separated by `and'.
+    %
 :- func component_list_to_pieces(list(format_component)) =
 	list(format_component).
 
 	% choose_number(List, Singular, Plural) = Form
 	%
 	% Choose between a singular version and a plural version of something,
-	% based on the length of a list.  Chooses the plural if the list is
-	% empty.
+    % based on the length of a list.  Chooses the plural if the list is empty.
 	%
 :- func choose_number(list(T), U, U) = U.
 
 	% Display the given error message, without a context and with standard
 	% indentation.
+    %
 :- pred write_error_pieces_plain(list(format_component)::in,
 	io::di, io::uo) is det.
 
 	% write_error_plain_with_progname(ProgName, Msg):
+    %
 	% Display Msg as the error string, with ProgName as a context
 	% and with standard indentation.
+    %
 :- pred write_error_plain_with_progname(string::in, string::in,
 	io::di, io::uo) is det.
 
-	% write_error_pieces(Context, Indent, Components).
+    % write_error_pieces(Context, Indent, Components):
+    %
 	% Display `Components' as the error message, with
 	% `Context' as a context and indent by `Indent'.
 	%
@@ -119,13 +130,14 @@
 	list(format_component)::in, io::di, io::uo) is det.
 
 	% Display the given error message, but indent the first line.
-	% This is useful when adding extra lines to an already
-	% displayed message.
+    % This is useful when adding extra lines to an already displayed message.
+    %
 :- pred write_error_pieces_not_first_line(prog_context::in, int::in,
 	list(format_component)::in, io::di, io::uo) is det.
 
 	% Display the given error message. The bool is true iff
 	% this is the first line.
+    %
 :- pred write_error_pieces_maybe_first_line(bool::in, prog_context::in,
 	int::in, list(format_component)::in, io::di, io::uo) is det.
 
@@ -148,8 +160,7 @@
 
 	% report_error_num_args(MaybePredOrFunc, Arity, CorrectArities).
 	%
-	% Write
-	% "wrong number of arguments (<Arity>; should be <CorrectArities>)",
+    % Write "wrong number of arguments (<Arity>; should be <CorrectArities>)",
 	% adjusting `Arity' and `CorrectArities' if `MaybePredOrFunc' is
 	% `yes(function)'.
 	%
@@ -224,8 +235,7 @@
 component_lists_to_pieces(
 		[Components1, Components2, Components3 | Components]) =
 	list__append(append_punctuation(Components1, ','),
-		component_lists_to_pieces(
-			[Components2, Components3 | Components])).
+        component_lists_to_pieces([Components2, Components3 | Components])).
 
 component_list_to_pieces([]) = [].
 component_list_to_pieces([Component]) = [Component].
@@ -234,8 +244,7 @@
 component_list_to_pieces(
 		[Component1, Component2, Component3 | Components]) =
 	list__append(append_punctuation([Component1], ','),
-		component_list_to_pieces(
-			[Component2, Component3 | Components])).
+        component_list_to_pieces([Component2, Component3 | Components])).
 
 choose_number([], _Singular, Plural) = Plural.
 choose_number([_], Singular, _Plural) = Singular.
@@ -262,8 +271,7 @@
 		write_error_pieces(Context, Indent, Components, !IO)
 	;
 		IsFirst = no,
-		write_error_pieces_not_first_line(Context, Indent, Components,
-			!IO)
+        write_error_pieces_not_first_line(Context, Indent, Components, !IO)
 	).
 
 write_error_pieces_maybe_with_context(MaybeContext, Indent, Components, !IO) :-
@@ -296,8 +304,7 @@
 			;
 				LineNumberStrLength = LineNumberStrLength0
 			),
-			ContextLength = FileNameLength + 1 +
-					LineNumberStrLength + 2
+            ContextLength = FileNameLength + 1 + LineNumberStrLength + 2
 		;
 			MaybeContext = no,
 			ContextLength = 0
@@ -307,9 +314,11 @@
 		convert_components_to_word_list(Components, [], [], Words),
 		group_words(IsFirst, Words, Remain, Lines)
 	),
-	( IsFirst = yes ->
+    (
+        IsFirst = yes,
 		write_lines(Lines, MaybeContext, Indent, !IO)
 	;
+        IsFirst = no,
 		write_nonfirst_lines(Lines, MaybeContext, Indent + 2, !IO)
 	).
 
@@ -402,6 +411,9 @@
 		Component = pred_or_func(PredOrFunc),
 		Str = pred_or_func_to_string(PredOrFunc)
 	;
+        Component = simple_call_id(SimpleCallId),
+        Str = simple_call_id_to_string(SimpleCallId)
+    ;
 		Component = nl,
 		Str = "\n" ++ TailStr
 	).
@@ -441,6 +453,10 @@
 		Word = pred_or_func_to_string(PredOrFunc),
 		RevWords1 = [word(Word) | RevWords0]
 	;
+        Component = simple_call_id(SimpleCallId),
+        WordsStr = simple_call_id_to_string(SimpleCallId),
+        break_into_words(WordsStr, RevWords0, RevWords1)
+    ;
 		Component = nl,
 		Strings = rev_words_to_strings(RevWords0),
 		list.cons(Strings, !Paras),
@@ -467,8 +483,7 @@
 			Strings = [Suffix]
 		;
 			Words = [word(String) | Tail],
-			Strings = [String ++ Suffix |
-				rev_words_to_rev_strings(Tail)]
+            Strings = [String ++ Suffix | rev_words_to_rev_strings(Tail)]
 		;
 			Words = [suffix_word(MoreSuffix) | Tail],
 			Strings = rev_words_to_rev_strings(
@@ -502,8 +517,7 @@
 		Length = End - Start + 1,
 		string__substring(String, Start, Length, WordStr),
 		Next = End + 1,
-		break_into_words_from(String, Next,
-			[word(WordStr) | Words0], Words)
+        break_into_words_from(String, Next, [word(WordStr) | Words0], Words)
 	;
 		Words = Words0
 	).
@@ -539,7 +553,7 @@
 	% characters on it; the later lines (if any) up to Max-2 characters.
 	% The given list of words must be nonempty, since we always return
 	% at least one line.
-
+    %
 :- pred group_words(bool::in, list(list(string))::in, int::in,
 	list(list(string))::out) is det.
 
@@ -554,11 +568,12 @@
 			group_words(IsFirst, LaterParas, Max, Lines)
 		;
 			FirstPara = [FirstWord | LaterWords],
-			get_line_of_words(FirstWord, LaterWords,
-				Max, Line, RestWords),
-			( IsFirst = yes ->
+            get_line_of_words(FirstWord, LaterWords, Max, Line, RestWords),
+            (
+                IsFirst = yes,
 				Max2 = Max - 2
 			;
+                IsFirst = no,
 				Max2 = Max
 			),
 			group_nonfirst_line_words(RestWords, Max2, RestLines1),
@@ -599,8 +614,7 @@
 	NewLen = OldLen + 1 + WordLen,
 	( NewLen =< MaxLen ->
 		list__append(Line0, [Word], Line1),
-		get_later_words(Words, NewLen, MaxLen,
-			Line1, Line, RestWords)
+        get_later_words(Words, NewLen, MaxLen, Line1, Line, RestWords)
 	;
 		Line = Line0,
 		RestWords = [Word | Words]
@@ -609,23 +623,20 @@
 %-----------------------------------------------------------------------------%
 
 describe_sym_name_and_arity(SymName / Arity) =
-		string__append_list(["`", SymNameString,
-			"/", string__int_to_string(Arity), "'"]) :-
+        string__append_list(["`", SymNameString, "/",
+            string__int_to_string(Arity), "'"]) :-
 	sym_name_to_string(SymName, SymNameString).
 
-describe_sym_name(SymName) =
-		string__append_list(["`", SymNameString, "'"]) :-
+describe_sym_name(SymName) = string__append_list(["`", SymNameString, "'"]) :-
 	sym_name_to_string(SymName, SymNameString).
 
 pred_or_func_to_string(predicate) = "predicate".
 pred_or_func_to_string(function) = "function".
 
 append_punctuation([], _) = _ :-
-	error("append_punctuation: " ++
-		"appending punctuation after nothing").
+    error("append_punctuation: appending punctuation after nothing").
 append_punctuation([Piece0], Punc) = [Piece] :-
-	% Avoid unwanted line splitting between the message
-	% and the punctuation.
+    % Avoid unwanted line splitting between the message and the punctuation.
 	(
 		Piece0 = words(String),
 		Piece = words(string__append(String, char_to_string(Punc)))
@@ -648,9 +659,12 @@
 		String = pred_or_func_to_string(PredOrFunc),
 		Piece = fixed(string__append(String, char_to_string(Punc)))
 	;
+        Piece0 = simple_call_id(SimpleCallId),
+        String = simple_call_id_to_string(SimpleCallId),
+        Piece = words(string__append(String, char_to_string(Punc)))
+    ;
 		Piece0 = nl,
-		error("append_punctutation: " ++
-			"appending punctuation after newline")
+        error("append_punctutation: appending punctuation after newline")
 	).
 append_punctuation([Piece1, Piece2 | Pieces], Punc) =
 	[Piece1 | append_punctuation([Piece2 | Pieces], Punc)].
@@ -663,8 +677,7 @@
 		adjust_func_arity(function, Arity, Arity0),
 		list__map(
 			(pred(OtherArity0::in, OtherArity::out) is det :-
-				adjust_func_arity(function,
-					OtherArity, OtherArity0)
+                adjust_func_arity(function, OtherArity, OtherArity0)
 			),
 			Arities0, Arities)
 	;
@@ -682,11 +695,14 @@
 report_error_right_num_args([], !IO).
 report_error_right_num_args([Arity | Arities], !IO) :-
 	io__write_int(Arity, !IO),
-	( Arities = [] ->
+    (
+        Arities = [],
 		true
-	; Arities = [_] ->
+    ;
+        Arities = [_],
 		io__write_string(" or ", !IO)
 	;
+        Arities = [_, _ | _],
 		io__write_string(", ", !IO)
 	),
 	report_error_right_num_args(Arities, !IO).
@@ -701,8 +717,7 @@
 
 unexpected(Module, What) = _ :- unexpected(Module, What).
 unexpected(Module, What) :-
-	string__format("%s: Unexpected: %s",
-		[s(Module), s(What)], ErrorMessage),
+    string__format("%s: Unexpected: %s", [s(Module), s(What)], ErrorMessage),
 	error(ErrorMessage).
 
 record_warning(!IO) :-
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.359
diff -u -b -r1.359 hlds_out.m
--- compiler/hlds_out.m	26 Jul 2005 01:56:22 -0000	1.359
+++ compiler/hlds_out.m	6 Aug 2005 07:37:56 -0000
@@ -81,20 +81,6 @@
 :- pred hlds_out__write_call_id(call_id::in, io::di, io::uo) is det.
 :- func hlds_out__call_id_to_string(call_id) = string.
 
-:- pred hlds_out__write_simple_call_id(simple_call_id::in, io::di, io::uo)
-	is det.
-:- func hlds_out__simple_call_id_to_string(simple_call_id) = string.
-
-:- pred hlds_out__write_simple_call_id(pred_or_func::in,
-	sym_name_and_arity::in, io::di, io::uo) is det.
-:- func hlds_out__simple_call_id_to_string(pred_or_func, sym_name_and_arity)
-	= string.
-
-:- pred hlds_out__write_simple_call_id(pred_or_func::in, sym_name::in,
-	arity::in, io::di, io::uo) is det.
-:- func hlds_out__simple_call_id_to_string(pred_or_func, sym_name, arity)
-	= string.
-
 	% Write "argument %i of call to pred_or_func `foo/n'".
 	% The pred_markers argument is used to tell if the calling
 	% predicate is a type class method implementation; if so,
@@ -397,7 +383,7 @@
 				prog_out__promise_to_string(PromiseType)
 				++ "' declaration", !IO)
 		;
-			hlds_out__write_simple_call_id(PredOrFunc,
+			write_simple_call_id(PredOrFunc,
 				qualified(Module, Name), Arity, !IO)
 		)
 	;
@@ -416,73 +402,12 @@
 	proc_id_to_int(ProcId, ModeNum),
 	io__write_int(ModeNum, !IO).
 
-hlds_out__write_simple_call_id(PredOrFunc - Name/Arity, !IO) :-
-	Str = hlds_out__simple_call_id_to_string(PredOrFunc, Name, Arity),
-	io__write_string(Str, !IO).
-
-hlds_out__write_simple_call_id(PredOrFunc, Name/Arity, !IO) :-
-	Str = hlds_out__simple_call_id_to_string(PredOrFunc, Name, Arity),
-	io__write_string(Str, !IO).
-
-hlds_out__write_simple_call_id(PredOrFunc, Name, Arity, !IO) :-
-	Str = hlds_out__simple_call_id_to_string(PredOrFunc, Name, Arity),
-	io__write_string(Str, !IO).
-
-hlds_out__simple_call_id_to_string(PredOrFunc - Name/Arity) =
-	hlds_out__simple_call_id_to_string(PredOrFunc, Name, Arity).
-
-hlds_out__simple_call_id_to_string(PredOrFunc, Name/Arity) =
-	hlds_out__simple_call_id_to_string(PredOrFunc, Name, Arity).
-
-hlds_out__simple_call_id_to_string(PredOrFunc, Name, Arity) = Str :-
-		% XXX when printed, promises are differentiated from
-		%     predicates or functions by module name, so the module
-		%     names `promise', `promise_exclusive', etc. should be
-		%     reserved, and their dummy predicates should have more
-		%     unusual module names
-	(
-		Name = unqualified(StrName)
-	;
-		Name = qualified(_, StrName)
-	),
-		% is it really a promise?
-	( string__prefix(StrName, "promise__") ->
-		Promise = promise(true)
-	; string__prefix(StrName, "promise_exclusive__") ->
-		Promise = promise(exclusive)
-	; string__prefix(StrName, "promise_exhaustive__") ->
-		Promise = promise(exhaustive)
-	; string__prefix(StrName, "promise_exclusive_exhaustive__") ->
-		Promise = promise(exclusive_exhaustive)
-	;
-		Promise = none	% no, it is really a pred or func
-	),
-	(
-		Promise = promise(PromiseType),
-		PromiseStr = promise_to_string(PromiseType),
-		Str = "`" ++ PromiseStr ++ "' declaration"
-	;
-		Promise = none,
-		PredOrFuncStr = prog_out__pred_or_func_to_full_str(PredOrFunc),
-		hlds_out__simple_call_id_to_sym_name_and_arity(
-			PredOrFunc - Name/Arity, SymArity),
-		SymArityStr = prog_out__sym_name_and_arity_to_string(SymArity),
-		Str = PredOrFuncStr ++ " `" ++ SymArityStr ++ "'"
-	).
-
-:- pred hlds_out__simple_call_id_to_sym_name_and_arity(simple_call_id::in,
-	sym_name_and_arity::out) is det.
-
-hlds_out__simple_call_id_to_sym_name_and_arity(PredOrFunc - SymName/Arity,
-		SymName/OrigArity) :-
-	adjust_func_arity(PredOrFunc, OrigArity, Arity).
-
 hlds_out__write_call_id(CallId, !IO) :-
 	Str = hlds_out__call_id_to_string(CallId),
 	io__write_string(Str, !IO).
 
 hlds_out__call_id_to_string(call(PredCallId)) =
-	hlds_out__simple_call_id_to_string(PredCallId).
+	simple_call_id_to_string(PredCallId).
 hlds_out__call_id_to_string(generic_call(GenericCallId)) =
 	hlds_out__generic_call_id_to_string(GenericCallId).
 
@@ -501,14 +426,12 @@
 		++ prog_out__pred_or_func_to_full_str(PredOrFunc)
 		++ " call".
 hlds_out__generic_call_id_to_string(class_method(_ClassId, MethodId)) =
-	hlds_out__simple_call_id_to_string(MethodId).
-hlds_out__generic_call_id_to_string(unsafe_cast) =
-	"unsafe_cast".
+	simple_call_id_to_string(MethodId).
+hlds_out__generic_call_id_to_string(unsafe_cast) = "unsafe_cast".
 hlds_out__generic_call_id_to_string(aditi_builtin(AditiBuiltin, CallId))
 		= Str :-
 	hlds_out__aditi_builtin_name(AditiBuiltin, Name),
-	Str = "`" ++ Name ++ "' of " ++
-		hlds_out__simple_call_id_to_string(CallId).
+	Str = "`" ++ Name ++ "' of " ++ simple_call_id_to_string(CallId).
 
 hlds_out__write_call_arg_id(CallId, ArgNum, PredMarkers, !IO) :-
 	Str = hlds_out__call_arg_id_to_string(CallId, ArgNum, PredMarkers),
@@ -2389,7 +2312,7 @@
 	PredOrFuncStr = prog_out__pred_or_func_to_str(PredOrFunc),
 	io__write_string(PredOrFuncStr, !IO),
 	io__write_string(" ", !IO),
-	hlds_out__simple_call_id_to_sym_name_and_arity(CallId, SymArity),
+	simple_call_id_to_sym_name_and_arity(CallId, SymArity),
 	prog_out__write_sym_name_and_arity(SymArity, !IO),
 	io__write_string(", ", !IO),
 	mercury_output_vars(ArgVars, VarSet, AppendVarNums, !IO),
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.167
diff -u -b -r1.167 hlds_pred.m
--- compiler/hlds_pred.m	26 Jul 2005 01:56:22 -0000	1.167
+++ compiler/hlds_pred.m	6 Aug 2005 07:08:57 -0000
@@ -137,8 +137,6 @@
 	;	unsafe_cast
 	;	aditi_builtin(aditi_builtin, simple_call_id).
 
-:- type simple_call_id == pair(pred_or_func, sym_name_and_arity).
-
 :- type pred_proc_list	==	list(pred_proc_id).
 
 :- type prog_var_name == string.
Index: compiler/make_hlds_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_passes.m,v
retrieving revision 1.1
diff -u -b -r1.1 make_hlds_passes.m
--- compiler/make_hlds_passes.m	26 Jul 2005 01:56:24 -0000	1.1
+++ compiler/make_hlds_passes.m	6 Aug 2005 08:27:30 -0000
@@ -955,11 +955,8 @@
     io::di, io::uo) is det.
 
 report_field_status_mismatch(Context, CallId, !IO) :-
-    CallIdString = hlds_out__simple_call_id_to_string(CallId),
     ErrorPieces = [
-        words("In declaration of"),
-        fixed(string__append(CallIdString, ":")),
-        nl,
+        words("In declaration of"), simple_call_id(CallId), suffix(":"), nl,
         words("error: a field access function for an"),
         words("exported field must also be exported.")
     ],
Index: compiler/make_hlds_warn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_warn.m,v
retrieving revision 1.1
diff -u -b -r1.1 make_hlds_warn.m
--- compiler/make_hlds_warn.m	26 Jul 2005 01:56:24 -0000	1.1
+++ compiler/make_hlds_warn.m	7 Aug 2005 07:30:27 -0000
@@ -340,13 +340,11 @@
             UnmentionedVars = []
         ;
             UnmentionedVars = [_ | _],
-            prog_out__write_context(Context, !IO),
-            io__write_string("In the " ++ LangStr ++ " code for ", !IO),
-            hlds_out__write_simple_call_id(PredOrFuncCallId, !IO),
-            io__write_string(":\n", !IO),
-            prog_out__write_context(Context, !IO),
-            write_variable_warning_start(UnmentionedVars, !IO),
-            io__write_string("not occur in the " ++ LangStr ++ " code.\n", !IO)
+            Pieces = [words("In the " ++ LangStr ++ " code for"),
+                simple_call_id(PredOrFuncCallId), suffix(":"), nl,
+                words(variable_warning_start(UnmentionedVars)),
+                words("not occur in the " ++ LangStr ++ " code.")],
+            write_error_pieces(Context, 0, Pieces, !IO)
         )
     ;
         PragmaImpl = nondet(_, _, FirstCode, _, LaterCode, _, _, SharedCode,
@@ -361,17 +359,15 @@
             \+ list__member(Name, FirstCodeList)
         ),
         solutions(InputFilter, UnmentionedInputVars),
-        ( UnmentionedInputVars = [] ->
-            true
+        (
+            UnmentionedInputVars = []
         ;
-            prog_out__write_context(Context, !IO),
-            io__write_string("In the " ++ LangStr ++ " code for ", !IO),
-            hlds_out__write_simple_call_id(PredOrFuncCallId, !IO),
-            io__write_string(":\n", !IO),
-            prog_out__write_context(Context, !IO),
-            write_variable_warning_start(UnmentionedInputVars, !IO),
-            io__write_string("not occur in the first " ++
-                LangStr ++ " code.\n ", !IO)
+            UnmentionedInputVars = [_ | _],
+            Pieces1 = [words("In the " ++ LangStr ++ " code for"),
+                simple_call_id(PredOrFuncCallId), suffix(":"), nl,
+                words(variable_warning_start(UnmentionedInputVars)),
+                words("not occur in the first " ++ LangStr ++ " code.")],
+            write_error_pieces(Context, 0, Pieces1, !IO)
         ),
         FirstOutputFilter = (pred(Name::out) is nondet :-
             list__member(yes(Name - Mode), Args),
@@ -385,14 +381,12 @@
             UnmentionedFirstOutputVars = []
         ;
             UnmentionedFirstOutputVars = [_ | _],
-            prog_out__write_context(Context, !IO),
-            io__write_string("In the " ++ LangStr ++ " code for ", !IO),
-            hlds_out__write_simple_call_id(PredOrFuncCallId, !IO),
-            io__write_string(":\n", !IO),
-            prog_out__write_context(Context, !IO),
-            write_variable_warning_start(UnmentionedFirstOutputVars, !IO),
-            io__write_string("not occur in the first " ++ LangStr ++
-                " code or the shared " ++ LangStr ++ " code.\n ", !IO)
+            Pieces2 = [words("In the " ++ LangStr ++ " code for"),
+                simple_call_id(PredOrFuncCallId), suffix(":"), nl,
+                words(variable_warning_start(UnmentionedFirstOutputVars)),
+                words("not occur in the first " ++ LangStr ++
+                    " code or the shared " ++ LangStr ++ " code.")],
+            write_error_pieces(Context, 0, Pieces2, !IO)
         ),
         LaterOutputFilter = (pred(Name::out) is nondet :-
             list__member(yes(Name - Mode), Args),
@@ -406,30 +400,25 @@
             UnmentionedLaterOutputVars = []
         ;
             UnmentionedLaterOutputVars = [_ | _],
-            prog_out__write_context(Context, !IO),
-            io__write_string("In the " ++ LangStr ++ " code for ", !IO),
-            hlds_out__write_simple_call_id(PredOrFuncCallId, !IO),
-            io__write_string(":\n", !IO),
-            prog_out__write_context(Context, !IO),
-            write_variable_warning_start(UnmentionedLaterOutputVars, !IO),
-            io__write_string("not occur in the retry " ++ LangStr ++
-                " code or the shared " ++ LangStr ++ " code.\n ", !IO)
+            Pieces3 = [words("In the " ++ LangStr ++ " code for"),
+                simple_call_id(PredOrFuncCallId), suffix(":"), nl,
+                words(variable_warning_start(UnmentionedLaterOutputVars)),
+                words("not occur in the retry " ++ LangStr ++
+                " code or the shared " ++ LangStr ++ " code.")],
+            write_error_pieces(Context, 0, Pieces3, !IO)
         )
     ;
         PragmaImpl = import(_, _, _, _)
     ).
 
-:- pred write_variable_warning_start(list(string)::in, io::di, io::uo) is det.
+:- func variable_warning_start(list(string)) = string.
 
-write_variable_warning_start(UnmentionedVars, !IO) :-
-    ( UnmentionedVars = [_] ->
-        io__write_string("  warning: variable `", !IO),
-        write_string_list(UnmentionedVars, !IO),
-        io__write_string("' does ", !IO)
-    ;
-        io__write_string("  warning: variables `", !IO),
-        write_string_list(UnmentionedVars, !IO),
-        io__write_string("' do ", !IO)
+variable_warning_start(UnmentionedVars) = Str :-
+    ( UnmentionedVars = [Var] ->
+        Str = "warning: variable `" ++ Var ++ "' does"
+    ;
+        Str = "warning: variables `" ++
+            string__join_list(", ", UnmentionedVars) ++ "' do"
     ).
 
     % c_code_to_name_list(Code, List) is true iff List is a list of the
@@ -540,20 +529,18 @@
     ->
         true
     ;
-        prog_out__write_context(Context, !IO),
-        io__write_string("In clause for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFuncCallId, !IO),
-        io__write_string(":\n", !IO),
-        prog_out__write_context(Context, !IO),
+        SingletonVarsStr = mercury_vars_to_string(SingletonVars, VarSet, no),
         ( SingletonVars = [_] ->
-            io__write_string("  warning: variable `", !IO),
-            mercury_output_vars(SingletonVars, VarSet, no, !IO),
-            report_warning("' occurs only once in this scope.\n", !IO)
-        ;
-            io__write_string("  warning: variables `", !IO),
-            mercury_output_vars(SingletonVars, VarSet, no, !IO),
-            report_warning("' occur only once in this scope.\n", !IO)
-        )
+            SingletonWarn = "warning: variable `" ++ SingletonVarsStr ++
+                "' occurs only once in this scope."
+        ;
+            SingletonWarn = "warning: variables `" ++ SingletonVarsStr ++
+                "' occur only once in this scope."
+        ),
+        Pieces1 = [words("In clause for"),
+            simple_call_id(PredOrFuncCallId), suffix(":"), nl,
+            words(SingletonWarn)],
+        report_warning(Context, 0, Pieces1, !IO)
     ),
 
     % Find all the variables in the goal that do occur outside the goal
@@ -565,20 +552,18 @@
         MultiVars = []
     ;
         MultiVars = [_ | _],
-        prog_out__write_context(Context, !IO),
-        io__write_string("In clause for ", !IO),
-        hlds_out__write_simple_call_id(PredOrFuncCallId, !IO),
-        io__write_string(":\n", !IO),
-        prog_out__write_context(Context, !IO),
+        MultiVarsStr = mercury_vars_to_string(MultiVars, VarSet, no),
         ( MultiVars = [_] ->
-            io__write_string("  warning: variable `", !IO),
-            mercury_output_vars(MultiVars, VarSet, no, !IO),
-            report_warning("' occurs more than once in this scope.\n", !IO)
-        ;
-            io__write_string("  warning: variables `", !IO),
-            mercury_output_vars(MultiVars, VarSet, no, !IO),
-            report_warning("' occur more than once in this scope.\n", !IO)
-        )
+            MultiWarn = "warning: variable `" ++ MultiVarsStr ++
+                "' occurs more than once in this scope."
+        ;
+            MultiWarn = "warning: variables `" ++ MultiVarsStr ++
+                "' occur more than once in this scope."
+        ),
+        Pieces2 = [words("In clause for"),
+            simple_call_id(PredOrFuncCallId), suffix(":"), nl,
+            words(MultiWarn)],
+        report_warning(Context, 0, Pieces2, !IO)
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/ml_tailcall.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_tailcall.m,v
retrieving revision 1.25
diff -u -b -r1.25 ml_tailcall.m
--- compiler/ml_tailcall.m	22 Mar 2005 06:40:10 -0000	1.25
+++ compiler/ml_tailcall.m	6 Aug 2005 08:01:06 -0000
@@ -82,6 +82,7 @@
 :- import_module ml_backend__ml_util.
 :- import_module parse_tree__error_util.
 :- import_module parse_tree__prog_data.
+:- import_module parse_tree__prog_out.
 
 :- import_module int.
 :- import_module list.
@@ -641,7 +642,7 @@
 	(
 		PredLabel = pred(PredOrFunc, _MaybeModule, Name, Arity,
 			_CodeModel, _NonOutputFunc),
-		CallId = hlds_out__simple_call_id_to_string(PredOrFunc -
+		CallId = simple_call_id_to_string(PredOrFunc -
 			unqualified(Name) / Arity),
 		proc_id_to_int(ProcId, ProcNumber0),
 		ProcNumber = ProcNumber0 + 1,
@@ -649,8 +650,7 @@
 		report_warning(mlds__get_prog_context(Context), 0, [
 			words("In mode number"), words(ProcNumberStr),
 			words("of"), fixed(CallId ++ ":"), nl,
-			words("  warning: recursive call " ++
-				"is not tail recursive.")
+			words("warning: recursive call is not tail recursive.")
 		], !IO)
 	;
 		PredLabel = special_pred(_, _, _, _)
Index: compiler/mmc_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mmc_analysis.m,v
retrieving revision 1.6
diff -u -b -r1.6 mmc_analysis.m
--- compiler/mmc_analysis.m	22 Mar 2005 06:40:12 -0000	1.6
+++ compiler/mmc_analysis.m	6 Aug 2005 08:02:26 -0000
@@ -31,7 +31,6 @@
 
 :- implementation.
 
-:- import_module hlds__hlds_out.
 :- import_module parse_tree__modules.
 :- import_module parse_tree__prog_out.
 :- import_module parse_tree__prog_util.
@@ -62,7 +61,7 @@
 	string_to_sym_name(ModuleId, ".", ModuleName).
 
 pred_or_func_name_arity_to_func_id(PredOrFunc, Name, Arity, ProcId) = FuncId :-
-	FuncId0 = hlds_out__simple_call_id_to_string(PredOrFunc
+	FuncId0 = simple_call_id_to_string(PredOrFunc
 		- unqualified(Name)/Arity),
 	proc_id_to_int(ProcId, ProcInt),
 	FuncId = FuncId0 ++ "-" ++ int_to_string(ProcInt).
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.74
diff -u -b -r1.74 post_typecheck.m
--- compiler/post_typecheck.m	23 May 2005 03:15:39 -0000	1.74
+++ compiler/post_typecheck.m	6 Aug 2005 07:30:48 -0000
@@ -1125,7 +1125,7 @@
 	),
 	string__append_list(["`:- pragma ", Pragma, "'"], PragmaStr),
 	CallId = PredOrFunc - qualified(Module, Name)/Arity,
-	CallIdStr = hlds_out__simple_call_id_to_string(CallId),
+	CallIdStr = simple_call_id_to_string(CallId),
 	ErrorPieces = [fixed("Error:"), fixed(PragmaStr),
 		words("declaration for"), fixed(CallIdStr)].
 
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.130
diff -u -b -r1.130 prog_data.m
--- compiler/prog_data.m	26 Jul 2005 01:56:25 -0000	1.130
+++ compiler/prog_data.m	6 Aug 2005 07:08:40 -0000
@@ -1722,6 +1722,7 @@
 	;	name_arity(sym_name, arity).
 :- type sym_name_and_arity
 	--->	sym_name / arity.
+:- type simple_call_id == pair(pred_or_func, sym_name_and_arity).
 
 :- type module_specifier ==	sym_name.
 :- type arity		==	int.
Index: compiler/prog_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_out.m,v
retrieving revision 1.59
diff -u -b -r1.59 prog_out.m
--- compiler/prog_out.m	26 Jul 2005 01:56:25 -0000	1.59
+++ compiler/prog_out.m	6 Aug 2005 08:43:36 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1993-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -33,65 +35,99 @@
 :- pred report_error(string::in, io::di, io::uo) is det.
 :- pred report_error(io__output_stream::in, string::in, io::di, io::uo) is det.
 
-:- pred prog_out__write_messages(message_list::in, io::di, io::uo) is det.
+    % Write out the list of error/warning messages which is returned
+    % when a module is parsed.
+    %
+:- pred write_messages(message_list::in, io::di, io::uo) is det.
 
-:- pred prog_out__write_context(prog_context::in, io::di, io::uo) is det.
+    % Write out the information in term context (at the moment, just
+    % the line number) in a form suitable for the beginning of an
+    % error message.
+    %
+:- pred write_context(prog_context::in, io::di, io::uo) is det.
 
-:- pred prog_out__context_to_string(prog_context::in, string::out) is det.
+    % Write to a string the information in term context (at the moment,
+    % just the line number) in a form suitable for the beginning of an
+    % error message.
+    %
+:- pred context_to_string(prog_context::in, string::out) is det.
 
 	% Write out a symbol name, with special characters escaped,
 	% but without any quotes.  This is suitable for use in
 	% error messages, where the caller should print out an
 	% enclosing forward/backward-quote pair (`...').
-:- pred prog_out__write_sym_name(sym_name::in, io::di, io::uo) is det.
+    %
+:- pred write_sym_name(sym_name::in, io::di, io::uo) is det.
 
-:- pred prog_out__write_sym_name_and_arity(sym_name_and_arity::in,
-	io::di, io::uo) is det.
+:- pred write_sym_name_and_arity(sym_name_and_arity::in, io::di, io::uo)
+    is det.
 
 	% Write out a symbol name, enclosed in single forward quotes ('...')
 	% if necessary, and with any special characters escaped.
 	% The output should be a syntactically valid Mercury term.
-:- pred prog_out__write_quoted_sym_name(sym_name::in, io::di, io::uo) is det.
+    %
+:- pred write_quoted_sym_name(sym_name::in, io::di, io::uo) is det.
 
 	% sym_name_and_arity_to_string(SymName, String):
-	%	convert a symbol name and arity to a "<Name>/<Arity>" string,
-	%	with module qualifiers separated by
-	%	the standard Mercury module qualifier operator.
-:- pred prog_out__sym_name_and_arity_to_string(sym_name_and_arity::in,
-	string::out) is det.
-:- func prog_out__sym_name_and_arity_to_string(sym_name_and_arity) = string.
-
-:- pred prog_out__write_module_spec(module_specifier::in, io::di, io::uo)
+    %
+    % Convert a symbol name and arity to a "<Name>/<Arity>" string,
+    % with module qualifiers separated by the standard Mercury module
+    % qualifier operator.
+    %
+:- pred sym_name_and_arity_to_string(sym_name_and_arity::in, string::out)
 	is det.
+:- func sym_name_and_arity_to_string(sym_name_and_arity) = string.
+
+:- pred write_simple_call_id(simple_call_id::in, io::di, io::uo) is det.
+:- func simple_call_id_to_string(simple_call_id) = string.
 
-:- pred prog_out__write_module_list(list(module_name)::in,
+:- pred write_simple_call_id(pred_or_func::in, sym_name_and_arity::in,
 	io::di, io::uo) is det.
+:- func simple_call_id_to_string(pred_or_func, sym_name_and_arity) = string.
 
-:- pred prog_out__write_list(list(T)::in,
-	pred(T, io, io)::in(pred(in, di, uo) is det), io::di, io::uo) is det.
+:- pred write_simple_call_id(pred_or_func::in, sym_name::in, arity::in,
+	io::di, io::uo) is det.
+:- func simple_call_id_to_string(pred_or_func, sym_name, arity) = string.
+
+:- pred simple_call_id_to_sym_name_and_arity(simple_call_id::in,
+	sym_name_and_arity::out) is det.
+
+    % Write out a module specifier.
+    %
+:- pred write_module_spec(module_specifier::in, io::di, io::uo) is det.
+
+:- pred write_module_list(list(module_name)::in, io::di, io::uo) is det.
+
+:- pred write_list(list(T)::in, pred(T, io, io)::in(pred(in, di, uo) is det),
+    io::di, io::uo) is det.
 
 :- pred write_string_list(list(string)::in, io::di, io::uo) is det.
 
-:- pred prog_out__write_promise_type(promise_type::in, io::di, io::uo) is det.
+:- pred write_promise_type(promise_type::in, io::di, io::uo) is det.
 
-:- func prog_out__promise_to_string(promise_type) = string.
-:- mode prog_out__promise_to_string(in) = out is det.
-:- mode prog_out__promise_to_string(out) = in is semidet.
-:- mode prog_out__promise_to_string(out) = out is multi.
+:- func promise_to_string(promise_type) = string.
+:- mode promise_to_string(in) = out is det.
+:- mode promise_to_string(out) = in is semidet.
+:- mode promise_to_string(out) = out is multi.
 
 	% Print "predicate" or "function" depending on the given value.
+    %
 :- pred write_pred_or_func(pred_or_func::in, io::di, io::uo) is det.
 
 	% Return "predicate" or "function" depending on the given value.
+    %
 :- func pred_or_func_to_full_str(pred_or_func) = string.
 
 	% Return "pred" or "func" depending on the given value.
+    %
 :- func pred_or_func_to_str(pred_or_func) = string.
 
 	% Print out a purity name.
+    %
 :- pred write_purity(purity::in, io::di, io::uo) is det.
 
 	% Get a purity name as a string.
+    %
 :- pred purity_name(purity, string).
 :- mode purity_name(in, out) is det.
 :- mode purity_name(out, in) is semidet.
@@ -99,10 +135,12 @@
 	% Print out a purity prefix.
 	% This works under the assumptions that all purity names but `pure'
 	% are operators, and that we never need `pure' indicators/declarations.
+    %
 :- pred write_purity_prefix(purity::in, io::di, io::uo) is det.
 :- func purity_prefix_to_string(purity) = string.
 
 	% Convert an evaluation method to a string.
+    %
 :- func eval_method_to_string(eval_method) = string.
 
 %-----------------------------------------------------------------------------%
@@ -111,6 +149,7 @@
 :- implementation.
 
 :- import_module mdbcomp__prim_data.
+:- import_module parse_tree__prog_util.
 
 :- import_module int.
 :- import_module require.
@@ -146,31 +185,24 @@
 	report_error(ErrorMessage, !IO),
 	io__set_output_stream(OldStream, _, !IO).
 
-	% write out the list of error/warning messages which is
-	% returned when a module is parsed.
-
-prog_out__write_messages([], !IO).
-prog_out__write_messages([Message | Messages], !IO) :-
-	prog_out__write_message(Message, !IO),
-	prog_out__write_messages(Messages, !IO).
+write_messages([], !IO).
+write_messages([Message | Messages], !IO) :-
+    write_message(Message, !IO),
+    write_messages(Messages, !IO).
 
-:- pred prog_out__write_message(pair(string, term)::in,
+:- pred write_message(pair(string, term)::in,
 	io::di, io::uo) is det.
 
-prog_out__write_message(Msg - Term, !IO) :-
-	(
-		Term = term__functor(_Functor, _Args, Context0)
-	->
+write_message(Msg - Term, !IO) :-
+    ( Term = term__functor(_Functor, _Args, Context0) ->
 		Context0 = term__context(File, Line),
 		Context = term__context(File, Line),
-		prog_out__write_context(Context, !IO)
+        write_context(Context, !IO)
 	;
 		true
 	),
 	io__write_string(Msg, !IO),
-	(
-		Term = term__functor(term__atom(""), [], _Context2)
-	->
+    ( Term = term__functor(term__atom(""), [], _Context2) ->
 		io__write_string(".\n", !IO)
 	;
 		io__write_string(": ", !IO),
@@ -181,21 +213,11 @@
 
 %-----------------------------------------------------------------------------%
 
-	% Write out the information in term context (at the moment, just
-	% the line number) in a form suitable for the beginning of an
-	% error message.
-
-prog_out__write_context(Context, !IO) :-
-	prog_out__context_to_string(Context, ContextMessage),
+write_context(Context, !IO) :-
+    context_to_string(Context, ContextMessage),
 	io__write_string(ContextMessage, !IO).
 
-%-----------------------------------------------------------------------------%
-
-	% Write to a string the information in term context (at the moment,
-	% just the line number) in a form suitable for the beginning of an
-	% error message.
-
-prog_out__context_to_string(Context, ContextMessage) :-
+context_to_string(Context, ContextMessage) :-
 	term__context_file(Context, FileName),
 	term__context_line(Context, LineNumber),
 	( FileName = "" ->
@@ -207,62 +229,115 @@
 
 %-----------------------------------------------------------------------------%
 
-	% write out a (possibly qualified) symbol name
-
-prog_out__write_sym_name(qualified(ModuleSpec,Name), !IO) :-
-	prog_out__write_module_spec(ModuleSpec, !IO),
+write_sym_name(qualified(ModuleSpec,Name), !IO) :-
+    write_module_spec(ModuleSpec, !IO),
 	io__write_string(".", !IO),
 	term_io__write_escaped_string(Name, !IO).
-prog_out__write_sym_name(unqualified(Name), !IO) :-
+write_sym_name(unqualified(Name), !IO) :-
 	term_io__write_escaped_string(Name, !IO).
 
-prog_out__write_sym_name_and_arity(Name / Arity, !IO) :-
-	prog_out__write_sym_name(Name, !IO),
+write_sym_name_and_arity(Name / Arity, !IO) :-
+    write_sym_name(Name, !IO),
 	io__write_string("/", !IO),
 	io__write_int(Arity, !IO).
 
-prog_out__write_quoted_sym_name(SymName, !IO) :-
+write_quoted_sym_name(SymName, !IO) :-
 	io__write_string("'", !IO),
-	prog_out__write_sym_name(SymName, !IO),
+    write_sym_name(SymName, !IO),
 	io__write_string("'", !IO).
 
-prog_out__sym_name_and_arity_to_string(SymName/Arity, String) :-
+sym_name_and_arity_to_string(SymName/Arity, String) :-
 	mdbcomp__prim_data__sym_name_to_string(SymName, SymNameString),
 	string__int_to_string(Arity, ArityString),
 	string__append_list([SymNameString, "/", ArityString], String).
 
-prog_out__sym_name_and_arity_to_string(SymName/Arity) = String :-
-	prog_out__sym_name_and_arity_to_string(SymName/Arity, String).
+sym_name_and_arity_to_string(SymName/Arity) = String :-
+    sym_name_and_arity_to_string(SymName/Arity, String).
 
-	% write out a module specifier
+write_simple_call_id(PredOrFunc - Name/Arity, !IO) :-
+	Str = simple_call_id_to_string(PredOrFunc, Name, Arity),
+	io__write_string(Str, !IO).
+
+write_simple_call_id(PredOrFunc, Name/Arity, !IO) :-
+	Str = simple_call_id_to_string(PredOrFunc, Name, Arity),
+	io__write_string(Str, !IO).
+
+write_simple_call_id(PredOrFunc, Name, Arity, !IO) :-
+	Str = simple_call_id_to_string(PredOrFunc, Name, Arity),
+	io__write_string(Str, !IO).
+
+simple_call_id_to_string(PredOrFunc - Name/Arity) =
+	simple_call_id_to_string(PredOrFunc, Name, Arity).
+
+simple_call_id_to_string(PredOrFunc, Name/Arity) =
+	simple_call_id_to_string(PredOrFunc, Name, Arity).
+
+simple_call_id_to_string(PredOrFunc, Name, Arity) = Str :-
+    % XXX When printed, promises are differentiated from predicates or
+    % functions by module name, so the module names `promise',
+    % `promise_exclusive', etc. should be reserved, and their dummy
+    % predicates should have more unusual module names.
+	(
+		Name = unqualified(StrName)
+	;
+		Name = qualified(_, StrName)
+	),
+    % Is it really a promise?
+	( string__prefix(StrName, "promise__") ->
+		MaybePromise = yes(true)
+	; string__prefix(StrName, "promise_exclusive__") ->
+		MaybePromise = yes(exclusive)
+	; string__prefix(StrName, "promise_exhaustive__") ->
+		MaybePromise = yes(exhaustive)
+	; string__prefix(StrName, "promise_exclusive_exhaustive__") ->
+		MaybePromise = yes(exclusive_exhaustive)
+	;
+		MaybePromise = no	% No, it is really a pred or func.
+	),
+	(
+		MaybePromise = yes(PromiseType),
+		PromiseStr = promise_to_string(PromiseType),
+		Str = "`" ++ PromiseStr ++ "' declaration"
+	;
+		MaybePromise = no,
+		PredOrFuncStr = pred_or_func_to_full_str(PredOrFunc),
+		simple_call_id_to_sym_name_and_arity(PredOrFunc - Name/Arity,
+            SymArity),
+		SymArityStr = sym_name_and_arity_to_string(SymArity),
+		Str = PredOrFuncStr ++ " `" ++ SymArityStr ++ "'"
+	).
 
-prog_out__write_module_spec(ModuleSpec) -->
-	prog_out__write_sym_name(ModuleSpec).
+simple_call_id_to_sym_name_and_arity(PredOrFunc - SymName/Arity,
+		SymName/OrigArity) :-
+	adjust_func_arity(PredOrFunc, OrigArity, Arity).
+
+write_module_spec(ModuleSpec, !IO) :-
+    write_sym_name(ModuleSpec, !IO).
 
 %-----------------------------------------------------------------------------%
 
-prog_out__write_module_list(Modules, !IO) :-
-	prog_out__write_list(Modules, write_module, !IO).
+write_module_list(Modules, !IO) :-
+    write_list(Modules, write_module, !IO).
 
 :- pred write_module(module_name::in, io::di, io::uo) is det.
 
 write_module(Module, !IO) :-
 	io__write_string("`", !IO),
-	prog_out__write_sym_name(Module, !IO),
+    write_sym_name(Module, !IO),
 	io__write_string("'", !IO).
 
-prog_out__write_list([Import1, Import2, Import3 | Imports], Writer, !IO) :-
+write_list([Import1, Import2, Import3 | Imports], Writer, !IO) :-
 	call(Writer, Import1, !IO),
 	io__write_string(", ", !IO),
-	prog_out__write_list([Import2, Import3 | Imports], Writer, !IO).
-prog_out__write_list([Import1, Import2], Writer, !IO) :-
+    write_list([Import2, Import3 | Imports], Writer, !IO).
+write_list([Import1, Import2], Writer, !IO) :-
 	call(Writer, Import1, !IO),
 	io__write_string(" and ", !IO),
 	call(Writer, Import2, !IO).
-prog_out__write_list([Import], Writer, !IO) :-
+write_list([Import], Writer, !IO) :-
 	call(Writer, Import, !IO).
-prog_out__write_list([], _, !IO) :-
-	error("prog_out__write_module_list").
+write_list([], _, !IO) :-
+    error("write_module_list").
 
 write_string_list([], !IO).
 write_string_list([Name], !IO) :-
@@ -272,14 +347,14 @@
 	io__write_string(", ", !IO),
 	write_string_list([Name2 | Names], !IO).
 
-prog_out__promise_to_string(true) = "promise".
-prog_out__promise_to_string(exclusive) = "promise_exclusive".
-prog_out__promise_to_string(exhaustive) =  "promise_exhaustive".
-prog_out__promise_to_string(exclusive_exhaustive) =
+promise_to_string(true) = "promise".
+promise_to_string(exclusive) = "promise_exclusive".
+promise_to_string(exhaustive) =  "promise_exhaustive".
+promise_to_string(exclusive_exhaustive) =
 		"promise_exclusive_exhaustive".
 
-prog_out__write_promise_type(PromiseType, !IO) :-
-	io__write_string(prog_out__promise_to_string(PromiseType), !IO).
+write_promise_type(PromiseType, !IO) :-
+    io__write_string(promise_to_string(PromiseType), !IO).
 
 write_pred_or_func(PorF, !IO) :-
 	io__write_string(pred_or_func_to_full_str(PorF), !IO).
@@ -345,242 +420,3 @@
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
-
-% THE REMAINDER OF THIS FILE IS JUNK THAT IS NOT USED.
-% It has been made obsolete by mercury_to_mercury.m.
-% However, the code below handles operator precedence better
-% than mercury_to_mercury.m.
-%
-% % Please note that this code is the property of
-% % the University of Melbourne and is Copyright 1985, 1986, 1987, 1988 by it.
-% %
-% % All rights are reserved.
-% %
-% % Author: Philip Dart, 1988
-% %		Based on a theme by Lawrence Byrd and Lee Naish.
-% %	Fixed again by Lee Naish 9/88
-%
-% % May bear some vague resemblance to some code written by Lawrence Byrd
-% % at Edinburgh a long time ago.
-%
-% prog_out__writeDCGClause(Head, Body, VarSet) -->
-% 	% prog_out__get_op_prec("-->", 1, Prec),
-% 	{ Prec = 1199 },
-% 	prog_out__qwrite(Prec, VarSet, Head),
-% 	io__write_string(" -->"),
-% 	prog_out__write_goal(Body, 1, ',', VarSet).
-%
-% :- type context ---> '(' ; (';') ; (then) ; (else) ; ','.
-%
-% :- pred prog_out__write_goal(goal, int, context, varset, io, io).
-% :- mode prog_out__write_goal(in, in, in, in, di, uo) is det.
-%
-% prog_out__write_goal(fail, I0, T, _VarSet) -->
-% 	prog_out__beforelit(T, I0),
-% 	io__write_string("fail").
-%
-% prog_out__write_goal(true, I0, T, _VarSet) -->
-% 	prog_out__beforelit(T, I0),
-% 	io__write_string("true").
-%
-% prog_out__write_goal(some(Vars,Goal), I0, T, VarSet) -->
-% 	prog_out__beforelit(T, I0),
-% 	io__write_string("some ["),
-% 	prog_out__write_var_list(Vars, VarSet),
-% 	io__write_string("] ("),
-% 	{ I1 is I0 + 1 },
-% 	prog_out__write_goal(Goal, I1, '(', VarSet),
-% 	io__write_string("\n"),
-% 	prog_out__indent(I0),
-% 	io__write_string(")").
-%
-% prog_out__write_goal(all(Vars,Goal), I0, T, VarSet) -->
-% 	prog_out__beforelit(T, I0),
-% 	io__write_string("all ["),
-% 	prog_out__write_var_list(Vars, VarSet),
-% 	io__write_string("] ("),
-% 	{ I1 is I0 + 1 },
-% 	prog_out__write_goal(Goal, I1, '(', VarSet),
-% 	io__write_string("\n"),
-% 	prog_out__indent(I0),
-% 	io__write_string(")").
-%
-% prog_out__write_goal((P, Q), I0, T, VarSet) -->
-% 	prog_out__write_goal(P, I0, T, VarSet),
-% 	io__write_string(","),
-% 	{if T = (',') then I = I0 else I is I0 + 1},
-% 	prog_out__write_goal(Q, I, (','), VarSet).
-%
-% prog_out__write_goal(if_then_else(Vars,C,A,B), I, T, VarSet) -->
-% 	{if T = (then) then I1 is I + 1 else I1 = I},
-% 	(if {T = (else)} then
-% 		[]
-% 	else
-% 		io__write_string("\n"),
-% 		prog_out__indent(I1)
-% 	),
-% 	io__write_string(" if "),
-% 	prog_out__write_some_vars(VarSet, Vars),
-% 	prog_out__write_goal(C, I, '(', VarSet),
-% 	io__write_string(" then"),
-% 	prog_out__write_goal(A, I1, (then), VarSet),
-% 	io__write_string("\n"),
-% 	prog_out__indent(I1),
-% 	io__write_string("else"),
-% 	prog_out__write_goal(B, I1, (else), VarSet),
-% 	(if {T = (else)} then
-% 		[]
-% 	else
-% 		io__write_string("\n"),
-% 		prog_out__indent(I1),
-% 		io__write_string(")")
-% 	).
-%
-% prog_out__write_goal(if_then(Vars,C,A), I, T, VarSet) -->
-% 	{if T = (then) then I1 is I + 1 else I1 = I},
-% 	(if {T = (else)} then
-% 		[]
-% 	else
-% 		io__write_string("\n"),
-% 		prog_out__indent(I1)
-% 	),
-% 	io__write_string(" if "),
-% 	prog_out__write_some_vars(VarSet, Vars),
-% 	prog_out__write_goal(C, I, '(', VarSet),
-% 	io__write_string(" then"),
-% 	prog_out__write_goal(A, I1, (then), VarSet),
-% 	(if {T = (else)} then
-% 		[]
-% 	else
-% 		io__write_string("\n"),
-% 		prog_out__indent(I1),
-% 		io__write_string(")")
-% 	).
-%
-% prog_out__write_goal((P ; Q), I, T, VarSet) -->
-% 	(if {T = (;)} then
-% 		io__write_string("\t\n"),
-% 		prog_out__write_goal(P, I, (;), VarSet)
-% 	else
-% 		io__write_string("\n"),
-% 		prog_out__indent(I),
-% 		io__write_string("("),
-% 		prog_out__write_goal(P, I, '(', VarSet)
-% 	),
-% 	io__write_string("\n"),
-% 	prog_out__indent(I),
-% 	io__write_string(";"),
-% 	prog_out__write_goal(Q, I, (;), VarSet),
-% 	(if {T = (;)} then
-% 		[]
-% 	else
-% 		io__write_string("\n"),
-% 		prog_out__indent(I),
-% 		io__write_string(")")
-% 	).
-%
-% prog_out__write_goal(not(A), I, _, VarSet) -->
-% 	io__write_string("not("),
-% 	prog_out__write_goal(A, I, '(', VarSet),
-% 	io__write_string(")").
-%
-% prog_out__write_goal(call(X), I, T, VarSet) -->
-% 	prog_out__beforelit(T, I),
-% 		% Pos 1 of (,) has lowest prec of constructs
-% 	% prog_out__get_op_prec(",", 1, Prec),
-% 	{ Prec = 999 },
-% 	prog_out__qwrite(Prec, VarSet, X).
-%
-% prog_out__write_var_list(_VarSet, Vars) -->
-% 	io__write_anything(Vars).
-%
-% prog_out__write_some_vars(_VarSet, Vars) -->
-% 	io__write_string("some "),
-% 	io__write_anything(Vars).		% XXX
-%
-% :- pred prog_out__beforelit(context, int, io, io).
-% :- mode prog_out__beforelit(in, in, di, uo) is det.
-%
-% prog_out__beforelit('(', _) -->
-% 	io__write_string("\t").
-% prog_out__beforelit((;), I) -->
-% 	io__write_string("\n"),
-% 	{ I1 is I + 1 },
-% 	prog_out__indent(I1),
-% 	io__write_string("\t").
-% prog_out__beforelit((then), I) -->
-% 	io__write_string("\n"),
-% 	{ I1 is I + 1 },
-% 	prog_out__indent(I1).
-% prog_out__beforelit((else), I) -->
-% 	io__write_string("\n"),
-% 	{ I1 is I + 1 },
-% 	prog_out__indent(I1).
-% prog_out__beforelit(',', I) -->
-% 	io__write_string("\n"),
-% 	prog_out__indent(I).
-%
-% :- pred prog_out__indent(int, io, io).
-% :- mode prog_out__indent(int, di, uo) is det.
-% prog_out__indent(N) -->
-% 	(if {N > 0} then
-% 		io__write_string("\t"),
-% 		{ N1 is N - 1 },
-% 		prog_out__indent(N1)
-% 	else
-% 		[]
-% 	).
-%
-% :- pred prog_out__qwrite(int, varset, term, io, io).
-% :- mode prog_out__qwrite(in, in, in, di, uo) is det.
-%
-% 	% XXX problems with precedence
-%
-% prog_out__qwrite(_Prec, VarSet, X) -->
-% 	term_io__write_term(VarSet, X).
-%
-% :- pred prog_out__get_op_prec(string, int, int, io, io).
-% :- mode prog_out__get_op_prec(in, in, out, di, uo) is det.
-%
-% prog_out__get_op_prec(Op, Pos, Prec) -->
-% 	term_io__current_ops(Ops),
-% 	{ get_prec_and_type(Op, Ops, Prec1, Type),
-% 	  prog_out__op_adj(Pos, Type, Adj),
-% 	  Prec is Prec1 - Adj
-% 	}.
-%
-% get_prec_and_type(ThisOp, [Op | Ops], Prec, Type) :-
-% 	(if some [Prec1, Type1]
-% 		Op = op(Prec1, Type1, ThisOp)
-% 	then
-% 		Prec = Prec1,
-% 		Type = Type1
-% 	else
-% 		get_prec_and_type(ThisOp, Ops, Prec, Type)
-% 	).
-%
-% :- pred prog_out__op_adj(int, op_type, int).
-% :- mode prog_out__op_adj(in, in, out) is det.
-%
-% prog_out__op_adj(1, xfx, 1).
-% prog_out__op_adj(1, xfy, 1).
-% prog_out__op_adj(1, fxy, 1).
-% prog_out__op_adj(1, fxx, 1).
-% prog_out__op_adj(1, yfx, 0).
-% % prog_out__op_adj(1, yfy, 0).
-% prog_out__op_adj(1, fyx, 0).
-% prog_out__op_adj(1, fyy, 0).
-% prog_out__op_adj(2, xfx, 1).
-% prog_out__op_adj(2, xfy, 0).
-% prog_out__op_adj(2, fxy, 0).
-% prog_out__op_adj(2, fxx, 1).
-% prog_out__op_adj(2, yfx, 1).
-% % prog_out__op_adj(2, yfy, 0).
-% prog_out__op_adj(2, fyx, 1).
-% prog_out__op_adj(2, fyy, 0).
-% prog_out__op_adj(1,  xf, 1).
-% prog_out__op_adj(1,  fx, 1).
-% prog_out__op_adj(1,  yf, 0).
-% prog_out__op_adj(1,  fy, 0).
-%
-% ******************************/
Index: compiler/typecheck_errors.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck_errors.m,v
retrieving revision 1.2
diff -u -b -r1.2 typecheck_errors.m
--- compiler/typecheck_errors.m	23 Apr 2005 08:07:22 -0000	1.2
+++ compiler/typecheck_errors.m	6 Aug 2005 07:37:06 -0000
@@ -289,10 +289,9 @@
 			"a list of variables.\n", !IO)
 	;
 		io__write_string("  error: undefined ", !IO),
-		hlds_out__write_simple_call_id(PredOrFunc - PredCallId, !IO),
+		write_simple_call_id(PredOrFunc - PredCallId, !IO),
 		( PredName = qualified(ModuleQualifier, _) ->
-			maybe_report_missing_import(Info,
-				ModuleQualifier, !IO)
+			maybe_report_missing_import(Info, ModuleQualifier, !IO)
 		;
 			io__write_string(".\n", !IO)
 		)
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.170
diff -u -b -r1.170 Mmakefile
--- tests/invalid/Mmakefile	3 Aug 2005 11:26:59 -0000	1.170
+++ tests/invalid/Mmakefile	7 Aug 2005 04:50:55 -0000
@@ -227,7 +227,8 @@
 
 #-----------------------------------------------------------------------------#
 
-# These tests test things which only work for back-ends which support the C interface.
+# These tests test things which only work for back-ends which support
+# the C interface.
 ifneq "$(filter java% il%,$(GRADE))" ""
 C_INTERFACE_PROGS=
 else
@@ -241,9 +242,9 @@
 RESERVE_TAG_PROGS = $(RESERVE_TAG_MODULES)
 endif
 
-# The java back-end ignores pragma type_spec, so it doesn't diagnose errors in them.
-# (XXX Perhaps the code to ignore them in make_hlds.m should be moved to after the
-# error-checking?)
+# The java back-end ignores pragma type_spec, so it doesn't diagnose errors
+# in them. (XXX Perhaps the code to ignore them in make_hlds.m should be moved
+# to after the error-checking?)
 ifneq "$(filter java%,$(GRADE))" ""
 TYPE_SPEC_PROGS =
 else
Index: tests/invalid/aditi_update_errors.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/aditi_update_errors.err_exp,v
retrieving revision 1.10
diff -u -b -r1.10 aditi_update_errors.err_exp
--- tests/invalid/aditi_update_errors.err_exp	14 Feb 2005 08:26:37 -0000	1.10
+++ tests/invalid/aditi_update_errors.err_exp	6 Aug 2005 14:10:30 -0000
@@ -53,16 +53,26 @@
 aditi_update_errors.m:081: In clause for predicate
 aditi_update_errors.m:081:   `aditi_update_errors.aditi_update_syntax/2':
 aditi_update_errors.m:081:   warning: variable `X' has overlapping scopes.
-aditi_update_errors.m:102: In clause for predicate `aditi_update_errors.aditi_update_types/2':
-aditi_update_errors.m:102:   warning: variable `_Y' occurs more than once in this scope.
-aditi_update_errors.m:102: In clause for predicate `aditi_update_errors.aditi_update_types/2':
-aditi_update_errors.m:102:   warning: variable `_Y' occurs more than once in this scope.
-aditi_update_errors.m:103: In clause for predicate `aditi_update_errors.aditi_update_types/2':
-aditi_update_errors.m:103:   warning: variable `_Y' occurs more than once in this scope.
-aditi_update_errors.m:103: In clause for predicate `aditi_update_errors.aditi_update_types/2':
-aditi_update_errors.m:103:   warning: variable `_Y' occurs more than once in this scope.
-aditi_update_errors.m:166: In clause for predicate `aditi_update_errors.aditi_update_types/2':
-aditi_update_errors.m:166:   warning: variable `DB' occurs only once in this scope.
+aditi_update_errors.m:102: In clause for predicate
+aditi_update_errors.m:102:   `aditi_update_errors.aditi_update_types/2':
+aditi_update_errors.m:102:   warning: variable `_Y' occurs more than once in
+aditi_update_errors.m:102:   this scope.
+aditi_update_errors.m:102: In clause for predicate
+aditi_update_errors.m:102:   `aditi_update_errors.aditi_update_types/2':
+aditi_update_errors.m:102:   warning: variable `_Y' occurs more than once in
+aditi_update_errors.m:102:   this scope.
+aditi_update_errors.m:103: In clause for predicate
+aditi_update_errors.m:103:   `aditi_update_errors.aditi_update_types/2':
+aditi_update_errors.m:103:   warning: variable `_Y' occurs more than once in
+aditi_update_errors.m:103:   this scope.
+aditi_update_errors.m:103: In clause for predicate
+aditi_update_errors.m:103:   `aditi_update_errors.aditi_update_types/2':
+aditi_update_errors.m:103:   warning: variable `_Y' occurs more than once in
+aditi_update_errors.m:103:   this scope.
+aditi_update_errors.m:166: In clause for predicate
+aditi_update_errors.m:166:   `aditi_update_errors.aditi_update_types/2':
+aditi_update_errors.m:166:   warning: variable `DB' occurs only once in this
+aditi_update_errors.m:166:   scope.
 aditi_update_errors.m:007: Error: no clauses for predicate
 aditi_update_errors.m:007:   `aditi_update_syntax/2'.
 aditi_update_errors.m:096: In clause for predicate `aditi_update_errors.aditi_update_types/2':
Index: tests/invalid/aditi_update_mode_errors.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/aditi_update_mode_errors.err_exp,v
retrieving revision 1.9
diff -u -b -r1.9 aditi_update_mode_errors.err_exp
--- tests/invalid/aditi_update_mode_errors.err_exp	25 Apr 2005 08:47:39 -0000	1.9
+++ tests/invalid/aditi_update_mode_errors.err_exp	6 Aug 2005 14:10:22 -0000
@@ -1,27 +1,51 @@
-aditi_update_mode_errors.m:062: In clause for predicate `aditi_update_mode_errors.aditi_update_modes4/2':
-aditi_update_mode_errors.m:062:   warning: variables `_X, _Y' occur more than once in this scope.
-aditi_update_mode_errors.m:062: In clause for predicate `aditi_update_mode_errors.aditi_update_modes4/2':
-aditi_update_mode_errors.m:062:   warning: variables `_X, _Y' occur more than once in this scope.
-aditi_update_mode_errors.m:062: In clause for predicate `aditi_update_mode_errors.aditi_update_modes4/2':
-aditi_update_mode_errors.m:062:   warning: variable `X' occurs only once in this scope.
-aditi_update_mode_errors.m:065: In clause for predicate `aditi_update_mode_errors.aditi_update_modes5/2':
-aditi_update_mode_errors.m:065:   warning: variables `_X, _Y' occur more than once in this scope.
-aditi_update_mode_errors.m:065: In clause for predicate `aditi_update_mode_errors.aditi_update_modes5/2':
-aditi_update_mode_errors.m:065:   warning: variables `_X, _Y' occur more than once in this scope.
-aditi_update_mode_errors.m:065: In clause for predicate `aditi_update_mode_errors.aditi_update_modes5/2':
-aditi_update_mode_errors.m:065:   warning: variable `X' occurs only once in this scope.
-aditi_update_mode_errors.m:102: In clause for predicate `aditi_update_mode_errors.aditi_update_modes10/2':
-aditi_update_mode_errors.m:102:   warning: variable `_X0' occurs more than once in this scope.
-aditi_update_mode_errors.m:102: In clause for predicate `aditi_update_mode_errors.aditi_update_modes10/2':
-aditi_update_mode_errors.m:102:   warning: variable `_X0' occurs more than once in this scope.
-aditi_update_mode_errors.m:102: In clause for predicate `aditi_update_mode_errors.aditi_update_modes10/2':
-aditi_update_mode_errors.m:102:   warning: variable `X0' occurs only once in this scope.
-aditi_update_mode_errors.m:105: In clause for predicate `aditi_update_mode_errors.aditi_update_modes11/2':
-aditi_update_mode_errors.m:105:   warning: variable `_X0' occurs more than once in this scope.
-aditi_update_mode_errors.m:105: In clause for predicate `aditi_update_mode_errors.aditi_update_modes11/2':
-aditi_update_mode_errors.m:105:   warning: variable `_X0' occurs more than once in this scope.
-aditi_update_mode_errors.m:105: In clause for predicate `aditi_update_mode_errors.aditi_update_modes11/2':
-aditi_update_mode_errors.m:105:   warning: variable `X0' occurs only once in this scope.
+aditi_update_mode_errors.m:062: In clause for predicate
+aditi_update_mode_errors.m:062:   `aditi_update_mode_errors.aditi_update_modes4/2':
+aditi_update_mode_errors.m:062:   warning: variables `_X, _Y' occur more than
+aditi_update_mode_errors.m:062:   once in this scope.
+aditi_update_mode_errors.m:062: In clause for predicate
+aditi_update_mode_errors.m:062:   `aditi_update_mode_errors.aditi_update_modes4/2':
+aditi_update_mode_errors.m:062:   warning: variables `_X, _Y' occur more than
+aditi_update_mode_errors.m:062:   once in this scope.
+aditi_update_mode_errors.m:062: In clause for predicate
+aditi_update_mode_errors.m:062:   `aditi_update_mode_errors.aditi_update_modes4/2':
+aditi_update_mode_errors.m:062:   warning: variable `X' occurs only once in
+aditi_update_mode_errors.m:062:   this scope.
+aditi_update_mode_errors.m:065: In clause for predicate
+aditi_update_mode_errors.m:065:   `aditi_update_mode_errors.aditi_update_modes5/2':
+aditi_update_mode_errors.m:065:   warning: variables `_X, _Y' occur more than
+aditi_update_mode_errors.m:065:   once in this scope.
+aditi_update_mode_errors.m:065: In clause for predicate
+aditi_update_mode_errors.m:065:   `aditi_update_mode_errors.aditi_update_modes5/2':
+aditi_update_mode_errors.m:065:   warning: variables `_X, _Y' occur more than
+aditi_update_mode_errors.m:065:   once in this scope.
+aditi_update_mode_errors.m:065: In clause for predicate
+aditi_update_mode_errors.m:065:   `aditi_update_mode_errors.aditi_update_modes5/2':
+aditi_update_mode_errors.m:065:   warning: variable `X' occurs only once in
+aditi_update_mode_errors.m:065:   this scope.
+aditi_update_mode_errors.m:102: In clause for predicate
+aditi_update_mode_errors.m:102:   `aditi_update_mode_errors.aditi_update_modes10/2':
+aditi_update_mode_errors.m:102:   warning: variable `_X0' occurs more than once
+aditi_update_mode_errors.m:102:   in this scope.
+aditi_update_mode_errors.m:102: In clause for predicate
+aditi_update_mode_errors.m:102:   `aditi_update_mode_errors.aditi_update_modes10/2':
+aditi_update_mode_errors.m:102:   warning: variable `_X0' occurs more than once
+aditi_update_mode_errors.m:102:   in this scope.
+aditi_update_mode_errors.m:102: In clause for predicate
+aditi_update_mode_errors.m:102:   `aditi_update_mode_errors.aditi_update_modes10/2':
+aditi_update_mode_errors.m:102:   warning: variable `X0' occurs only once in
+aditi_update_mode_errors.m:102:   this scope.
+aditi_update_mode_errors.m:105: In clause for predicate
+aditi_update_mode_errors.m:105:   `aditi_update_mode_errors.aditi_update_modes11/2':
+aditi_update_mode_errors.m:105:   warning: variable `_X0' occurs more than once
+aditi_update_mode_errors.m:105:   in this scope.
+aditi_update_mode_errors.m:105: In clause for predicate
+aditi_update_mode_errors.m:105:   `aditi_update_mode_errors.aditi_update_modes11/2':
+aditi_update_mode_errors.m:105:   warning: variable `_X0' occurs more than once
+aditi_update_mode_errors.m:105:   in this scope.
+aditi_update_mode_errors.m:105: In clause for predicate
+aditi_update_mode_errors.m:105:   `aditi_update_mode_errors.aditi_update_modes11/2':
+aditi_update_mode_errors.m:105:   warning: variable `X0' occurs only once in
+aditi_update_mode_errors.m:105:   this scope.
 aditi_update_mode_errors.m:053: In clause for `aditi_update_modes1((aditi.aditi_di), (aditi.aditi_uo))':
 aditi_update_mode_errors.m:053:   in argument 2 of the inserted tuple of `aditi_insert' of predicate `aditi_update_mode_errors.p/3':
 aditi_update_mode_errors.m:053:   mode error: variable `V_4' has instantiatedness `free',
Index: tests/invalid/errors.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/errors.err_exp,v
retrieving revision 1.11
diff -u -b -r1.11 errors.err_exp
--- tests/invalid/errors.err_exp	20 Mar 2005 02:24:39 -0000	1.11
+++ tests/invalid/errors.err_exp	6 Aug 2005 14:11:36 -0000
@@ -28,7 +28,8 @@
 errors.m:038: Error: clause for predicate
 errors.m:038:   `errors.clause_without_pred_or_mode_declaration/0'
 errors.m:038:   without preceding `pred' declaration.
-errors.m:075: In clause for predicate `errors.pred_with_unresolved_polymorphism/0':
+errors.m:075: In clause for predicate
+errors.m:075:   `errors.pred_with_unresolved_polymorphism/0':
 errors.m:075:   warning: variable `Arg' occurs only once in this scope.
 errors.m:091: In clause for predicate `errors.pred_with_singleton_vars/1':
 errors.m:091:   warning: variable `X' occurs only once in this scope.
Index: tests/invalid/errors1.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/errors1.err_exp,v
retrieving revision 1.8
diff -u -b -r1.8 errors1.err_exp
--- tests/invalid/errors1.err_exp	20 Mar 2005 02:24:39 -0000	1.8
+++ tests/invalid/errors1.err_exp	6 Aug 2005 14:11:39 -0000
@@ -22,7 +22,8 @@
 errors1.m:038: Error: clause for predicate
 errors1.m:038:   `errors1.clause_without_pred_or_mode_declaration/0'
 errors1.m:038:   without preceding `pred' declaration.
-errors1.m:072: In clause for predicate `errors1.pred_with_unresolved_polymorphism/0':
+errors1.m:072: In clause for predicate
+errors1.m:072:   `errors1.pred_with_unresolved_polymorphism/0':
 errors1.m:072:   warning: variable `Arg' occurs only once in this scope.
 errors1.m:088: In clause for predicate `errors1.pred_with_singleton_vars/1':
 errors1.m:088:   warning: variable `X' occurs only once in this scope.
Index: tests/invalid/field_syntax_error.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/field_syntax_error.err_exp,v
retrieving revision 1.2
diff -u -b -r1.2 field_syntax_error.err_exp
--- tests/invalid/field_syntax_error.err_exp	17 Jan 2003 05:57:08 -0000	1.2
+++ tests/invalid/field_syntax_error.err_exp	6 Aug 2005 14:11:47 -0000
@@ -1,7 +1,9 @@
 field_syntax_error.m:013: In clause for function `field_syntax_error.baz/1':
-field_syntax_error.m:013:   warning: variable `Bar' occurs only once in this scope.
+field_syntax_error.m:013:   warning: variable `Bar' occurs only once in this
+field_syntax_error.m:013:   scope.
 field_syntax_error.m:015: In clause for function `field_syntax_error.baz3/1':
-field_syntax_error.m:015:   warning: variable `Bar' occurs only once in this scope.
+field_syntax_error.m:015:   warning: variable `Bar' occurs only once in this
+field_syntax_error.m:015:   scope.
 field_syntax_error.m:013: In clause for function `field_syntax_error.baz/1':
 field_syntax_error.m:013:   in function result term of clause head:
 field_syntax_error.m:013:   error: invalid use of field selection operator (`^').
Index: tests/invalid/foreign_singleton.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/foreign_singleton.err_exp,v
retrieving revision 1.3
diff -u -b -r1.3 foreign_singleton.err_exp
--- tests/invalid/foreign_singleton.err_exp	17 Jan 2003 05:57:08 -0000	1.3
+++ tests/invalid/foreign_singleton.err_exp	7 Aug 2005 13:00:40 -0000
@@ -1,9 +1,13 @@
 foreign_singleton.m:021: In the C code for predicate `foreign_singleton.f/3':
-foreign_singleton.m:021:   warning: variable `IO0' does not occur in the C code.
+foreign_singleton.m:021:   warning: variable `IO0' does not occur in the C
+foreign_singleton.m:021:   code.
 foreign_singleton.m:026: In clause for predicate `foreign_singleton.f/3':
-foreign_singleton.m:026:   warning: variable `X' occurs only once in this scope.
+foreign_singleton.m:026:   warning: variable `X' occurs only once in this
+foreign_singleton.m:026:   scope.
 foreign_singleton.m:030: In clause for predicate `foreign_singleton.g/3':
-foreign_singleton.m:030:   warning: variable `X' occurs only once in this scope.
+foreign_singleton.m:030:   warning: variable `X' occurs only once in this
+foreign_singleton.m:030:   scope.
 foreign_singleton.m:032: In the C code for predicate `foreign_singleton.g/3':
-foreign_singleton.m:032:   warning: variable `IO0' does not occur in the C code.
+foreign_singleton.m:032:   warning: variable `IO0' does not occur in the C
+foreign_singleton.m:032:   code.
 For more information, try recompiling with `-E'.
Index: tests/invalid/pragma_c_code_dup_var.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/pragma_c_code_dup_var.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 pragma_c_code_dup_var.err_exp
--- tests/invalid/pragma_c_code_dup_var.err_exp	14 May 2004 08:40:31 -0000	1.6
+++ tests/invalid/pragma_c_code_dup_var.err_exp	6 Aug 2005 14:15:06 -0000
@@ -1,5 +1,6 @@
-pragma_c_code_dup_var.m:019: In `:- pragma foreign_proc' declaration for function `pragma_c_code_dup_var.bread_impl/6':
-pragma_c_code_dup_var.m:019:   error: variable `Buf' occurs multiple times
-pragma_c_code_dup_var.m:019:   in the argument list.
+pragma_c_code_dup_var.m:019: In `:- pragma foreign_proc' declaration for
+pragma_c_code_dup_var.m:019:   function `pragma_c_code_dup_var.bread_impl/6':
+pragma_c_code_dup_var.m:019:   error: variable `Buf' occurs multiple times in
+pragma_c_code_dup_var.m:019:   the argument list.
 pragma_c_code_dup_var.m:014: Error: no clauses for function `bread_impl/7'.
 For more information, try recompiling with `-E'.
Index: tests/invalid/record_syntax_errors.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/record_syntax_errors.err_exp,v
retrieving revision 1.13
diff -u -b -r1.13 record_syntax_errors.err_exp
--- tests/invalid/record_syntax_errors.err_exp	1 Apr 2005 02:03:36 -0000	1.13
+++ tests/invalid/record_syntax_errors.err_exp	6 Aug 2005 14:18:01 -0000
@@ -9,8 +9,8 @@
 record_syntax_errors.m:048: Error: clause for predicate
 record_syntax_errors.m:048:   `record_syntax_errors.term_type_error/1'
 record_syntax_errors.m:048:   without preceding `pred' declaration.
-record_syntax_errors.m:054: In declaration of
-record_syntax_errors.m:054:   function `record_syntax_errors.field4/1':
+record_syntax_errors.m:054: In declaration of function
+record_syntax_errors.m:054:   `record_syntax_errors.field4/1':
 record_syntax_errors.m:054:   error: a field access function for an exported
 record_syntax_errors.m:054:   field must also be exported.
 record_syntax_errors.m:057: Error: clause for automatically generated field
Index: tests/invalid/state_vars_test5.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/state_vars_test5.err_exp,v
retrieving revision 1.5
diff -u -b -r1.5 state_vars_test5.err_exp
--- tests/invalid/state_vars_test5.err_exp	8 Mar 2004 02:26:37 -0000	1.5
+++ tests/invalid/state_vars_test5.err_exp	6 Aug 2005 14:18:09 -0000
@@ -1,5 +1,6 @@
 state_vars_test5.m:021: In clause for predicate `state_vars_test5.p/1':
-state_vars_test5.m:021:   warning: variable `STATE_VARIABLE_X' occurs only once in this scope.
+state_vars_test5.m:021:   warning: variable `STATE_VARIABLE_X' occurs only once
+state_vars_test5.m:021:   in this scope.
 state_vars_test5.m:021: In clause for `p(out)':
 state_vars_test5.m:021:   mode error: argument 1 did not get sufficiently instantiated.
 state_vars_test5.m:021:   Final instantiatedness of `STATE_VARIABLE_X' was `free',
Index: tests/invalid/type_spec.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/type_spec.err_exp,v
retrieving revision 1.5
diff -u -b -r1.5 type_spec.err_exp
--- tests/invalid/type_spec.err_exp	20 Mar 2005 02:24:40 -0000	1.5
+++ tests/invalid/type_spec.err_exp	6 Aug 2005 15:59:12 -0000
@@ -1,16 +1,21 @@
-type_spec.m:010: In `:- pragma type_spec' declaration for predicate `type_spec.type_spec1/1':
-type_spec.m:010:   error: variable `U' does not occur in the `:- pred' declaration.
+type_spec.m:010: In `:- pragma type_spec' declaration for predicate
+type_spec.m:010:   `type_spec.type_spec1/1':
+type_spec.m:010:   error: variable `U' does not occur in the `:- pred'
+type_spec.m:010:   declaration.
 type_spec.m:011: Error: `:- pragma type_spec' declaration for
 type_spec.m:011:   `type_spec.type_spec1'/1 specifies non-existent mode.
 type_spec.m:013: Error: `:- pragma type_spec' declaration for
 type_spec.m:013:   `type_spec.type_spec1'/2 without corresponding `pred' or
 type_spec.m:013:   `func' declaration.
-type_spec.m:024: In `:- pragma type_spec' declaration for predicate `type_spec.type_spec2/1':
+type_spec.m:024: In `:- pragma type_spec' declaration for predicate
+type_spec.m:024:   `type_spec.type_spec2/1':
 type_spec.m:024:   error: the substitution includes the existentially
 type_spec.m:024:   quantified type variable `U'.
-type_spec.m:026: In `:- pragma type_spec' declaration for predicate `type_spec.type_spec2/1':
-type_spec.m:026:   error: variable `U' occurs
-type_spec.m:026:   on both sides of the substitution.
-type_spec.m:028: In `:- pragma type_spec' declaration for predicate `type_spec.type_spec2/1':
+type_spec.m:026: In `:- pragma type_spec' declaration for predicate
+type_spec.m:026:   `type_spec.type_spec2/1':
+type_spec.m:026:   error: variable `U' occurs on both sides of the
+type_spec.m:026:   substitution.
+type_spec.m:028: In `:- pragma type_spec' declaration for predicate
+type_spec.m:028:   `type_spec.type_spec2/1':
 type_spec.m:028:   error: variable `U' has multiple replacement types.
 For more information, try recompiling with `-E'.
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
Index: tests/warnings/double_underscore.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/double_underscore.exp,v
retrieving revision 1.3
diff -u -b -r1.3 double_underscore.exp
--- tests/warnings/double_underscore.exp	17 Jan 2003 05:57:19 -0000	1.3
+++ tests/warnings/double_underscore.exp	6 Aug 2005 10:45:33 -0000
@@ -1,4 +1,6 @@
 double_underscore.m:011: In clause for predicate `double_underscore.p/2':
-double_underscore.m:011:   warning: variable `_X' occurs more than once in this scope.
+double_underscore.m:011:   warning: variable `_X' occurs more than once in this
+double_underscore.m:011:   scope.
 double_underscore.m:011: In clause for predicate `double_underscore.p/2':
-double_underscore.m:011:   warning: variable `_X' occurs more than once in this scope.
+double_underscore.m:011:   warning: variable `_X' occurs more than once in this
+double_underscore.m:011:   scope.
Index: tests/warnings/singleton_test.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/singleton_test.exp,v
retrieving revision 1.10
diff -u -b -r1.10 singleton_test.exp
--- tests/warnings/singleton_test.exp	20 Feb 2004 04:18:16 -0000	1.10
+++ tests/warnings/singleton_test.exp	6 Aug 2005 14:04:48 -0000
@@ -1,14 +1,16 @@
 singleton_test.m:022: In clause for predicate `singleton_test.my_append/3':
 singleton_test.m:022:   warning: variable `L2' occurs only once in this scope.
 singleton_test.m:026: In clause for function `singleton_test.my_append_func/2':
-singleton_test.m:026:   warning: variables `L1, L2' occur only once in this scope.
+singleton_test.m:026:   warning: variables `L1, L2' occur only once in this
+singleton_test.m:026:   scope.
 singleton_test.m:027: In clause for function `singleton_test.my_append_func/2':
 singleton_test.m:027:   warning: variable `T' occurs only once in this scope.
 singleton_test.m:029: In the C code for predicate `singleton_test.my_c_pred/3':
 singleton_test.m:029:   warning: variable `Y' does not occur in the C code.
 singleton_test.m:041: In the C code for function `singleton_test.my_c_func/2':
 singleton_test.m:041:   warning: variable `X' does not occur in the C code.
-singleton_test.m:055: In the C code for predicate `singleton_test.c_hello_world/3':
+singleton_test.m:055: In the C code for predicate
+singleton_test.m:055:   `singleton_test.c_hello_world/3':
 singleton_test.m:055:   warning: variable `Msg' does not occur in the C code.
 singleton_test.m:008: In function `singleton_test.my_append_func/2':
 singleton_test.m:008:   warning: unresolved polymorphism.
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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