1COCCILIB(3COCCI)                                              COCCILIB(3COCCI)
2
3
4

NAME

6       Coccilib  -  Library  of functions for use with Coccinelle OCaml script
7       code
8

MODULE

10       Module   Coccilib
11

DOCUMENTATION

13       Module Coccilib
14        : sig end
15
16       === Positions ===
17
18       type pos = {
19        current_element : string ;
20        current_element_line : int ;
21        current_element_col : int ;
22        current_element_line_end : int ;
23        current_element_col_end : int ;
24        file : string ;
25        line : int ;
26        col : int ;
27        line_end : int ;
28        col_end : int ;
29        }
30
31
32       A value of type pos describes  a  position  in  a  source  file.   cur‐
33       rent_element  is  the name of the function containing the matched posi‐
34       tion; current_element_line is the number of  the  line  containing  the
35       first  character  of the function containing the matched position; cur‐
36       rent_element_col is the (0-based) column containing the first character
37       of   the   function   containing  the  matched  position;  current_ele‐
38       ment_line_end is the number of the line containing the  last  character
39       of   the   function   containing  the  matched  position;  current_ele‐
40       ment_col_end is the (0-based) column containing the last  character  of
41       the  function  containing  the matched position file is the name of the
42       file containing the matched position; line is the number  of  the  line
43       containing  the  first  character  of  the matched position; col is the
44       (0-based) column containing the first character of  the  matched  posi‐
45       tion;  line_end is the number of the line containing the last character
46       of the matched position; col_end is the (0-based) column containing the
47       last character of the matched position.
48
49
50       === Abstract Syntax Tree ===
51
52       type param_type
53        =
54        | Pos of pos list
55        | Str of string
56        | Type of Ast_c.fullType
57        | Init of Ast_c.initialiser
58        | InitList of Ast_c.initialiser Ast_c.wrap2 list
59        | Int of int
60        | Param of Ast_c.parameterType
61        | ParamList of Ast_c.parameterType Ast_c.wrap2 list
62        | Expr of Ast_c.expression
63        | ExprList of Ast_c.argument Ast_c.wrap2 list
64        | Decl of Ast_c.declaration
65        | Field of Ast_c.field
66        | FieldList of Ast_c.field list
67        | Stmt of Ast_c.statement
68
69
70       val make_ident : string -> Ast_c.metavar_binding_kind
71
72       Make an identifier
73
74
75       val make_expr : string -> Ast_c.metavar_binding_kind
76
77       Make an expression
78
79
80       val make_expr_with_env : string -> string -> Ast_c.metavar_binding_kind
81
82       Make  an  expression  in  a  type environment.  The first argument is a
83       string containing any C variable declarations needed to make the  envi‐
84       ronment and the second argument is a string containing the expression.
85
86
87       val make_stmt : string -> Ast_c.metavar_binding_kind
88
89       Make a single statement
90
91
92       val make_stmt_in_env : string -> Ast_c.metavar_binding_kind
93
94       Make a single statement in a type environment.  The first argument is a
95       string containing any C variable declarations needed to make the  envi‐
96       ronment and the second argument is a string containing the statement.
97
98
99       val make_type : string -> Ast_c.metavar_binding_kind
100
101       Make a type
102
103
104       val make_listlen : int -> Ast_c.metavar_binding_kind
105
106       Make a list length, for parameter lists, expression lists, etc.
107
108
109       val  make_full_position  : string -> string -> int -> int -> int -> int
110       -> int -> int -> int -> int -> Ast_c.metavar_binding_kind
111
112       Make a position.  The arguments are the  file  name,  the  function  or
113       other  toplevel  element  containing the position, the starting line of
114       the containing element, the starting column of the containing  element,
115       the  ending  line  of  the containing element, the ending column of the
116       containing element, the starting line  of  the  created  position,  the
117       starting column of the created position, the ending line of the created
118       position, and the ending column of the created position.
119
120
121       start at 0.  The ending line is the one that contains the last  charac‐
122       ter  of  what  is  to be matched.  The ending character is one past the
123       last character of the thing to  be  matched.   The  containing  element
124       position will be a default value.
125
126       val  make_position  :  string  -> string -> int -> int -> int -> int ->
127       Ast_c.metavar_binding_kind
128
129       Make a position.  The arguments are the  file  name,  the  function  or
130       other  toplevel element containing the position, the starting line, the
131       starting column, the ending line, and the ending column.   Lines  start
132       at  1.   Columns  start at 0.  The ending line is the one that contains
133       the last character of what is to be matched.  The ending  character  is
134       one past the last character of the thing to be matched.  The containing
135       element position will be a default value.
136
137
138       === Match management functions ===
139
140       val include_match : bool -> unit
141
142       If the argument is true, retain the environment with respect  to  which
143       the  ocaml  script  code is being executed for use in subsequent rules.
144       If the argument is false, discard this environment.   By  default,  the
145       environment is retained.
146
147
148       val exit : unit -> unit
149
150       If  called,  aborts  the  treatment  of the current file.  All previous
151       changes take effect.
152
153
154       val dir : unit -> string
155
156       Returns the directory on which spatch was launched.
157
158
159       val files : unit -> string list
160
161       Returns the list of files on which spatch is  currently  working.   The
162       result is the empty list if spatch is not currently working on any file
163       (eg, in an initialize or finalize rule).
164
165
166       val cocci_version : unit -> string
167
168       Returns a string indicating the current version.   Note  that  if  Coc‐
169       cinelle  has  been modified since a release, the version number will be
170       postfixed with "-dirty".
171
172
173       val print_main : ?color:string -> string -> pos list -> unit
174
175       Print information about a main position using org mode.
176
177
178       val print_sec : ?color:string -> string -> pos list -> unit
179
180       Print information about a single secondary position using org mode.
181
182
183       val print_secs : ?color:string -> string -> pos list -> unit
184
185       Print information about a list of secondary positions using org mode.
186
187
188

REFERENCES

190       Y. Padioleau, J.L. Lawall,  R.R  Hansen,  G.  Muller  "Documenting  and
191       Automating  Collateral Evolutions in Linux Device Driver" EuroSys 2008,
192       Glasgow, Scotland (April 2008) pp. 247-260.
193

AUTHOR

195       This manual page was written by Julia Lawall <Julia.Lawall@lip6.fr>.
196

REPORTING BUGS

198       Send a mail to <cocci@systeme.lip6.fr>
199
201       Copyright 2011, DIKU, University of Copenhagen  and  INRIA.   Copyright
202       2012-2015, INRIA.
203
204
205
206                                 Jul 26, 2015                 COCCILIB(3COCCI)
Impressum