~npalix/coccinelle/upstream

« back to all changes in this revision

Viewing changes to parsing_c/unparse_hrule.ml

  • Committer: Nicolas Palix
  • Date: 2010-01-28 14:23:49 UTC
  • Revision ID: git-v1:70d17887795852eca805bfe27745b9810c0a39be
Remove trailing whitespace/tab

svn path=/coccinelle/; revision=8684

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 * This program is free software; you can redistribute it and/or
6
6
 * modify it under the terms of the GNU General Public License (GPL)
7
7
 * version 2 as published by the Free Software Foundation.
8
 
 * 
 
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
10
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
12
 * file license.txt for more details.
13
 
 * 
 
13
 *
14
14
 * This file was part of Coccinelle.
15
15
 *)
16
16
 
168
168
    | Ast_c.AbstractLineTok pi ->
169
169
        Ast_c.AbstractLineTok { pi with Common.str = s;})}
170
170
 
171
 
let rewrap_prefix_name prefix name = 
 
171
let rewrap_prefix_name prefix name =
172
172
  match name with
173
 
  | Ast_c.RegularName (s, iiname) -> 
174
 
      let iis = Common.tuple_of_list1 iiname in 
 
173
  | Ast_c.RegularName (s, iiname) ->
 
174
      let iis = Common.tuple_of_list1 iiname in
175
175
      let iis' = rewrap_str (prefix^s) iis in
176
176
      Ast_c.RegularName (prefix ^ s, [iis'])
177
 
  | Ast_c.CppConcatenatedName _ | Ast_c.CppVariadicName _ 
 
177
  | Ast_c.CppConcatenatedName _ | Ast_c.CppVariadicName _
178
178
  | Ast_c.CppIdentBuilder _
179
179
      -> raise Common.Todo
180
180
 
188
188
      pr ("expression "^prefix); pr param
189
189
  | ({Ast_c.p_namei = Some name; p_type = (_,ty)} : Ast_c.parameterType) ->
190
190
 
191
 
      let name' = rewrap_prefix_name prefix name in 
 
191
      let name' = rewrap_prefix_name prefix name in
192
192
 
193
193
      print_typedef pr ty;
194
194
 
218
218
let print_extra_typedefs pr env =
219
219
  let bigf =
220
220
    { Visitor_c.default_visitor_c with
221
 
      Visitor_c.ktype = (fun (k, bigf) ty -> 
 
221
      Visitor_c.ktype = (fun (k, bigf) ty ->
222
222
        match ty with
223
223
          (_,((Ast_c.TypeName(_,_),_) as ty)) -> print_typedef pr ty
224
224
        | _ -> k ty) } in
240
240
    env
241
241
 
242
242
let rename argids env =
243
 
  let argenv = List.map (function name -> 
 
243
  let argenv = List.map (function name ->
244
244
    let arg = Ast_c.str_of_name name in
245
245
    (arg,prefix^arg)
246
246
  ) argids in
247
247
  let lookup x = try List.assoc x argenv with Not_found -> x in
248
248
  let bigf =
249
249
    { Visitor_c.default_visitor_c_s with
250
 
    Visitor_c.kexpr_s = (fun (k,bigf) e -> 
 
250
    Visitor_c.kexpr_s = (fun (k,bigf) e ->
251
251
      match e with
252
252
        ((Ast_c.Ident (name), info), []) ->
253
253
 
287
287
    (Type_cocci.MetaType(name,keep,inherited)) as ty ->
288
288
      (try
289
289
        match List.assoc name env with
290
 
          Ast_c.MetaTypeVal ty -> 
 
290
          Ast_c.MetaTypeVal ty ->
291
291
            Pretty_print_c.pp_type_gen
292
292
              (function x -> pr (Ast_c.str_of_info x))
293
293
              (function _ -> pr " ")