[m-dev.] for review: improve DD user interface
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Feb 21 01:20:49 AEDT 2000
On 20-Feb-2000, Mark Anthony BROWN <dougl at cs.mu.OZ.AU> wrote:
> 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.
That change looks fine to me.
> +confirm_bug(Store, Bug, Response, Diagnoser0, Diagnoser) -->
> + {
> + Bug = e_bug(Node),
> + Message = "Incorrect node found:\n"
> + ;
> + Bug = i_bug(Node),
> + Message = "Inadmissible call node found:\n"
> + },
I'm not sure that "node" is the ideal term to describe
these things to the user.
> +++ browser/declarative_execution.m 2000/02/20 05:48:31
> @@ -92,20 +92,16 @@
> )
> .
>
> - % If either of the following two types are modified, some of
> - % the macros in trace/mercury_trace_declarative.h may need
> - % to be updated.
> - %
> :- type trace_atom
> ---> atom(
> string, % Procedure name.
> - list(univ) % Arguments.
> - % XXX we also need to store some information about
> - % where the arguments come from, since they will
> - % not necessarily be in the right order or all
> - % present (we do not store unbound variables).
> + list(maybe(univ)) % Arguments.
> ).
Please put an XXX there saying that this representation
won't handle partially instantiated data structures.
> +:- func construct_trace_atom(string, int) = trace_atom.
> +:- pragma export(construct_trace_atom(in, in) = out,
> + "MR_DD_construct_trace_atom").
> +
> +construct_trace_atom(Functor, Arity) = atom(Functor, Args) :-
> + list__duplicate(Arity, no, Args).
> +
> +:- func add_trace_atom_arg(trace_atom, int, univ) = trace_atom.
> +:- pragma export(add_trace_atom_arg(in, in, in) = out,
> + "MR_DD_add_trace_atom_arg").
> +
> +add_trace_atom_arg(atom(F, Args0), Num, Val) = atom(F, Args) :-
> + list__replace_nth_det(Args0, Num, yes(Val), Args).
That is not a particularly efficient way of constructing
a list -- for N arguments it's O(N^2).
However, I suppose it probably doesn't matter
(that's not in the inner loop, right?).
> +:- pred user_confirm_bug_help(user_state, io__state, io__state).
> +:- mode user_confirm_bug_help(in, di, uo) is det.
> +
> +user_confirm_bug_help(user(_, OutStr)) -->
> + io__write_strings(OutStr, [
> + "Answer one of:\n",
> + "\ty\tyes\t\tconfirm that the suspect is a bug\n",
> + "\tn\tno\t\tdo not accept that the suspect is a bug\n",
> +% "\tb\tbrowse\t\tbrowse the suspect\n",
> + "\ta\tabort\t\tabort this diagnosis session\n",
> + "\th, ?\thelp\t\tthis help message\n"
> + ]).
Does the abort command return to the mdb prompt?
If so, it might be a good idea to mention that
to the explanation above.
> +/*
> +** If the variable specified by n is a head variable, then return
> +** its argument position, otherwise return an error.
> +*/
> +
> +extern const char *MR_trace_headvar_num(int n, int *num);
The comment here is potentially misleading: you don't return the
argument position, you store the argument position in *num and return
NULL.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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