Thanks, it worked!

Isaac

On Tue, May 10, 2011 at 10:58:41PM +0200, Julia Lawall wrote:
> ......
> Oops, sorry about that.  When you want to send a variable from python to 
> smpl, you have to refer to the variable in the python code as 
> coccinelle.varname.  There is an example in demos/pythontococci.cocci:
> 
> @script:python b@
> x << a.x;
> y;
> z;
> @@
> 
> print y
> coccinelle.y = x
> coccinelle.z = "something"
> print y
> 
> The equivalent ocaml script code is:
> 
> @script:ocaml b@
> x << a.x;
> y;
> z;
> @@
> 
> y := x;
> z := "something"
> 
> That is, in ocaml you can just assign the variables directly.
> 
> julia
> 
> > 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)

Reply via email to