mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 04:43:53 +00:00
Estimated hours taken: 15
Fix the user interface of the declarative debugger so that it
produces more readable output; the representation of atoms
is updated so that it can handle non-ground arguments.
Ensure that all DD output goes through the correct stream, so that
the debugger works properly under emacs.
browser/declarative_debugger.m:
Call a procedure in the oracle to handle bug confirmation
(including printing out the bug), rather than handle
it directly.
browser/declarative_execution.m:
Update the trace_atom type so that it can handle both ground
and free arguments. Export to C some procedures for
constructing trace atoms.
browser/declarative_oracle.m:
Export a procedure which handles bug confirmation. This calls
the declarative_user module to do the interaction, and interprets
the result.
browser/declarative_user.m:
Export a procedure to handle bug confirmation by the user.
Update to handle the changes to trace_atom.
trace/mercury_trace_declarative.c:
Construct trace_atoms by calling the new Mercury procedures
exported from browser/declarative_execution.m.
trace/mercury_trace_declarative.h:
Remove the macro that had been used to construct old style atoms.
trace/mercury_trace_vars.{c,h}:
Export a procedure to calculate the argument position of a
head variable.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/args.{m,inp,exp,exp2}:
New test case to test mixing bound and free arguments.
tests/debugger/declarative/*.inp:
tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
Update test cases to reflect new output, and the extra question
asked for bug confirmation.
41 lines
753 B
Mathematica
41 lines
753 B
Mathematica
:- module args.
|
|
:- interface.
|
|
:- import_module io.
|
|
:- pred main(io__state::di, io__state::uo) is cc_multi.
|
|
:- implementation.
|
|
:- import_module std_util, int.
|
|
|
|
main -->
|
|
(
|
|
{ p(1, X, 3, Y, 5) },
|
|
{ my_fail }
|
|
->
|
|
io__write_int(X),
|
|
io__nl,
|
|
io__write_int(Y),
|
|
io__nl
|
|
;
|
|
io__write_string("no.\n")
|
|
).
|
|
|
|
:- pred p(int, int, int, int, int).
|
|
:- mode p(in, out, in, out, in) is nondet.
|
|
|
|
p(A, A + (B * C), B, (A + B) * C, C) :-
|
|
my_succeed.
|
|
p(A, A - B, B, C - B, C) :-
|
|
my_succeed.
|
|
|
|
% The purpose of the following two procedures is to ensure
|
|
% that the test cases work consistently in both debugging
|
|
% and non-debugging grades.
|
|
%
|
|
:- pred my_succeed is semidet.
|
|
my_succeed :-
|
|
semidet_succeed.
|
|
|
|
:- pred my_fail is semidet.
|
|
my_fail :-
|
|
semidet_fail.
|
|
|