Release coccinelle-0.2.0rc1
[bpt/coccinelle.git] / engine / lib_engine.ml
CommitLineData
34e49164
C
1open Ograph_extended
2
3(*****************************************************************************)
4(* the different ctl formula related types *)
5(*****************************************************************************)
6type mvar = Ast_cocci.meta_name
7
8type predicate =
9 InLoop | TrueBranch | FalseBranch
10 | After (* pointer to the code after an if or while *)
951c7801 11 | FallThrough | LoopFallThrough
34e49164
C
12 | Return (* any exit from the current function *)
13 | FunHeader | Top | Exit | ErrorExit | Goto
14 | Paren of Ast_cocci.meta_name
15 | Match of Ast_cocci.rule_elem
16 | Label of Ast_cocci.meta_name
17 | BCLabel of Ast_cocci.meta_name (* parent of break or continue *)
18 | PrefixLabel of Ast_cocci.meta_name
19 | BindGood of Ast_cocci.meta_name (* used to implement \+ *)
20 | BindBad of Ast_cocci.meta_name
21 | FakeBrace
22
485bce71 23(* coccionly: *)
34e49164
C
24type ctlcocci = (predicate, Ast_cocci.meta_name) Wrapper_ctl.wrapped_ctl
25
26
27(*****************************************************************************)
28(* the different binding types *)
29(*****************************************************************************)
30type metavars_binding = Ast_c.metavars_binding
31
32(* used in ctlcocci_integration *)
33type metavar_binding_kind2 =
34 | NormalMetaVal of Ast_c.metavar_binding_kind
35 | ParenVal of Ast_cocci.meta_name
7f004419 36 | LabelVal of labelval
34e49164
C
37 | GoodVal | BadVal (* used to implement \+ *)
38
7f004419
C
39and labelval = Absolute of int list | Prefix of int list
40
34e49164
C
41and metavars_binding2 = (mvar, metavar_binding_kind2) Common.assoc
42
43
44
45(*****************************************************************************)
46(* the CTL model related types *)
47(*****************************************************************************)
485bce71 48(* coccionly: *)
34e49164
C
49type label_ctlcocci =
50 predicate ->
51 (nodei *
52 (predicate * (mvar, metavar_binding_kind2) Ast_ctl.generic_substitution))
53 list
54
55type model = Control_flow_c.cflow * label_ctlcocci * nodei list
56
57type transformation_info =
58 (nodei * metavars_binding * Ast_cocci.rule_elem) list
59
708f4980
C
60type numbered_transformation_info =
61 (int list * (nodei * metavars_binding * Ast_cocci.rule_elem)) list
62
34e49164
C
63
64(*****************************************************************************)
65(* comparing binding *)
66(*****************************************************************************)
67
68let equal_binding xs ys =
69 List.sort compare xs = List.sort compare ys