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