mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-25 14:24:11 +00:00
Estimated hours taken: 5 Branches: main The annotated trace used for declarative debugging now keeps a reference to the proc layout for a predicate/function, instead of all the details of the predicate/function. This saves space and gives access to more information about the predicate/function. browser/declarative_debugger.m Changed write_origin to look up the proc name through the proc_layout. browser/declarative_execution.m Info about the predicate like its name, module etc is now represented by a proc_layout type. Changed the trace_atom type appropriately and added useful predicates and functions to manipulate proc_layouts - thanks to Zoltan. browser/declarative_oracle.m Since proc_layouts are unique per mode, all modes must now be added to the knowledge base in assert_oracle_kb. browser/declarative_tree.m Minor changes to predicate that expected four arguments to trace_atom type. browser/declarative_user.m Minor changes to predicates that used the old trace_atom type. tests/debugger/declarative/remember_modes.m Test to see that all modes of a predicate are added to the knowledge base of the oracle. tests/debugger/declarative/Mmakefile Added remember_modes test. tests/debugger/declarative/remember_modes.exp Expected results for remember_modes test. tests/debugger/declarative/remember_modes.inp Input to remember_modes test. tests/debugger/declarative/trust.m Removed superfluous import of trust_1 in interface. trace/mercury_trace_declarative.c Removed MR_decl_atom_name_and_module which is no longer necessary since the debugger looks the name and module up in the proc_layout directly.
40 lines
621 B
Mathematica
40 lines
621 B
Mathematica
:- module remember_modes.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list, int.
|
|
|
|
:- pred p(int, int).
|
|
:- mode p(in, in) is semidet.
|
|
:- mode p(in, out) is semidet.
|
|
:- mode p(out, in) is semidet.
|
|
:- mode p(out, out) is det.
|
|
|
|
p(1, 2).
|
|
|
|
:- pred q(int::in, int::out, int::out, int::out, int::out) is semidet.
|
|
|
|
q(V, W, X, Y, Z) :-
|
|
p(V, 2),
|
|
p(W, 2),
|
|
p(1, X),
|
|
p(Y, Z).
|
|
|
|
main(!IO) :-
|
|
(
|
|
q(1, W, X, Y, Z)
|
|
->
|
|
write(W, !IO), nl(!IO),
|
|
write(X, !IO), nl(!IO),
|
|
write(Y, !IO), nl(!IO),
|
|
write(Z, !IO), nl(!IO)
|
|
;
|
|
write_string("failed\n", !IO)
|
|
).
|