biocc has asked for the wisdom of the Perl Monks concerning the following question:
I am more into C than perl - (sorry, but I have to) - and feel like I need the power of perl now.
I have a large set of C source files, and need to empty out all the function bodies - but just the bodies. Everything else should be left untouched.
Does anybody know a quick way to do that?
I read the C::Scan library and it can extract quite a lot of structures out of a c file. The thing is, not to delete anything, except the function bodies. Ok, it offers structs like:
defines_args fdecls, etc. and one would be able to print those. But the order is important, and the printed output should include everything.
I need to change this:
#define IN_LIBXML #include "libxml.h" struct _xmlLink { struct _xmlLink *next; struct _xmlLink *prev; void *data; }; static int xmlLinkCompare(const void *data0, const void *data1); static int xmlLinkCompare(const void *data0, const void *data1) { if (data0 < data1) return (-1); else if (data0 == data1) return (0); return (1); }
-----------
into:
#define IN_LIBXML #include "libxml.h" struct _xmlLink { struct _xmlLink *next; struct _xmlLink *prev; void *data; }; static int xmlLinkCompare(const void *data0, const void *data1); static int xmlLinkCompare(const void *data0, const void *data1) { }
Any suggestions??
Frank
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: empty out C function bodies
by jakobi (Pilgrim) on Oct 24, 2009 at 12:51 UTC | |
by jwkrahn (Abbot) on Oct 24, 2009 at 13:37 UTC | |
by jakobi (Pilgrim) on Oct 24, 2009 at 14:09 UTC | |
by biocc (Initiate) on Oct 24, 2009 at 13:11 UTC | |
|
Re: empty out C function bodies
by GrandFather (Saint) on Oct 24, 2009 at 20:23 UTC |