For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2006 > Re: Find function definition in a C file for a function with its name and starting li









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Find function definition in a C file for a function with its name and starting li
jeniffer

2006-03-24, 3:59 am


jeniffer wrote:

> I am writing a perl code to find out the location (line number) of
> ending bracket of a function given its name and start line number .Do i
> just scan character by character (from start line number ) and
> increment a counter when I encounter { decrement the counter by 1 on
> getting } ,and when the counter = 0 ,I take the line number .This would
> free me from parsing the code .Is this method correct? or can i do it
> in a better way by regular expression ? I need to have a fast approach
> since the code has finally to work on thousands of C files.




I figured out one thing ...{ and } falling within /* */ and after //
would have to be ignored

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com