On Fri, 9 Jul 2010, Richard W.M. Jones wrote:

> 
> I'd like to use coccinelle to change the namespace of all public
> identifiers (functions in particular) in a program.  eg: foo_xxx ->
> bar_xxx for all substrings 'xxx'.
> 
> It seems this should be easy with coccinelle but I couldn't work out
> how to do it.  This is about as far as I got:
> 
> @@
> identifier f ~= "foo_.*";
> @@
> 
> - f
> + ## what to write here?? ##

There is the notion of a fresh identifier, which is described here:

http://cocci.ekstranet.diku.dk/wiki/doku.php?id=metavariables#fresh_identifier

The problem is that I don't think there is any way to reference what was 
matched by the .* part of the regular expression.  So unfortunately I 
think it is not currently possible.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to