Use the pretty_print module to pretty print terms in

Estimated hours taken: 3
Branches: main

Use the pretty_print module to pretty print terms in
the debugger, rather than pprint.

browser/browse.m:
	Use the new pretty_printer.

browser/browser_info.m:
	Make the debugger type a member of the stream
	typeclass, so that we can use it from the new
	pretty printer.
This commit is contained in:
Peter Ross
2007-08-14 05:25:24 +00:00
parent d94ba52167
commit 2dd493be45
2 changed files with 35 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
%---------------------------------------------------------------------------% %---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et % vim: ft=mercury ts=4 sw=4 et
%---------------------------------------------------------------------------% %---------------------------------------------------------------------------%
% Copyright (C) 1998-2006 The University of Melbourne. % Copyright (C) 1998-2007 The University of Melbourne.
% This file may only be copied under the terms of the GNU Library General % This file may only be copied under the terms of the GNU Library General
% Public License - see the file COPYING.LIB in the Mercury distribution. % Public License - see the file COPYING.LIB in the Mercury distribution.
%---------------------------------------------------------------------------% %---------------------------------------------------------------------------%

View File

@@ -27,6 +27,7 @@
:- import_module io. :- import_module io.
:- import_module list. :- import_module list.
:- import_module maybe. :- import_module maybe.
:- import_module stream.
:- import_module univ. :- import_module univ.
%---------------------------------------------------------------------------% %---------------------------------------------------------------------------%
@@ -283,6 +284,11 @@
; browser_end_command ; browser_end_command
; browser_quit. ; browser_quit.
:- instance stream.stream(debugger, io).
:- instance stream.output(debugger, io).
:- instance stream.writer(debugger, string, io).
:- instance stream.writer(debugger, int, io).
:- pred run_param_command(debugger::in, param_cmd::in, bool::in, :- pred run_param_command(debugger::in, param_cmd::in, bool::in,
browser_info::in, browser_info::out, io::di, io::uo) is det. browser_info::in, browser_info::out, io::di, io::uo) is det.
@@ -1031,6 +1037,34 @@ send_term_to_socket(Term, !IO) :-
%---------------------------------------------------------------------------% %---------------------------------------------------------------------------%
:- instance stream.stream(debugger, io) where [
stream.name(_, "debugger", !IO)
].
:- instance stream.output(debugger, io) where [
(flush(internal, !IO) :-
io.flush_output(!IO)
),
(flush(external, !IO) :-
% XXX
true
)
].
:- instance stream.writer(debugger, string, io) where [
(put(D, S, !IO) :-
write_string_debugger(D, S, !IO)
)
].
:- instance stream.writer(debugger, int, io) where [
(put(D, I, !IO) :-
write_int_debugger(D, I, !IO)
)
].
%---------------------------------------------------------------------------%
:- pragma foreign_export("C", browser_params_to_string(in, in, out), :- pragma foreign_export("C", browser_params_to_string(in, in, out),
"ML_BROWSE_browser_params_to_string"). "ML_BROWSE_browser_params_to_string").