| 1 | Coccinelle |
| 2 | |
| 3 | |
| 4 | Coccinelle allows programmers to easily write some complex |
| 5 | style-preserving source-to-source transformations on C source code, |
| 6 | like for instance to perform some refactorings. |
| 7 | |
| 8 | To install Coccinelle from its source, see the instructions in install.txt. |
| 9 | Once you have installed Coccinelle (either from the source or from one |
| 10 | of the binary form available on the Coccinelle website), You may have |
| 11 | to setup a few environment variables so that the Coccinelle program |
| 12 | knows where to find its configuration files. |
| 13 | For bash do: |
| 14 | |
| 15 | $ source env.sh |
| 16 | |
| 17 | For tcsh do: |
| 18 | |
| 19 | $ source env.csh |
| 20 | |
| 21 | You can then test coccinelle with: |
| 22 | |
| 23 | $ spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | If you downloaded the bytecode version of spatch you may first |
| 29 | have to install OCaml (which contains the 'ocamlrun' bytecode interpreter, |
| 30 | the equivalent of 'java', the Java virtual machine, but for OCaml) and then do: |
| 31 | |
| 32 | $ ocamlrun spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c |
| 33 | |
| 34 | |
| 35 | |
| 36 | For more information on Coccinelle, type 'make docs' and have a look at the |
| 37 | files in the docs/ directory. You may need to install the texlive-fonts-extra |
| 38 | packages from your distribution to compile some of the LaTeX documentation |
| 39 | files. |
| 40 | |
| 41 | ** Runtime dependencies under Debian/Ubuntu** |
| 42 | |
| 43 | - For the OCaml scripting feature in SmPL |
| 44 | ocaml-native-compilers |
| 45 | or ocaml-nox |