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