[m-dev.] for review: bug fix for browser output streams.

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Dec 13 00:07:59 AEDT 1998

On 07-Dec-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> Fix a bug in the debugger -- the term printing wasn't working after
> you had changed the output stream -- output would be sent to the
> program's output stream instead of the debugger's output stream.

That change looks OK.  But I think the default stream for the browser
output should be stdout, not stderr, for consistency with the
rest of output from the internal debugger, which (apart from error
messages) currently goes to stdout.

But I also have a comment about the longer-term evolution of this code.
Ideally, `mdb' should have options for doing all the I/O on a different
xterm or tty.  These would be passed to the Mercury runtime,
which would in turn pass them on to the browser.
So there should be a version of `browse__init_state' which takes
an input stream and an output stream as arguments.

P.S. Here's the relevant bits of the code from the diff:
>  browse__init_state(State) -->
> -	{ default_state(State) }.
> +	default_state(State).
> -:- pred default_state(browser_state).
> -:- mode default_state(out) is det.
> -default_state(State) :-
> +:- pred default_state(browser_state, io__state, io__state).
> +:- mode default_state(out, di, uo) is det.
> +default_state(State) -->
> +	io__stderr_stream(StdErr),
> +	io__stdin_stream(StdIn),
> +	{ State = browser_state(Univ, 3, DefaultDepth, [], verbose, 79, 25,
> +		StdIn, StdErr) }.

Fergus Henderson <fjh at cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh at        |     -- leaked Microsoft memo.

More information about the developers mailing list