[m-rev.] for review: fix failure of debugger/declarative/sort.m

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Jun 8 15:02:44 AEST 2006


For review by Ian or Zoltan.

Estimated hours taken: 3
Branches: main, release

Fix the failure of debugger/declarative/sort.m.  The problem was that the
depth command in the declarative debugger did not affect the depth to which
I/O actions were printed.  This was because printing I/O actions uses the
`print all' configuration parameters and the `depth' command in the
declarative debugger only affects the `print' configuration parameters.  The
solution is to add four new formatting commands to the declarative debugger
(really just variants of the existing commands.)  These are `depth io', `size
io', `lines io' and `width io'.  These function identically to the `depth',
`size', `lines' and `width' commands except that they affect the `print all'
configuration parameters, rather the ones for `print'.

browser/declarative_user.m:
	Add the four new commands described above.

doc/user_guide.texi:
	Document the new commands.

browser/declarative_debugger.m:
	Fix some formatting.

tests/debugger/declarative/sort.inp:
tests/debugger/declarative/sort.exp:
	Use the new commands set the depth to which I/O actions are printed in
	the declarative debugger to an appropriate level for this test - it
	needs to be deep enough to print out the strings returned by
	read_line_as_string_2.

tests/debugger/declarative/dd_params.exp:
tests/debugger/declarative/dd_params.inp:
	Extend this test to cover the new commands.

Julien.

Index: browser/declarative_debugger.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_debugger.m,v
retrieving revision 1.68
diff -u -r1.68 declarative_debugger.m
--- browser/declarative_debugger.m	29 Mar 2006 08:06:31 -0000	1.68
+++ browser/declarative_debugger.m	8 Jun 2006 01:35:51 -0000
@@ -5,10 +5,10 @@
 % 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.
 %-----------------------------------------------------------------------------%
-
+%
 % File: declarative_debugger.m.
 % Author: Mark Brown.
-
+%
 % This module has two main purposes:
 %   - to define the interface between the front and back ends of
 %     a Mercury declarative debugger, and
@@ -53,7 +53,7 @@
 % portion of the annotated trace, although the backend will not materialize
 % nodes which already exist in the current annotated trace when materializing
 % a supertree.
-
+%
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%

Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.62
diff -u -r1.62 declarative_user.m
--- browser/declarative_user.m	6 Jun 2006 07:37:36 -0000	1.62
+++ browser/declarative_user.m	8 Jun 2006 04:37:48 -0000
@@ -120,6 +120,7 @@
 :- import_module list.
 :- import_module maybe.
 :- import_module string.
+:- import_module svmap.
 :- import_module univ.

 %-----------------------------------------------------------------------------%
@@ -959,11 +960,33 @@
 :- func format_param_arg_cmd(string::in, list(string)::in)
     = (user_command::out) is semidet.

-format_param_arg_cmd(Cmd, ArgWords)
-        = param_command(format_param(MaybeOptionTable, Setting)) :-
+format_param_arg_cmd(Cmd, ArgWords0) = Command :-
+    ( ArgWords0 = ["io" | ArgWords1] ->
+        ArgWords = ArgWords1,
+        HasIOArg = yes : bool
+    ;
+        ArgWords = ArgWords0,
+        HasIOArg = no : bool
+    ),
     ArgWords \= [],
-    parse.parse([Cmd | ArgWords],
-        param_command(format_param(MaybeOptionTable, Setting))).
+    parse.parse([Cmd | ArgWords], ParsedCommand),
+    ParsedCommand = param_command(format_param(MaybeOptionTable0, Setting)),
+    (
+        HasIOArg = yes,
+        % Since the command was invoked with the `io' argument we want to
+        % change the settings for the `print all' configuration parameter,
+        % rather than the ones for `print'.
+        some [!OptionTable] (
+            MaybeOptionTable0 = ok(!:OptionTable),
+            svmap.det_update(set_print, bool(no), !OptionTable),
+            svmap.det_update(set_print_all, bool(yes), !OptionTable),
+            MaybeOptionTable = ok(!.OptionTable)
+        )
+    ;
+        HasIOArg = no,
+        MaybeOptionTable = MaybeOptionTable0
+    ),
+    Command = param_command(format_param(MaybeOptionTable, Setting)).

 :- func num_io_actions_cmd(list(string)::in) = (user_command::out) is semidet.

Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.479
diff -u -r1.479 user_guide.texi
--- doc/user_guide.texi	7 Jun 2006 06:14:04 -0000	1.479
+++ doc/user_guide.texi	8 Jun 2006 04:05:11 -0000
@@ -4323,16 +4323,29 @@
 @item depth @var{num}
 Set the maximum depth to which terms are printed to @var{num}.
 @sp 1
+ at item depth io @var{num}
+Set the maximum depth to which I/O actions are printed to @var{num}.
+ at sp 1
 @item size @var{num}
 Set the maximum number of function symbols
 to be printed in terms to @var{num}.
 @sp 1
+ at item size io @var{num}
+Set the maximum number of function symbols
+to be printed in I/O actions to @var{num}.
+ at sp 1
 @item width @var{num}
 Set the number of columns in which terms are to be printed to @var{num}.
 @sp 1
+ at item width io @var{num}
+Set the number of columns in which I/O actions are to be printed to @var{num}.
+ at sp 1
 @item lines @var{num}
 Set the maximum number of lines in terms to be printed to @var{num}.
 @sp 1
+ at item lines io @var{num}
+Set the maximum number of lines in I/O actions to be printed to @var{num}.
+ at sp 1
 @item actions @var{num}
 Set the maximum number of I/O actions to be printed in questions to @var{num}.
 @sp 1
Index: tests/debugger/declarative/dd_params.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/dd_params.exp,v
retrieving revision 1.1
diff -u -r1.1 dd_params.exp
--- tests/debugger/declarative/dd_params.exp	5 Jun 2006 07:03:01 -0000	1.1
+++ tests/debugger/declarative/dd_params.exp	8 Jun 2006 04:26:09 -0000
@@ -57,6 +57,37 @@
 Printall raw_pretty:             3         10        80        2

 Number of I/O actions printed is: 10
+dd> depth 5
+dd> size 5
+dd> width 5
+dd> lines 5
+dd> depth io 10
+dd> size io 10
+dd> width io 10
+dd> lines io 10
+dd> params
+Browser default format: flat
+                                 depth     size      width     lines
+Browser flat:                    10        30        80        25
+Browser verbose:                 10        30        80        25
+Browser pretty:                  10        30        80        25
+Browser raw_pretty:              10        30        80        25
+
+Print default format: flat
+                                 depth     size      width     lines
+Print flat:                      5         5         5         5
+Print verbose:                   5         5         5         5
+Print pretty:                    5         5         5         5
+Print raw_pretty:                5         5         5         5
+
+Printall default format: flat
+                                 depth     size      width     lines
+Printall flat:                   10        10        10        10
+Printall verbose:                10        10        10        10
+Printall pretty:                 10        10        10        10
+Printall raw_pretty:             10        10        10        10
+
+Number of I/O actions printed is: 10
 dd> quit
 Diagnosis aborted.
        3:      2  2 EXIT pred dd_params.p/2-0 (det) dd_params.m:22 (dd_params.m:11)
Index: tests/debugger/declarative/dd_params.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/dd_params.inp,v
retrieving revision 1.1
diff -u -r1.1 dd_params.inp
--- tests/debugger/declarative/dd_params.inp	5 Jun 2006 07:03:01 -0000	1.1
+++ tests/debugger/declarative/dd_params.inp	8 Jun 2006 04:25:26 -0000
@@ -7,5 +7,14 @@
 params
 actions 10
 params
+depth 5
+size 5
+width 5
+lines 5
+depth io 10
+size io 10
+width io 10
+lines io 10
+params
 quit
 continue
Index: tests/debugger/declarative/sort.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/sort.exp,v
retrieving revision 1.2
diff -u -r1.2 sort.exp
--- tests/debugger/declarative/sort.exp	4 Apr 2006 07:37:24 -0000	1.2
+++ tests/debugger/declarative/sort.exp	8 Jun 2006 04:36:32 -0000
@@ -31,10 +31,10 @@
 write_string(...)
 write_string(...)
 write_string(...)
-Valid? depth 10
+Valid? depth io 10
 dd> print io 9
 read_line_as_string_2(<<foreign>>, yes, -1, "")
-dd> depth 1
+dd> depth io 1
 dd> no
 open_stream(...)
 3 tabled IO actions:
Index: tests/debugger/declarative/sort.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/sort.inp,v
retrieving revision 1.2
diff -u -r1.2 sort.inp
--- tests/debugger/declarative/sort.inp	4 Apr 2006 07:37:24 -0000	1.2
+++ tests/debugger/declarative/sort.inp	8 Jun 2006 04:36:16 -0000
@@ -5,9 +5,9 @@
 format pretty
 format_param depth 1
 dd
-depth 10
+depth io 10
 print io 9
-depth 1
+depth io 1
 no
 yes
 quit

--------------------------------------------------------------------------
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