Thank you Julia. I tried: @r@ expression E; identifier func ~= "^\(spin_lock\|spin_unlock\|baaalah\)$"; @@ func(E);
@script:python s@ func << r.func; prefix_func; @@ prefix_func = "prefix_%s" % func print prefix_func @@ expression E; identifier r.func, s.prefix_func; @@ -func(E); +prefix_func(E); The "print prefix_func" showed correct names like prefix_spin_lock, but the generated patch had wrong names like: - spin_lock(&ueq->ueq_lock); + initial value(&ueq->ueq_lock); I'm using "spatch version 1.0.0-rc1 with Python support". I'm likely doing something stupid here but couldn't figure it out. Any ideas? Thanks, Isaac On Thu, May 05, 2011 at 06:22:25PM +0200, Julia Lawall wrote: > ...... > You could use python. This is illustarted by the following, which changes > the name of all one-argument functions. I will add this to the demos > directory. > > @r@ > expression E; > identifier func; > @@ > func(E); > > @script:python s@ > func << r.func; > prefix_func; > @@ > > prefix_func = "one_argument_function_%s" % func > > @@ > expression E; > identifier r.func,s.prefix_func; > @@ > -func(E); > +prefix_func(E); > > julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
