| 1 | open Ograph_extended |
| 2 | |
| 3 | (*****************************************************************************) |
| 4 | (* the different ctl formula related types *) |
| 5 | (*****************************************************************************) |
| 6 | type mvar = Ast_cocci.meta_name |
| 7 | |
| 8 | type predicate = |
| 9 | InLoop | TrueBranch | FalseBranch |
| 10 | | After (* pointer to the code after an if or while *) |
| 11 | | FallThrough | LoopFallThrough |
| 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 | |
| 23 | (* coccionly: *) |
| 24 | type ctlcocci = (predicate, Ast_cocci.meta_name) Wrapper_ctl.wrapped_ctl |
| 25 | |
| 26 | |
| 27 | (*****************************************************************************) |
| 28 | (* the different binding types *) |
| 29 | (*****************************************************************************) |
| 30 | type metavars_binding = Ast_c.metavars_binding |
| 31 | |
| 32 | (* used in ctlcocci_integration *) |
| 33 | type metavar_binding_kind2 = |
| 34 | | NormalMetaVal of Ast_c.metavar_binding_kind |
| 35 | | ParenVal of Ast_cocci.meta_name |
| 36 | | LabelVal of labelval |
| 37 | | GoodVal | BadVal (* used to implement \+ *) |
| 38 | |
| 39 | and labelval = Absolute of int list | Prefix of int list |
| 40 | |
| 41 | and metavars_binding2 = (mvar, metavar_binding_kind2) Common.assoc |
| 42 | |
| 43 | |
| 44 | |
| 45 | (*****************************************************************************) |
| 46 | (* the CTL model related types *) |
| 47 | (*****************************************************************************) |
| 48 | (* coccionly: *) |
| 49 | type label_ctlcocci = |
| 50 | predicate -> |
| 51 | (nodei * |
| 52 | (predicate * (mvar, metavar_binding_kind2) Ast_ctl.generic_substitution)) |
| 53 | list |
| 54 | |
| 55 | type model = Control_flow_c.cflow * label_ctlcocci * nodei list |
| 56 | |
| 57 | type transformation_info = |
| 58 | (nodei * metavars_binding * Ast_cocci.rule_elem) list |
| 59 | |
| 60 | type numbered_transformation_info = |
| 61 | (int list * (nodei * metavars_binding * Ast_cocci.rule_elem)) list |
| 62 | |
| 63 | |
| 64 | (*****************************************************************************) |
| 65 | (* comparing binding *) |
| 66 | (*****************************************************************************) |
| 67 | |
| 68 | let equal_binding xs ys = |
| 69 | List.sort compare xs = List.sort compare ys |