[m-dev.] diff: remove the stop flag in collect
Erwan Jahier
Erwan.Jahier at irisa.fr
Wed Aug 29 06:12:59 AEST 2001
Estimated hours taken: .5
branches: main.
Remove the binary flag used as fourth argument of filter and make
filter a semidet predicate instead. If filter succeeds, it means that
the monitoring process can continue (the flag was set to `continue');
if it fails, it it means that the monitoring process should stop (the
flag was set to `stop').
extras/morphine/source/collect.in:
Remove the fourth argument of filter and make it semidet.
extras/morphine/source/collect.op:
Compile monitors with --no-warn-det-decls-too-lax to avoid
warnings when filter is det (since it is declared semidet).
extras/morphine/source/collect__dynamic_call_graph:
extras/morphine/source/collect__control_flow_graph:
extras/morphine/source/collect__proof_tree:
extras/morphine/non-regression-tests/test_ln:
Remove the fourth argument of filter.
Index: extras/morphine/non-regression-tests/test_ln
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/non-regression-tests/test_ln,v
retrieving revision 1.1
diff -u -d -u -r1.1 test_ln
--- extras/morphine/non-regression-tests/test_ln 2001/07/05 08:05:37 1.1
+++ extras/morphine/non-regression-tests/test_ln 2001/08/28 20:07:01
@@ -9,7 +9,7 @@
initialize([]).
-filter(Event, L, [line_number(Event)|L], continue).
+filter(Event, L, [line_number(Event)|L]).
Index: extras/morphine/source/collect.in
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/collect.in,v
retrieving revision 1.6
diff -u -d -u -r1.6 collect.in
--- extras/morphine/source/collect.in 2001/07/05 08:05:32 1.6
+++ extras/morphine/source/collect.in 2001/08/28 20:07:01
@@ -192,24 +192,19 @@
Event = event(_, _, _, _, _, _, _, _, _, _, _, _, _, LineNumber).
-% Type of the fourth argument of filter/4 which tells whether to stop collecting
-% or not.
-:- type stop_or_continue --->
- stop
- ; continue.
filter(EventNumber, CallNumber, DepthNumber, Port, PredOrFunc, DeclModuleName,
DefModuleName, PredName, Arity, ModeNum, Arguments, Determinism,
Path, LN, AccIn, AccOut, Char) :-
- filter(event(EventNumber, CallNumber, DepthNumber, Port, PredOrFunc,
+ ( if filter(event(EventNumber, CallNumber, DepthNumber, Port, PredOrFunc,
DeclModuleName, DefModuleName, PredName, Arity, ModeNum,
- Arguments, Determinism, Path, LN), AccIn, AccOut, StopOrContinue),
- (
- StopOrContinue = continue,
- Char = 'n'
- ;
- StopOrContinue = stop,
- Char = 'y'
+ Arguments, Determinism, Path, LN), AccIn, AccOut0)
+ then
+ Char = 'n',
+ AccOut = AccOut0
+ else
+ Char = 'y',
+ AccOut = AccIn
).
% This predicate retrieves the type of the collecting variable.
@@ -230,6 +225,6 @@
collected(collected_type).
-:- pred filter(event, accumulator_type, accumulator_type, stop_or_continue).
-:- mode filter(in, acc_in, acc_out, out) is det.
-:- pragma inline(filter/4).
+:- pred filter(event, accumulator_type, accumulator_type).
+:- mode filter(in, acc_in, acc_out) is semidet.
+:- pragma inline(filter/3).
Index: extras/morphine/source/collect.op
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/collect.op,v
retrieving revision 1.9
diff -u -d -r1.9 collect.op
--- extras/morphine/source/collect.op 2001/07/12 07:28:45 1.9
+++ extras/morphine/source/collect.op 2001/08/28 20:10:27
@@ -267,7 +267,7 @@
sh("rm -f collect.so collect.o"),
current_grade(Grade),
concat_string([
- "mmc --grade ",
+ "mmc --no-warn-det-decls-too-lax --grade ",
Grade,
" -O6",
" -c --pic-reg collect.m"], Command1),
Index: extras/morphine/source/collect__control_flow_graph
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/collect__control_flow_graph,v
retrieving revision 1.3
diff -u -d -u -r1.3 collect__control_flow_graph
--- extras/morphine/source/collect__control_flow_graph 2001/07/12 07:32:09 1.3
+++ extras/morphine/source/collect__control_flow_graph 2001/08/28 20:07:02
@@ -18,7 +18,7 @@
initialize(ct("user"/0, set__init)).
-filter(Event, Acc0, Acc, continue) :-
+filter(Event, Acc0, Acc) :-
Port = port(Event),
(
(Port = call ; Port = exit ; Port = fail ; Port = redo)
Index: extras/morphine/source/collect__dynamic_call_graph
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/collect__dynamic_call_graph,v
retrieving revision 1.3
diff -u -d -u -r1.3 collect__dynamic_call_graph
--- extras/morphine/source/collect__dynamic_call_graph 2001/07/12 07:32:10 1.3
+++ extras/morphine/source/collect__dynamic_call_graph 2001/08/28 20:07:02
@@ -20,7 +20,7 @@
initialize(ct(Stack, set__init)) :-
stack__push(stack__init, "user"/0, Stack).
-filter(Event, Acc0, Acc, continue) :-
+filter(Event, Acc0, Acc) :-
Port = port(Event),
Acc0 = ct(Stack0, Graph0),
(
Index: extras/morphine/source/collect__proof_tree
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/collect__proof_tree,v
retrieving revision 1.2
diff -u -d -u -r1.2 collect__proof_tree
--- extras/morphine/source/collect__proof_tree 2001/07/18 20:43:49 1.2
+++ extras/morphine/source/collect__proof_tree 2001/08/28 20:07:02
@@ -77,7 +77,7 @@
map__det_insert(GoalSuccTable0, 0, [], GoalSuccTable),
map__init(ProofTable).
-filter(Event, Acc0, Acc, continue) :-
+filter(Event, Acc0, Acc) :-
Acc0 = ct(CallStack0, GoalPath0, GpDetStack0, GpNonDetStack0,
GoalSuccT0, AllSolList0, ProofT0),
Port = port(Event),
--
R1.
--------------------------------------------------------------------------
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