[m-rev.] diff: more modules for 4-space indentation
Zoltan Somogyi
zs at cs.mu.OZ.AU
Sun Aug 14 15:45:35 AEST 2005
compiler/det_report.m:
compiler/hlds_out.m:
Convert these modules to four-space indentation to reduce the number
of bad line breaks. Fix some departures from our coding standards.
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/det_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.101
diff -u -b -r1.101 det_report.m
--- compiler/det_report.m 14 Aug 2005 03:20:38 -0000 1.101
+++ compiler/det_report.m 14 Aug 2005 03:23:19 -0000
@@ -1,4 +1,6 @@
%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
% Copyright (C) 1995-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.
@@ -24,9 +26,10 @@
:- import_module list.
:- import_module set.
-:- type det_msg --->
- % warnings
- multidet_disj(prog_context, list(prog_context))
+:- type det_msg
+ % The followintg are warnings.
+
+ ---> multidet_disj(prog_context, list(prog_context))
; det_disj(prog_context, list(prog_context))
; semidet_disj(prog_context, list(prog_context))
; zero_soln_disj(prog_context, list(prog_context))
@@ -38,26 +41,23 @@
; goal_cannot_succeed(prog_context)
; det_goal_has_no_outputs(prog_context)
; warn_obsolete(pred_id, prog_context)
- % warning about calls to predicates
- % for which there is a `:- pragma obsolete'
- % declaration.
+ % Warning about calls to predicates for which there is
+ % a `:- pragma obsolete' declaration.
; warn_infinite_recursion(prog_context)
- % warning about recursive calls
- % which would cause infinite loops.
- ; duplicate_call(seen_call_id, prog_context,
- prog_context)
- % multiple calls with the same input args.
- % errors
+ % Warning about recursive calls which would cause infinite loops.
+ ; duplicate_call(seen_call_id, prog_context, prog_context)
+ % Multiple calls with the same input args.
+
+ % The following are errors.
+
; cc_unify_can_fail(hlds_goal_info, prog_var, type,
prog_varset, cc_unify_context)
; cc_unify_in_wrong_context(hlds_goal_info, prog_var,
type, prog_varset, cc_unify_context)
; cc_pred_in_wrong_context(hlds_goal_info, determinism,
pred_id, proc_id)
- ; higher_order_cc_pred_in_wrong_context(hlds_goal_info,
- determinism)
- ; error_in_lambda(
- determinism, determinism, % declared, inferred
+ ; higher_order_cc_pred_in_wrong_context(hlds_goal_info, determinism)
+ ; error_in_lambda(determinism, determinism, % declared, inferred
hlds_goal, hlds_goal_info, pred_id, proc_id)
; par_conj_not_det(determinism, pred_id, proc_id,
hlds_goal_info, list(hlds_goal))
@@ -65,12 +65,12 @@
; has_io_state_but_not_det(pred_id, proc_id)
; will_not_throw_with_erroneous(pred_id, proc_id)
; export_model_non_proc(pred_id, proc_id, determinism)
- % Procedure with multi or nondet detism
- % exported via :- pragma export ...
+ % Procedure with multi or nondet detism exported
+ % via :- pragma export ...
; promise_equivalent_solutions_missing_vars(prog_context,
prog_varset, set(prog_var))
- ; promise_equivalent_solutions_extra_vars(prog_context,
- prog_varset, set(prog_var)).
+ ; promise_equivalent_solutions_extra_vars(prog_context, prog_varset,
+ set(prog_var)).
:- type seen_call_id
---> seen_call(pred_id, proc_id)
@@ -84,47 +84,48 @@
% Check all the determinism declarations in this module.
% This is the main predicate exported by this module.
-
+ %
:- pred global_checking_pass(pred_proc_list::in,
module_info::in, module_info::out, io::di, io::uo) is det.
% Check a lambda goal with the specified declared and inferred
% determinisms.
-
+ %
:- pred det_check_lambda(determinism::in, determinism::in, hlds_goal::in,
hlds_goal_info::in, det_info::in, list(det_msg)::out) is det.
% Print some determinism warning and/or error messages,
% and update the module info accordingly.
-
+ %
:- pred det_report_and_handle_msgs(list(det_msg)::in,
module_info::in, module_info::out, io::di, io::uo) is det.
% Print some determinism warning and/or error messages,
% and return the number of warnings and errors, so that code
% somewhere elsewhere can update the module info.
-
+ %
:- pred det_report_msgs(list(det_msg)::in, module_info::in, int::out, int::out,
io::di, io::uo) is det.
-
:- type msg_modes
- ---> all_modes % the warning should be reported only
- % if it occurs in all modes of the predicate
- ; any_mode. % the warning should be reported
+ ---> all_modes % The warning should be reported only
+ % if it occurs in all modes of the predicate.
+
+ ; any_mode. % The warning should be reported
% if it occurs in any mode of the predicate
% Decide if the warning should be reported if it occurs in
% any mode of the predicate, not only if it occurs in all modes.
+ %
:- pred det_msg_is_any_mode_msg(det_msg::in, msg_modes::out) is det.
%-----------------------------------------------------------------------------%
:- type options_to_restore.
- % Call this predicate before rerunning determinism analysis
- % after an optimization pass to disable all warnings. Errors will
- % still be reported.
+ % Call this predicate before rerunning determinism analysis after an
+ % optimization pass to disable all warnings. Errors will still be reported.
+ %
:- pred disable_det_warnings(options_to_restore::out, io::di, io::uo) is det.
:- pred restore_det_warnings(options_to_restore::in, io::di, io::uo) is det.
@@ -175,17 +176,15 @@
global_checking_pass([proc(PredId, ProcId) | Rest], !ModuleInfo, !IO) :-
module_info_pred_proc_info(!.ModuleInfo, PredId, ProcId,
PredInfo, ProcInfo),
- check_determinism(PredId, ProcId, PredInfo, ProcInfo,
- !ModuleInfo, !IO),
- check_determinism_of_main(PredId, ProcId, PredInfo, ProcInfo,
- !ModuleInfo, !IO),
- check_for_multisoln_func(PredId, ProcId, PredInfo, ProcInfo,
- !ModuleInfo, !IO),
+ check_determinism(PredId, ProcId, PredInfo, ProcInfo, !ModuleInfo, !IO),
+ check_determinism_of_main(PredId, ProcId, PredInfo, ProcInfo, !ModuleInfo,
+ !IO),
+ check_for_multisoln_func(PredId, ProcId, PredInfo, ProcInfo, !ModuleInfo,
+ !IO),
global_checking_pass(Rest, !ModuleInfo, !IO).
:- pred check_determinism(pred_id::in, proc_id::in, pred_info::in,
- proc_info::in, module_info::in, module_info::out,
- io::di, io::uo) is det.
+ proc_info::in, module_info::in, module_info::out, io::di, io::uo) is det.
check_determinism(PredId, ProcId, PredInfo0, ProcInfo0, !ModuleInfo, !IO) :-
proc_info_declared_determinism(ProcInfo0, MaybeDetism),
@@ -207,32 +206,25 @@
(
ShouldIssueWarning = yes,
- % Don't report warnings for class method
- % implementations -- the determinism in the
- % `:- typeclass' declaration will be
- % the loosest of all possible instances.
- % This is similar to the reason we don't
- % report warnings for lambda expressions.
- \+ check_marker(Markers,
- class_instance_method),
+ % Don't report warnings for class method implementations --
+ % the determinism in the `:- typeclass' declaration will be
+ % the loosest of all possible instances. This is similar to
+ % the reason we don't report warnings for lambda expressions.
+ \+ check_marker(Markers, class_instance_method),
- % Don't report warnings for procedures with
- % no clauses.
+ % Don't report warnings for procedures with no clauses.
\+ check_marker(Markers, stub),
- % Don't report warnings for compiler-generated
- % Unify, Compare or Index procedures, since the
- % user has no way to shut these up. These can
- % happen for the Unify pred for the unit type,
- % if such types are not boxed (as they are not
+ % Don't report warnings for compiler-generated Unify, Compare
+ % or Index procedures, since the user has no way to shut
+ % these up. These can happen for the Unify pred for the unit
+ % type, if such types are not boxed (as they are not
% boxed for the IL backend).
\+ is_unify_or_compare_pred(PredInfo0),
- % Don't warn about predicates which are
- % inferred erroneous when the appropiate
- % option is set. This is to avoid
- % warnings about unimplemented
- % predicates.
+ % Don't warn about predicates which are inferred erroneous
+ % when the appropiate option is set. This is to avoid warnings
+ % about unimplemented predicates.
(
WarnAboutInferredErroneous = yes
;
@@ -240,41 +232,34 @@
InferredDetism \= erroneous
)
->
- Message = " warning: determinism " ++
- "declaration could be tighter.\n",
- report_determinism_problem(PredId, ProcId,
- !.ModuleInfo, Message, DeclaredDetism,
- InferredDetism, !IO)
+ Message = "warning: determinism declaration " ++
+ "could be tighter.\n",
+ report_determinism_problem(PredId, ProcId, !.ModuleInfo,
+ Message, DeclaredDetism, InferredDetism, !IO)
;
true
)
;
Cmp = tighter,
module_info_incr_errors(!ModuleInfo),
- Message = " error: determinism declaration " ++
- "not satisfied.\n",
- report_determinism_problem(PredId, ProcId,
- !.ModuleInfo, Message, DeclaredDetism,
- InferredDetism, !IO),
+ Message = " error: determinism declaration not satisfied.\n",
+ report_determinism_problem(PredId, ProcId, !.ModuleInfo, Message,
+ DeclaredDetism, InferredDetism, !IO),
proc_info_goal(ProcInfo0, Goal),
proc_info_vartypes(ProcInfo0, VarTypes),
globals__io_get_globals(Globals, !IO),
- det_info_init(!.ModuleInfo, VarTypes, PredId, ProcId,
- Globals, DetInfo),
- det_diagnose_goal(Goal, DeclaredDetism, [], DetInfo,
- _, !IO)
- % XXX with the right verbosity options, we want to
- % call report_determinism_problem only if diagnose
- % returns false, i.e. it didn't print a message.
+ det_info_init(!.ModuleInfo, VarTypes, PredId, ProcId, Globals,
+ DetInfo),
+ det_diagnose_goal(Goal, DeclaredDetism, [], DetInfo, _, !IO)
+ % XXX With the right verbosity options, we want to call
+ % report_determinism_problem only if diagnose returns false,
+ % i.e. it didn't print a message.
)
),
- % make sure the code model is valid given the eval method
+ % Make sure the code model is valid given the eval method.
proc_info_eval_method(ProcInfo0, EvalMethod),
- (
- valid_determinism_for_eval_method(EvalMethod,
- InferredDetism) = yes
- ->
+ ( valid_determinism_for_eval_method(EvalMethod, InferredDetism) = yes ->
proc_info_set_eval_method(EvalMethod, ProcInfo0, ProcInfo),
pred_info_procedures(PredInfo0, ProcTable0),
map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable),
@@ -284,14 +269,11 @@
proc_info_context(ProcInfo0, Context),
write_error_pieces(Context, 0,
[words("Error: `pragma "
- ++ eval_method_to_one_string(EvalMethod)
- ++ "'"),
+ ++ eval_method_to_one_string(EvalMethod) ++ "'"),
words("declaration not allowed for procedure"),
words("with determinism `"
- ++ determinism_to_string(InferredDetism)
- ++ "'.")], !IO),
- globals__io_lookup_bool_option(verbose_errors, VerboseErrors,
- !IO),
+ ++ determinism_to_string(InferredDetism) ++ "'.")], !IO),
+ globals__io_lookup_bool_option(verbose_errors, VerboseErrors, !IO),
(
VerboseErrors = yes,
solutions(get_valid_dets(EvalMethod), Detisms),
@@ -313,10 +295,11 @@
determinism(Detism),
valid_determinism_for_eval_method(EvalMethod, Detism) = yes.
- % generate all the possible determinisms
+ % Generate all the possible determinisms.
+ %
:- pred determinism(determinism).
:- mode determinism(out) is multi.
-:- mode determinism(in) is det. % to ensure we don't forget any
+:- mode determinism(in) is det. % To ensure we don't forget any.
determinism(det).
determinism(semidet).
@@ -333,10 +316,8 @@
check_determinism_of_main(_PredId, _ProcId, PredInfo, ProcInfo,
!ModuleInfo, !IO) :-
- %
- % check that `main/2' has determinism `det' or `cc_multi',
- % as required by the language reference manual
- %
+ % Check that `main/2' has determinism `det' or `cc_multi',
+ % as required by the language reference manual.
proc_info_declared_determinism(ProcInfo, MaybeDetism),
(
pred_info_name(PredInfo) = "main",
@@ -348,16 +329,14 @@
->
proc_info_context(ProcInfo, Context1),
write_error_pieces(Context1, 0,
- [words("Error: main/2 must be " ++
- "`det' or `cc_multi'.")], !IO),
+ [words("Error: main/2 must be `det' or `cc_multi'.")], !IO),
module_info_incr_errors(!ModuleInfo)
;
true
).
:- pred check_for_multisoln_func(pred_id::in, proc_id::in, pred_info::in,
- proc_info::in, module_info::in, module_info::out,
- io::di, io::uo) is det.
+ proc_info::in, module_info::in, module_info::out, io::di, io::uo) is det.
check_for_multisoln_func(PredId, _ProcId, PredInfo, ProcInfo,
!ModuleInfo, !IO) :-
@@ -376,8 +355,7 @@
NumSolns \= at_most_one,
% ... but for which all the arguments are input ...
proc_info_argmodes(ProcInfo, PredArgModes),
- pred_args_to_func_args(PredArgModes,
- FuncArgModes, _FuncResultMode),
+ pred_args_to_func_args(PredArgModes, FuncArgModes, _FuncResultMode),
\+ (
list__member(FuncArgMode, FuncArgModes),
\+ mode_is_fully_input(!.ModuleInfo, FuncArgMode)
@@ -387,16 +365,13 @@
proc_info_context(ProcInfo, FuncContext),
proc_info_inst_varset(ProcInfo, InstVarSet),
PredModePieces = describe_one_pred_name_mode(!.ModuleInfo,
- should_not_module_qualify, PredId, InstVarSet,
- PredArgModes),
+ should_not_module_qualify, PredId, InstVarSet, PredArgModes),
Pieces = [words("Error: invalid determinism for")]
++ PredModePieces ++ [suffix(":"), nl,
words("the primary mode of a function cannot be"),
- words("`" ++ mercury_det_to_string(InferredDetism) ++
- "'.")],
+ words("`" ++ mercury_det_to_string(InferredDetism) ++ "'.")],
write_error_pieces(FuncContext, 0, Pieces, !IO),
- globals__io_lookup_bool_option(verbose_errors, VerboseErrors,
- !IO),
+ globals__io_lookup_bool_option(verbose_errors, VerboseErrors, !IO),
(
VerboseErrors = yes,
ExtMsg = func_primary_mode_det_msg,
@@ -426,12 +401,11 @@
( Cmp = tighter ->
det_info_get_pred_id(DetInfo, PredId),
det_info_get_proc_id(DetInfo, ProcId),
- Msgs = [error_in_lambda(DeclaredDetism, InferredDetism,
- Goal, GoalInfo, PredId, ProcId)]
+ Msgs = [error_in_lambda(DeclaredDetism, InferredDetism, Goal, GoalInfo,
+ PredId, ProcId)]
;
- % we don't bother issuing warnings if
- % the determinism was too loose; that will often
- % be the case, and should not be warned about.
+ % We don't bother issuing warnings if the determinism was too loose;
+ % that will often be the case, and should not be warned about.
Msgs = []
).
@@ -447,10 +421,8 @@
should_not_module_qualify, proc(PredId, ProcId)),
Pieces = [words("In")] ++ ProcPieces ++ [suffix(":"), nl,
words(Message), nl,
- words("Declared `"
- ++ determinism_to_string(DeclaredDetism)
- ++ "', inferred `"
- ++ determinism_to_string(InferredDetism)
+ words("Declared `" ++ determinism_to_string(DeclaredDetism)
+ ++ "', inferred `" ++ determinism_to_string(InferredDetism)
++ "'.")],
write_error_pieces(Context, 0, Pieces, !IO).
@@ -510,17 +482,16 @@
% The given goal should have determinism Desired, but doesn't.
% Find out what is wrong and print a report of the cause.
-
+ %
:- pred det_diagnose_goal(hlds_goal::in, determinism::in,
- list(switch_context)::in, det_info::in, bool::out, io::di, io::uo)
- is det.
+ list(switch_context)::in, det_info::in, bool::out, io::di, io::uo) is det.
-det_diagnose_goal(Goal - GoalInfo, Desired, SwitchContext, DetInfo,
- Diagnosed, !IO) :-
+det_diagnose_goal(Goal - GoalInfo, Desired, SwitchContext, DetInfo, Diagnosed,
+ !IO) :-
goal_info_get_determinism(GoalInfo, Actual),
( compare_determinisms(Desired, Actual, tighter) ->
- det_diagnose_goal_2(Goal, GoalInfo, Desired, Actual,
- SwitchContext, DetInfo, Diagnosed, !IO)
+ det_diagnose_goal_2(Goal, GoalInfo, Desired, Actual, SwitchContext,
+ DetInfo, Diagnosed, !IO)
;
Diagnosed = no
).
@@ -561,7 +532,7 @@
% the cases. Also, if only a subset of the constructors are handled,
% then it is semideterministic or worse - this is determined
% in switch_detection.m and handled via the CanFail field.
-
+ %
det_diagnose_goal_2(switch(Var, SwitchCanFail, Cases), GoalInfo,
Desired, _Actual, SwitchContext, DetInfo, Diagnosed, !IO) :-
(
@@ -569,15 +540,14 @@
determinism_components(Desired, cannot_fail, _)
->
goal_info_get_context(GoalInfo, Context),
- det_diagnose_write_switch_context(Context, SwitchContext,
- DetInfo, yes, IsFirst, !IO),
+ det_diagnose_write_switch_context(Context, SwitchContext, DetInfo,
+ yes, IsFirst, !IO),
det_get_proc_info(DetInfo, ProcInfo),
proc_info_varset(ProcInfo, VarSet),
det_info_get_module_info(DetInfo, ModuleInfo),
VarStr = mercury_var_to_string(Var, VarSet, no),
(
- det_lookup_var_type(ModuleInfo, ProcInfo, Var,
- TypeDefn),
+ det_lookup_var_type(ModuleInfo, ProcInfo, Var, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
ConsTable = TypeBody ^ du_type_cons_tag_values
->
@@ -590,8 +560,7 @@
Pieces = [words("The switch on "), fixed(VarStr),
words("can fail.")]
),
- write_error_pieces_maybe_first_line(IsFirst, Context, 0,
- Pieces, !IO),
+ write_error_pieces_maybe_first_line(IsFirst, Context, 0, Pieces, !IO),
Diagnosed1 = yes
;
Diagnosed1 = no
@@ -604,8 +573,7 @@
Desired, Actual, _, DetInfo, yes, !IO) :-
goal_info_get_context(GoalInfo, Context),
det_diagnose_atomic_goal(Desired, Actual,
- det_report_call_context(Context, CallContext, DetInfo,
- PredId, ModeId),
+ det_report_call_context(Context, CallContext, DetInfo, PredId, ModeId),
Context, !IO).
det_diagnose_goal_2(generic_call(GenericCall, _, _, _), GoalInfo,
@@ -621,7 +589,8 @@
( First = yes, Last = yes ),
det_diagnose_atomic_goal(Desired, Actual,
det_report_unify_context(First, Last, Context, UnifyContext,
- DetInfo, LHS, RHS), Context, !IO).
+ DetInfo, LHS, RHS),
+ Context, !IO).
det_diagnose_goal_2(if_then_else(_Vars, Cond, Then, Else), _GoalInfo,
Desired, _Actual, SwitchContext, DetInfo, Diagnosed, !IO) :-
@@ -639,10 +608,8 @@
;
Diagnosed1 = no
),
- det_diagnose_goal(Then, Desired, SwitchContext, DetInfo, Diagnosed2,
- !IO),
- det_diagnose_goal(Else, Desired, SwitchContext, DetInfo, Diagnosed3,
- !IO),
+ det_diagnose_goal(Then, Desired, SwitchContext, DetInfo, Diagnosed2, !IO),
+ det_diagnose_goal(Else, Desired, SwitchContext, DetInfo, Diagnosed3, !IO),
bool__or(Diagnosed2, Diagnosed3, Diagnosed23),
bool__or(Diagnosed1, Diagnosed23, Diagnosed).
@@ -654,16 +621,15 @@
ActualCanFail = can_fail
->
goal_info_get_context(GoalInfo, Context),
- write_error_pieces(Context, 0,
- [words("Negated goal can succeed.")], !IO),
+ write_error_pieces(Context, 0, [words("Negated goal can succeed.")],
+ !IO),
Diagnosed = yes
;
DesiredSolns = at_most_zero,
ActualSolns \= at_most_zero
->
goal_info_get_context(GoalInfo, Context),
- write_error_pieces(Context, 0,
- [words("Negated goal can fail.")], !IO),
+ write_error_pieces(Context, 0, [words("Negated goal can fail.")], !IO),
Diagnosed = yes
;
Diagnosed = no
@@ -679,8 +645,8 @@
determinism_components(Desired, CanFail, _),
determinism_components(InternalDesired, CanFail, at_most_many)
),
- det_diagnose_goal(Goal, InternalDesired, SwitchContext, DetInfo,
- Diagnosed, !IO).
+ det_diagnose_goal(Goal, InternalDesired, SwitchContext, DetInfo, Diagnosed,
+ !IO).
det_diagnose_goal_2(foreign_proc(_, _, _, _, _, _), GoalInfo, Desired,
_, _, _, yes, !IO) :-
@@ -691,7 +657,7 @@
write_error_pieces(Context, 0, Pieces, !IO).
det_diagnose_goal_2(shorthand(_), _, _, _, _, _, _, !IO) :-
- % these should have been expanded out by now
+ % These should have been expanded out by now.
error("det_diagnose_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
@@ -701,14 +667,13 @@
report_generic_call_context(Context, CallType, !IO) :-
hlds_goal__generic_call_id(CallType, CallId),
- write_error_pieces(Context, 0, [words(call_id_to_string(CallId))],
- !IO).
+ write_error_pieces(Context, 0, [words(call_id_to_string(CallId))], !IO).
%-----------------------------------------------------------------------------%
:- pred det_diagnose_atomic_goal(determinism::in, determinism::in,
- pred(io, io)::in(pred(di, uo) is det), prog_context::in,
- io::di, io::uo) is det.
+ pred(io, io)::in(pred(di, uo) is det), prog_context::in, io::di, io::uo)
+ is det.
det_diagnose_atomic_goal(Desired, Actual, WriteContext, Context) -->
{ determinism_components(Desired, DesiredCanFail, DesiredSolns) },
@@ -756,12 +721,12 @@
list(switch_context)::in, det_info::in, bool::out, io::di, io::uo)
is det.
-det_diagnose_conj([], _Desired, _SwitchContext, _DetInfo, no) --> [].
+det_diagnose_conj([], _Desired, _SwitchContext, _DetInfo, no, !IO).
det_diagnose_conj([Goal | Goals], Desired, SwitchContext, DetInfo,
- Diagnosed) -->
- det_diagnose_goal(Goal, Desired, SwitchContext, DetInfo, Diagnosed1),
- det_diagnose_conj(Goals, Desired, SwitchContext, DetInfo, Diagnosed2),
- { bool__or(Diagnosed1, Diagnosed2, Diagnosed) }.
+ Diagnosed, !IO) :-
+ det_diagnose_goal(Goal, Desired, SwitchContext, DetInfo, Diagnosed1, !IO),
+ det_diagnose_conj(Goals, Desired, SwitchContext, DetInfo, Diagnosed2, !IO),
+ bool__or(Diagnosed1, Diagnosed2, Diagnosed).
:- pred det_diagnose_disj(list(hlds_goal)::in, determinism::in, determinism::in,
list(switch_context)::in, det_info::in, int::in, int::out, bool::out,
@@ -810,8 +775,7 @@
det_diagnose_switch(Var, [case(ConsId, Goal) | Cases], Desired,
SwitchContext0, DetInfo, Diagnosed, !IO) :-
SwitchContext1 = [switch_context(Var, ConsId) | SwitchContext0],
- det_diagnose_goal(Goal, Desired, SwitchContext1, DetInfo, Diagnosed1,
- !IO),
+ det_diagnose_goal(Goal, Desired, SwitchContext1, DetInfo, Diagnosed1, !IO),
det_diagnose_switch(Var, Cases, Desired, SwitchContext0, DetInfo,
Diagnosed2, !IO),
bool__or(Diagnosed1, Diagnosed2, Diagnosed).
@@ -839,11 +803,14 @@
cons_id_list_to_pieces([], []).
cons_id_list_to_pieces([ConsId | ConsIds], Pieces) :-
ConsIdStr = cons_id_to_string(ConsId),
- ( ConsIds = [] ->
+ (
+ ConsIds = [],
PiecesHead = [fixed(ConsIdStr ++ ".")]
- ; ConsIds = [_] ->
+ ;
+ ConsIds = [_],
PiecesHead = [fixed(ConsIdStr), fixed("or")]
;
+ ConsIds = [_, _ | _],
PiecesHead = [fixed(ConsIdStr ++ ",")]
),
cons_id_list_to_pieces(ConsIds, PiecesTail),
@@ -867,8 +834,7 @@
VarStr = mercury_var_to_string(Var, VarSet, no),
Pieces = [words("Inside the case"), fixed(ConsIdStr),
words("of the switch on"), fixed(VarStr), words(":")],
- write_error_pieces_maybe_first_line(!.IsFirst, Context, 0, Pieces,
- !IO),
+ write_error_pieces_maybe_first_line(!.IsFirst, Context, 0, Pieces, !IO),
!:IsFirst = no,
det_diagnose_write_switch_context(Context, SwitchContexts, DetInfo,
!IsFirst, !IO).
@@ -895,11 +861,10 @@
%
( Origin = special_pred(unify - _) ->
(
- CallUnifyContext = yes(
- call_unify_context(LHS, RHS, UC)),
+ CallUnifyContext = yes(call_unify_context(LHS, RHS, UC)),
First = yes, Last = yes,
- det_report_unify_context(First, Last, Context, UC,
- DetInfo, LHS, RHS, !IO)
+ det_report_unify_context(First, Last, Context, UC, DetInfo,
+ LHS, RHS, !IO)
;
% this shouldn't happen; every call to a compiler
% generated type-specific unification predicate
@@ -913,12 +878,11 @@
)
;
(
- CallUnifyContext = yes(
- call_unify_context(LHS, RHS, UC)),
+ CallUnifyContext = yes(call_unify_context(LHS, RHS, UC)),
First = yes,
Last = no,
- det_report_unify_context(First, Last, Context, UC,
- DetInfo, LHS, RHS, !IO),
+ det_report_unify_context(First, Last, Context, UC, DetInfo,
+ LHS, RHS, !IO),
io__write_string(":\n", !IO)
;
CallUnifyContext = no
@@ -934,21 +898,21 @@
%-----------------------------------------------------------------------------%
-% det_report_unify_context prints out information about the context of an
-% error, i.e. where the error occurred.
-% The first two arguments are boolean flags that specify whether this is
-% the first part of a sentence (in which case we start the error message
-% with a capital letter) and whether it is the last part (in which case we
-% omit the word "in" on the final "... in unification ...").
-
+ % det_report_unify_context prints out information about the context of an
+ % error, i.e. where the error occurred.
+ %
+ % The first two arguments are boolean flags that specify whether this is
+ % the first part of a sentence (in which case we start the error message
+ % with a capital letter) and whether it is the last part (in which case we
+ % omit the word "in" on the final "... in unification ...").
+ %
:- pred det_report_unify_context(bool::in, bool::in, prog_context::in,
unify_context::in, det_info::in, prog_var::in, unify_rhs::in,
io::di, io::uo) is det.
det_report_unify_context(First0, Last, Context, UnifyContext, DetInfo,
LHS, RHS, !IO) :-
- hlds_out__write_unify_context(First0, UnifyContext, Context, First,
- !IO),
+ hlds_out__write_unify_context(First0, UnifyContext, Context, First, !IO),
prog_out__write_context(Context, !IO),
det_get_proc_info(DetInfo, ProcInfo),
proc_info_varset(ProcInfo, VarSet),
@@ -956,16 +920,22 @@
% We don't have the inst varset - it's not in the
% proc_info, so we'll just make one up....
varset__init(InstVarSet),
- ( First = yes ->
- ( Last = yes ->
+ (
+ First = yes,
+ (
+ Last = yes,
io__write_string(" Unification ", !IO)
;
+ Last = no,
io__write_string(" In unification ", !IO)
)
;
- ( Last = yes ->
+ First = no,
+ (
+ Last = yes,
io__write_string(" unification ", !IO)
;
+ Last = no,
io__write_string(" in unification ", !IO)
)
),
@@ -997,10 +967,11 @@
:- type det_msg_type ---> simple_code_warning ; call_warning ; error.
det_report_and_handle_msgs(Msgs, !ModuleInfo, !IO) :-
- ( Msgs = [] ->
+ (
+ Msgs = []
% fast path for the usual case
- true
;
+ Msgs = [_ | _],
det_report_msgs(Msgs, !.ModuleInfo, WarnCnt, ErrCnt, !IO),
globals__io_lookup_bool_option(halt_at_warn, HaltAtWarn, !IO),
(
@@ -1025,16 +996,22 @@
0, WarnCnt, 0, ErrCnt, !IO).
:- pred det_report_msgs_2(list(det_msg)::in, bool::in, bool::in,
- module_info::in, int::in, int::out, int::in, int::out,
- io::di, io::uo) is det.
+ module_info::in, int::in, int::out, int::in, int::out, io::di, io::uo)
+ is det.
det_report_msgs_2([], _, _, _ModuleInfo, !WarnCnt, !ErrCnt, !IO).
det_report_msgs_2([Msg | Msgs], WarnSimple, WarnCalls, ModuleInfo,
!WarnCnt, !ErrCnt, !IO) :-
det_msg_get_type(Msg, MsgType),
- ( WarnSimple = no, MsgType = simple_code_warning ->
+ (
+ WarnSimple = no,
+ MsgType = simple_code_warning
+ ->
true
- ; WarnCalls = no, MsgType = call_warning ->
+ ;
+ WarnCalls = no,
+ MsgType = call_warning
+ ->
true
;
det_report_msg(Msg, ModuleInfo, !IO),
@@ -1261,8 +1238,7 @@
words("representations, but I'm not going to do that"),
words("implicitly. (If that's really what you want,"),
words("you must do it explicitly.)")],
- write_error_pieces_not_first_line(Context, 0, VerbosePieces,
- !IO)
+ write_error_pieces_not_first_line(Context, 0, VerbosePieces, !IO)
;
VerboseErrors = no
).
@@ -1272,8 +1248,7 @@
(
GoalContext = switch,
VarStr = mercury_var_to_string(Var, VarSet, no),
- Pieces0 = [words("In switch on variable `" ++ VarStr ++ "':"),
- nl]
+ Pieces0 = [words("In switch on variable `" ++ VarStr ++ "':"), nl]
;
GoalContext = unify(UnifyContext),
hlds_out__unify_context_to_pieces(UnifyContext, [], Pieces0)
@@ -1311,8 +1286,7 @@
words("representations, but I'm not going to do that"),
words("implicitly. (If that's really what you want,"),
words("you must do it explicitly.)")],
- write_error_pieces_not_first_line(Context, 0, VerbosePieces,
- !IO)
+ write_error_pieces_not_first_line(Context, 0, VerbosePieces, !IO)
;
VerboseErrors = no
).
@@ -1342,28 +1316,21 @@
write_error_pieces(Context, 0,
[words("In")] ++ PredPieces ++ [suffix(":"), nl,
words("Determinism error in lambda expression."), nl,
- words("Declared `"
- ++ determinism_to_string(DeclaredDetism)
- ++ "', inferred `"
- ++ determinism_to_string(InferredDetism)
+ words("Declared `" ++ determinism_to_string(DeclaredDetism)
+ ++ "', inferred `" ++ determinism_to_string(InferredDetism)
++ "'.")], !IO),
globals__io_get_globals(Globals, !IO),
module_info_pred_proc_info(ModuleInfo, PredId, ProcId, _, ProcInfo),
proc_info_vartypes(ProcInfo, VarTypes),
- det_info_init(ModuleInfo, VarTypes, PredId, ProcId, Globals,
- DetInfo),
+ det_info_init(ModuleInfo, VarTypes, PredId, ProcId, Globals, DetInfo),
det_diagnose_goal(Goal, DeclaredDetism, [], DetInfo, _, !IO).
det_report_msg(par_conj_not_det(InferredDetism, PredId,
ProcId, GoalInfo, Goals), ModuleInfo, !IO) :-
goal_info_get_context(GoalInfo, Context),
determinism_components(InferredDetism, CanFail, MaxSoln),
- (
- CanFail \= cannot_fail
- ->
+ ( CanFail \= cannot_fail ->
First = "Error: parallel conjunct may fail."
- ;
- MaxSoln = at_most_many
- ->
+ ; MaxSoln = at_most_many ->
First = "Error: parallel conjunct may have multiple solutions."
;
error("strange determinism error for parallel conjunction")
@@ -1374,8 +1341,7 @@
globals__io_get_globals(Globals, !IO),
module_info_pred_proc_info(ModuleInfo, PredId, ProcId, _, ProcInfo),
proc_info_vartypes(ProcInfo, VarTypes),
- det_info_init(ModuleInfo, VarTypes, PredId, ProcId, Globals,
- DetInfo),
+ det_info_init(ModuleInfo, VarTypes, PredId, ProcId, Globals, DetInfo),
det_diagnose_conj(Goals, det, [], DetInfo, _, !IO).
det_report_msg(pragma_c_code_without_det_decl(PredId, ProcId),
ModuleInfo, !IO) :-
@@ -1401,8 +1367,7 @@
VerboseErrors = yes,
VerbosePieces = [words("Valid determinisms are "),
words("det, cc_multi and erroneous.")],
- write_error_pieces_not_first_line(Context, 0, VerbosePieces,
- !IO)
+ write_error_pieces_not_first_line(Context, 0, VerbosePieces, !IO)
;
VerboseErrors = no
).
@@ -1423,20 +1388,17 @@
!IO) :-
module_info_get_pragma_exported_procs(ModuleInfo, ExportedProcs),
(
- get_exported_proc_context(ExportedProcs, PredId, ProcId,
- Context)
+ get_exported_proc_context(ExportedProcs, PredId, ProcId, Context)
->
Pieces = [words("Error: "),
fixed(":- pragma export' declaration"),
- words("for a procedure that has"),
- words("a determinism of"),
- fixed(hlds_out.determinism_to_string(Detism)
- ++ ",")
+ words("for a procedure that has a determinism of"),
+ fixed(hlds_out.determinism_to_string(Detism) ++ ",")
],
error_util.write_error_pieces(Context, 0, Pieces, !IO)
;
- unexpected(this_file, "Cannot find proc in table of "
- ++ "pragma exported procs")
+ unexpected(this_file,
+ "Cannot find proc in table of pragma exported procs")
).
det_report_msg(promise_equivalent_solutions_missing_vars(Context, VarSet, Vars),
_, !IO) :-
@@ -1489,6 +1451,7 @@
;
get_exported_proc_context(Procs, PredId, ProcId, Context)
).
+
%-----------------------------------------------------------------------------%
:- func det_report_seen_call_id(module_info, seen_call_id)
@@ -1497,8 +1460,8 @@
det_report_seen_call_id(ModuleInfo, SeenCall) = Pieces :-
(
SeenCall = seen_call(PredId, _),
- PredPieces = describe_one_pred_name(ModuleInfo,
- should_module_qualify, PredId),
+ PredPieces = describe_one_pred_name(ModuleInfo, should_module_qualify,
+ PredId),
Pieces = [words("call to") | PredPieces]
;
SeenCall = higher_order_call,
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.362
diff -u -b -r1.362 hlds_out.m
--- compiler/hlds_out.m 14 Aug 2005 03:20:38 -0000 1.362
+++ compiler/hlds_out.m 14 Aug 2005 03:22:25 -0000
@@ -1,4 +1,6 @@
%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
% Copyright (C) 1994-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,7 +70,7 @@
% except in some special cases where the predicate name is mangled
% and we can print a more meaningful identification of the predicate
% in question.
-
+ %
:- pred hlds_out__write_pred_id(module_info::in, pred_id::in, io::di, io::uo)
is det.
@@ -81,11 +83,11 @@
:- 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.
- % 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,
- % we omit the "call to" part, since the user didn't write
- % any explicit call.
+ % 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, we omit the "call to" part, since the user didn't
+ % write any explicit call.
+ %
:- pred hlds_out__write_call_arg_id(call_id::in, int::in, pred_markers::in,
io::di, io::uo) is det.
:- func hlds_out__call_arg_id_to_string(call_id, int, pred_markers) = string.
@@ -98,12 +100,11 @@
:- pred hlds_out__write_unify_context(unify_context::in, prog_context::in,
io::di, io::uo) is det.
- % hlds_out__write_unify_context_first/6 is the
- % same as above, except that it also takes and returns a bool
- % which specifies whether this is the start of a sentence.
- % If the first argument is `yes', then
- % it means this is the first line of an error message, so
- % the message starts with a capital letter, e.g.
+ % hlds_out__write_unify_context_first/6 is the same as above, except that
+ % it also takes and returns a bool which specifies whether this is the
+ % start of a sentence. If the first argument is `yes', then it means
+ % this is the first line of an error message, so the message starts with
+ % a capital letter, e.g.
% foo.m:123: In argument 3 of functor `foo/5':
% foo.m:123: in unification of `X' and `blah':
% The bool returned as the fourth argument will be `no' unless nothing
@@ -130,11 +131,12 @@
%-----------------------------------------------------------------------------%
% Print out an entire hlds structure.
-
+ %
:- pred hlds_out__write_hlds(int::in, module_info::in, io::di, io::uo) is det.
% hlds_out__write_clause(Indent, ModuleInfo, PredId, VarSet,
% AppendVarNums, HeadVars, PredOrFunc, Clauses, MaybeVarTypes).
+ %
:- pred hlds_out__write_clauses(int::in, module_info::in, pred_id::in,
prog_varset::in, bool::in, list(prog_var)::in, pred_or_func::in,
list(clause)::in, maybe_vartypes::in, io::di, io::uo) is det.
@@ -142,6 +144,7 @@
% hlds_out__write_clause(Indent, ModuleInfo, PredId, VarSet,
% AppendVarNums, HeadTerms, PredOrFunc, Clause,
% UseDeclaredModes, MaybeVarTypes).
+ %
:- pred hlds_out__write_clause(int::in, module_info::in, pred_id::in,
prog_varset::in, bool::in, list(prog_term)::in, pred_or_func::in,
clause::in, bool::in, maybe_vartypes::in, io::di, io::uo) is det.
@@ -157,7 +160,7 @@
% of indentation to be used within the goal. The string says what
% should end the line containing the goal; it should include a newline
% character, but may also contain other characters before that.
-
+ %
:- pred hlds_out__write_goal(hlds_goal::in, module_info::in, prog_varset::in,
bool::in, int::in, string::in, io::di, io::uo) is det.
@@ -169,7 +172,7 @@
% within the goal. The string says what should be on the line
% between each goal; it should include a newline character,
% but may also contain other characters before that.
-
+ %
:- pred hlds_out__write_goal_list(list(hlds_goal)::in, module_info::in,
prog_varset::in, bool::in, int::in, string::in, maybe_vartypes::in,
io::di, io::uo) is det.
@@ -177,14 +180,14 @@
% Print out a functor and its arguments. The prog_varset gives
% the context. The boolean says whether variables should have their
% numbers appended to them.
-
+ %
:- pred hlds_out__write_functor(const::in, list(prog_var)::in, prog_varset::in,
bool::in, io::di, io::uo) is det.
% Print out a cons_id and arguments. The module_info and prog_varset
% give the context. The boolean says whether variables should have
% their numbers appended to them.
-
+ %
:- pred hlds_out__write_functor_cons_id(cons_id::in, list(prog_var)::in,
prog_varset::in, module_info::in, bool::in, io::di, io::uo) is det.
@@ -192,7 +195,7 @@
% the varsets give the context of the rhs. The boolean says whether
% variables should have their numbers appended to them. The integer
% gives the level of indentation to be used within the rhs.
-
+ %
:- pred hlds_out__write_unify_rhs(unify_rhs::in, module_info::in,
prog_varset::in, inst_varset::in, bool::in, int::in, io::di, io::uo)
is det.
@@ -201,7 +204,7 @@
% (e.g. for a lambda expressions). The varsets gives the context.
% The boolean says whether variables should have their numbers
% appended to them.
-
+ %
:- pred hlds_out__write_var_modes(list(prog_var)::in, list(mode)::in,
prog_varset::in, inst_varset::in, bool::in, io::di, io::uo) is det.
@@ -209,11 +212,11 @@
int::in, io::di, io::uo) is det.
% Find the name of a marker.
-
+ %
:- pred hlds_out__marker_name(marker::in, string::out) is det.
% Print out the name of a marker.
-
+ %
:- pred hlds_out__write_marker(marker::in, io::di, io::uo) is det.
:- type maybe_vartypes
@@ -221,6 +224,7 @@
; no.
% Convert a mode or inst to a term representation.
+ %
:- func mode_to_term(mode) = prog_term.
:- func inst_to_term(inst) = prog_term.
@@ -240,7 +244,7 @@
% have been expanded out; recursive insts have their self-referential
% parts printed out as elipses ("...").
% (These routines are used for outputting insts in mode errors.)
-
+ %
:- pred mercury_output_expanded_inst((inst)::in, inst_varset::in,
module_info::in, io::di, io::uo) is det.
:- func mercury_expanded_inst_to_string(inst, inst_varset, module_info)
@@ -349,7 +353,6 @@
% The code of this predicate duplicates the functionality of
% hlds_error_util__describe_one_pred_name. Changes here should be made
% there as well.
-
hlds_out__write_pred_id(ModuleInfo, PredId, !IO) :-
module_info_preds(ModuleInfo, PredTable),
( map__search(PredTable, PredId, PredInfo) ->
@@ -374,17 +377,15 @@
pred_info_get_markers(PredInfo, Markers),
check_marker(Markers, class_instance_method)
->
- io__write_string("type class method implementation",
- !IO)
+ io__write_string("type class method implementation", !IO)
;
pred_info_get_goal_type(PredInfo, promise(PromiseType))
->
- io__write_string("`" ++
- prog_out__promise_to_string(PromiseType)
+ io__write_string("`" ++ prog_out__promise_to_string(PromiseType)
++ "' declaration", !IO)
;
- write_simple_call_id(PredOrFunc,
- qualified(Module, Name), Arity, !IO)
+ write_simple_call_id(PredOrFunc, qualified(Module, Name), Arity,
+ !IO)
)
;
% The predicate has been deleted, so we print what we can.
@@ -421,10 +422,8 @@
:- func hlds_out__generic_call_id_to_string(generic_call_id) = string.
hlds_out__generic_call_id_to_string(higher_order(Purity, PredOrFunc, _)) =
- purity_prefix_to_string(Purity)
- ++ "higher-order "
- ++ prog_out__pred_or_func_to_full_str(PredOrFunc)
- ++ " call".
+ purity_prefix_to_string(Purity) ++ "higher-order "
+ ++ prog_out__pred_or_func_to_full_str(PredOrFunc) ++ " call".
hlds_out__generic_call_id_to_string(class_method(_ClassId, MethodId)) =
simple_call_id_to_string(MethodId).
hlds_out__generic_call_id_to_string(cast(CastType)) =
@@ -457,8 +456,7 @@
% rather than "in argument N of call to".
Str1 = ""
;
- Str1 = hlds_out__arg_number_to_string(CallId, ArgNum)
- ++ " of "
+ Str1 = hlds_out__arg_number_to_string(CallId, ArgNum) ++ " of "
),
(
(
@@ -534,8 +532,8 @@
simple_call_id::in, int::in, io::di, io::uo) is det.
hlds_out__write_aditi_builtin_arg_number(Builtin, SimpleCallId, ArgNum, !IO) :-
- Str = hlds_out__aditi_builtin_arg_number_to_string(Builtin,
- SimpleCallId, ArgNum),
+ Str = hlds_out__aditi_builtin_arg_number_to_string(Builtin, SimpleCallId,
+ ArgNum),
io__write_string(Str, !IO).
:- func hlds_out__aditi_builtin_arg_number_to_string(aditi_builtin,
@@ -557,8 +555,7 @@
_, ArgNum) = Str :-
Str = "argument " ++ int_to_string(ArgNum).
hlds_out__aditi_builtin_arg_number_to_string(
- aditi_bulk_update(_, _, sym_name_and_closure),
- _, ArgNum) = Str :-
+ aditi_bulk_update(_, _, sym_name_and_closure), _, ArgNum) = Str :-
% The original goal had a sym_name/arity
% at the front of the argument list.
Str = "argument " ++ int_to_string(ArgNum + 1).
@@ -571,10 +568,10 @@
hlds_out__write_unify_context(First0, UnifyContext, Context, First, !IO) :-
UnifyContext = unify_context(MainContext, RevSubContexts),
list__reverse(RevSubContexts, SubContexts),
- hlds_out__write_unify_main_context(First0, MainContext, Context,
- First1, !IO),
- hlds_out__write_unify_sub_contexts(First1, SubContexts, Context,
- First, !IO).
+ hlds_out__write_unify_main_context(First0, MainContext, Context, First1,
+ !IO),
+ hlds_out__write_unify_sub_contexts(First1, SubContexts, Context, First,
+ !IO).
hlds_out__unify_context_to_pieces(UnifyContext, !Pieces) :-
UnifyContext = unify_context(MainContext, RevSubContexts),
@@ -622,8 +619,7 @@
!:Pieces = !.Pieces ++ [words("of clause head:"), nl].
hlds_out__unify_main_context_to_pieces(head_result, !Pieces) :-
hlds_out__start_in_message_to_pieces(!Pieces),
- !:Pieces = !.Pieces ++
- [words("function result term of clause head:"), nl].
+ !:Pieces = !.Pieces ++ [words("function result term of clause head:"), nl].
hlds_out__unify_main_context_to_pieces(call(CallId, ArgNum), !Pieces) :-
hlds_out__start_in_message_to_pieces(!Pieces),
% The markers argument below is used only for type class method
@@ -651,8 +647,7 @@
io__write_string(" of functor `", !IO),
hlds_out__write_cons_id(ConsId, !IO),
io__write_string("':\n", !IO),
- hlds_out__write_unify_sub_contexts(no, SubContexts, Context, First,
- !IO).
+ hlds_out__write_unify_sub_contexts(no, SubContexts, Context, First, !IO).
:- pred hlds_out__unify_sub_contexts_to_pieces(unify_sub_contexts::in,
list(format_component)::in, list(format_component)::out) is det.
@@ -662,8 +657,7 @@
!Pieces) :-
hlds_out__in_argument_to_pieces(ArgNum, !Pieces),
NewPieces = [words("of functor"),
- fixed("`" ++ cons_id_to_string(ConsId) ++ "':"),
- nl],
+ fixed("`" ++ cons_id_to_string(ConsId) ++ "':"), nl],
!:Pieces = !.Pieces ++ NewPieces,
hlds_out__unify_sub_contexts_to_pieces(SubContexts, !Pieces).
@@ -804,8 +798,7 @@
DumpPredId >= 0
->
( PredIdInt = DumpPredId ->
- hlds_out__write_pred(Indent, ModuleInfo, PredId,
- PredInfo, !IO)
+ hlds_out__write_pred(Indent, ModuleInfo, PredId, PredInfo, !IO)
;
true
)
@@ -814,19 +807,17 @@
\+ string__contains_char(Verbose, 'I'),
pred_info_is_imported(PredInfo)
;
- % For pseudo-imported predicates (i.e. unification
- % preds), only print them if we are using a local
- % mode for them.
+ % For pseudo-imported predicates (i.e. unification preds),
+ % only print them if we are using a local mode for them.
\+ string__contains_char(Verbose, 'I'),
pred_info_is_pseudo_imported(PredInfo),
ProcIds = pred_info_procids(PredInfo),
hlds_pred__in_in_unification_proc_id(ProcId),
ProcIds = [ProcId]
;
- % We dump unification and other compiler-generated
- % special predicates if suboption 'U' is on. We don't
- % need that information to understand how the program
- % has been transformed.
+ % We dump unification and other compiler-generated special
+ % predicates if suboption 'U' is on. We don't need that information
+ % to understand how the program has been transformed.
\+ string__contains_char(Verbose, 'U'),
is_unify_or_compare_pred(PredInfo)
)
@@ -863,28 +854,24 @@
AppendVarNums = no
),
( string__contains_char(Verbose, 'C') ->
- % Information about predicates is dumped if 'C'
- % suboption is on.
+ % Information about predicates is dumped if 'C' suboption is on.
(
PredOrFunc = predicate,
mercury_output_pred_type(TVarSet, ExistQVars,
- qualified(Module, PredName),
- ArgTypes, no, Purity, ClassContext, Context,
- AppendVarNums, !IO)
+ qualified(Module, PredName), ArgTypes, no, Purity,
+ ClassContext, Context, AppendVarNums, !IO)
;
PredOrFunc = function,
- pred_args_to_func_args(ArgTypes, FuncArgTypes,
- FuncRetType),
+ pred_args_to_func_args(ArgTypes, FuncArgTypes, FuncRetType),
mercury_output_func_type(TVarSet, ExistQVars,
- qualified(Module, PredName), FuncArgTypes,
- FuncRetType, no, Purity, ClassContext,
- Context, AppendVarNums, !IO)
+ qualified(Module, PredName), FuncArgTypes, FuncRetType, no,
+ Purity, ClassContext, Context, AppendVarNums, !IO)
)
;
true
),
- ClausesInfo = clauses_info(VarSet, _, _, VarTypes, HeadVars,
- ClausesRep, RttiVarMaps, _),
+ ClausesInfo = clauses_info(VarSet, _, _, VarTypes, HeadVars, ClausesRep,
+ RttiVarMaps, _),
( string__contains_char(Verbose, 'C') ->
hlds_out__write_indent(Indent, !IO),
io__write_string("% pred id: ", !IO),
@@ -900,20 +887,21 @@
io__write(GoalType, !IO),
io__write_string("\n", !IO),
markers_to_marker_list(Markers, MarkerList),
- ( MarkerList = [] ->
- true
+ (
+ MarkerList = []
;
+ MarkerList = [_ | _],
io__write_string("% markers: ", !IO),
hlds_out__write_marker_list(MarkerList, !IO),
io__write_string("\n", !IO)
),
- hlds_out__write_rtti_varmaps(Indent, AppendVarNums,
- RttiVarMaps, VarSet, TVarSet, !IO),
+ hlds_out__write_rtti_varmaps(Indent, AppendVarNums, RttiVarMaps,
+ VarSet, TVarSet, !IO),
( map__is_empty(Proofs) ->
true
;
- hlds_out__write_constraint_proofs(Indent, TVarSet,
- Proofs, AppendVarNums, !IO),
+ hlds_out__write_constraint_proofs(Indent, TVarSet, Proofs,
+ AppendVarNums, !IO),
io__write_string("\n", !IO)
),
( map__is_empty(ConstraintMap) ->
@@ -928,36 +916,35 @@
% with the condition `string__contains_char(Verbose, 'C')'?
% Shouldn't it be dependent on a different letter?
- ( Indexes = [] ->
- true
+ (
+ Indexes = []
;
+ Indexes = [_ | _],
io__write_string("% indexes: ", !IO),
- io__write_list(Indexes, ", ",
- mercury_output_index_spec, !IO),
+ io__write_list(Indexes, ", ", mercury_output_index_spec, !IO),
io__nl(!IO)
),
- ( HeadTypeParams \= [] ->
+ (
+ HeadTypeParams = [_ | _],
io__write_string("% head_type_params:\n", !IO),
io__write_string("% ", !IO),
- mercury_output_vars(HeadTypeParams, TVarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(HeadTypeParams, TVarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
- true
+ HeadTypeParams = []
),
- hlds_out__write_var_types(Indent, VarSet, AppendVarNums,
- VarTypes, TVarSet, !IO),
+ hlds_out__write_var_types(Indent, VarSet, AppendVarNums, VarTypes,
+ TVarSet, !IO),
get_clause_list(ClausesRep, Clauses),
(
Clauses = [_ | _],
set_dump_opts_for_clauses(SavedDumpString, !IO),
- hlds_out__write_clauses(Indent, ModuleInfo, PredId,
- VarSet, AppendVarNums, HeadVars, PredOrFunc,
- Clauses, no, !IO),
- globals__io_set_option(dump_hlds_options,
- string(SavedDumpString), !IO)
+ hlds_out__write_clauses(Indent, ModuleInfo, PredId, VarSet,
+ AppendVarNums, HeadVars, PredOrFunc, Clauses, no, !IO),
+ globals__io_set_option(dump_hlds_options, string(SavedDumpString),
+ !IO)
;
Clauses = []
),
@@ -965,33 +952,27 @@
pred_info_get_origin(PredInfo, Origin),
(
Origin = instance_method(MethodConstraints),
- MethodConstraints = instance_method_constraints(
- ClassId, InstanceTypes, InstanceConstraints,
- ClassMethodConstraints),
- io__write_string("% instance method constraints:\n",
- !IO),
+ MethodConstraints = instance_method_constraints(ClassId,
+ InstanceTypes, InstanceConstraints, ClassMethodConstraints),
+ io__write_string("% instance method constraints:\n", !IO),
ClassId = class_id(ClassName, _),
mercury_output_constraint(TVarSet, AppendVarNums,
constraint(ClassName, InstanceTypes), !IO),
io__nl(!IO),
io__write_string("instance constraints: ", !IO),
io__write_list(InstanceConstraints, ", ",
- mercury_output_constraint(TVarSet,
- AppendVarNums), !IO),
+ mercury_output_constraint(TVarSet, AppendVarNums), !IO),
io__nl(!IO),
- ClassMethodConstraints = constraints(
- MethodUnivConstraints,
+ ClassMethodConstraints = constraints(MethodUnivConstraints,
MethodExistConstraints),
io__write_string("method univ constraints: ", !IO),
io__write_list(MethodUnivConstraints, ", ",
- mercury_output_constraint(TVarSet,
- AppendVarNums), !IO),
+ mercury_output_constraint(TVarSet, AppendVarNums), !IO),
io__nl(!IO),
io__write_string("method exist constraints: ", !IO),
io__write_list(MethodExistConstraints, ", ",
- mercury_output_constraint(TVarSet,
- AppendVarNums), !IO),
+ mercury_output_constraint(TVarSet, AppendVarNums), !IO),
io__nl(!IO)
;
Origin = special_pred(_),
@@ -1124,8 +1105,7 @@
hlds_out__write_clauses(Indent, ModuleInfo, PredId, VarSet, AppendVarNums,
HeadVars, PredOrFunc, Clauses0, TypeQual, !IO) :-
hlds_out__write_clauses_2(Indent, ModuleInfo, PredId, VarSet,
- AppendVarNums, HeadVars, PredOrFunc, Clauses0, TypeQual,
- 1, !IO).
+ AppendVarNums, HeadVars, PredOrFunc, Clauses0, TypeQual, 1, !IO).
:- pred hlds_out__write_clauses_2(int::in, module_info::in, pred_id::in,
prog_varset::in, bool::in, list(prog_var)::in, pred_or_func::in,
@@ -1151,16 +1131,14 @@
true
).
-hlds_out__write_clause(Indent, ModuleInfo, PredId, VarSet,
- AppendVarNums, HeadTerms, PredOrFunc, Clause,
- UseDeclaredModes, TypeQual, !IO) :-
+hlds_out__write_clause(Indent, ModuleInfo, PredId, VarSet, AppendVarNums,
+ HeadTerms, PredOrFunc, Clause, UseDeclaredModes, TypeQual, !IO) :-
Clause = clause(Modes, Goal, Lang, Context),
Indent1 = Indent + 1,
globals__io_lookup_string_option(dump_hlds_options, Verbose, !IO),
( string__contains_char(Verbose, 'm') ->
hlds_out__write_indent(Indent, !IO),
- io__write_string("% Modes for which this clause applies: ",
- !IO),
+ io__write_string("% Modes for which this clause applies: ", !IO),
ModeInts = list__map(proc_id_to_int, Modes),
hlds_out__write_intlist(ModeInts, !IO),
io__write_string("\n", !IO)
@@ -1182,16 +1160,16 @@
; Modes = ProcIds
)
->
- hlds_out__write_clause_head(ModuleInfo, PredId, VarSet,
- AppendVarNums, HeadTerms, PredOrFunc, !IO)
+ hlds_out__write_clause_head(ModuleInfo, PredId, VarSet, AppendVarNums,
+ HeadTerms, PredOrFunc, !IO)
;
% If Modes contains more than one mode, the output will have
% multiple clause heads. This won't be pretty and it won't be
% syntactically valid, but it is more useful for debugging
% than a compiler abort during the dumping process.
- hlds_out__write_annotated_clause_heads(ModuleInfo, Context,
- PredId, Modes, VarSet, AppendVarNums, HeadTerms,
- PredOrFunc, UseDeclaredModes, !IO)
+ hlds_out__write_annotated_clause_heads(ModuleInfo, Context, PredId,
+ Modes, VarSet, AppendVarNums, HeadTerms, PredOrFunc,
+ UseDeclaredModes, !IO)
),
( Goal = conj([]) - _GoalInfo ->
io__write_string(".\n", !IO)
@@ -1223,27 +1201,22 @@
io::di, io::uo) is det.
hlds_out__write_annotated_clause_head(ModuleInfo, Context, PredId, ProcId,
- VarSet, AppendVarNums, HeadTerms,
- PredOrFunc, UseDeclaredModes, !IO) :-
+ VarSet, AppendVarNums, HeadTerms, PredOrFunc, UseDeclaredModes, !IO) :-
module_info_pred_info(ModuleInfo, PredId, PredInfo),
pred_info_procedures(PredInfo, Procedures),
( map__search(Procedures, ProcId, ProcInfo) ->
%
- % When writing `.opt' files, use the declared
- % argument modes so that the modes are guaranteed
- % to be syntactically identical to those in the
- % original program. The test in make_hlds.m to
- % check whether a clause matches a procedure
- % tests for syntactic identity (roughly).
- % The modes returned by proc_info_argmodes may have
- % been slightly expanded by propagate_types_into_modes.
+ % When writing `.opt' files, use the declared argument modes so that
+ % the modes are guaranteed to be syntactically identical to those
+ % in the original program. The test in add_clause.m to check whether
+ % a clause matches a procedure tests for syntactic identity (roughly).
+ % The modes returned by proc_info_argmodes may have been slightly
+ % expanded by propagate_types_into_modes.
%
- % We can't use the declared argument modes when writing
- % HLDS dumps because the modes of the type-infos will
- % not have been added, so the call to
- % assoc_list__from_corresponding_lists below
- % will abort. `.opt' files are written before
- % the polymorphism pass.
+ % We can't use the declared argument modes when writing HLDS dumps
+ % because the modes of the type-infos will not have been added,
+ % so the call to assoc_list__from_corresponding_lists below
+ % will abort. `.opt' files are written before the polymorphism pass.
%
( UseDeclaredModes = yes ->
proc_info_declared_argmodes(ProcInfo, ArgModes)
@@ -1254,8 +1227,8 @@
AnnotatedPairs),
AnnotatedHeadTerms = list__map(add_mode_qualifier(Context),
AnnotatedPairs),
- hlds_out__write_clause_head(ModuleInfo, PredId, VarSet,
- AppendVarNums, AnnotatedHeadTerms, PredOrFunc, !IO)
+ hlds_out__write_clause_head(ModuleInfo, PredId, VarSet, AppendVarNums,
+ AnnotatedHeadTerms, PredOrFunc, !IO)
;
% This procedure, even though it existed in the past, has been
% eliminated.
@@ -1273,30 +1246,28 @@
(
PredOrFunc = function,
pred_args_to_func_args(HeadTerms, FuncArgs, RetVal),
- hlds_out__write_qualified_functor_with_term_args(
- ModuleName, term__atom(PredName), FuncArgs, VarSet,
- AppendVarNums, !IO),
+ hlds_out__write_qualified_functor_with_term_args(ModuleName,
+ term__atom(PredName), FuncArgs, VarSet, AppendVarNums, !IO),
io__write_string(" = ", !IO),
mercury_output_term(RetVal, VarSet, AppendVarNums,
next_to_graphic_token, !IO)
;
PredOrFunc = predicate,
- hlds_out__write_qualified_functor_with_term_args(
- ModuleName, term__atom(PredName), HeadTerms, VarSet,
- AppendVarNums, !IO)
+ hlds_out__write_qualified_functor_with_term_args(ModuleName,
+ term__atom(PredName), HeadTerms, VarSet, AppendVarNums, !IO)
).
hlds_out__write_goal(Goal, ModuleInfo, VarSet, AppendVarNums, Indent, Follow,
!IO) :-
- % don't type qualify everything
+ % Don't type qualify everything.
hlds_out__write_goal_a(Goal, ModuleInfo, VarSet, AppendVarNums,
Indent, Follow, no, !IO).
- % TypeQual is yes(TVarset, VarTypes) if all constructors should
- % be module qualified.
+ % TypeQual is yes(TVarset, VarTypes) if all constructors should be
+ % module qualified.
+ %
:- pred hlds_out__write_goal_a(hlds_goal::in, module_info::in, prog_varset::in,
- bool::in, int::in, string::in, maybe_vartypes::in, io::di, io::uo)
- is det.
+ bool::in, int::in, string::in, maybe_vartypes::in, io::di, io::uo) is det.
hlds_out__write_goal_a(Goal - GoalInfo, ModuleInfo, VarSet, AppendVarNums,
Indent, Follow, TypeQual, !IO) :-
@@ -1320,14 +1291,15 @@
),
( string__contains_char(Verbose, 'P') ->
goal_info_get_goal_path(GoalInfo, Path),
- ( Path \= [] ->
+ (
+ Path = [_ | _],
goal_path_to_string(Path, PathStr),
hlds_out__write_indent(Indent, !IO),
io__write_string("% goal path: ", !IO),
io__write_string(PathStr, !IO),
io__write_string("\n", !IO)
;
- true
+ Path = []
)
;
true
@@ -1335,14 +1307,14 @@
( string__contains_char(Verbose, 'n') ->
goal_info_get_nonlocals(GoalInfo, NonLocalsSet),
set__to_sorted_list(NonLocalsSet, NonLocalsList),
- ( NonLocalsList \= [] ->
+ (
+ NonLocalsList = [_ | _],
hlds_out__write_indent(Indent, !IO),
io__write_string("% nonlocals: ", !IO),
- mercury_output_vars(NonLocalsList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(NonLocalsList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
- true
+ NonLocalsList = []
)
;
true
@@ -1355,8 +1327,7 @@
->
hlds_out__write_indent(Indent, !IO),
io__write_string("% pre-deaths: ", !IO),
- mercury_output_vars(PreDeathList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(PreDeathList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
true
@@ -1368,8 +1339,7 @@
->
hlds_out__write_indent(Indent, !IO),
io__write_string("% pre-births: ", !IO),
- mercury_output_vars(PreBirthList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(PreBirthList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
true
@@ -1383,8 +1353,7 @@
set__to_sorted_list(ProducingVars, ProducingVarsList),
hlds_out__write_indent(Indent, !IO),
io__write_string("% producing vars: ", !IO),
- mercury_output_vars(ProducingVarsList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(ProducingVarsList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
true
@@ -1395,8 +1364,7 @@
set__to_sorted_list(ConsumingVars, ConsumingVarsList),
hlds_out__write_indent(Indent, !IO),
io__write_string("% consuming vars: ", !IO),
- mercury_output_vars(ConsumingVarsList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(ConsumingVarsList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
true
@@ -1404,12 +1372,11 @@
MakeVisibleVars = GoalInfo ^ make_visible_vars,
( set__non_empty(MakeVisibleVars) ->
- set__to_sorted_list(MakeVisibleVars,
- MakeVisibleVarsList),
+ set__to_sorted_list(MakeVisibleVars, MakeVisibleVarsList),
hlds_out__write_indent(Indent, !IO),
io__write_string("% make_visible vars: ", !IO),
- mercury_output_vars(MakeVisibleVarsList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(MakeVisibleVarsList, VarSet, AppendVarNums,
+ !IO),
io__write_string("\n", !IO)
;
true
@@ -1417,12 +1384,11 @@
NeedVisibleVars = GoalInfo ^ need_visible_vars,
( set__non_empty(NeedVisibleVars) ->
- set__to_sorted_list(NeedVisibleVars,
- NeedVisibleVarsList),
+ set__to_sorted_list(NeedVisibleVars, NeedVisibleVarsList),
hlds_out__write_indent(Indent, !IO),
io__write_string("% need_visible vars: ", !IO),
- mercury_output_vars(NeedVisibleVarsList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(NeedVisibleVarsList, VarSet, AppendVarNums,
+ !IO),
io__write_string("\n", !IO)
;
true
@@ -1453,15 +1419,13 @@
hlds_out__write_indent(Indent, !IO),
( string__contains_char(Verbose, 'D') ->
io__write_string("% new insts: ", !IO),
- hlds_out__write_instmap_delta(InstMapDelta,
- VarSet, AppendVarNums, Indent, !IO),
+ hlds_out__write_instmap_delta(InstMapDelta, VarSet,
+ AppendVarNums, Indent, !IO),
io__write_string("\n", !IO)
;
- io__write_string("% vars with new insts: ",
- !IO),
- hlds_out__write_instmap_delta_vars(
- InstMapDelta, VarSet, AppendVarNums,
- !IO),
+ io__write_string("% vars with new insts: ", !IO),
+ hlds_out__write_instmap_delta_vars(InstMapDelta, VarSet,
+ AppendVarNums, !IO),
io__write_string("\n", !IO)
)
)
@@ -1476,8 +1440,7 @@
->
hlds_out__write_indent(Indent, !IO),
io__write_string("% post-deaths: ", !IO),
- mercury_output_vars(PostDeathList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(PostDeathList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
true
@@ -1489,8 +1452,7 @@
->
hlds_out__write_indent(Indent, !IO),
io__write_string("% post-births: ", !IO),
- mercury_output_vars(PostBirthList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(PostBirthList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
;
true
@@ -1503,18 +1465,19 @@
CodeGenInfo = no_code_gen_info
;
CodeGenInfo = llds_code_gen_info(_CodeGenDetails),
- hlds_out__write_llds_code_gen_info(GoalInfo, VarSet,
- AppendVarNums, Indent, Verbose, !IO)
+ hlds_out__write_llds_code_gen_info(GoalInfo, VarSet, AppendVarNums,
+ Indent, Verbose, !IO)
),
( string__contains_char(Verbose, 'g') ->
goal_info_get_features(GoalInfo, Features),
- set__to_sorted_list(Features, Flist),
- ( Flist = [] ->
- true
+ set__to_sorted_list(Features, FeatureList),
+ (
+ FeatureList = []
;
+ FeatureList = [_ | _],
hlds_out__write_indent(Indent, !IO),
io__write_string("% Goal features: ", !IO),
- io__write(Flist, !IO),
+ io__write(FeatureList, !IO),
io__write_string("\n", !IO)
)
;
@@ -1534,12 +1497,14 @@
mercury_output_var(Var, VarSet, AppendVarNums, !IO),
io__write_string("'\n", !IO),
Indent1 = Indent + 1,
- ( CasesList = [Case | Cases] ->
- hlds_out__write_case(Case, Var, ModuleInfo, VarSet,
- AppendVarNums, Indent1, TypeQual, !IO),
- hlds_out__write_cases(Cases, Var, ModuleInfo, VarSet,
- AppendVarNums, Indent, TypeQual, !IO)
+ (
+ CasesList = [Case | Cases],
+ hlds_out__write_case(Case, Var, ModuleInfo, VarSet, AppendVarNums,
+ Indent1, TypeQual, !IO),
+ hlds_out__write_cases(Cases, Var, ModuleInfo, VarSet, AppendVarNums,
+ Indent, TypeQual, !IO)
;
+ CasesList = [],
hlds_out__write_indent(Indent1, !IO),
io__write_string("fail\n", !IO)
),
@@ -1655,24 +1620,24 @@
hlds_out__write_goal_2(conj(List), ModuleInfo, VarSet, AppendVarNums,
Indent, Follow, TypeQual, !IO) :-
- ( List = [Goal | Goals] ->
- globals__io_lookup_string_option(dump_hlds_options, Verbose,
- !IO),
+ (
+ List = [Goal | Goals],
+ globals__io_lookup_string_option(dump_hlds_options, Verbose, !IO),
( Verbose \= "" ->
hlds_out__write_indent(Indent, !IO),
io__write_string("( % conjunction\n", !IO),
hlds_out__write_conj(Goal, Goals, ModuleInfo, VarSet,
- AppendVarNums, Indent + 1, "\n", Verbose,
- ",\n", TypeQual, !IO),
+ AppendVarNums, Indent + 1, "\n", Verbose, ",\n", TypeQual,
+ !IO),
hlds_out__write_indent(Indent, !IO),
io__write_string(")", !IO),
io__write_string(Follow, !IO)
;
hlds_out__write_conj(Goal, Goals, ModuleInfo, VarSet,
- AppendVarNums, Indent, Follow, Verbose, ",\n",
- TypeQual, !IO)
+ AppendVarNums, Indent, Follow, Verbose, ",\n", TypeQual, !IO)
)
;
+ List = [],
hlds_out__write_indent(Indent, !IO),
io__write_string("true", !IO),
io__write_string(Follow, !IO)
@@ -1703,8 +1668,8 @@
io__write_string("( % disjunction\n", !IO),
hlds_out__write_goal_a(Goal, ModuleInfo, VarSet, AppendVarNums,
Indent + 1, "\n", TypeQual, !IO),
- hlds_out__write_goal_list(Goals, ModuleInfo, VarSet,
- AppendVarNums, Indent, ";\n", TypeQual, !IO),
+ hlds_out__write_goal_list(Goals, ModuleInfo, VarSet, AppendVarNums,
+ Indent, ";\n", TypeQual, !IO),
hlds_out__write_indent(Indent, !IO),
io__write_string(")", !IO),
io__write_string(Follow, !IO)
@@ -1718,14 +1683,12 @@
% XXX we should print more info here
(
GenericCall = higher_order(PredVar, Purity, PredOrFunc, _),
- globals__io_lookup_string_option(dump_hlds_options, Verbose,
- !IO),
+ globals__io_lookup_string_option(dump_hlds_options, Verbose, !IO),
(
PredOrFunc = predicate,
( string__contains_char(Verbose, 'l') ->
hlds_out__write_indent(Indent, !IO),
- io__write_string("% higher-order " ++
- "predicate call\n", !IO)
+ io__write_string("% higher-order predicate call\n", !IO)
;
true
),
@@ -1737,8 +1700,7 @@
PredOrFunc = function,
( string__contains_char(Verbose, 'l') ->
hlds_out__write_indent(Indent, !IO),
- io__write_string("% higher-order " ++
- "function application\n", !IO)
+ io__write_string("% higher-order function application\n", !IO)
;
true
),
@@ -1746,18 +1708,15 @@
FuncArgVars, FuncRetVar),
hlds_out__write_indent(Indent, !IO),
write_purity_prefix(Purity, !IO),
- mercury_output_var(FuncRetVar, VarSet, AppendVarNums,
- !IO),
+ mercury_output_var(FuncRetVar, VarSet, AppendVarNums, !IO),
io__write_string(" = ", !IO),
- hlds_out__write_functor(term__atom("apply"),
- FuncArgVars, VarSet, AppendVarNums, !IO)
+ hlds_out__write_functor(term__atom("apply"), FuncArgVars, VarSet,
+ AppendVarNums, !IO)
),
io__write_string(Follow, !IO)
;
- GenericCall = class_method(TCInfoVar, MethodNum, _ClassId,
- _MethodId),
- globals__io_lookup_string_option(dump_hlds_options, Verbose,
- !IO),
+ GenericCall = class_method(TCInfoVar, MethodNum, _ClassId, _MethodId),
+ globals__io_lookup_string_option(dump_hlds_options, Verbose, !IO),
( string__contains_char(Verbose, 'l') ->
hlds_out__write_indent(Indent, !IO),
io__write_string("% class method call\n", !IO)
@@ -1767,19 +1726,17 @@
term__context_init(Context),
Functor = term__atom("class_method_call"),
TCInfoTerm = term__variable(TCInfoVar),
- MethodNumTerm = term__functor(term__integer(MethodNum), [],
- Context),
+ MethodNumTerm = term__functor(term__integer(MethodNum), [], Context),
term__var_list_to_term_list(ArgVars, ArgTerms),
- Term = term__functor(Functor,
- [TCInfoTerm, MethodNumTerm | ArgTerms], Context),
+ Term = term__functor(Functor, [TCInfoTerm, MethodNumTerm | ArgTerms],
+ Context),
hlds_out__write_indent(Indent, !IO),
mercury_output_term(Term, VarSet, AppendVarNums, !IO),
io__write_string(Follow, !IO)
;
GenericCall = cast(CastType),
CastTypeString = hlds_out__cast_type_to_string(CastType),
- globals__io_lookup_string_option(dump_hlds_options, Verbose,
- !IO),
+ globals__io_lookup_string_option(dump_hlds_options, Verbose, !IO),
( string__contains_char(Verbose, 'l') ->
hlds_out__write_indent(Indent, !IO),
io__write_strings(["% ", CastTypeString, "\n"], !IO)
@@ -1830,8 +1787,7 @@
),
hlds_out__write_indent(Indent, !IO),
( PredId = invalid_pred_id ->
- % If we don't know then the call must be treated
- % as a predicate.
+ % If we don't know then the call must be treated as a predicate.
PredOrFunc = predicate
;
module_info_pred_info(ModuleInfo, PredId, PredInfo),
@@ -1867,17 +1823,15 @@
;
VarType = no
),
- CallUnifyContext = call_unify_context(Var,
- RHS, _UnifyContext),
+ CallUnifyContext = call_unify_context(Var, RHS, _UnifyContext),
hlds_out__write_indent(Indent, !IO),
io__write_string("% unify context: ", !IO),
mercury_output_var(Var, VarSet, AppendVarNums, !IO),
io__write_string(" = ", !IO),
% XXX Fake the inst varset
varset__init(InstVarSet),
- hlds_out__write_unify_rhs_2(RHS, ModuleInfo, VarSet,
- InstVarSet, AppendVarNums, Indent, Follow,
- VarType, TypeQual, !IO)
+ hlds_out__write_unify_rhs_2(RHS, ModuleInfo, VarSet, InstVarSet,
+ AppendVarNums, Indent, Follow, VarType, TypeQual, !IO)
;
true
)
@@ -1896,7 +1850,7 @@
;
VarType = no
),
- % XXX Fake the inst varset
+ % XXX Fake the inst varset.
varset__init(InstVarSet),
hlds_out__write_unify_rhs_2(B, ModuleInfo, VarSet, InstVarSet,
AppendVarNums, Indent, Follow, VarType, TypeQual, !IO),
@@ -1911,16 +1865,15 @@
(
% don't output bogus info if we haven't been through
% mode analysis yet
- Unification = complicated_unify(Mode, CanFail,
- TypeInfoVars),
+ Unification = complicated_unify(Mode, CanFail, TypeInfoVars),
CanFail = can_fail,
Mode = (free - free -> free - free),
TypeInfoVars = []
->
true
;
- hlds_out__write_unification(Unification, ModuleInfo,
- VarSet, InstVarSet, AppendVarNums, Indent, !IO)
+ hlds_out__write_unification(Unification, ModuleInfo, VarSet,
+ InstVarSet, AppendVarNums, Indent, !IO)
)
;
true
@@ -1943,13 +1896,11 @@
io__write_int(ProcIdInt, !IO),
io__write_string(",\n", !IO),
hlds_out__write_indent(Indent, !IO),
- % XXX We don't have the TypeVarSet available here,
- % but it's only used for printing out the names of the
- % type variables, which isn't essential.
+ % XXX We don't have the TypeVarSet available here, but it is only used
+ % for printing out the names of the type variables, which isn't essential.
varset__init(TypeVarSet),
io__write_string("[", !IO),
- hlds_out__write_foreign_args(Args, VarSet, TypeVarSet, AppendVarNums,
- !IO),
+ hlds_out__write_foreign_args(Args, VarSet, TypeVarSet, AppendVarNums, !IO),
io__write_string("],\n", !IO),
(
ExtraArgs = []
@@ -1967,9 +1918,8 @@
io__write_string(C_Code, !IO),
io__write_string("""", !IO)
;
- PragmaCode = nondet(Fields, _FieldsContext,
- First, _FirstContext, Later, _LaterContext,
- Treat, Shared, _SharedContext),
+ PragmaCode = nondet(Fields, _FieldsContext, First, _FirstContext,
+ Later, _LaterContext, Treat, Shared, _SharedContext),
io__write_string("local_vars(""", !IO),
io__write_string(Fields, !IO),
io__write_string("""), ", !IO),
@@ -2072,8 +2022,8 @@
io__write_string("% follow vars: ", !IO),
io__write_int(NextReg, !IO),
io__write_string("\n", !IO),
- hlds_out__write_var_to_abs_locns(FVlist, VarSet,
- AppendVarNums, Indent, !IO)
+ hlds_out__write_var_to_abs_locns(FVlist, VarSet, AppendVarNums,
+ Indent, !IO)
;
MaybeFollowVars = no
)
@@ -2102,8 +2052,7 @@
Locs = stack_and_orig,
io__write_string("stack and orig ", !IO)
),
- mercury_output_vars(ResumeVarList, VarSet,
- AppendVarNums, !IO),
+ mercury_output_vars(ResumeVarList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
)
;
@@ -2117,49 +2066,51 @@
->
hlds_out__write_indent(Indent, !IO),
io__write_string("% store map:\n", !IO),
- hlds_out__write_var_to_abs_locns(StoreMapList, VarSet,
- AppendVarNums, Indent, !IO)
+ hlds_out__write_var_to_abs_locns(StoreMapList, VarSet, AppendVarNums,
+ Indent, !IO)
;
true
),
(
string__contains_char(Verbose, 's'),
- goal_info_get_maybe_need_across_call(GoalInfo,
- MaybeNeedAcrossCall),
+ goal_info_get_maybe_need_across_call(GoalInfo, MaybeNeedAcrossCall),
MaybeNeedAcrossCall = yes(NeedAcrossCall)
->
- NeedAcrossCall = need_across_call(CallForwardSet,
- CallResumeSet, CallNondetSet),
+ NeedAcrossCall = need_across_call(CallForwardSet, CallResumeSet,
+ CallNondetSet),
set__to_sorted_list(CallForwardSet, CallForwardList),
set__to_sorted_list(CallResumeSet, CallResumeList),
set__to_sorted_list(CallNondetSet, CallNondetList),
hlds_out__write_indent(Indent, !IO),
io__write_string("% need across call forward vars: ", !IO),
- ( CallForwardList = [] ->
+ (
+ CallForwardList = [],
io__write_string("none\n", !IO)
;
- hlds_out__write_vars(CallForwardList, VarSet,
- AppendVarNums, !IO),
+ CallForwardList = [_ | _],
+ hlds_out__write_vars(CallForwardList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
),
hlds_out__write_indent(Indent, !IO),
io__write_string("% need across call resume vars: ", !IO),
- ( CallResumeList = [] ->
+ (
+ CallResumeList = [],
io__write_string("none\n", !IO)
;
- hlds_out__write_vars(CallResumeList, VarSet,
- AppendVarNums, !IO),
+ CallResumeList = [_ | _],
+ hlds_out__write_vars(CallResumeList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
),
hlds_out__write_indent(Indent, !IO),
io__write_string("% need across call nondet vars: ", !IO),
- ( CallNondetList = [] ->
+ (
+ CallNondetList = [],
io__write_string("none\n", !IO)
;
- hlds_out__write_vars(CallNondetList, VarSet,
- AppendVarNums, !IO),
+ CallNondetList = [_ | _],
+ hlds_out__write_vars(CallNondetList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
)
;
@@ -2167,8 +2118,7 @@
),
(
string__contains_char(Verbose, 's'),
- goal_info_get_maybe_need_in_resume(GoalInfo,
- MaybeNeedInResume),
+ goal_info_get_maybe_need_in_resume(GoalInfo, MaybeNeedInResume),
MaybeNeedInResume = yes(NeedInResume)
->
NeedInResume = need_in_resume(ResumeOnStack, ResumeResumeSet,
@@ -2179,30 +2129,30 @@
hlds_out__write_indent(Indent, !IO),
(
ResumeOnStack = yes,
- io__write_string("% resume point has stack label\n",
- !IO)
+ io__write_string("% resume point has stack label\n", !IO)
;
ResumeOnStack = no,
- io__write_string("% resume point has no stack label\n",
- !IO)
+ io__write_string("% resume point has no stack label\n", !IO)
),
hlds_out__write_indent(Indent, !IO),
io__write_string("% need in resume resume vars: ", !IO),
- ( ResumeResumeList = [] ->
+ (
+ ResumeResumeList = [],
io__write_string("none\n", !IO)
;
- hlds_out__write_vars(ResumeResumeList, VarSet,
- AppendVarNums, !IO),
+ ResumeResumeList = [_ | _],
+ hlds_out__write_vars(ResumeResumeList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
),
hlds_out__write_indent(Indent, !IO),
io__write_string("% need in resume nondet vars: ", !IO),
- ( ResumeNondetList = [] ->
+ (
+ ResumeNondetList = [],
io__write_string("none\n", !IO)
;
- hlds_out__write_vars(ResumeNondetList, VarSet,
- AppendVarNums, !IO),
+ ResumeNondetList = [_ | _],
+ hlds_out__write_vars(ResumeNondetList, VarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
)
;
@@ -2210,8 +2160,7 @@
),
(
string__contains_char(Verbose, 's'),
- goal_info_get_maybe_need_in_par_conj(GoalInfo,
- MaybeNeedInParConj),
+ goal_info_get_maybe_need_in_par_conj(GoalInfo, MaybeNeedInParConj),
MaybeNeedInParConj = yes(NeedInParConj)
->
NeedInParConj = need_in_par_conj(ParConjSet),
@@ -2277,7 +2226,6 @@
% make_hlds.m checks the arity so this cannot fail.
get_state_args_det(ArgVars, Args, State0Var, StateVar),
hlds_out__write_indent(Indent, !IO),
-
(
InsertDelete = insert,
io__write_string("aditi_insert(", !IO)
@@ -2285,18 +2233,17 @@
InsertDelete = delete,
io__write_string("aditi_delete(", !IO)
),
-
- CallId = PredOrFunc - SymName/_,
+ CallId = PredOrFunc - SymName / _,
(
PredOrFunc = predicate,
- hlds_out__write_sym_name_and_args(SymName, Args,
- VarSet, AppendVarNums, !IO)
+ hlds_out__write_sym_name_and_args(SymName, Args, VarSet,
+ AppendVarNums, !IO)
;
PredOrFunc = function,
pred_args_to_func_args(Args, FuncArgs, RetArg),
io__write_string("(", !IO),
- hlds_out__write_sym_name_and_args(SymName, FuncArgs,
- VarSet, AppendVarNums, !IO),
+ hlds_out__write_sym_name_and_args(SymName, FuncArgs, VarSet,
+ AppendVarNums, !IO),
io__write_string(" = ", !IO),
mercury_output_var(RetArg, VarSet, AppendVarNums, !IO),
io__write_string(")", !IO)
@@ -2380,9 +2327,8 @@
io__write_string("% ", !IO),
mercury_output_var(Var, ProgVarSet, AppendVarNums, !IO),
io__write_string(" := ", !IO),
- hlds_out_write_functor_and_submodes(ConsId, ArgVars, ArgModes,
- ModuleInfo, ProgVarSet, InstVarSet, AppendVarNums, Indent,
- !IO),
+ hlds_out_write_functor_and_submodes(ConsId, ArgVars, ArgModes, ModuleInfo,
+ ProgVarSet, InstVarSet, AppendVarNums, Indent, !IO),
(
Uniqueness = cell_is_unique,
hlds_out__write_indent(Indent, !IO),
@@ -2402,8 +2348,7 @@
;
SizeSource = dynamic_size(SizeVar),
io__write_string("var ", !IO),
- mercury_output_var(SizeVar, ProgVarSet, AppendVarNums,
- !IO),
+ mercury_output_var(SizeVar, ProgVarSet, AppendVarNums, !IO),
io__write_string("\n", !IO)
)
;
@@ -2432,13 +2377,11 @@
CanFail = cannot_fail,
io__write_string(" => ", !IO)
),
- hlds_out_write_functor_and_submodes(ConsId, ArgVars, ArgModes,
- ModuleInfo, ProgVarSet, InstVarSet, AppendVarNums, Indent,
- !IO).
+ hlds_out_write_functor_and_submodes(ConsId, ArgVars, ArgModes, ModuleInfo,
+ ProgVarSet, InstVarSet, AppendVarNums, Indent, !IO).
hlds_out__write_unification(complicated_unify(Mode, CanFail, TypeInfoVars),
- _ModuleInfo, ProgVarSet, InstVarSet, AppendVarNums, Indent,
- !IO) :-
+ _ModuleInfo, ProgVarSet, InstVarSet, AppendVarNums, Indent, !IO) :-
hlds_out__write_indent(Indent, !IO),
io__write_string("% ", !IO),
(
@@ -2463,14 +2406,15 @@
hlds_out_write_functor_and_submodes(ConsId, ArgVars, ArgModes, _ModuleInfo,
ProgVarSet, InstVarSet, AppendVarNums, Indent, !IO) :-
hlds_out__write_cons_id(ConsId, !IO),
- ( ArgVars = [] ->
+ (
+ ArgVars = [],
io__write_string("\n", !IO)
;
+ ArgVars = [_ | _],
io__write_string(" (", !IO),
mercury_output_vars(ArgVars, ProgVarSet, AppendVarNums, !IO),
io__write_string(")\n", !IO),
- globals__io_lookup_string_option(dump_hlds_options, Verbose,
- !IO),
+ globals__io_lookup_string_option(dump_hlds_options, Verbose, !IO),
( string__contains_char(Verbose, 'a') ->
hlds_out__write_indent(Indent, !IO),
io__write_string("% arg-modes ", !IO),
@@ -2522,8 +2466,7 @@
TypeQual = yes(TVarSet, _)
->
io__write_string(" `with_type` ", !IO),
- mercury_output_term(Type, TVarSet, no, next_to_graphic_token,
- !IO)
+ mercury_output_term(Type, TVarSet, no, next_to_graphic_token, !IO)
;
true
).
@@ -2544,12 +2487,14 @@
PredOrFunc = predicate,
io__write_string("(", !IO),
io__write_string(EvalStr, !IO),
- ( Vars = [] ->
+ (
+ Vars = [],
io__write_string("(pred)", !IO)
;
+ Vars = [_ | _],
io__write_string("pred(", !IO),
- hlds_out__write_var_modes(Vars, Modes, VarSet,
- InstVarSet, AppendVarNums, !IO),
+ hlds_out__write_var_modes(Vars, Modes, VarSet, InstVarSet,
+ AppendVarNums, !IO),
io__write_string(")", !IO)
),
io__write_string(" is ", !IO),
@@ -2565,17 +2510,19 @@
pred_args_to_func_args(Vars, ArgVars, RetVar),
io__write_string("(", !IO),
io__write_string(EvalStr, !IO),
- ( ArgVars = [] ->
+ (
+ ArgVars = [],
io__write_string("(func)", !IO)
;
+ ArgVars = [_ | _],
io__write_string("func(", !IO),
- hlds_out__write_var_modes(ArgVars, ArgModes, VarSet,
- InstVarSet, AppendVarNums, !IO),
+ hlds_out__write_var_modes(ArgVars, ArgModes, VarSet, InstVarSet,
+ AppendVarNums, !IO),
io__write_string(")", !IO)
),
io__write_string(" = (", !IO),
- hlds_out__write_var_mode(RetVar, RetMode, VarSet,
- InstVarSet, AppendVarNums, !IO),
+ hlds_out__write_var_mode(RetVar, RetMode, VarSet, InstVarSet,
+ AppendVarNums, !IO),
io__write_string(") is ", !IO),
mercury_output_det(Det, !IO),
io__write_string(" :-\n", !IO),
@@ -2599,8 +2546,7 @@
( NonLocals \= [] ->
hlds_out__write_indent(Indent1, !IO),
io__write_string("% lambda nonlocals: ", !IO),
- mercury_output_vars(NonLocals, VarSet, AppendVarNums,
- !IO)
+ mercury_output_vars(NonLocals, VarSet, AppendVarNums, !IO)
;
true
)
@@ -2635,8 +2581,7 @@
term__context_init(Context),
term__var_list_to_term_list(ArgVars, ArgTerms),
Term = term__functor(Functor, ArgTerms, Context),
- mercury_output_term(Term, VarSet, AppendVarNums, NextToGraphicToken,
- !IO).
+ mercury_output_term(Term, VarSet, AppendVarNums, NextToGraphicToken, !IO).
:- pred hlds_out__write_qualified_functor(module_name::in, const::in,
list(prog_var)::in, prog_varset::in, bool::in, io::di, io::uo) is det.
@@ -2666,27 +2611,25 @@
ConsId = cons(SymName, _),
(
SymName = qualified(Module, Name),
- hlds_out__write_qualified_functor(Module,
- term__atom(Name), ArgVars, VarSet,
- AppendVarNums, !IO)
+ hlds_out__write_qualified_functor(Module, term__atom(Name),
+ ArgVars, VarSet, AppendVarNums, !IO)
;
SymName = unqualified(Name),
hlds_out__write_functor(term__atom(Name),
- ArgVars, VarSet, AppendVarNums,
- next_to_graphic_token, !IO)
+ ArgVars, VarSet, AppendVarNums, next_to_graphic_token, !IO)
)
;
ConsId = int_const(Int),
- hlds_out__write_functor(term__integer(Int), ArgVars,
- VarSet, AppendVarNums, !IO)
+ hlds_out__write_functor(term__integer(Int), ArgVars, VarSet,
+ AppendVarNums, !IO)
;
ConsId = float_const(Float),
- hlds_out__write_functor(term__float(Float), ArgVars,
- VarSet, AppendVarNums, !IO)
+ hlds_out__write_functor(term__float(Float), ArgVars, VarSet,
+ AppendVarNums, !IO)
;
ConsId = string_const(Str),
- hlds_out__write_functor(term__string(Str), ArgVars,
- VarSet, AppendVarNums, !IO)
+ hlds_out__write_functor(term__string(Str), ArgVars, VarSet,
+ AppendVarNums, !IO)
;
ConsId = pred_const(ShroudedPredProcId, _),
proc(PredId, _) = unshroud_pred_proc_id(ShroudedPredProcId),
@@ -2694,8 +2637,7 @@
PredModule = pred_info_module(PredInfo),
PredName = pred_info_name(PredInfo),
hlds_out__write_functor_cons_id(
- cons(qualified(PredModule, PredName),
- list__length(ArgVars)),
+ cons(qualified(PredModule, PredName), list__length(ArgVars)),
ArgVars, VarSet, ModuleInfo, AppendVarNums, !IO)
;
ConsId = type_ctor_info_const(Module, Name, Arity),
@@ -2721,20 +2663,15 @@
io__write_string(")", !IO)
;
ConsId = type_info_cell_constructor(_),
- hlds_out__write_functor(
- term__atom("type_info_cell_constructor"),
- ArgVars, VarSet, AppendVarNums, next_to_graphic_token,
- !IO)
+ hlds_out__write_functor(term__atom("type_info_cell_constructor"),
+ ArgVars, VarSet, AppendVarNums, next_to_graphic_token, !IO)
;
ConsId = typeclass_info_cell_constructor,
- hlds_out__write_functor(
- term__atom("typeclass_info_cell_constructor"),
- ArgVars, VarSet, AppendVarNums, next_to_graphic_token,
- !IO)
+ hlds_out__write_functor(term__atom("typeclass_info_cell_constructor"),
+ ArgVars, VarSet, AppendVarNums, next_to_graphic_token, !IO)
;
ConsId = tabling_pointer_const(ShroudedPredProcId),
- proc(PredId, ProcId) =
- unshroud_pred_proc_id(ShroudedPredProcId),
+ proc(PredId, ProcId) = unshroud_pred_proc_id(ShroudedPredProcId),
io__write_string("tabling_pointer_const(", !IO),
hlds_out__write_pred_id(ModuleInfo, PredId, !IO),
io__write_string(", ", !IO),
@@ -2743,8 +2680,7 @@
io__write_string(")", !IO)
;
ConsId = deep_profiling_proc_layout(ShroudedPredProcId),
- proc(PredId, ProcId) =
- unshroud_pred_proc_id(ShroudedPredProcId),
+ proc(PredId, ProcId) = unshroud_pred_proc_id(ShroudedPredProcId),
io__write_string("deep_profiling_proc_layout(", !IO),
hlds_out__write_pred_id(ModuleInfo, PredId, !IO),
proc_id_to_int(ProcId, ProcIdInt),
@@ -2753,8 +2689,7 @@
io__write_string("))", !IO)
;
ConsId = table_io_decl(ShroudedPredProcId),
- proc(PredId, ProcId) =
- unshroud_pred_proc_id(ShroudedPredProcId),
+ proc(PredId, ProcId) = unshroud_pred_proc_id(ShroudedPredProcId),
io__write_string("table_io_decl(", !IO),
hlds_out__write_pred_id(ModuleInfo, PredId, !IO),
proc_id_to_int(ProcId, ProcIdInt),
@@ -2764,21 +2699,21 @@
).
hlds_out__write_var_modes([], [], _, _, _, !IO).
-hlds_out__write_var_modes([Var|Vars], [Mode|Modes], VarSet, InstVarSet,
+hlds_out__write_var_modes([Var | Vars], [Mode | Modes], VarSet, InstVarSet,
AppendVarNums, !IO) :-
hlds_out__write_var_mode(Var, Mode, VarSet, InstVarSet, AppendVarNums,
!IO),
- ( Vars \= [] ->
+ (
+ Vars = [_ | _],
io__write_string(", ", !IO)
;
- true
+ Vars = []
),
hlds_out__write_var_modes(Vars, Modes, VarSet, InstVarSet,
AppendVarNums, !IO).
-
-hlds_out__write_var_modes([], [_|_], _, _, _, !IO) :-
+hlds_out__write_var_modes([], [_ | _], _, _, _, !IO) :-
error("hlds_out__write_var_modes: length mis-match").
-hlds_out__write_var_modes([_|_], [], _, _, _, !IO) :-
+hlds_out__write_var_modes([_ | _], [], _, _, _, !IO) :-
error("hlds_out__write_var_modes: length mis-match").
:- pred hlds_out__write_var_mode(prog_var::in, (mode)::in, prog_varset::in,
@@ -2803,22 +2738,20 @@
% since that way it visually separates
% the lines after one goal
% and the lines before the next
- hlds_out__write_goal_a(Goal1, ModuleInfo, VarSet,
- AppendVarNums, Indent, "\n", TypeQual, !IO),
+ hlds_out__write_goal_a(Goal1, ModuleInfo, VarSet, AppendVarNums,
+ Indent, "\n", TypeQual, !IO),
hlds_out__write_indent(Indent, !IO),
io__write_string(Separator, !IO)
;
- hlds_out__write_goal_a(Goal1, ModuleInfo, VarSet,
- AppendVarNums, Indent, Separator, TypeQual,
- !IO)
+ hlds_out__write_goal_a(Goal1, ModuleInfo, VarSet, AppendVarNums,
+ Indent, Separator, TypeQual, !IO)
),
- hlds_out__write_conj(Goal2, Goals2, ModuleInfo, VarSet,
- AppendVarNums, Indent, Follow, Verbose, Separator,
- TypeQual, !IO)
+ hlds_out__write_conj(Goal2, Goals2, ModuleInfo, VarSet, AppendVarNums,
+ Indent, Follow, Verbose, Separator, TypeQual, !IO)
;
Goals1 = [],
- hlds_out__write_goal_a(Goal1, ModuleInfo, VarSet,
- AppendVarNums, Indent, Follow, TypeQual, !IO)
+ hlds_out__write_goal_a(Goal1, ModuleInfo, VarSet, AppendVarNums,
+ Indent, Follow, TypeQual, !IO)
).
hlds_out__write_goal_list(GoalList, ModuleInfo, VarSet, AppendVarNums, Indent,
@@ -2876,8 +2809,7 @@
:- pred hlds_out__write_some(list(prog_var)::in, prog_varset::in,
io::di, io::uo) is det.
- % quantification is all implicit by the time we get to the hlds.
-
+ % Quantification is all implicit by the time we get to the hlds.
hlds_out__write_some(_Vars, _VarSet, !IO).
hlds_out__write_instmap(InstMap, VarSet, AppendVarNums, Indent, !IO) :-
@@ -2885,8 +2817,8 @@
io__write_string("unreachable", !IO)
;
instmap__to_assoc_list(InstMap, AssocList),
- hlds_out__write_instmap_2(AssocList, VarSet, AppendVarNums,
- Indent, !IO)
+ hlds_out__write_instmap_2(AssocList, VarSet, AppendVarNums, Indent,
+ !IO)
).
:- pred hlds_out__write_instmap_2(assoc_list(prog_var, inst)::in,
@@ -2899,13 +2831,13 @@
io__write_string(" -> ", !IO),
varset__init(InstVarSet),
mercury_output_inst(Inst, InstVarSet, !IO),
- ( Rest = [] ->
- true
+ (
+ Rest = []
;
+ Rest = [_ | _],
mercury_output_newline(Indent, !IO),
io__write_string("% ", !IO),
- hlds_out__write_instmap_2(Rest, VarSet, AppendVarNums, Indent,
- !IO)
+ hlds_out__write_instmap_2(Rest, VarSet, AppendVarNums, Indent, !IO)
).
:- pred hlds_out__write_instmap_delta(instmap_delta::in, prog_varset::in,
@@ -2917,8 +2849,8 @@
io__write_string("unreachable", !IO)
;
instmap_delta_to_assoc_list(InstMapDelta, AssocList),
- hlds_out__write_instmap_2(AssocList, VarSet, AppendVarNums,
- Indent, !IO)
+ hlds_out__write_instmap_2(AssocList, VarSet, AppendVarNums, Indent,
+ !IO)
).
:- pred hlds_out__write_instmap_delta_vars(instmap_delta::in, prog_varset::in,
@@ -2969,8 +2901,7 @@
io::di, io::uo) is det.
hlds_out__write_type_list(Types, TypeVarSet, AppendVarNums, !IO) :-
- list__foldl(output_term_and_comma(TypeVarSet, AppendVarNums),
- Types, !IO).
+ list__foldl(output_term_and_comma(TypeVarSet, AppendVarNums), Types, !IO).
:- pred output_term_and_comma(tvarset::in, bool::in, (type)::in,
io::di, io::uo) is det.
@@ -3063,8 +2994,7 @@
io__write_string("\n", !IO).
:- pred write_typeclass_info_var(int::in, bool::in, rtti_varmaps::in,
- prog_varset::in, tvarset::in, prog_constraint::in, io::di, io::uo)
- is det.
+ prog_varset::in, tvarset::in, prog_constraint::in, io::di, io::uo) is det.
write_typeclass_info_var(Indent, AppendVarNums, RttiVarMaps, VarSet, TVarSet,
Constraint, !IO) :-
@@ -3287,12 +3217,12 @@
hlds_out__write_indent(Indent, !IO),
io__write_string(";\t", !IO),
hlds_out__write_ctor(C, TVarSet, TagValues, !IO),
- ( Cs = [] ->
- true
+ (
+ Cs = []
;
+ Cs = [_ | _],
io__write_string("\n", !IO),
- hlds_out__write_constructors_2(Indent, TVarSet, Cs, TagValues,
- !IO)
+ hlds_out__write_constructors_2(Indent, TVarSet, Cs, TagValues, !IO)
).
:- pred hlds_out__write_ctor(constructor::in, tvarset::in,
@@ -3318,8 +3248,8 @@
hlds_out__write_indent(Indent, !IO),
io__write_string("%-------- Classes --------\n", !IO),
map__to_assoc_list(ClassTable, ClassTableList),
- io__write_list(ClassTableList, "\n",
- hlds_out__write_class_defn(Indent), !IO),
+ io__write_list(ClassTableList, "\n", hlds_out__write_class_defn(Indent),
+ !IO),
io__nl(!IO).
:- pred hlds_out__write_class_defn(int::in,
@@ -3481,8 +3411,7 @@
hlds_out__write_instance_defn(Indent, InstanceDefn, !IO) :-
InstanceDefn = hlds_instance_defn(_InstanceModule, _Status,
- Context, Constraints, Types, Body,
- MaybePredProcIds, VarSet, Proofs),
+ Context, Constraints, Types, Body, MaybePredProcIds, VarSet, Proofs),
term__context_file(Context, FileName),
term__context_line(Context, LineNumber),
@@ -3540,9 +3469,8 @@
;
MaybePredProcIds = no
),
-
- hlds_out__write_constraint_proofs(Indent, VarSet, Proofs,
- AppendVarNums, !IO),
+ hlds_out__write_constraint_proofs(Indent, VarSet, Proofs, AppendVarNums,
+ !IO),
io__nl(!IO).
%-----------------------------------------------------------------------------%
@@ -3719,13 +3647,11 @@
io__write_string("TopCSD is ", !IO),
mercury_output_var(TopCSD, VarSet, AppendVarNums, !IO),
io__write_string(", MiddleCSD is ", !IO),
- mercury_output_var(MiddleCSD, VarSet, AppendVarNums,
- !IO),
+ mercury_output_var(MiddleCSD, VarSet, AppendVarNums, !IO),
(
MaybeOldOutermost = yes(OldOutermost),
io__write_string(", OldOutermost is ", !IO),
- mercury_output_var(OldOutermost, VarSet,
- AppendVarNums, !IO)
+ mercury_output_var(OldOutermost, VarSet, AppendVarNums, !IO)
;
MaybeOldOutermost = no
),
@@ -3739,8 +3665,8 @@
(
MaybeUntupleInfo = yes(UntupleInfo),
- hlds_out__write_untuple_info(UntupleInfo, VarSet,
- AppendVarNums, Indent, !IO)
+ hlds_out__write_untuple_info(UntupleInfo, VarSet, AppendVarNums,
+ Indent, !IO)
;
MaybeUntupleInfo = no
),
@@ -3751,16 +3677,13 @@
varset__init(ModeVarSet),
(
PredOrFunc = predicate,
- mercury_output_pred_mode_decl(ModeVarSet,
- unqualified(PredName), HeadModes,
- DeclaredDeterminism, ModeContext, !IO)
+ mercury_output_pred_mode_decl(ModeVarSet, unqualified(PredName),
+ HeadModes, DeclaredDeterminism, ModeContext, !IO)
;
PredOrFunc = function,
- pred_args_to_func_args(HeadModes, FuncHeadModes,
- RetHeadMode),
- mercury_output_func_mode_decl(ModeVarSet,
- unqualified(PredName), FuncHeadModes, RetHeadMode,
- DeclaredDeterminism, ModeContext, !IO)
+ pred_args_to_func_args(HeadModes, FuncHeadModes, RetHeadMode),
+ mercury_output_func_mode_decl(ModeVarSet, unqualified(PredName),
+ FuncHeadModes, RetHeadMode, DeclaredDeterminism, ModeContext, !IO)
),
(
@@ -3793,12 +3716,12 @@
;
proc_info_stack_slots(Proc, StackSlots),
hlds_out__write_indent(Indent, !IO),
- hlds_out__write_stack_slots(Indent, StackSlots, VarSet,
- AppendVarNums, !IO),
+ hlds_out__write_stack_slots(Indent, StackSlots, VarSet, AppendVarNums,
+ !IO),
hlds_out__write_indent(Indent, !IO),
term__var_list_to_term_list(HeadVars, HeadTerms),
- hlds_out__write_clause_head(ModuleInfo, PredId, VarSet,
- AppendVarNums, HeadTerms, PredOrFunc, !IO),
+ hlds_out__write_clause_head(ModuleInfo, PredId, VarSet, AppendVarNums,
+ HeadTerms, PredOrFunc, !IO),
io__write_string(" :-\n", !IO),
hlds_out__write_goal(Goal, ModuleInfo, VarSet, AppendVarNums,
Indent1, ".\n", !IO)
@@ -3874,8 +3797,7 @@
io__write_string("% Proofs: \n", !IO),
map__to_assoc_list(Proofs, ProofsList),
io__write_list(ProofsList, "\n",
- hlds_out__write_constraint_proof(Indent,
- VarSet, AppendVarNums), !IO).
+ hlds_out__write_constraint_proof(Indent, VarSet, AppendVarNums), !IO).
:- pred hlds_out__write_constraint_proof(int::in, tvarset::in, bool::in,
pair(prog_constraint, constraint_proof)::in, io::di, io::uo) is det.
@@ -3950,23 +3872,19 @@
mode_to_term(Context, (InstA -> InstB)) = Term :-
(
- %
- % check for higher-order pred or func modes, and output them
- % in a nice format
- %
+ % Check for higher-order pred or func modes, and output them
+ % in a nice format.
InstA = ground(_Uniq, higher_order(_)),
InstB = InstA
->
Term = inst_to_term(InstA, Context)
;
construct_qualified_term(unqualified(">>"),
- [inst_to_term(InstA, Context),
- inst_to_term(InstB, Context)],
+ [inst_to_term(InstA, Context), inst_to_term(InstB, Context)],
Context, Term)
).
mode_to_term(Context, user_defined_mode(Name, Args)) = Term :-
- construct_qualified_term(Name,
- list__map(map_inst_to_term(Context), Args),
+ construct_qualified_term(Name, list__map(map_inst_to_term(Context), Args),
Context, Term).
:- func make_atom(string, prog_context) = prog_term.
@@ -3995,7 +3913,7 @@
(
GroundInstInfo = higher_order(pred_inst_info(PredOrFunc,
Modes, Det)),
- /* XXX we ignore Uniq */
+ % XXX we ignore Uniq
(
PredOrFunc = predicate,
construct_qualified_term(unqualified("pred"),
@@ -4022,8 +3940,7 @@
inst_to_term(constrained_inst_vars(Vars, Inst), Context) =
set__fold(func(Var, Term) =
term__functor(term__atom("=<"),
- [term__coerce(term__variable(Var)), Term],
- Context),
+ [term__coerce(term__variable(Var)), Term], Context),
Vars, inst_to_term(Inst, Context)).
inst_to_term(abstract_inst(Name, Args), Context) =
inst_name_to_term(user_inst(Name, Args), Context).
@@ -4112,8 +4029,7 @@
;
BoundInsts = [_ | _],
construct_qualified_term(unqualified(";"),
- [FirstTerm,
- bound_insts_to_term(BoundInsts, Context)],
+ [FirstTerm, bound_insts_to_term(BoundInsts, Context)],
Context, Term)
)
;
@@ -4194,15 +4110,13 @@
( set__member(InstName, ExpandedInstInfo ^ eii_expansions) ->
add_string("...", !S)
; InstName = user_inst(_, _) ->
- % don't expand user-defined insts, just output them as is
+ % Don't expand user-defined insts, just output them as is
% (we do expand any compiler-defined insts that occur
- % in the arguments of the user-defined inst, however)
+ % in the arguments of the user-defined inst, however).
mercury_format_inst_name(InstName, ExpandedInstInfo, !S)
;
- inst_lookup(ExpandedInstInfo ^ eii_module_info, InstName,
- Inst),
- set__insert(ExpandedInstInfo ^ eii_expansions, InstName,
- Expansions),
+ inst_lookup(ExpandedInstInfo ^ eii_module_info, InstName, Inst),
+ set__insert(ExpandedInstInfo ^ eii_expansions, InstName, Expansions),
mercury_format_inst(Inst,
ExpandedInstInfo ^ eii_expansions := Expansions, !S)
).
@@ -4215,8 +4129,7 @@
mercury_expanded_inst_to_string(Inst, VarSet, ModuleInfo) = String :-
set__init(Expansions),
mercury_format_inst(Inst,
- expanded_inst_info(VarSet, ModuleInfo, Expansions),
- "", String).
+ expanded_inst_info(VarSet, ModuleInfo, Expansions), "", String).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
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
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
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