I am looking for an easy way to print out a specific function from within some C/C++ source code. For example, assume that test.c has several functions defined within it. I want to be able to print out the source code associated with only one of those functions.
Edit: Sorry, I should be a bit more clear about my end goal. I want the function printed to the screen so I can use wc
to grab the word count of this specific function. Also, I want this be part of a command line tool-chain so it isn't an option to manually enter files and select the text.
I generally use the
print-region
(or preferablyprint-region-with-faces
) from withinemacs
. However, it is not automated, I have to select the region by hand.Works in other languages as well.
The following due to Tom Smith in the comments:
If you liked this, follow the link to Tom's user-page and see if he deserves your vote...
Making this CW, so I won't benefit from people voting up Tom's good thinking. Cheers.
Edit after clarification: This doesn't seem to be pointed at the OP's actual question. Alas.