[m-dev.] for review: use browser to print DD output

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Fri Aug 11 16:25:13 AEST 2000


Hi,

This is for review by anybody.

Cheers,
Mark.

Estimated hours taken: 8

Use the term browser to print arguments in the declarative debugger.

browser/browse.m:
	Remove (unused) io__state arguments from browse__init_state.
	Export term_size_left_from_max/3 for use by the declarative
	debugger.

browser/declarative_user.m:
	Add a browser_state field to the user_state type.
	
	Implement the `browse' command for checking questions as well as
	for verifying the bug that is reported at the end of the process.
	The original plan was to browse the whole atom at once, but this
	is not possible with the current browser, so we instead browse one
	argument at a time.  The `browse' command now expects an integer
	that specifies which argument.

	Modify write_decl_atom/5 so that it checks whether the atom size
	is below a certain limit.  If not, then it calls browse__print/5
	to do the output.

tests/debugger/declarative/app.exp:
tests/debugger/declarative/app.exp2:
tests/debugger/declarative/filter.exp:
tests/debugger/declarative/filter.exp2:
	Update test cases.

Index: browser/browse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browse.m,v
retrieving revision 1.14
diff -u -r1.14 browse.m
--- browser/browse.m	2000/05/22 06:46:05	1.14
+++ browser/browse.m	2000/08/11 05:33:13
@@ -20,15 +20,15 @@
 
 :- interface.
 
-:- import_module io.
+:- import_module io, std_util.
 
 	% an abstract data type that holds persistent browser settings,
 	% e.g. the maximum print depth
 :- type browser_state.
 
 	% initialize the browser state with default values
-:- pred browse__init_state(browser_state, io__state, io__state).
-:- mode browse__init_state(out, di, uo) is det.
+:- pred browse__init_state(browser_state).
+:- mode browse__init_state(out) is det.
 
 	% The interactive term browser.
 :- pred browse__browse(T, io__input_stream, io__output_stream,
@@ -44,6 +44,24 @@
 			io__state, io__state).
 :- mode browse__print(in, in, in, di, uo) is det.
 
+	% Estimate the total term size, in characters,
+	% We count the number of characters in the functor,
+	% plus two characters for each argument: "(" and ")"
+	% for the first, and ", " for each of the rest,
+	% plus the sizes of the arguments themselves.
+	% This is only approximate since it doesn't take into
+	% account all the special cases such as operators.
+	%
+	% This predicate returns not the estimated total term size,
+	% but the difference between the given maximum size the caller
+	% is interested in and the estimated total term size.
+	% This difference is positive if the term is smaller than the
+	% maximum and negative if it is bigger. If the difference is
+	% 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.
+
 %---------------------------------------------------------------------------%
 :- implementation.
 
@@ -56,7 +74,7 @@
 % they are used in trace/mercury_trace_browser.c.
 %
 
-:- pragma export(browse__init_state(out, di, uo),
+:- pragma export(browse__init_state(out),
 	"ML_BROWSE_init_state").
 :- pragma export(browse__browse(in, in, in, in, out, di, uo),
 	"ML_BROWSE_browse").
@@ -89,16 +107,29 @@
 	;	external.
 
 %---------------------------------------------------------------------------%
+
+browse__init_state(State) :-
+	% We need to supply an object to initialize the state,
+	% but this object won't be used, since the first call
+	% to browse__browse will overwrite it.  So we just supply
+	% a dummy object -- it doesn't matter what its type or value is.
+	DummyObject = "",
+	type_to_univ(DummyObject, Univ),
+	default_depth(DefaultDepth),
+	MaxTermSize = 10,
+	DefaultFormat = verbose,
+	ClipX = 79,
+	ClipY = 25,
+	State = browser_state(Univ, DefaultDepth, MaxTermSize, [],
+			DefaultFormat, ClipX, ClipY).
 
-browse__init_state(State) -->
-	{ default_state(State) }.
 
 % return the type_info for a browser_state type
 :- pred browse__browser_state_type(type_desc).
 :- mode browse__browser_state_type(out) is det.
 
 browse__browser_state_type(Type) :-
-	default_state(State),
+	browse__init_state(State),
 	Type = type_of(State).
 
 %---------------------------------------------------------------------------%
@@ -160,23 +191,6 @@
 	list__foldl(AddSizes, ArgSizes, Arity * 2, TotalArgsSize),
 	TotalSize = TotalArgsSize + FunctorSize.
 
-	% Estimate the total term size, in characters,
-	% We count the number of characters in the functor,
-	% plus two characters for each argument: "(" and ")"
-	% for the first, and ", " for each of the rest,
-	% plus the sizes of the arguments themselves.
-	% This is only approximate since it doesn't take into
-	% account all the special cases such as operators.
-	%
-	% This predicate returns not the estimated total term size,
-	% but the difference between the given maximum size the caller
-	% is interested in and the estimated total term size.
-	% This difference is positive if the term is smaller than the
-	% maximum and negative if it is bigger. If the difference is
-	% 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.
 term_size_left_from_max(Univ, MaxSize, RemainingSize) :-
 	( MaxSize < 0 ->
 		RemainingSize = MaxSize
@@ -718,23 +732,6 @@
 		).
 
 	% access predicates
-
-:- pred default_state(browser_state).
-:- mode default_state(out) is det.
-default_state(State) :-
-	% We need to supply an object to initialize the state,
-	% but this object won't be used, since the first call
-	% to browse__browse will overwrite it.  So we just supply
-	% a dummy object -- it doesn't matter what its type or value is.
-	DummyObject = "",
-	type_to_univ(DummyObject, Univ),
-	default_depth(DefaultDepth),
-	MaxTermSize = 10,
-	DefaultFormat = verbose,
-	ClipX = 79,
-	ClipY = 25,
-	State = browser_state(Univ, DefaultDepth, MaxTermSize, [],
-			DefaultFormat, ClipX, ClipY).
 
 :- pred get_term(browser_state, univ).
 :- mode get_term(in, out) is det.
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.9
diff -u -r1.9 declarative_user.m
--- browser/declarative_user.m	2000/08/10 05:50:57	1.9
+++ browser/declarative_user.m	2000/08/11 05:33:17
@@ -45,18 +45,22 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module mdb__declarative_execution, mdb__util.
-:- import_module std_util, char, string, bool.
+:- import_module mdb__declarative_execution, mdb__browse, mdb__util.
+:- import_module std_util, char, string, bool, int.
 
 :- type user_state
 	--->	user(
 			instr	:: io__input_stream,
-			outstr	:: io__output_stream
+			outstr	:: io__output_stream,
+			browser	:: browser_state
 		).
 
 user_state_init(InStr, OutStr, User) :-
-	User = user(InStr, OutStr).
+	browse__init_state(Browser),
+	User = user(InStr, OutStr, Browser).
 
+%-----------------------------------------------------------------------------%
+
 query_user(Nodes, Response, User0, User) -->
 	query_user_2(Nodes, [], Response, User0, User).
 
@@ -90,8 +94,8 @@
 		{ reverse_and_append(Skipped, [Node | Nodes], Questions) },
 		query_user_2(Questions, [], Response, User1, User)
 	;
-		{ Command = browse },
-		browse_edt_node(Node, User1, User2),
+		{ Command = browse(Arg) },
+		browse_edt_node(Node, Arg, User1, User2),
 		query_user_2([Node | Nodes], Skipped, Response, User2, User)
 	;
 		{ Command = abort },
@@ -113,20 +117,56 @@
 decl_question_prompt(wrong_answer(_), "Valid? ").
 decl_question_prompt(missing_answer(_, _), "Complete? ").
 decl_question_prompt(unexpected_exception(_, _), "Expected? ").
+
+:- pred browse_edt_node(decl_question, int, user_state, user_state,
+		io__state, io__state).
+:- mode browse_edt_node(in, in, in, out, di, uo) is det.
 
-:- pred browse_edt_node(decl_question, user_state, user_state,
+browse_edt_node(Node, ArgNum, User0, User) -->
+	{
+		Node = wrong_answer(Atom)
+	;
+		Node = missing_answer(Atom, _)
+	;
+		Node = unexpected_exception(Atom, _)
+	},
+	browse_atom_argument(Atom, ArgNum, User0, User).
+
+:- pred browse_decl_bug(decl_bug, int, user_state, user_state,
 		io__state, io__state).
-:- mode browse_edt_node(in, in, out, di, uo) is det.
+:- mode browse_decl_bug(in, in, in, out, di, uo) is det.
 
-browse_edt_node(_Node, User, User) -->
-	io__write_string("Sorry, not implemented.\n").
+browse_decl_bug(Bug, ArgNum, User0, User) -->
+	{
+		Bug = e_bug(EBug),
+		(
+			EBug = incorrect_contour(Atom, _, _)
+		;
+			EBug = partially_uncovered_atom(Atom, _)
+		;
+			EBug = unhandled_exception(Atom, _, _)
+		)
+	;
+		Bug = i_bug(inadmissible_call(_, _, Atom, _))
+	},
+	browse_atom_argument(Atom, ArgNum, User0, User).
 
-:- pred browse_decl_bug(decl_bug, user_state, user_state,
+:- pred browse_atom_argument(decl_atom, int, user_state, user_state,
 		io__state, io__state).
-:- mode browse_decl_bug(in, in, out, di, uo) is det.
+:- mode browse_atom_argument(in, in, in, out, di, uo) is det.
 
-browse_decl_bug(_Bug, User, User) -->
-	io__write_string("Sorry, not implemented.\n").
+browse_atom_argument(Atom, ArgNum, User0, User) -->
+	{ Atom = atom(_, Args) },
+	(
+		{ list__index1(Args, ArgNum, MaybeArg) },
+		{ MaybeArg = yes(Arg) }
+	->
+		browse(Arg, User0^instr, User0^outstr, User0^browser, Browser),
+		{ User = User0^browser := Browser }
+	;
+		io__write_string(User^outstr, "Invalid argument number\n"),
+		{ User = User0 }
+	).
 
 	% Reverse the first argument and append the second to it.
 	%
@@ -145,7 +185,8 @@
 	;	inadmissible		% The node is inadmissible.
 	;	skip			% The user has no answer.
 	;	restart			% Ask the skipped questions again.
-	;	browse			% Browse the data before answering.
+	;	browse(int)		% Browse the nth argument before
+					% answering.
 	;	abort			% Abort this diagnosis session.
 	;	help			% Request help before answering.
 	;	illegal_command.	% None of the above.
@@ -162,7 +203,7 @@
 %		"\ti\tinadmissible\tthe input arguments are out of range\n",
 		"\ts\tskip\t\tskip this question\n",
 		"\tr\trestart\t\task the skipped questions again\n",
-%		"\tb\tbrowse\t\tbrowse the atom\n",
+		"\tb <n>\tbrowse <n>\tbrowse the nth argument of the atom\n",
 		"\ta\tabort\t\t",
 			"abort this diagnosis session and return to mdb\n",
 		"\th, ?\thelp\t\tthis help message\n"
@@ -214,10 +255,27 @@
 command_chars(['i' | _], inadmissible).
 command_chars(['s' | _], skip).
 command_chars(['r' | _], restart).
-command_chars(['b' | _], browse).
 command_chars(['a' | _], abort).
 command_chars(['h' | _], help).
 command_chars(['?' | _], help).
+command_chars(['b' | Line0], browse(Arg)) :-
+	(
+		Line0 = ['r','o','w','s','e' | Line1]
+	->
+		Line2 = Line1
+	;
+		Line2 = Line0
+	),
+	list__takewhile(char__is_whitespace, Line2, _, ArgChars),
+	parse_integer(ArgChars, 0, Arg).
+
+:- pred parse_integer(list(char), int, int).
+:- mode parse_integer(in, in, out) is semidet.
+
+parse_integer([], N, N).
+parse_integer([D | Ds], N0, N) :-
+	char__digit_to_int(D, I),
+	parse_integer(Ds, N0 * 10 + I, N).
 
 %-----------------------------------------------------------------------------%
 
@@ -240,9 +298,9 @@
 		{ Response = abort_diagnosis },
 		{ User = User1 }
 	;
-		{ Command = browse }
+		{ Command = browse(Arg) }
 	->
-		browse_decl_bug(Bug, User1, User2),
+		browse_decl_bug(Bug, Arg, User1, User2),
 		user_confirm_bug(Bug, Response, User2, User)
 	;
 		user_confirm_bug_help(User1),
@@ -258,25 +316,24 @@
 :- mode write_decl_question(in, in, di, uo) is det.
 
 write_decl_question(wrong_answer(Atom), User) -->
-	write_decl_atom(User^outstr, "", Atom).
+	write_decl_atom(User, "", Atom).
 	
 write_decl_question(missing_answer(Call, Solns), User) -->
-	write_decl_atom(User^outstr, "Call ", Call),
+	write_decl_atom(User, "Call ", Call),
 	(
 		{ Solns = [] }
 	->
 		io__write_string(User^outstr, "No solutions.\n")
 	;
 		io__write_string(User^outstr, "Solutions:\n"),
-		list__foldl(write_decl_atom(User^outstr, "\t"), Solns)
+		list__foldl(write_decl_atom(User, "\t"), Solns)
 	).
 
 write_decl_question(unexpected_exception(Call, Exception), User) -->
-	{ User = user(_, OutStr) },
-	write_decl_atom(OutStr, "Call ", Call),
-	io__write_string(OutStr, "Throws "),
-	io__print(OutStr, Exception),
-	io__nl(OutStr).
+	write_decl_atom(User, "Call ", Call),
+	io__write_string(User^outstr, "Throws "),
+	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.
@@ -285,16 +342,16 @@
 	(
 		{ EBug = incorrect_contour(Atom, _, _) },
 		io__write_string(User^outstr, "Found incorrect contour:\n"),
-		write_decl_atom(User^outstr, "", Atom)
+		write_decl_atom(User, "", Atom)
 	;
 		{ EBug = partially_uncovered_atom(Atom, _) },
 		io__write_string(User^outstr,
 				"Found partially uncovered atom:\n"),
-		write_decl_atom(User^outstr, "", Atom)
+		write_decl_atom(User, "", Atom)
 	;
 		{ EBug = unhandled_exception(Atom, Exception, _) },
 		io__write_string(User^outstr, "Found unhandled exception:\n"),
-		write_decl_atom(User^outstr, "", Atom),
+		write_decl_atom(User, "", Atom),
 		io__write(User^outstr, univ_value(Exception)),
 		io__nl(User^outstr)
 	).
@@ -302,20 +359,79 @@
 write_decl_bug(i_bug(IBug), User) -->
 	{ IBug = inadmissible_call(Parent, _, Call, _) },
 	io__write_string(User^outstr, "Found inadmissible call:\n"),
-	write_decl_atom(User^outstr, "Parent", Parent),
-	write_decl_atom(User^outstr, "Call ", Call).
+	write_decl_atom(User, "Parent ", Parent),
+	write_decl_atom(User, "Call ", Call).
 
-:- pred write_decl_atom(io__output_stream, string, decl_atom,
-		io__state, io__state).
+:- pred write_decl_atom(user_state, string, decl_atom, io__state, io__state).
 :- mode write_decl_atom(in, in, in, di, uo) is det.
 
-write_decl_atom(OutStr, Indent, atom(Functor, Args)) -->
-	io__write_string(OutStr, Indent),
-
-		% XXX We should call the browser to print this.  But
-		% that can wait until the browser has more flexible
-		% term display facilities.
+write_decl_atom(User, Indent, Atom) -->
+	io__write_string(User^outstr, Indent),
+		%
+		% Check whether the atom is likely to fit on one line.
+		% If it's not, then call the browser to print the term
+		% to a limited depth.  If it is, then we prefer to print
+		% it out directly so that all arguments are put on the
+		% same line.
 		%
+	(
+		{ check_decl_atom_size(Indent, Atom) }
+	->
+		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.
+
+check_decl_atom_size(Indent, atom(Functor, Args)) :-
+	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.
+
+:- pred size_left_after_args(list(maybe(univ)), int, int).
+:- mode size_left_after_args(in, in, out) is det.
+
+size_left_after_args([]) -->
+	[].
+size_left_after_args([yes(A) | As]) -->
+	term_size_left_from_max(A),
+	size_left_after_args(As).
+size_left_after_args([no | As]) -->
+	size_left_after_args(As).
+
+:- pred decl_atom_size_limit(int).
+:- mode decl_atom_size_limit(out) is det.
+
+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.
+
+write_decl_atom_limited(atom(Functor, Args), User) -->
+	io__write_string(User^outstr, Functor),
+	io__nl(User^outstr),
+	foldl(print_decl_atom_arg(User), Args).
+
+:- pred print_decl_atom_arg(user_state, maybe(univ), io__state, io__state).
+:- mode print_decl_atom_arg(in, in, di, uo) is det.
+
+print_decl_atom_arg(User, yes(Arg)) -->
+	io__write_string(User^outstr, "\t"),
+	browse__print(univ_value(Arg), User^outstr, User^browser).
+print_decl_atom_arg(User, no) -->
+	io__write_string(User^outstr, "\t_\n").
+
+:- pred write_decl_atom_direct(io__output_stream, decl_atom,
+		io__state, io__state).
+:- mode write_decl_atom_direct(in, in, di, uo) is det.
+
+write_decl_atom_direct(OutStr, atom(Functor, Args)) -->
 	io__write_string(OutStr, Functor),
 	(
 		{ Args = [] }
Index: tests/debugger/declarative/app.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/app.exp,v
retrieving revision 1.7
diff -u -r1.7 app.exp
--- tests/debugger/declarative/app.exp	2000/05/08 18:16:51	1.7
+++ tests/debugger/declarative/app.exp	2000/08/11 05:34:02
@@ -28,10 +28,16 @@
 mdb> continue
       19:      2  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:13)
 mdb> dd
-app([2, 3, 4, 5], [6, 7, 8], [2, 3, 4, 5, 6, 7, 8])
+app
+	[2, 3, 4, 5]
+	[6, 7, 8]
+	[2, 3, 4, 5, 6, 7, 8]
+Valid? no
+app
+	[3, 4, 5]
+	[6, 7, 8]
+	[3, 4, 5, 6, 7, 8]
 Valid? no
-app([3, 4, 5], [6, 7, 8], [3, 4, 5, 6, 7, 8])
-Valid? no
 app([4, 5], [6, 7, 8], [4, 5, 6, 7, 8])
 Valid? no
 Found incorrect contour:
@@ -50,25 +56,55 @@
 mdb> finish -n
       67:      8  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
 mdb> dd
-app([2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([0, 1, 2, 3, 4, 5], [6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([1, 2, 3, 4, 5], [6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8])
+app
+	.(2, .(3, .(4, ./2)))
+	[6, 7, 8]
+	.(2, .(3, .(4, ./2)))
+Valid? no
+app
+	.(3, .(4, .(5, ./2)))
+	[6, 7, 8]
+	.(3, .(4, .(5, ./2)))
+Valid? no
+app
+	.(4, .(5, .(6, ./2)))
+	[6, 7, 8]
+	.(4, .(5, .(6, ./2)))
+Valid? no
+app
+	.(5, .(6, .(7, ./2)))
+	[6, 7, 8]
+	.(5, .(6, .(7, ./2)))
+Valid? no
+app
+	.(6, .(7, .(8, ./2)))
+	[6, 7, 8]
+	.(6, .(7, .(8, ./2)))
+Valid? no
+app
+	[7, 8, 9, 0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	.(7, .(8, .(9, ./2)))
+Valid? no
+app
+	[8, 9, 0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	.(8, .(9, .(0, ./2)))
+Valid? no
+app
+	[9, 0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	.(9, .(0, .(1, ./2)))
+Valid? no
+app
+	[0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	[0, 1, 2, 3, 4, 5, 6, 7, 8]
+Valid? no
+app
+	[1, 2, 3, 4, 5]
+	[6, 7, 8]
+	[1, 2, 3, 4, 5, 6, 7, 8]
 Valid? no
 Found incorrect contour:
 app([4, 5], [6, 7, 8], [4, 5, 6, 7, 8])
Index: tests/debugger/declarative/app.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/app.exp2,v
retrieving revision 1.7
diff -u -r1.7 app.exp2
--- tests/debugger/declarative/app.exp2	2000/05/08 18:16:52	1.7
+++ tests/debugger/declarative/app.exp2	2000/08/11 05:34:03
@@ -28,10 +28,16 @@
 mdb> continue
       19:      2  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:13)
 mdb> dd
-app([2, 3, 4, 5], [6, 7, 8], [2, 3, 4, 5, 6, 7, 8])
+app
+	[2, 3, 4, 5]
+	[6, 7, 8]
+	[2, 3, 4, 5, 6, 7, 8]
+Valid? no
+app
+	[3, 4, 5]
+	[6, 7, 8]
+	[3, 4, 5, 6, 7, 8]
 Valid? no
-app([3, 4, 5], [6, 7, 8], [3, 4, 5, 6, 7, 8])
-Valid? no
 app([4, 5], [6, 7, 8], [4, 5, 6, 7, 8])
 Valid? no
 Found incorrect contour:
@@ -50,25 +56,55 @@
 mdb> finish -n
       71:     10  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
 mdb> dd
-app([2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([0, 1, 2, 3, 4, 5], [6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8])
-Valid? no
-app([1, 2, 3, 4, 5], [6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8])
+app
+	.(2, .(3, .(4, ./2)))
+	[6, 7, 8]
+	.(2, .(3, .(4, ./2)))
+Valid? no
+app
+	.(3, .(4, .(5, ./2)))
+	[6, 7, 8]
+	.(3, .(4, .(5, ./2)))
+Valid? no
+app
+	.(4, .(5, .(6, ./2)))
+	[6, 7, 8]
+	.(4, .(5, .(6, ./2)))
+Valid? no
+app
+	.(5, .(6, .(7, ./2)))
+	[6, 7, 8]
+	.(5, .(6, .(7, ./2)))
+Valid? no
+app
+	.(6, .(7, .(8, ./2)))
+	[6, 7, 8]
+	.(6, .(7, .(8, ./2)))
+Valid? no
+app
+	[7, 8, 9, 0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	.(7, .(8, .(9, ./2)))
+Valid? no
+app
+	[8, 9, 0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	.(8, .(9, .(0, ./2)))
+Valid? no
+app
+	[9, 0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	.(9, .(0, .(1, ./2)))
+Valid? no
+app
+	[0, 1, 2, 3, 4, 5]
+	[6, 7, 8]
+	[0, 1, 2, 3, 4, 5, 6, 7, 8]
+Valid? no
+app
+	[1, 2, 3, 4, 5]
+	[6, 7, 8]
+	[1, 2, 3, 4, 5, 6, 7, 8]
 Valid? no
 Found incorrect contour:
 app([4, 5], [6, 7, 8], [4, 5, 6, 7, 8])
Index: tests/debugger/declarative/filter.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/filter.exp,v
retrieving revision 1.1
diff -u -r1.1 filter.exp
--- tests/debugger/declarative/filter.exp	2000/05/08 18:16:56	1.1
+++ tests/debugger/declarative/filter.exp	2000/08/11 05:34:04
@@ -50,7 +50,10 @@
 mdb> finish
       50:      2  2 EXIT pred filter:p/1-0 (multi) filter.m:20 (filter.m:10)
 mdb> dd
-my_append([1, 2, 3], [7, 8, 9], [1, 2, 3, 7, 8, 9])
+my_append
+	[1, 2, 3]
+	[7, 8, 9]
+	[1, 2, 3, 7, 8, 9]
 Valid? yes
 Found incorrect contour:
 p([1, 2, 3, 7, 8, 9])
Index: tests/debugger/declarative/filter.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/filter.exp2,v
retrieving revision 1.1
diff -u -r1.1 filter.exp2
--- tests/debugger/declarative/filter.exp2	2000/05/08 18:16:56	1.1
+++ tests/debugger/declarative/filter.exp2	2000/08/11 05:34:05
@@ -50,7 +50,10 @@
 mdb> finish
       64:      2  2 EXIT pred filter:p/1-0 (multi) filter.m:20 (filter.m:10)
 mdb> dd
-my_append([1, 2, 3], [7, 8, 9], [1, 2, 3, 7, 8, 9])
+my_append
+	[1, 2, 3]
+	[7, 8, 9]
+	[1, 2, 3, 7, 8, 9]
 Valid? yes
 Found incorrect contour:
 p([1, 2, 3, 7, 8, 9])
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list