2 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
3 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
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.
26 let rec exprrep expr
= match expr
with
27 Ast_c.Ident
(ident
) -> Ast_c.str_of_name ident
28 | Ast_c.Constant c
-> constantrep c
29 | Ast_c.FunCall
(e
,args
) -> "TODO: FunCall"
30 | Ast_c.CondExpr
(e1
,e2
,e3
) -> "TODO: CondExpr"
31 | Ast_c.Sequence
(e1
,e2
) -> "TODO: Sequence"
32 | Ast_c.Assignment
(e1
,op
,e2
) -> "TODO: Assignment"
33 | Ast_c.Postfix
(e
,op
) -> "TODO: Postfix"
34 | Ast_c.Infix
(e
,op
) -> "TODO: Infix"
35 | Ast_c.Unary
(e
,op
) -> "TODO: Unary"
36 | Ast_c.Binary
(e1
,op
,e2
) -> "TODO: Binary"
37 | Ast_c.ArrayAccess
(e1
,e2
) -> "TODO: ArrayAccess"
38 | Ast_c.RecordAccess
(e1
,s
) -> "TODO: RecordAccess"
39 | Ast_c.RecordPtAccess
(e
,s
) -> "TODO: RecordPtAccess"
40 | Ast_c.SizeOfExpr e
-> "TODO: SizeOfExpr"
41 | Ast_c.SizeOfType t
-> "TODO: SizeOfType"
42 | Ast_c.Cast
(t
,e
) -> "TODO: Cast"
43 | Ast_c.StatementExpr c
-> "TODO: StatementExpr"
44 | Ast_c.Constructor
(t
,i
) -> "TODO: Constructor"
45 | Ast_c.ParenExpr e
-> "TODO: ParenExpr"
46 and constantrep c
= match c
with
47 Ast_c.String
(s
,isWchar
) -> s
48 | Ast_c.MultiString _
-> "TODO: MultiString"
49 | Ast_c.Char
(s
,isWchar
) -> s
51 | Ast_c.Float
(s
,t
) -> s
54 let str = ref ([] : string list
) in
55 let pr_elem info
= str := (Ast_c.str_of_info info
) :: !str in
58 String.concat
" " (List.rev
!str)
60 let stringrep mvb
= match mvb
with
61 Ast_c.MetaIdVal s
-> s
62 | Ast_c.MetaFuncVal s
-> s
63 | Ast_c.MetaLocalFuncVal s
-> s
64 | Ast_c.MetaExprVal
((expr
,_
),[il
]) -> (exprrep expr
)
65 | Ast_c.MetaExprVal e
-> "TODO: <<MetaExprVal>>"
66 | Ast_c.MetaExprListVal expr_list
-> "TODO: <<exprlist>>"
67 | Ast_c.MetaTypeVal typ
-> call_pretty Pretty_print_c.pp_type_gen typ
68 | Ast_c.MetaStmtVal statement
-> "TODO: stmt"
69 | Ast_c.MetaParamVal params
-> "TODO: <<param>>"
70 | Ast_c.MetaParamListVal params
-> "TODO: <<paramlist>>"
71 | Ast_c.MetaListlenVal n
-> string_of_int n
72 | Ast_c.MetaPosVal
(pos1
, pos2
) ->
73 (* Common.sprintf ("pos(%d,%d)") pos1 pos2 *)
75 | Ast_c.MetaPosValList positions
-> "TODO: <<postvallist>>"
76 | Ast_c.MetaInitVal _
-> "TODO: <<metainitval>>"