[m-rev.] diff: fix failure of debugger/declarative/browse_arg
Julien Fischer
juliensf at cs.mu.OZ.AU
Tue Jun 6 17:21:59 AEST 2006
This has already been reviewed by Ian in person.
Estimated hours taken: 5
Branches: main, release
Fix a bug that was causing debugger/declarative/browse_arg to fail. The
problem was that the default format command in the the declarative debugger
was setting format for the browser rather than for the print command.
browser/browser_info.m:
If a format command with no options is issued at the dd> prompt make
sure we update the correct set of params. The existing code was
written in such a way that it would _always_ update the params for the
browser regardless of where the format command was invoked.
borwser/declarative_user.m:
The default format command at the dd> prompt should change the
settings for the print command, not the browser.
browser/RESERVED_MACRO_NAMES:
s/polution/pollution/
tests/debugger/declarative/browse_arg.exp:
Update the expected output for this test case to match the current
input.
Julien.
Index: browser/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/RESERVED_MACRO_NAMES,v
retrieving revision 1.3
diff -u -r1.3 RESERVED_MACRO_NAMES
--- browser/RESERVED_MACRO_NAMES 15 Dec 2004 06:57:25 -0000 1.3
+++ browser/RESERVED_MACRO_NAMES 6 Jun 2006 02:29:00 -0000
@@ -47,7 +47,7 @@
# These are defined automatically by GCC -- gcc optionally passes
# them on the command line when calling cc1, depending on the
# exact options which gcc was invoked with. These are not
-# namespace polution, since they are in the _[A-Z]* namespace
+# namespace pollution, since they are in the _[A-Z]* namespace
# which is reserved for the C implementation, and they are being
# defined by the C implementation.
_GNU_SOURCE
Index: browser/browser_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browser_info.m,v
retrieving revision 1.28
diff -u -r1.28 browser_info.m
--- browser/browser_info.m 5 Jun 2006 07:03:00 -0000 1.28
+++ browser/browser_info.m 6 Jun 2006 06:13:59 -0000
@@ -206,6 +206,14 @@
bool::in, bool::in, bool::in, bool::in, setting::in,
browser_persistent_state::in, browser_persistent_state::out) is det.
+ % As above but the first argument specifies where the browser was
+ % invoked from.
+ %
+:- pred set_browser_param_with_caller_type(browse_caller_type::in,
+ bool::in, bool::in, bool::in, bool::in, bool::in, bool::in, bool::in,
+ setting::in, browser_persistent_state::in, browser_persistent_state::out)
+ is det.
+
% Update a setting in the browser state. The first argument should be
% true iff the set command is invoked from within the browser. The next
% argument indicates the presence of at most one of the options
@@ -217,12 +225,12 @@
bool::in, bool::in, bool::in, bool::in, setting::in,
browser_persistent_state::in, browser_persistent_state::out) is det.
- % set_param_from_option_table(FromBrowser, OptionTable, Setting, !State):
+ % set_param_from_option_table(CallerType, OptionTable, Setting, !State).
%
% Same as set_param/11, but looks up the options in the
% supplied option table.
%
-:- pred set_browser_param_from_option_table(bool::in,
+:- pred set_browser_param_from_option_table(browse_caller_type::in,
option_table(setting_option)::in, setting::in,
browser_persistent_state::in, browser_persistent_state::out) is det.
@@ -386,7 +394,8 @@
info_set_browse_param(OptionTable, Setting, !Info) :-
PersistentState0 = !.Info ^ state,
- set_browser_param_from_option_table(yes, OptionTable, Setting,
+ CallerType = !.Info ^ caller_type,
+ set_browser_param_from_option_table(CallerType, OptionTable, Setting,
PersistentState0, PersistentState),
!:Info = !.Info ^ state := PersistentState.
@@ -637,15 +646,42 @@
!.State ^ num_printed_io_actions,
!.State ^ xml_browser_cmd, !.State ^ xml_tmp_filename).
+set_browser_param_with_caller_type(CallerType, P0, B0, A0, F0, Pr0, V0, NPr0,
+ Setting, !State) :-
+ (
+ P0 = no,
+ B0 = no,
+ A0 = no
+ ->
+ % DummyInBrowser will always be ignored because the second
+ % argument is yes/1.
+ DummyInBrowser = yes,
+ affected_caller_types(DummyInBrowser, yes(CallerType), P, B, A)
+ ;
+ P = P0,
+ B = B0,
+ A = A0
+ ),
+ default_all_yes(F0, Pr0, V0, NPr0, F, Pr, V, NPr),
+ PParams0 = !.State ^ print_params,
+ BParams0 = !.State ^ browse_params,
+ AParams0 = !.State ^ print_all_params,
+ maybe_set_param(P, F, Pr, V, NPr, Setting, PParams0, PParams),
+ maybe_set_param(B, F, Pr, V, NPr, Setting, BParams0, BParams),
+ maybe_set_param(A, F, Pr, V, NPr, Setting, AParams0, AParams),
+ !:State = browser_persistent_state(PParams, BParams, AParams,
+ !.State ^ num_printed_io_actions,
+ !.State ^ xml_browser_cmd, !.State ^ xml_tmp_filename).
+
set_browser_param_maybe_caller_type(FromBrowser, MaybeCallerType,
F0, Pr0, V0, NPr0, Setting, !State) :-
affected_caller_types(FromBrowser, MaybeCallerType, P, B, A),
set_browser_param(FromBrowser, P, B, A, F0, Pr0, V0, NPr0, Setting,
!State).
-set_browser_param_from_option_table(FromBrowser, OptionTable, Setting,
+set_browser_param_from_option_table(CallerType, OptionTable, Setting,
!State) :-
- set_browser_param(FromBrowser,
+ set_browser_param_with_caller_type(CallerType,
lookup_bool_option(OptionTable, set_print) : bool,
lookup_bool_option(OptionTable, set_browse) : bool,
lookup_bool_option(OptionTable, set_print_all) : bool,
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.61
diff -u -r1.61 declarative_user.m
--- browser/declarative_user.m 5 Jun 2006 07:03:00 -0000 1.61
+++ browser/declarative_user.m 6 Jun 2006 06:22:04 -0000
@@ -333,7 +333,7 @@
!User, !IO) :-
Browser0 = !.User ^ browser,
DummyTerm = synthetic_term("", [], no),
- Info0 = browser_info(DummyTerm, [], browse, no, Browser0, no_track, no),
+ Info0 = browser_info(DummyTerm, [], print, no, Browser0, no_track, no),
run_param_command(internal, ParamCommand, no, Info0, Info, !IO),
Info = browser_info(_, _, _, _, Browser, _, _),
!:User = !.User ^ browser := Browser,
Index: tests/debugger/declarative/browse_arg.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/browse_arg.exp,v
retrieving revision 1.10
diff -u -r1.10 browse_arg.exp
--- tests/debugger/declarative/browse_arg.exp 4 Apr 2006 07:37:23 -0000 1.10
+++ tests/debugger/declarative/browse_arg.exp 6 Jun 2006 06:20:23 -0000
@@ -17,7 +17,7 @@
browser> ls
baz(1, bar)
browser> quit
-dd> set format verbose
+dd> format verbose
dd> print
p
1-1
@@ -25,7 +25,7 @@
1-1
2-bar
-Valid? set -B format pretty
+Valid? format -B pretty
dd> p
p
1-1
@@ -33,7 +33,7 @@
1-1
2-bar
-Valid? set -P format pretty
+Valid? format -P pretty
dd> p
p(1, baz(1, bar))
Valid? b -x 2
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list