permit multiline comments and strings in macros
[bpt/coccinelle.git] / docs / Coccilib.3cocci
1 .\" -*- nroff -*-
2 .\" Please adjust this date whenever revising the manpage.
3 .TH COCCILIB 3COCCI "May 18, 2011"
4
5 .\" see http://www.fnal.gov/docs/products/ups/ReferenceManual/html/manpages.html
6 .\" see http://www.linuxjournal.com/article/1158
7 .\" see http://www.schweikhardt.net/man_page_howto.html
8 .\" groff -Tascii -man ./Coccilib.3cocci | more
9 .\"
10 .\" Some roff macros, for reference:
11 .\" .nh disable hyphenation
12 .\" .hy enable hyphenation
13 .\" .ad l left justify
14 .\" .ad b justify to both left and right margins
15 .\" .nf disable filling
16 .\" .fi enable filling
17 .\" .br insert line break
18 .\" .sp <n> insert n+1 empty lines
19 .\" for manpage-specific macros, see man(7)
20 .\"
21 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
22 .\" \fI<whatever>\fP escape sequences to invode bold face and italics,
23 .\" respectively. Also \fR for roman.
24 .\" pad: src: deputy man page
25 .SH NAME
26 Coccilib \- Library of functions for use with Coccinelle OCaml script code
27 .SH MODULE
28 Module Coccilib
29 .SH DOCUMENTATION
30 .sp
31 Module
32 .BI "Coccilib"
33 :
34 .B sig end
35
36 .B ===
37 .B Positions
38 .B ===
39 .PP
40 .I type pos
41 = {
42 current_element :
43 .B string
44 ;
45 file :
46 .B string
47 ;
48 line :
49 .B int
50 ;
51 col :
52 .B int
53 ;
54 line_end :
55 .B int
56 ;
57 col_end :
58 .B int
59 ;
60 }
61
62 .sp
63 A value of type
64 .B pos
65 describes a position in a source file\&.
66 .B current_element
67 is the name of the function containing the matched position;
68 .B file
69 is the name of the file containing the matched position;
70 .B line
71 is the number of the line containing the first character of the matched
72 position;
73 .B col
74 is the (0-based) column containing the first character of the matched position;
75 .B line_end
76 is the number of the line containing the last character of the matched
77 position;
78 .B col_end
79 is the (0-based) column containing the last character of the matched position\&.
80 .sp
81
82 .B ===
83 .B Abstract Syntax Tree
84 .B ===
85 .PP
86 .I type param_type
87 =
88 | Pos
89 .B of
90 .B pos list
91 | Str
92 .B of
93 .B string
94 | Type
95 .B of
96 .B Ast_c.fullType
97 | Init
98 .B of
99 .B Ast_c.initialiser
100 | InitList
101 .B of
102 .B Ast_c.initialiser Ast_c.wrap2 list
103 | Int
104 .B of
105 .B int
106 | Param
107 .B of
108 .B Ast_c.parameterType
109 | ParamList
110 .B of
111 .B Ast_c.parameterType Ast_c.wrap2 list
112 | Expr
113 .B of
114 .B Ast_c.expression
115 | ExprList
116 .B of
117 .B Ast_c.argument Ast_c.wrap2 list
118 | Decl
119 .B of
120 .B Ast_c.declaration
121 | Field
122 .B of
123 .B Ast_c.field
124 | FieldList
125 .B of
126 .B Ast_c.field list
127 | Stmt
128 .B of
129 .B Ast_c.statement
130 .sp
131
132 .B ===
133 .B Match management functions
134 .B ===
135
136 .I val include_match
137 :
138 .B bool -> unit
139 .sp
140 If the argument is true, retain the environment with respect to which the
141 ocaml script code is being executed for use in subsequent rules. If
142 the argument is false, discard this environment. By default, the
143 environment is retained.
144 .sp
145
146 .I val exit
147 :
148 .B unit -> unit
149 .sp
150 If called, aborts the treatment of the current file. All previous changes
151 take effect.
152 .sp
153
154 .I val dir
155 :
156 .B unit -> string
157 .sp
158 Returns the directory on which spatch was launched.
159 .sp
160
161 .I val print_main
162 :
163 .B ?color:string -> string -> pos list -> unit
164 .sp
165 Print information about a main position using org mode.
166 .sp
167
168 .I val print_sec
169 :
170 .B ?color:string -> string -> pos list -> unit
171 .sp
172 Print information about a single secondary position using org mode.
173 .sp
174
175 .I val print_secs
176 :
177 .B ?color:string -> string -> pos list -> unit
178 .sp
179 Print information about a list of secondary positions using org mode.
180 .sp
181
182 .SH REFERENCES
183 Y. Padioleau, J.L. Lawall, R.R Hansen, G. Muller
184 "Documenting and Automating Collateral Evolutions in Linux Device Driver"
185 .I EuroSys 2008,
186 Glasgow, Scotland (April 2008) pp. 247-260.
187 .SH AUTHOR
188 This manual page was written by Julia Lawall <julia@diku.dk>.
189 .SH REPORTING BUGS
190 Send a mail to <cocci@diku.dk>
191 .SH COPYRIGHT
192 Copyright 2011, DIKU, University of Copenhagen and INRIA.