[m-rev.] diff: make the debugger use committed choice deconstructions
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Jan 28 18:20:18 AEDT 2002
Estimated hours taken: 2
Branches: main
browser/*.m:
Make the debugger use the committed choice versions of the
deconstruction predicates, and propagate the committed choice
environment up the call chain as far as necessary.
Zoltan.
cvs diff: Diffing .
Index: browse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browse.m,v
retrieving revision 1.25
diff -u -b -r1.25 browse.m
--- browse.m 2002/01/17 11:28:54 1.25
+++ browse.m 2002/01/22 01:39:19
@@ -26,17 +26,17 @@
% The interactive term browser. The caller type will be `browse', and
% the default format for the `browse' caller type will be used.
%
-:- pred browse__browse(T, io__input_stream, io__output_stream,
- maybe(list(dir)), browser_persistent_state,
- browser_persistent_state, io__state, io__state).
-:- mode browse__browse(in, in, in, out, in, out, di, uo) is det.
+:- pred browse__browse(T::in, io__input_stream::in,
+ io__output_stream::in, maybe(list(dir))::out,
+ browser_persistent_state::in, browser_persistent_state::out,
+ io__state::di, io__state::uo) is cc_multi.
% As above, except that the supplied format will override the default.
%
-:- pred browse__browse_format(T, io__input_stream, io__output_stream,
- portray_format, browser_persistent_state,
- browser_persistent_state, io__state, io__state).
-:- mode browse__browse_format(in, in, in, in, in, out, di, uo) is det.
+:- pred browse__browse_format(T::in, io__input_stream::in,
+ io__output_stream::in, portray_format::in,
+ browser_persistent_state::in, browser_persistent_state::out,
+ io__state::di, io__state::uo) is cc_multi.
% A version of browse__browse that works on synthetic terms
% in the sense of browser_info:browser_term.
@@ -44,7 +44,7 @@
:- pred browse__browse_synthetic(string::in, list(univ)::in, bool::in,
io__input_stream::in, io__output_stream::in, maybe(list(dir))::out,
browser_persistent_state::in, browser_persistent_state::out,
- io__state::di, io__state::uo) is det.
+ io__state::di, io__state::uo) is cc_multi.
% A version of browse__browse_format that works on synthetic terms
% in the sense of browser_info:browser_term.
@@ -52,42 +52,46 @@
:- pred browse__browse_format_synthetic(string::in, list(univ)::in, bool::in,
io__input_stream::in, io__output_stream::in, portray_format::in,
browser_persistent_state::in, browser_persistent_state::out,
- io__state::di, io__state::uo) is det.
+ io__state::di, io__state::uo) is cc_multi.
% The browser interface for the external debugger. The caller type
% will be `browse', and the default format will be used.
%
-:- pred browse__browse_external(T, io__input_stream, io__output_stream,
- browser_persistent_state, browser_persistent_state,
- io__state, io__state).
-:- mode browse__browse_external(in, in, in, in, out, di, uo) is det.
+:- pred browse__browse_external(T::in, io__input_stream::in,
+ io__output_stream::in,
+ browser_persistent_state::in, browser_persistent_state::out,
+ io__state::di, io__state::uo) is cc_multi.
% The non-interactive term browser. The caller type should be either
% `print' or `print_all'. The default portray format for that
% caller type is used.
%
:- pred browse__print(T::in, io__output_stream::in, browse_caller_type::in,
- browser_persistent_state::in, io__state::di, io__state::uo) is det.
+ browser_persistent_state::in, io__state::di, io__state::uo)
+ is cc_multi.
% A version of browse__print that works on synthetic terms
% in the sense of browser_info:browser_term.
%
:- pred browse__print_synthetic(string::in, list(univ)::in, bool::in,
io__output_stream::in, browse_caller_type::in,
- browser_persistent_state::in, io__state::di, io__state::uo) is det.
+ browser_persistent_state::in, io__state::di, io__state::uo)
+ is cc_multi.
% As above, except that the supplied format will override the default.
%
:- pred browse__print_format(T::in, io__output_stream::in,
browse_caller_type::in, portray_format::in,
- browser_persistent_state::in, io__state::di, io__state::uo) is det.
+ browser_persistent_state::in, io__state::di, io__state::uo)
+ is cc_multi.
% A version of browse__print_format that works on synthetic terms
% in the sense of browser_info:browser_term.
%
:- pred browse__print_format_synthetic(string::in, list(univ)::in, bool::in,
io__output_stream::in, browse_caller_type::in, portray_format::in,
- browser_persistent_state::in, io__state::di, io__state::uo) is det.
+ browser_persistent_state::in, io__state::di, io__state::uo)
+ is cc_multi.
% Estimate the total term size, in characters,
% We count the number of characters in the functor,
@@ -105,10 +109,10 @@
% negative, term_size_left_from_max will return a negative difference
% but the value will usually not be accurate, since in such cases
% by definition the caller is not interested in the accurate value.
-:- pred term_size_left_from_max(univ::in, int::in, int::out) is det.
+:- pred term_size_left_from_max(univ::in, int::in, int::out) is cc_multi.
:- pred browser_term_size_left_from_max(browser_term::in,
- int::in, int::out) is det.
+ int::in, int::out) is cc_multi.
%---------------------------------------------------------------------------%
:- implementation.
@@ -189,7 +193,8 @@
:- pred browse__print_common(browser_term::in, io__output_stream::in,
browse_caller_type::in, maybe(portray_format)::in,
- browser_persistent_state::in, io__state::di, io__state::uo) is det.
+ browser_persistent_state::in, io__state::di, io__state::uo)
+ is cc_multi.
browse__print_common(BrowserTerm, OutputStream, Caller, MaybeFormat, State) -->
{ Info = browser_info__init(BrowserTerm, MaybeFormat, State) },
@@ -246,7 +251,8 @@
:- pred browse_common(debugger::in, browser_term::in, io__input_stream::in,
io__output_stream::in, maybe(portray_format)::in,
maybe(list(dir))::out, browser_persistent_state::in,
- browser_persistent_state::out, io__state::di, io__state::uo) is det.
+ browser_persistent_state::out, io__state::di, io__state::uo)
+ is cc_multi.
browse_common(Debugger, Object, InputStream, OutputStream, MaybeFormat,
MaybeMark, State0, State) -->
@@ -283,9 +289,8 @@
yes(Return))
).
-:- pred browse_main_loop(debugger, browser_info, browser_info,
- io__state, io__state).
-:- mode browse_main_loop(in, in, out, di, uo) is det.
+:- pred browse_main_loop(debugger::in, browser_info::in, browser_info::out,
+ io__state::di, io__state::uo) is cc_multi.
browse_main_loop(Debugger, Info0, Info) -->
(
@@ -313,15 +318,17 @@
).
:- pred startup_message(debugger::in, io__state::di, io__state::uo) is det.
+
startup_message(Debugger) -->
write_string_debugger(Debugger, "-- Simple Mercury Term Browser.\n"),
write_string_debugger(Debugger, "-- Type \"help\" for help.\n\n").
:- pred prompt(string::out) is det.
+
prompt("browser> ").
:- pred run_command(debugger::in, command::in, bool::out, browser_info::in,
- browser_info::out, io__state::di, io__state::uo) is det.
+ browser_info::out, io__state::di, io__state::uo) is cc_multi.
run_command(Debugger, Command, Quit, Info0, Info) -->
% XXX The commands `set', `ls' and `print' should allow the format
@@ -452,9 +459,9 @@
% Various pretty-print routines
%
-:- pred portray(debugger, browse_caller_type, maybe(portray_format),
- browser_info, io__state, io__state).
-:- mode portray(in, in, in, in, di, uo) is det.
+:- pred portray(debugger::in, browse_caller_type::in,
+ maybe(portray_format)::in, browser_info::in,
+ io__state::di, io__state::uo) is cc_multi.
portray(Debugger, Caller, MaybeFormat, Info) -->
{ browser_info__get_format(Info, Caller, MaybeFormat, Format) },
@@ -479,18 +486,17 @@
write_string_debugger(Debugger, "error: no such subterm")
),
nl_debugger(Debugger).
-
-:- pred portray_path(debugger, browse_caller_type, maybe(portray_format),
- browser_info, path, io__state, io__state).
-:- mode portray_path(in, in, in, in, in, di, uo) is det.
+:- pred portray_path(debugger::in, browse_caller_type::in,
+ maybe(portray_format)::in, browser_info::in, path::in,
+ io__state::di, io__state::uo) is cc_multi.
portray_path(Debugger, Caller, MaybeFormat, Info0, Path) -->
{ set_path(Path, Info0, Info) },
portray(Debugger, Caller, MaybeFormat, Info).
:- pred portray_flat(debugger::in, browser_term::in, format_params::in,
- io__state::di, io__state::uo) is det.
+ io__state::di, io__state::uo) is cc_multi.
portray_flat(Debugger, BrowserTerm, Params) -->
%
@@ -536,7 +542,7 @@
).
:- pred portray_verbose(debugger::in, browser_term::in, format_params::in,
- io__state::di, io__state::uo) is det.
+ io__state::di, io__state::uo) is cc_multi.
portray_verbose(Debugger, BrowserTerm, Params) -->
{ browser_term_to_string_verbose(BrowserTerm, Params ^ size,
@@ -552,7 +558,7 @@
write_string_debugger(Debugger, Str).
:- pred portray_pretty(debugger::in, browser_term::in, format_params::in,
- io__state::di, io__state::uo) is det.
+ io__state::di, io__state::uo) is cc_multi.
portray_pretty(Debugger, BrowserTerm, Params) -->
{ sized_pretty__browser_term_to_string_line(BrowserTerm,
@@ -570,7 +576,7 @@
->
RemainingSize = MaxSize
;
- limited_deconstruct(univ_value(Univ), MaxSize,
+ limited_deconstruct_cc(univ_value(Univ), MaxSize,
Functor, Arity, Args)
->
string__length(Functor, FunctorSize),
@@ -611,7 +617,7 @@
%
:- pred browser_term_to_string(browser_term::in, int::in, int::in,
- string::out) is det.
+ string::out) is cc_multi.
browser_term_to_string(BrowserTerm, MaxSize, MaxDepth, Str) :-
CurSize = 0,
@@ -623,15 +629,15 @@
% further subterms compressed. We don't just stop printing.
% XXX: Is this reasonable?
:- pred browser_term_to_string_2(browser_term::in, int::in, int::in, int::out,
- int::in, int::in, string::out) is det.
+ int::in, int::in, string::out) is cc_multi.
browser_term_to_string_2(BrowserTerm, MaxSize, CurSize, NewSize,
MaxDepth, CurDepth, Str) :-
(
CurSize < MaxSize,
CurDepth < MaxDepth,
- limited_deconstruct_browser_term(BrowserTerm, MaxSize, Functor,
- _Arity, Args, MaybeReturn)
+ limited_deconstruct_browser_term_cc(BrowserTerm, MaxSize,
+ Functor, _Arity, Args, MaybeReturn)
->
CurSize1 = CurSize + 1,
CurDepth1 = CurDepth + 1,
@@ -657,7 +663,7 @@
).
:- pred args_to_string_list(list(univ)::in, int::in, int::in, int::out,
- int::in, int::in, list(string)::out) is det.
+ int::in, int::in, list(string)::out) is cc_multi.
args_to_string_list([], _MaxSize, CurSize, NewSize,
_MaxDepth, _CurDepth, Strs) :-
@@ -695,10 +701,10 @@
string__append_list([S1, ", ", Rest], Str)
).
-:- pred browser_term_compress(browser_term::in, string::out) is det.
+:- pred browser_term_compress(browser_term::in, string::out) is cc_multi.
browser_term_compress(BrowserTerm, Str) :-
- functor_browser_term(BrowserTerm, Functor, Arity, IsFunc),
+ functor_browser_term_cc(BrowserTerm, Functor, Arity, IsFunc),
( Arity = 0 ->
Str = Functor
;
@@ -738,7 +744,7 @@
%
:- pred browser_term_to_string_verbose(browser_term::in, int::in, int::in,
- int::in, int::in, string::out) is det.
+ int::in, int::in, string::out) is cc_multi.
browser_term_to_string_verbose(BrowserTerm, MaxSize, MaxDepth, X, Y, Str) :-
CurSize = 0,
@@ -749,15 +755,15 @@
unlines(ClippedFrame, Str).
:- pred browser_term_to_string_verbose_2(browser_term::in, int::in, int::in,
- int::out, int::in, int::in, frame::out) is det.
+ int::out, int::in, int::in, frame::out) is cc_multi.
browser_term_to_string_verbose_2(BrowserTerm, MaxSize, CurSize, NewSize,
MaxDepth, CurDepth, Frame) :-
(
CurSize < MaxSize,
CurDepth < MaxDepth,
- limited_deconstruct_browser_term(BrowserTerm, MaxSize, Functor,
- _Arity, Args0, MaybeReturn)
+ limited_deconstruct_browser_term_cc(BrowserTerm, MaxSize,
+ Functor, _Arity, Args0, MaybeReturn)
->
% XXX we should consider formatting function terms differently.
(
@@ -780,7 +786,7 @@
).
:- pred args_to_string_verbose_list(list(univ)::in, int::in, int::in,
- int::in, int::out, int::in, int::in, frame::out) is det.
+ int::in, int::out, int::in, int::in, frame::out) is cc_multi.
args_to_string_verbose_list([], _ArgNum, _MaxSize, CurSize, NewSize,
_MaxDepth, _CurDepth, []) :-
Index: browser_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browser_info.m,v
retrieving revision 1.6
diff -u -b -r1.6 browser_info.m
--- browser_info.m 2002/01/12 09:08:07 1.6
+++ browser_info.m 2002/01/12 13:01:04
@@ -140,21 +140,21 @@
%---------------------------------------------------------------------------%
-% These three predicates are like the deconstruct, limited_deconstruct and
-% functor procedures in std_util, except they work on browser_terms.
+% These three predicates are like the deconstruct_cc, limited_deconstruct_cc
+% and functor_cc procedures in std_util, except they work on browser_terms.
% This requires them to have an extra argument (the last). For deconstruct
% and limited_deconstruct, this returns the return value if the browser term
% represents a function call. For functor, it says whether the browser term
% represents a function call.
-:- pred deconstruct_browser_term(browser_term::in,
- string::out, int::out, list(univ)::out, maybe(univ)::out) is det.
+:- pred deconstruct_browser_term_cc(browser_term::in,
+ string::out, int::out, list(univ)::out, maybe(univ)::out) is cc_multi.
-:- pred limited_deconstruct_browser_term(browser_term::in, int::in,
- string::out, int::out, list(univ)::out, maybe(univ)::out) is semidet.
+:- pred limited_deconstruct_browser_term_cc(browser_term::in, int::in,
+ string::out, int::out, list(univ)::out, maybe(univ)::out) is cc_nondet.
-:- pred functor_browser_term(browser_term::in, string::out, int::out,
- bool::out) is det.
+:- pred functor_browser_term_cc(browser_term::in, string::out, int::out,
+ bool::out) is cc_multi.
%---------------------------------------------------------------------------%
@@ -448,21 +448,21 @@
%---------------------------------------------------------------------------%
-deconstruct_browser_term(BrowserTerm, Functor, Arity, Args, MaybeReturn) :-
+deconstruct_browser_term_cc(BrowserTerm, Functor, Arity, Args, MaybeReturn) :-
(
BrowserTerm = plain_term(Univ),
- deconstruct(univ_value(Univ), Functor, Arity, Args),
+ deconstruct_cc(univ_value(Univ), Functor, Arity, Args),
MaybeReturn = no
;
BrowserTerm = synthetic_term(Functor, Args, MaybeReturn),
list__length(Args, Arity)
).
-limited_deconstruct_browser_term(BrowserTerm, Limit, Functor, Arity, Args,
+limited_deconstruct_browser_term_cc(BrowserTerm, Limit, Functor, Arity, Args,
MaybeReturn) :-
(
BrowserTerm = plain_term(Univ),
- limited_deconstruct(univ_value(Univ), Limit,
+ limited_deconstruct_cc(univ_value(Univ), Limit,
Functor, Arity, Args),
MaybeReturn = no
;
@@ -470,10 +470,10 @@
list__length(Args, Arity)
).
-functor_browser_term(BrowserTerm, Functor, Arity, IsFunc) :-
+functor_browser_term_cc(BrowserTerm, Functor, Arity, IsFunc) :-
(
BrowserTerm = plain_term(Univ),
- functor(univ_value(Univ), Functor, Arity),
+ functor_cc(univ_value(Univ), Functor, Arity),
IsFunc = no
;
BrowserTerm = synthetic_term(Functor, Args, MaybeReturn),
Index: declarative_debugger.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_debugger.m,v
retrieving revision 1.21
diff -u -b -r1.21 declarative_debugger.m
--- declarative_debugger.m 2001/04/23 16:26:26 1.21
+++ declarative_debugger.m 2002/01/28 07:19:31
@@ -1,5 +1,5 @@
%-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 The University of Melbourne.
% This file may only be copied under the terms of the GNU Library General
% Public License - see the file COPYING.LIB in the Mercury distribution.
%-----------------------------------------------------------------------------%
@@ -161,10 +161,9 @@
diagnoser_state(R)).
:- mode diagnoser_state_init(in, in, out) is det.
-:- pred diagnosis(S, R, diagnoser_response, diagnoser_state(R),
- diagnoser_state(R), io__state, io__state)
- <= annotated_trace(S, R).
-:- mode diagnosis(in, in, out, in, out, di, uo) is det.
+:- pred diagnosis(S::in, R::in, diagnoser_response::out,
+ diagnoser_state(R)::in, diagnoser_state(R)::out,
+ io__state::di, io__state::uo) is cc_multi <= annotated_trace(S, R).
%-----------------------------------------------------------------------------%
@@ -214,10 +213,10 @@
handle_analyser_response(Store, AnalyserResponse, Response,
Diagnoser1, Diagnoser).
-:- pred handle_analyser_response(S, analyser_response(edt_node(R)),
- diagnoser_response, diagnoser_state(R), diagnoser_state(R),
- io__state, io__state) <= annotated_trace(S, R).
-:- mode handle_analyser_response(in, in, out, in, out, di, uo) is det.
+:- pred handle_analyser_response(S::in, analyser_response(edt_node(R))::in,
+ diagnoser_response::out,
+ diagnoser_state(R)::in, diagnoser_state(R)::out,
+ io__state::di, io__state::uo) is cc_multi <= annotated_trace(S, R).
handle_analyser_response(_, no_suspects, no_bug_found, D, D) -->
io__write_string("No bug found.\n").
@@ -244,10 +243,10 @@
Response = require_subtree(Event, Seqno)
}.
-:- pred handle_oracle_response(S, oracle_response, diagnoser_response,
- diagnoser_state(R), diagnoser_state(R), io__state, io__state)
- <= annotated_trace(S, R).
-:- mode handle_oracle_response(in, in, out, in, out, di, uo) is det.
+:- pred handle_oracle_response(S::in, oracle_response::in,
+ diagnoser_response::out,
+ diagnoser_state(R)::in, diagnoser_state(R)::out,
+ io__state::di, io__state::uo) is cc_multi <= annotated_trace(S, R).
handle_oracle_response(Store, oracle_answers(Answers), Response, Diagnoser0,
Diagnoser) -->
@@ -265,9 +264,9 @@
handle_oracle_response(_, abort_diagnosis, no_bug_found, D, D) -->
io__write_string("Diagnosis aborted.\n").
-:- pred confirm_bug(decl_bug, diagnoser_response, diagnoser_state(R),
- diagnoser_state(R), io__state, io__state).
-:- mode confirm_bug(in, out, in, out, di, uo) is det.
+:- pred confirm_bug(decl_bug::in, diagnoser_response::out,
+ diagnoser_state(R)::in, diagnoser_state(R)::out,
+ io__state::di, io__state::uo) is cc_multi.
confirm_bug(Bug, Response, Diagnoser0, Diagnoser) -->
{ diagnoser_get_oracle(Diagnoser0, Oracle0) },
@@ -301,10 +300,10 @@
% Export a monomorphic version of diagnosis/9, to make it
% easier to call from C code.
%
-:- pred diagnosis_store(trace_node_store, trace_node_id, diagnoser_response,
- diagnoser_state(trace_node_id), diagnoser_state(trace_node_id),
- io__state, io__state).
-:- mode diagnosis_store(in, in, out, in, out, di, uo) is det.
+:- pred diagnosis_store(trace_node_store::in, trace_node_id::in,
+ diagnoser_response::out, diagnoser_state(trace_node_id)::in,
+ diagnoser_state(trace_node_id)::out, io__state::di, io__state::uo)
+ is cc_multi.
:- pragma export(diagnosis_store(in, in, out, in, out, di, uo),
"MR_DD_decl_diagnosis").
Index: declarative_oracle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_oracle.m,v
retrieving revision 1.10
diff -u -b -r1.10 declarative_oracle.m
--- declarative_oracle.m 2001/04/23 16:26:27 1.10
+++ declarative_oracle.m 2002/01/28 07:19:33
@@ -1,5 +1,5 @@
%-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 The University of Melbourne.
% This file may only be copied under the terms of the GNU Library General
% Public License - see the file COPYING.LIB in the Mercury distribution.
%-----------------------------------------------------------------------------%
@@ -51,15 +51,15 @@
% state is threaded through so its contents can be updated after
% user responses.
%
-:- pred query_oracle(list(decl_question), oracle_response, oracle_state,
- oracle_state, io__state, io__state).
-:- mode query_oracle(in, out, in, out, di, uo) is det.
+:- pred query_oracle(list(decl_question)::in, oracle_response::out,
+ oracle_state::in, oracle_state::out, io__state::di, io__state::uo)
+ is cc_multi.
% Confirm that the node found is indeed an e_bug or an i_bug.
%
-:- pred oracle_confirm_bug(decl_bug, decl_confirmation, oracle_state,
- oracle_state, io__state, io__state).
-:- mode oracle_confirm_bug(in, out, in, out, di, uo) is det.
+:- pred oracle_confirm_bug(decl_bug::in, decl_confirmation::out,
+ oracle_state::in, oracle_state::out, io__state::di, io__state::uo)
+ is cc_multi.
%-----------------------------------------------------------------------------%
Index: declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.14
diff -u -b -r1.14 declarative_user.m
--- declarative_user.m 2001/04/23 16:26:27 1.14
+++ declarative_user.m 2002/01/28 07:19:35
@@ -1,5 +1,5 @@
%-----------------------------------------------------------------------------%
-% Copyright (C) 1999-2001 The University of Melbourne.
+% Copyright (C) 1999-2002 The University of Melbourne.
% This file may only be copied under the terms of the GNU Library General
% Public License - see the file COPYING.LIB in the Mercury distribution.
%-----------------------------------------------------------------------------%
@@ -32,15 +32,15 @@
% and is asked to respond about the truth of the node in the
% intended interpretation.
%
-:- pred query_user(list(decl_question), user_response, user_state, user_state,
- io__state, io__state).
-:- mode query_user(in, out, in, out, di, uo) is det.
+:- pred query_user(list(decl_question)::in, user_response::out,
+ user_state::in, user_state::out, io__state::di, io__state::uo)
+ is cc_multi.
% Confirm that the node found is indeed an e_bug or an i_bug.
%
-:- pred user_confirm_bug(decl_bug, decl_confirmation, user_state, user_state,
- io__state, io__state).
-:- mode user_confirm_bug(in, out, in, out, di, uo) is det.
+:- pred user_confirm_bug(decl_bug::in, decl_confirmation::out,
+ user_state::in, user_state::out, io__state::di, io__state::uo)
+ is cc_multi.
%-----------------------------------------------------------------------------%
@@ -65,9 +65,9 @@
query_user(Nodes, Response, User0, User) -->
query_user_2(Nodes, [], Response, User0, User).
-:- pred query_user_2(list(decl_question), list(decl_question), user_response,
- user_state, user_state, io__state, io__state).
-:- mode query_user_2(in, in, out, in, out, di, uo) is det.
+:- pred query_user_2(list(decl_question)::in, list(decl_question)::in,
+ user_response::out, user_state::in, user_state::out,
+ io__state::di, io__state::uo) is cc_multi.
query_user_2([], _, no_user_answer, User, User) -->
[].
@@ -129,8 +129,8 @@
decl_question_prompt(unexpected_exception(_, _), "Expected? ").
:- pred browse_edt_node(decl_question::in, int::in, maybe(term_path)::out,
- user_state::in, user_state::out, io__state::di,
- io__state::uo) is det.
+ user_state::in, user_state::out, io__state::di, io__state::uo)
+ is cc_multi.
browse_edt_node(Node, ArgNum, MaybeMark, User0, User) -->
{
@@ -142,9 +142,8 @@
},
browse_atom_argument(Atom, ArgNum, MaybeMark, User0, User).
-:- pred browse_decl_bug(decl_bug, int, user_state, user_state,
- io__state, io__state).
-:- mode browse_decl_bug(in, in, in, out, di, uo) is det.
+:- pred browse_decl_bug(decl_bug::in, int::in, user_state::in, user_state::out,
+ io__state::di, io__state::uo) is cc_multi.
browse_decl_bug(Bug, ArgNum, User0, User) -->
{
@@ -162,8 +161,8 @@
browse_atom_argument(Atom, ArgNum, _, User0, User).
:- pred browse_atom_argument(decl_atom::in, int::in, maybe(term_path)::out,
- user_state::in, user_state::out, io__state::di,
- io__state::uo) is det.
+ user_state::in, user_state::out, io__state::di, io__state::uo)
+ is cc_multi.
browse_atom_argument(Atom, ArgNum, MaybeMark, User0, User) -->
{ Atom = atom(_, _, Args) },
@@ -332,8 +331,8 @@
% Display the node in user readable form on the current
% output stream.
%
-:- pred write_decl_question(decl_question, user_state, io__state, io__state).
-:- mode write_decl_question(in, in, di, uo) is det.
+:- pred write_decl_question(decl_question::in, user_state::in,
+ io__state::di, io__state::uo) is cc_multi.
write_decl_question(wrong_answer(Atom), User) -->
write_decl_atom(User, "", Atom).
@@ -355,8 +354,8 @@
io__print(User^outstr, Exception),
io__nl(User^outstr).
-:- pred write_decl_bug(decl_bug, user_state, io__state, io__state).
-:- mode write_decl_bug(in, in, di, uo) is det.
+:- pred write_decl_bug(decl_bug::in, user_state::in,
+ io__state::di, io__state::uo) is cc_multi.
write_decl_bug(e_bug(EBug), User) -->
(
@@ -382,8 +381,8 @@
write_decl_atom(User, "Parent ", Parent),
write_decl_atom(User, "Call ", Call).
-:- pred write_decl_atom(user_state, string, decl_atom, io__state, io__state).
-:- mode write_decl_atom(in, in, in, di, uo) is det.
+:- pred write_decl_atom(user_state::in, string::in, decl_atom::in,
+ io__state::di, io__state::uo) is cc_multi.
write_decl_atom(User, Indent, Atom) -->
io__write_string(User^outstr, Indent),
@@ -394,28 +393,26 @@
% it out directly so that all arguments are put on the
% same line.
%
- (
- { check_decl_atom_size(Indent, Atom) }
- ->
+ { check_decl_atom_size(Indent, Atom, RemSize) },
+ ( { RemSize > 0 } ->
write_decl_atom_direct(User^outstr, Atom)
;
write_decl_atom_limited(Atom, User)
).
-:- pred check_decl_atom_size(string, decl_atom).
-:- mode check_decl_atom_size(in, in) is semidet.
+:- pred check_decl_atom_size(string, decl_atom, int).
+:- mode check_decl_atom_size(in, in, out) is cc_multi.
-check_decl_atom_size(Indent, atom(_, Functor, Args)) :-
+check_decl_atom_size(Indent, atom(_, Functor, Args), RemSize) :-
decl_atom_size_limit(RemSize0),
string__length(Indent, I),
string__length(Functor, F),
P = 2, % parentheses
RemSize1 = RemSize0 - I - F - P,
- size_left_after_args(Args, RemSize1, RemSize),
- RemSize > 0.
+ size_left_after_args(Args, RemSize1, RemSize).
:- pred size_left_after_args(list(maybe(univ)), int, int).
-:- mode size_left_after_args(in, in, out) is det.
+:- mode size_left_after_args(in, in, out) is cc_multi.
size_left_after_args([]) -->
[].
@@ -430,8 +427,8 @@
decl_atom_size_limit(79).
-:- pred write_decl_atom_limited(decl_atom, user_state, io__state, io__state).
-:- mode write_decl_atom_limited(in, in, di, uo) is det.
+:- pred write_decl_atom_limited(decl_atom::in, user_state::in,
+ io__state::di, io__state::uo) is cc_multi.
write_decl_atom_limited(atom(PredOrFunc, Functor, Args), User) -->
write_decl_atom_category(User^outstr, PredOrFunc),
@@ -448,8 +445,8 @@
write_decl_atom_category(OutStr, function) -->
io__write_string(OutStr, "func ").
-:- pred print_decl_atom_arg(user_state, maybe(univ), io__state, io__state).
-:- mode print_decl_atom_arg(in, in, di, uo) is det.
+:- pred print_decl_atom_arg(user_state::in, maybe(univ)::in,
+ io__state::di, io__state::uo) is cc_multi.
print_decl_atom_arg(User, yes(Arg)) -->
io__write_string(User^outstr, "\t"),
Index: sized_pretty.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/sized_pretty.m,v
retrieving revision 1.5
diff -u -b -r1.5 sized_pretty.m
--- sized_pretty.m 2002/01/12 09:08:08 1.5
+++ sized_pretty.m 2002/01/12 13:10:20
@@ -169,12 +169,12 @@
% of width LineWidth. It may throw an exception or cause a runtime
% abort if the term in question has no canonical representation.
:- pred sized_pretty__univ_to_string_line(univ::in, int::in, int::in,
- string::out) is det.
+ string::out) is cc_multi.
% The same as sized_pretty__univ_to_string_line, except works on
% browser_terms.
:- pred sized_pretty__browser_term_to_string_line(browser_term::in,
- int::in, int::in, string::out) is det.
+ int::in, int::in, string::out) is cc_multi.
%---------------------------------------------------------------------------%
@@ -249,7 +249,7 @@
% - adjusted measure parameter(s).
pred measured_split(browser_term::in, MeasureParams::in, T::in,
int::in, bool::in, T::out, maybe(T)::out, T::out,
- MeasureParams::out) is det
+ MeasureParams::out) is cc_multi
].
%---------------------------------------------------------------------------%
@@ -270,7 +270,7 @@
sized_pretty__browser_term_to_string_line(BrowserTerm, LineWidth, Lines,
String) :-
Params = measure_params(LineWidth),
- functor_browser_term(BrowserTerm, _Functor, Arity, _MaybeReturn),
+ functor_browser_term_cc(BrowserTerm, _Functor, Arity, _MaybeReturn),
(
Arity \= 0,
Lines \= 0,
@@ -294,7 +294,7 @@
% In the Second pass the space is evenly distributed between
% the terms and therefore the subterms are deconstructed evenly.
:- pred annotate_with_size(browser_term::in, MeasureParams::in, T::in,
- size_annotated_term(T)::out) is det
+ size_annotated_term(T)::out) is cc_multi
<= measure_with_params(T, MeasureParams).
annotate_with_size(BrowserTerm, Params, Limit, SizedTerm2) :-
@@ -304,13 +304,13 @@
%---------------------------------------------------------------------------%
:- pred first_pass(browser_term::in, MeasureParams::in, T::in,
- size_annotated_term(T)::out) is det
+ size_annotated_term(T)::out) is cc_multi
<= measure_with_params(T, MeasureParams).
first_pass(BrowserTerm, Params, Limit, Size) :-
MaxFunctors = maximum_functors(Limit, Params),
(
- limited_deconstruct_browser_term(BrowserTerm, MaxFunctors,
+ limited_deconstruct_browser_term_cc(BrowserTerm, MaxFunctors,
Functor, Arity, Args, _MaybeReturn)
->
measured_split(BrowserTerm, Params, Limit, Arity, yes,
@@ -341,7 +341,7 @@
% annotating the arguments.
:- pred annotate_args_with_size(list(univ)::in, maybe(T)::in,
MeasureParams::in, T::in, T::in, T::out, bool::in, bool::out,
- size_annotated_args(T)::out) is det <= measure_with_params(T,
+ size_annotated_args(T)::out) is cc_multi <= measure_with_params(T,
MeasureParams).
annotate_args_with_size([], _, _, _, SoFar, SoFar, Exact, Exact, []).
@@ -407,7 +407,7 @@
% If a term can be fully printed within the given space,
% ("exact" type) then the Term is not altered.
:- pred second_pass(size_annotated_term(T)::in, MeasureParams::in, T::in,
- size_annotated_term(T)::out) is det
+ size_annotated_term(T)::out) is cc_multi
<= measure_with_params(T, MeasureParams).
second_pass(OldSizeTerm, Params, Limit, NewSizeTerm) :-
@@ -499,7 +499,7 @@
% represented would be annoted again with a new limit
% (SplitLimit). The rest of the terms are left alone.
:- pred process_args(MeasureParams::in, size_annotated_args(T)::in, T::in,
- T::in, size_annotated_args(T)::out, T::out) is det <=
+ T::in, size_annotated_args(T)::out, T::out) is cc_multi <=
measure_with_params(T, MeasureParams).
process_args(_, [], _, _, [], zero_measure).
@@ -644,13 +644,16 @@
:- pred functor_count_split(browser_term::in, no_measure_params::in,
functor_count::in, int::in, bool::in, functor_count::out,
maybe(functor_count)::out, functor_count::out, no_measure_params::out)
- is det.
+ is cc_multi.
functor_count_split(_, Params, functor_count(Limit), Arity, _,
functor_count(1), MaybeArgLimit, functor_count(Limit),
Params) :-
( Arity = 0 ->
- MaybeArgLimit = no
+ % This artificial detism cast shuts up a warning about
+ % the true detism of functor_count_split being det.
+ MaybeArgLimit0 = no,
+ cc_multi_equal(MaybeArgLimit0, MaybeArgLimit)
;
( Limit =< Arity + 1 ->
MaybeArgLimit = no
@@ -714,12 +717,13 @@
:- pred char_count_split(browser_term::in, no_measure_params::in,
char_count::in, int::in, bool::in, char_count::out,
maybe(char_count)::out, char_count::out, no_measure_params::out)
- is det.
+ is cc_multi.
char_count_split(BrowserTerm, Params, char_count(Limit), Arity, Check,
char_count(FunctorSize), MaybeArgLimit, char_count(Limit),
Params) :-
- deconstruct_browser_term(BrowserTerm, Functor, _, Args, MaybeReturn),
+ deconstruct_browser_term_cc(BrowserTerm, Functor, _, Args,
+ MaybeReturn),
( Check = yes ->
get_arg_length(Args, TotalLength, _)
;
@@ -884,13 +888,13 @@
% the whole term should be printed on a single line.
:- pred size_count_split(browser_term::in, measure_params::in, size_count::in,
int::in, bool::in, size_count::out, maybe(size_count)::out,
- size_count::out, measure_params::out) is det.
+ size_count::out, measure_params::out) is cc_multi.
size_count_split(BrowserTerm, Params, Limit, Arity, Check, FunctorSize,
MaybeArgLimit, NewLimit, NewParams) :-
% LineWidth is length of the line in which the functor is printed.
Params = measure_params(LineWidth),
- deconstruct_browser_term(BrowserTerm, Functor, ActualArity, Args,
+ deconstruct_browser_term_cc(BrowserTerm, Functor, ActualArity, Args,
MaybeReturn),
FSize = string__length(Functor) + 2 * (ActualArity),
( Check = yes ->
--------------------------------------------------------------------------
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