if it actually has 'function' in the text, becomes more trivial. I used wildcards to account for any standard C type syntax.
On Thu, Apr 23, 2009 at 7:40 PM, joy merwin monteiro <[email protected]> wrote: > a command line thing like > > perl -e 'while(<>) { $_ =~ s/\n(.*?)\{/$1\{\n\/\/this is $1/m' < inputfile.c > > or some equivalent should work. This will work best when in the format > function a { > > and somewhat badly for > function b > { > > no perl access right now, so cannot test it, sorry!! > > Joy > > On Thu, Apr 23, 2009 at 7:14 PM, Sindhu Sundar <[email protected]> > wrote: >> You mean to say when the program runs, it should execute the function and >> whether or not it is a function and add an appropriate comment line within >> itself in the program? >> >> -Sindhu S >> sindhu-s.com >> >> >> On Thu, Apr 23, 2009 at 6:48 PM, tecgaty <[email protected]> wrote: >>> >>> Hi.. >>> >>> I need some help.. >>> >>> I have a file which looks like this.. >>> >>> function a{ >>> statement1; >>> statement2; >>> } >>> function b{ >>> statement1; >>> statement2; >>> } >>> //function: this is not a function >>> >>> function >>> >>> function c >>> { >>> statement1; >>> statement2; >>> } >>> >>> >>> An extra line, comment with function name, should be added to every >>> function block in the above file.. The desired output is the >>> following.. >>> >>> >>> function a{ >>> //this is function a >>> >>> statement1; >>> statement2; >>> } >>> function b{ >>> //this is function b >>> >>> statement1; >>> statement2; >>> } >>> //function: this is not a function >>> >>> function >>> >>> function c >>> { >>> //this is function c >>> >>> statement1; >>> statement2; >>> } >>> >>> >> >> >> >> >> > > > > -- > The best ruler, when he finishes his > tasks and completes his affairs, > the people say > “It all happened naturally” > > - Te Tao Ch'ing > -- The best ruler, when he finishes his tasks and completes his affairs, the people say “It all happened naturally” - Te Tao Ch'ing --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MyLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mylug?hl=en -~----------~----~----~----~------~----~------~--~---
