| 1 | (* |
| 2 | * Copyright 2010, INRIA, University of Copenhagen |
| 3 | * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix |
| 4 | * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen |
| 5 | * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix |
| 6 | * This file is part of Coccinelle. |
| 7 | * |
| 8 | * Coccinelle is free software: you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation, according to version 2 of the License. |
| 11 | * |
| 12 | * Coccinelle is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>. |
| 19 | * |
| 20 | * The authors reserve the right to distribute this or future versions of |
| 21 | * Coccinelle under other licenses. |
| 22 | *) |
| 23 | |
| 24 | |
| 25 | type 'a combiner = |
| 26 | {combiner_ident : Ast_cocci.ident -> 'a; |
| 27 | combiner_expression : Ast_cocci.expression -> 'a; |
| 28 | combiner_fullType : Ast_cocci.fullType -> 'a; |
| 29 | combiner_typeC : Ast_cocci.typeC -> 'a; |
| 30 | combiner_declaration : Ast_cocci.declaration -> 'a; |
| 31 | combiner_initialiser : Ast_cocci.initialiser -> 'a; |
| 32 | combiner_parameter : Ast_cocci.parameterTypeDef -> 'a; |
| 33 | combiner_parameter_list : Ast_cocci.parameter_list -> 'a; |
| 34 | combiner_rule_elem : Ast_cocci.rule_elem -> 'a; |
| 35 | combiner_statement : Ast_cocci.statement -> 'a; |
| 36 | combiner_case_line : Ast_cocci.case_line -> 'a; |
| 37 | combiner_top_level : Ast_cocci.top_level -> 'a; |
| 38 | combiner_anything : Ast_cocci.anything -> 'a; |
| 39 | combiner_expression_dots : |
| 40 | Ast_cocci.expression Ast_cocci.dots -> 'a; |
| 41 | combiner_statement_dots : |
| 42 | Ast_cocci.statement Ast_cocci.dots -> 'a; |
| 43 | combiner_declaration_dots : |
| 44 | Ast_cocci.declaration Ast_cocci.dots -> 'a; |
| 45 | combiner_initialiser_dots : |
| 46 | Ast_cocci.initialiser Ast_cocci.dots -> 'a} |
| 47 | |
| 48 | type ('mc,'a) cmcode = 'a combiner -> 'mc Ast_cocci.mcode -> 'a |
| 49 | type ('cd,'a) ccode = 'a combiner -> ('cd -> 'a) -> 'cd -> 'a |
| 50 | |
| 51 | val combiner : |
| 52 | ('a -> 'a -> 'a) -> 'a -> |
| 53 | ((Ast_cocci.meta_name,'a) cmcode) -> |
| 54 | ((string,'a) cmcode) -> |
| 55 | ((Ast_cocci.constant,'a) cmcode) -> |
| 56 | ((Ast_cocci.assignOp,'a) cmcode) -> |
| 57 | ((Ast_cocci.fixOp,'a) cmcode) -> |
| 58 | ((Ast_cocci.unaryOp,'a) cmcode) -> |
| 59 | ((Ast_cocci.binaryOp,'a) cmcode) -> |
| 60 | ((Ast_cocci.const_vol,'a) cmcode) -> |
| 61 | ((Ast_cocci.sign,'a) cmcode) -> |
| 62 | ((Ast_cocci.structUnion,'a) cmcode) -> |
| 63 | ((Ast_cocci.storage,'a) cmcode) -> |
| 64 | ((Ast_cocci.inc_file,'a) cmcode) -> |
| 65 | ((Ast_cocci.expression Ast_cocci.dots,'a) ccode) -> |
| 66 | ((Ast_cocci.parameterTypeDef Ast_cocci.dots,'a) ccode) -> |
| 67 | ((Ast_cocci.statement Ast_cocci.dots,'a) ccode) -> |
| 68 | ((Ast_cocci.declaration Ast_cocci.dots,'a) ccode) -> |
| 69 | ((Ast_cocci.initialiser Ast_cocci.dots,'a) ccode) -> |
| 70 | ((Ast_cocci.ident,'a) ccode) -> |
| 71 | ((Ast_cocci.expression,'a) ccode) -> |
| 72 | ((Ast_cocci.fullType,'a) ccode) -> |
| 73 | ((Ast_cocci.typeC,'a) ccode) -> |
| 74 | ((Ast_cocci.initialiser,'a) ccode) -> |
| 75 | ((Ast_cocci.parameterTypeDef,'a) ccode) -> |
| 76 | ((Ast_cocci.declaration,'a) ccode) -> |
| 77 | ((Ast_cocci.rule_elem,'a) ccode) -> |
| 78 | ((Ast_cocci.statement,'a) ccode) -> |
| 79 | ((Ast_cocci.case_line,'a) ccode) -> |
| 80 | ((Ast_cocci.top_level,'a) ccode) -> |
| 81 | ((Ast_cocci.anything,'a) ccode) -> |
| 82 | 'a combiner |
| 83 | |
| 84 | type 'a inout = 'a -> 'a (* for specifying the type of rebuilder *) |
| 85 | |
| 86 | type rebuilder = |
| 87 | {rebuilder_ident : Ast_cocci.ident inout; |
| 88 | rebuilder_expression : Ast_cocci.expression inout; |
| 89 | rebuilder_fullType : Ast_cocci.fullType inout; |
| 90 | rebuilder_typeC : Ast_cocci.typeC inout; |
| 91 | rebuilder_declaration : Ast_cocci.declaration inout; |
| 92 | rebuilder_initialiser : Ast_cocci.initialiser inout; |
| 93 | rebuilder_parameter : Ast_cocci.parameterTypeDef inout; |
| 94 | rebuilder_parameter_list : Ast_cocci.parameter_list inout; |
| 95 | rebuilder_statement : Ast_cocci.statement inout; |
| 96 | rebuilder_case_line : Ast_cocci.case_line inout; |
| 97 | rebuilder_rule_elem : Ast_cocci.rule_elem inout; |
| 98 | rebuilder_top_level : Ast_cocci.top_level inout; |
| 99 | rebuilder_expression_dots : Ast_cocci.expression Ast_cocci.dots inout; |
| 100 | rebuilder_statement_dots : Ast_cocci.statement Ast_cocci.dots inout; |
| 101 | rebuilder_declaration_dots : Ast_cocci.declaration Ast_cocci.dots inout; |
| 102 | rebuilder_initialiser_dots : Ast_cocci.initialiser Ast_cocci.dots inout; |
| 103 | rebuilder_define_param_dots: Ast_cocci.define_param Ast_cocci.dots inout; |
| 104 | rebuilder_define_param : Ast_cocci.define_param inout; |
| 105 | rebuilder_define_parameters : Ast_cocci.define_parameters inout; |
| 106 | rebuilder_anything : Ast_cocci.anything inout} |
| 107 | |
| 108 | type 'mc rmcode = 'mc Ast_cocci.mcode inout |
| 109 | type 'cd rcode = rebuilder -> ('cd inout) -> 'cd inout |
| 110 | |
| 111 | val rebuilder : |
| 112 | (Ast_cocci.meta_name rmcode) -> |
| 113 | (string rmcode) -> |
| 114 | (Ast_cocci.constant rmcode) -> |
| 115 | (Ast_cocci.assignOp rmcode) -> |
| 116 | (Ast_cocci.fixOp rmcode) -> |
| 117 | (Ast_cocci.unaryOp rmcode) -> |
| 118 | (Ast_cocci.binaryOp rmcode) -> |
| 119 | (Ast_cocci.const_vol rmcode) -> |
| 120 | (Ast_cocci.sign rmcode) -> |
| 121 | (Ast_cocci.structUnion rmcode) -> |
| 122 | (Ast_cocci.storage rmcode) -> |
| 123 | (Ast_cocci.inc_file rmcode) -> |
| 124 | (Ast_cocci.expression Ast_cocci.dots rcode) -> |
| 125 | (Ast_cocci.parameterTypeDef Ast_cocci.dots rcode) -> |
| 126 | (Ast_cocci.statement Ast_cocci.dots rcode) -> |
| 127 | (Ast_cocci.declaration Ast_cocci.dots rcode) -> |
| 128 | (Ast_cocci.initialiser Ast_cocci.dots rcode) -> |
| 129 | (Ast_cocci.ident rcode) -> |
| 130 | (Ast_cocci.expression rcode) -> |
| 131 | (Ast_cocci.fullType rcode) -> |
| 132 | (Ast_cocci.typeC rcode) -> |
| 133 | (Ast_cocci.initialiser rcode) -> |
| 134 | (Ast_cocci.parameterTypeDef rcode) -> |
| 135 | (Ast_cocci.declaration rcode) -> |
| 136 | (Ast_cocci.rule_elem rcode) -> |
| 137 | (Ast_cocci.statement rcode) -> |
| 138 | (Ast_cocci.case_line rcode) -> |
| 139 | (Ast_cocci.top_level rcode) -> |
| 140 | (Ast_cocci.anything rcode) -> |
| 141 | rebuilder |