Hello,

I have a simple rule to add a variable declaration
whenever I see a function call with a certain name
as shown below.

@initialize:python@
count = 0

@@
identifier bCall ~= "^\(foo\|bar\|abc\)$"

@@
+ int x = 42;
bCall(...);

@script:python@
@@
count = count + 1


@@
identifier cCall ~="^\(foo1\|bar1\|abc1\)$"

@@
+ int y = 42;
cCall(...);

@script:python@
@@
count = count + 1

Is it possible to add the variable declarations (x,y) in such a way
that they are initialized to *count *rather than 42 ?

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

Reply via email to