[m-dev.] trivial diff: fix browser default depth

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Thu May 11 17:24:53 AEST 2000


Estimated hours taken: 0.2

Fix a bug in the term browser: the term size limit was by default
being set to the default depth value, 10.  The depth value was
hard-coded to 3.  Since 3 is a more sensible depth limit (atleast
for the one-line printing that the internal debugger does), the default
has been changed to that.

browser/parse.m:
	Set the intended default depth to 3.

browser/browse.m:
	Set the browser defaults in a more readable fashion.
	Don't hard-code the default depth limit in the help message.

Index: browser/browse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browse.m,v
retrieving revision 1.12
diff -u -r1.12 browse.m
--- browser/browse.m	2000/03/24 10:27:19	1.12
+++ browser/browse.m	2000/05/11 06:21:36
@@ -324,30 +324,32 @@
 		{ true }
 	).
 
-	% XXX: default depth is hardwired to 10.
 :- pred help(debugger::in, io__state::di, io__state::uo) is det.
 help(Debugger) -->
-	write_string_debugger(Debugger,
-"Commands are:\n\
-\tls [path]      -- list subterm (expanded)\n\
-\tcd [path]      -- cd current subterm (default is root)\n\
-\thelp           -- show this help message\n\
-\tset var value  -- set a setting\n\
-\tset            -- show settings\n\
-\tprint          -- show single line representation of current term\n\
-\tquit           -- quit browser\n\
-SICStus Prolog style commands are:\n\
-\tp              -- print\n\
-\t< [n]          -- set depth (default is 10)\n\
-\t^ [path]       -- cd [path]\n\
-\t?              -- help\n\
-\th              -- help\n\
-\n\
--- settings:\n\
---    size; depth; path; format (flat pretty verbose); clipx; clipy\n\
---    Paths can be Unix-style or SICStus-style: /2/3/1 or ^2^3^1\n\
-\n"
-	).
+	{ default_depth(Default) },
+	{ string__int_to_string(Default, DefaultStr) },
+	{ string__append_list([
+"Commands are:\n",
+"\tls [path]      -- list subterm (expanded)\n",
+"\tcd [path]      -- cd current subterm (default is root)\n",
+"\thelp           -- show this help message\n",
+"\tset var value  -- set a setting\n",
+"\tset            -- show settings\n",
+"\tprint          -- show single line representation of current term\n",
+"\tquit           -- quit browser\n",
+"SICStus Prolog style commands are:\n",
+"\tp              -- print\n",
+"\t< [n]          -- set depth (default is ", DefaultStr, ")\n",
+"\t^ [path]       -- cd [path]\n",
+"\t?              -- help\n",
+"\th              -- help\n",
+"\n",
+"-- settings:\n",
+"--    size; depth; path; format (flat pretty verbose); clipx; clipy\n",
+"--    Paths can be Unix-style or SICStus-style: /2/3/1 or ^2^3^1\n",
+"\n"],
+		HelpMessage) },
+	write_string_debugger(Debugger, HelpMessage).
 
 %---------------------------------------------------------------------------%
 %
@@ -794,7 +796,12 @@
 	DummyObject = "",
 	type_to_univ(DummyObject, Univ),
 	default_depth(DefaultDepth),
-	State = browser_state(Univ, 3, DefaultDepth, [], verbose, 79, 25).
+	MaxTermSize = 10,
+	DefaultFormat = verbose,
+	ClipX = 79,
+	ClipY = 25,
+	State = browser_state(Univ, DefaultDepth, MaxTermSize, [],
+			DefaultFormat, ClipX, ClipY).
 
 :- pred get_term(browser_state, univ).
 :- mode get_term(in, out) is det.
Index: browser/parse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/parse.m,v
retrieving revision 1.6
diff -u -r1.6 parse.m
--- browser/parse.m	2000/02/04 03:45:29	1.6
+++ browser/parse.m	2000/05/11 06:21:40
@@ -308,7 +308,7 @@
 		)
 	).
 
-default_depth(10).
+default_depth(3).
 
 :- pred parse_path(list(token), path).
 :- mode parse_path(in, out) is semidet.
-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
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