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.
24 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
25 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
26 * This file is part of Coccinelle.
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.
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.
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/>.
40 * The authors reserve the right to distribute this or future versions of
41 * Coccinelle under other licenses.
50 let str = ref ([] : string list
) in
51 let pr_elem info
= str := (Ast_c.str_of_info info
) :: !str in
53 f ~
pr_elem ~pr_space
:pr_sp a
;
54 String.concat
" " (List.rev
!str)
56 let exprrep = call_pretty Pretty_print_c.pp_expression_gen
58 let stringrep mvb
= match mvb
with
59 Ast_c.MetaIdVal s
-> s
60 | Ast_c.MetaFuncVal s
-> s
61 | Ast_c.MetaLocalFuncVal s
-> s
62 | Ast_c.MetaExprVal expr
-> exprrep expr
63 | Ast_c.MetaExprListVal expr_list
-> "TODO: <<exprlist>>"
64 | Ast_c.MetaTypeVal typ
-> call_pretty Pretty_print_c.pp_type_gen typ
65 | Ast_c.MetaInitVal ini
-> call_pretty Pretty_print_c.pp_init_gen ini
66 | Ast_c.MetaStmtVal statement
->
67 call_pretty Pretty_print_c.pp_statement_gen statement
68 | Ast_c.MetaParamVal param
->
69 call_pretty Pretty_print_c.pp_param_gen param
70 | Ast_c.MetaParamListVal params
-> "TODO: <<paramlist>>"
71 | Ast_c.MetaListlenVal n
-> string_of_int n
72 | Ast_c.MetaPosVal
(pos1
, pos2
) ->
73 let print_pos = function
74 Ast_cocci.Real x
-> string_of_int x
75 | Ast_cocci.Virt
(x
,off
) -> Printf.sprintf
"%d+%d" x off
in
76 Common.sprintf
("pos(%s,%s)") (print_pos pos1
) (print_pos pos2
)
77 | Ast_c.MetaPosValList positions
-> "TODO: <<postvallist>>"