| 1 | Coccinelle allows programmers to easily write some complex |
| 2 | style-preserving source-to-source transformations on C source code, |
| 3 | like for instance to perform some refactorings. |
| 4 | |
| 5 | To install Coccinelle from its source, see the instructions in install.txt. |
| 6 | For more information on Coccinelle see the files in the docs/ directory. |
| 7 | |
| 8 | Once you have installed Coccinelle (either from the source or from one |
| 9 | of the binary form available on the Coccinelle website), You may have |
| 10 | to setup a few environment variables so that the Coccinelle program |
| 11 | know where to find its configuration files. |
| 12 | For bash do: |
| 13 | |
| 14 | source env.sh |
| 15 | |
| 16 | For tcsh do: |
| 17 | |
| 18 | source env.csh |
| 19 | |
| 20 | |
| 21 | |
| 22 | You can then test coccinelle with: |
| 23 | |
| 24 | spatch -sp_file demos/simple.cocci demos/simple.c |
| 25 | |
| 26 | If you downloaded the bytecode version of spatch you may first |
| 27 | have to install OCaml (which contains the 'ocamlrun' bytecode interpreter, |
| 28 | the equivalent of 'java', the Java virtual machine, but for OCaml) and then do: |
| 29 | |
| 30 | ocamlrun spatch -sp_file demos/simple.cocci demos/simple.c |