diff: fix for problem with NU-Prolog debugging

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Mar 27 23:24:11 AEDT 1998


Estimated hours taken: 0.25

Fix a problem that broke the use of NU-Prolog debugging.

The problem was that portray.nl was calling current_op/3,
but NU-Prolog only has currentOp/3.
The fix was to change things to use the NU-Prolog version
and add an implementation of the NU-Prolog version in
terms of the SICStus/ISO Prolog version to sp_lib.nl.
(A better policy would be always use the ISO names, and
to have an nc_lib.nl file providing implementations of
the ISO names in terms of the NU Prolog names rather than
vice versa; however, the current policy of always using
the NU-Prolog names is at least consistent, and changing
the current policy consistently would be a relatively large
amount of work.)

library/portray.nl:
	Change calls to current_op/3 to instead call currentOp/3.

library/sp_lib.nl:
	Add an implementation of currentOp/3 in terms of current_op/3.

Index: portray.nl
===================================================================
RCS file: /home/mercury1/repository/mercury/library/portray.nl,v
retrieving revision 1.17
diff -u -u -r1.17 portray.nl
--- portray.nl	1997/11/04 01:12:13	1.17
+++ portray.nl	1998/03/27 12:16:33
@@ -438,9 +438,9 @@
 	).
 
 prefix_op(Op, NeededPrecedence, ArgPrecedence) :-
-	(   current_op(NeededPrecedence, fx, Op) ->
+	(   currentOp(NeededPrecedence, fx, Op) ->
 		ArgPrecedence is NeededPrecedence - 1
-	;   current_op(NeededPrecedence, fy, Op) ->
+	;   currentOp(NeededPrecedence, fy, Op) ->
 		ArgPrecedence = NeededPrecedence
 	;
 		fail				% to keep NU Prolog happy
@@ -448,9 +448,9 @@
 
 
 postfix_op(Op, NeededPrecedence, ArgPrecedence) :-
-	(   current_op(NeededPrecedence, xf, Op) ->
+	(   currentOp(NeededPrecedence, xf, Op) ->
 		ArgPrecedence is NeededPrecedence - 1
-	;   current_op(NeededPrecedence, yf, Op) ->
+	;   currentOp(NeededPrecedence, yf, Op) ->
 		ArgPrecedence = NeededPrecedence
 	;
 		fail				% to keep NU Prolog happy
@@ -458,13 +458,13 @@
 
 
 infix_op(Op, NeededPrecedence, Arg1Precedence, Arg2Precedence) :-
-	(   current_op(NeededPrecedence, xfx, Op) ->
+	(   currentOp(NeededPrecedence, xfx, Op) ->
 		Arg1Precedence is NeededPrecedence - 1,
 		Arg2Precedence = Arg1Precedence
-	;   current_op(NeededPrecedence, xfy, Op) ->
+	;   currentOp(NeededPrecedence, xfy, Op) ->
 		Arg1Precedence is NeededPrecedence - 1,
 		Arg2Precedence = NeededPrecedence
-	;   current_op(NeededPrecedence, yfx, Op) ->
+	;   currentOp(NeededPrecedence, yfx, Op) ->
 		Arg1Precedence = NeededPrecedence,
 		Arg2Precedence is NeededPrecedence - 1
 	;
Index: sp_lib.nl
===================================================================
RCS file: /home/mercury1/repository/mercury/library/sp_lib.nl,v
retrieving revision 1.24
diff -u -u -r1.24 sp_lib.nl
--- sp_lib.nl	1997/07/27 15:07:14	1.24
+++ sp_lib.nl	1998/03/27 12:16:15
@@ -44,6 +44,9 @@
 remprop(Atom, Key) :-
 	retractall(property(Atom, Key, _Property)).
 
+currentOp(A, B, C) :-
+	current_op(A, B, C).
+
 currentInput(X) :-
 	current_input(X).
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list