문제

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?

올바른 솔루션이 없습니다

다른 팁

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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top