File: collect__control_flow_graph

package info (click to toggle)
mercury 0.9-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 18,488 kB
  • ctags: 9,800
  • sloc: objc: 146,680; ansic: 51,418; sh: 6,436; lisp: 1,567; cpp: 1,040; perl: 854; makefile: 450; asm: 232; awk: 203; exp: 32; fortran: 3; csh: 1
file content (35 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
%------------------------------------------------------------------------------%
% Copyright (C) 1999 INRIA/INSA.
% 
% Author : Erwan Jahier <jahier@irisa.fr>
%
% define a monitor which is used in control_flow.op

:- import_module list.

:- type my_proc ---> proc_name/arity.
:- type edge ---> edge(my_proc, my_proc).
:- type graph == list(edge).

:- type collected_type --->  
	collected_type(my_proc, graph).

initialize(collected_type("main"/2, [])).

filter(Event, AccIn, AccOut, continue) :-
	Port = port(Event),
	AccIn = collected_type(Proc, Graph),
	( 
		not (Port = call ; Port = exit ; Port = redo ; Port = fail)
	->
		AccOut = AccIn
	;
		Proc2 = proc_name(Event) / proc_arity(Event),
		Edge = edge(Proc, Proc2),
		( member(Edge, Graph) ->
			AccOut = AccIn
		;
			AccOut = collected_type(Proc2, [Edge|Graph])
		)
	).