Hi,

On Friday 09 July 2010 11:41:04 Michael Stefaniuc wrote:
> Julia Lawall wrote:
> > 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.
> Well he could do it in two steps:
> 1.) Use the regexp and a python rule to generate a cocci file
> 2.) Run the generated cocci file.
> 

Indeed, that is currently the best way to go !

I will add group support for the regexp and fresh identifier,
hopefully soon... It will help in that case.


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

-- 
Nicolas Palix
Web: http://www.diku.dk/~npalix/
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to