[m-rev.] diff: implement limited_deconstruct_cc in Mercury.

Peter Ross pro at missioncriticalit.com
Tue Dec 3 21:20:49 AEDT 2002


Hi,

Sorry about only finding this needed change today, but I had an
MCFLAGS=... in my Mmake.params file which meant while compiling the
browser directory I used the installed library interface files not the
new ones.  Hence these changes not being discovered until today.

===================================================================


Estimated hours taken: 1
Branches: main

More fixes due to the interface changes of the _cc predicates in
deconstruct and std_util.

browser/browser_info.m:
    Change limited_deconstruct_browser_term_cc to use the
    std_util__limited_deconstruct_cc.
    Change deconstruct_browser_term_cc to use std_util__deconstruct_cc.

browser/browse.m:
browser/sized_pretty.m:
    Handle the changes to limited_deconstruct_browser_term_cc.


Index: browser/browse.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/browser/browse.m,v
retrieving revision 1.34
diff -u -r1.34 browse.m
--- browser/browse.m	2 Dec 2002 16:27:50 -0000	1.34
+++ browser/browse.m	3 Dec 2002 09:29:27 -0000
@@ -653,11 +653,12 @@
 
 browser_term_to_string_2(BrowserTerm, MaxSize, CurSize, NewSize,
 		MaxDepth, CurDepth, Str) :-
+	limited_deconstruct_browser_term_cc(BrowserTerm, MaxSize,
+			MaybeFunctorArityArgs, MaybeReturn),
 	(
 		CurSize < MaxSize,
 		CurDepth < MaxDepth,
-		limited_deconstruct_browser_term_cc(BrowserTerm, MaxSize,
-			Functor, _Arity, Args, MaybeReturn)
+		MaybeFunctorArityArgs = yes({Functor, _Arity, Args})
 	->
 		browser_term_to_string_3(Functor, Args, MaybeReturn,
 			MaxSize, CurSize, NewSize, MaxDepth, CurDepth, Str)
@@ -723,9 +724,10 @@
 	% We want the limit to be at least two to ensure that the limited
 	% deconstruct won't fail for any list term.
 	Limit = max(MaxSize, 2),
+	limited_deconstruct_browser_term_cc(plain_term(TailUniv),
+			Limit, MaybeFunctorArityArgs, MaybeReturn),
 	(
-		limited_deconstruct_browser_term_cc(plain_term(TailUniv),
-			Limit, Functor, _Arity, Args, MaybeReturn)
+		MaybeFunctorArityArgs = yes({Functor, _Arity, Args})
 	->
 		(
 			Functor = "[]",
@@ -873,11 +875,12 @@
 
 browser_term_to_string_verbose_2(BrowserTerm, MaxSize, CurSize, NewSize,
 		MaxDepth, CurDepth, Frame) :-
+	limited_deconstruct_browser_term_cc(BrowserTerm, MaxSize,
+			MaybeFunctorArityArgs, MaybeReturn),
 	(
 		CurSize < MaxSize,
 		CurDepth < MaxDepth,
-		limited_deconstruct_browser_term_cc(BrowserTerm, MaxSize,
-			Functor, _Arity, Args0, MaybeReturn)
+		MaybeFunctorArityArgs = yes({Functor, _Arity, Args0})
 	->
 		% XXX we should consider formatting function terms differently.
 		(
Index: browser/browser_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/browser/browser_info.m,v
retrieving revision 1.10
diff -u -r1.10 browser_info.m
--- browser/browser_info.m	1 Nov 2002 07:44:58 -0000	1.10
+++ browser/browser_info.m	3 Dec 2002 09:31:07 -0000
@@ -166,7 +166,7 @@
 	string::out, int::out, list(univ)::out, maybe(univ)::out) is cc_multi.
 
 :- pred limited_deconstruct_browser_term_cc(browser_term::in, int::in,
-	string::out, int::out, list(univ)::out, maybe(univ)::out) is cc_nondet.
+	maybe({string, int, list(univ)})::out, maybe(univ)::out) is cc_multi.
 
 :- pred functor_browser_term_cc(browser_term::in, string::out, int::out,
 	bool::out) is cc_multi.
@@ -504,24 +504,24 @@
 deconstruct_browser_term_cc(BrowserTerm, Functor, Arity, Args, MaybeReturn) :-
 	(
 		BrowserTerm = plain_term(Univ),
-		deconstruct(univ_value(Univ), include_details_cc,
-			Functor, Arity, Args),
+		deconstruct_cc(univ_value(Univ), Functor, Arity, Args),
 		MaybeReturn = no
 	;
 		BrowserTerm = synthetic_term(Functor, Args, MaybeReturn),
 		list__length(Args, Arity)
 	).
 
-limited_deconstruct_browser_term_cc(BrowserTerm, Limit, Functor, Arity, Args,
+limited_deconstruct_browser_term_cc(BrowserTerm, Limit, MaybeFunctorArityArgs,
 		MaybeReturn) :-
 	(
 		BrowserTerm = plain_term(Univ),
-		limited_deconstruct(univ_value(Univ), include_details_cc,
-			Limit, Functor, Arity, Args),
+		std_util__limited_deconstruct_cc(univ_value(Univ), Limit,
+				MaybeFunctorArityArgs),
 		MaybeReturn = no
 	;
 		BrowserTerm = synthetic_term(Functor, Args, MaybeReturn),
-		list__length(Args, Arity)
+		list__length(Args, Arity),
+		MaybeFunctorArityArgs = yes({Functor, Arity, Args})
 	).
 
 functor_browser_term_cc(BrowserTerm, Functor, Arity, IsFunc) :-
Index: browser/sized_pretty.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/browser/sized_pretty.m,v
retrieving revision 1.6
diff -u -r1.6 sized_pretty.m
--- browser/sized_pretty.m	28 Jan 2002 07:20:10 -0000	1.6
+++ browser/sized_pretty.m	3 Dec 2002 09:32:21 -0000
@@ -309,9 +309,10 @@
 
 first_pass(BrowserTerm, Params, Limit, Size) :-
 	MaxFunctors = maximum_functors(Limit, Params),
+	limited_deconstruct_browser_term_cc(BrowserTerm, MaxFunctors,
+			MaybeFunctorArityArgs, _MaybeReturn),
 	(
-		limited_deconstruct_browser_term_cc(BrowserTerm, MaxFunctors,
-			Functor, Arity, Args, _MaybeReturn)
+		MaybeFunctorArityArgs = yes({Functor, Arity, Args})
 	->
 		measured_split(BrowserTerm, Params, Limit, Arity, yes,
 			FunctorSize, MaybeInitArgLimit, NewLimit, NewParams),

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