2 * Copyright 2005-2009, 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.
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.
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.
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/>.
18 * The authors reserve the right to distribute this or future versions of
19 * Coccinelle under other licenses.
28 let str = ref ([] : string list
) in
29 let pr_elem info
= str := (Ast_c.str_of_info info
) :: !str in
31 f ~
pr_elem ~pr_space
:pr_sp a
;
32 String.concat
" " (List.rev
!str)
34 let exprrep = call_pretty Pretty_print_c.pp_expression_gen
36 let stringrep mvb
= match mvb
with
37 Ast_c.MetaIdVal s
-> s
38 | Ast_c.MetaFuncVal s
-> s
39 | Ast_c.MetaLocalFuncVal s
-> s
40 | Ast_c.MetaExprVal expr
-> exprrep expr
41 | Ast_c.MetaExprListVal expr_list
-> "TODO: <<exprlist>>"
42 | Ast_c.MetaTypeVal typ
-> call_pretty Pretty_print_c.pp_type_gen typ
43 | Ast_c.MetaInitVal ini
-> call_pretty Pretty_print_c.pp_init_gen ini
44 | Ast_c.MetaStmtVal statement
->
45 call_pretty Pretty_print_c.pp_statement_gen statement
46 | Ast_c.MetaParamVal param
->
47 call_pretty Pretty_print_c.pp_param_gen param
48 | Ast_c.MetaParamListVal params
-> "TODO: <<paramlist>>"
49 | Ast_c.MetaListlenVal n
-> string_of_int n
50 | Ast_c.MetaPosVal
(pos1
, pos2
) ->
51 let print_pos = function
52 Ast_cocci.Real x
-> string_of_int x
53 | Ast_cocci.Virt
(x
,off
) -> Printf.sprintf
"%d+%d" x off
in
54 Common.sprintf
("pos(%s,%s)") (print_pos pos1
) (print_pos pos2
)
55 | Ast_c.MetaPosValList positions
-> "TODO: <<postvallist>>"