Question

I don't know if it is possible, but I'd like to put some line of code around function calls from a certaint .c file. Say I have a file1.c in which I do something like:

#include "file2.h"
...
void fun(){
    <i want do add a line here>
    file2_fun();
    <..and here>
}

is it possible to add those lines? Can you give me some example using pycparser or a similar c parsing library for python?

No correct solution

OTHER TIPS

pycparser do not provide a special function for this. You can try to go throug the AST and do it manualy.

Thougt about Aspect-oriented programming? e.g. with aspect c++ you can add the "aspect" without changig the code (or use the intermediate output).

http://www.aspectc.org/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top