Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Function Protoytpe Identifier....

Reply
Thread Tools

Function Protoytpe Identifier....

 
 
Pardha
Guest
Posts: n/a
 
      03-21-2006
Hi all,

I am lookig for a SED script file which parses any .C source code file
to pick up all the funcions that are defined in it.
The functions are to be identified and are supposed to be moved in to
another file with two columns...the function name and the number of
arguments the function is being passed to.

i would be glad if any of the users wud supply me the relevant
scripts...as soon as possible.


Thanks & Regards
Pardha Saradhi

 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      03-21-2006
Pardha wrote:
> Hi all,
>
> I am lookig for a SED script file which parses any .C source code file
> to pick up all the funcions that are defined in it.
> The functions are to be identified and are supposed to be moved in to
> another file with two columns...the function name and the number of
> arguments the function is being passed to.
>
> i would be glad if any of the users wud supply me the relevant
> scripts...as soon as possible.


This is the wrong group. Try comp.editors, alt.comp.editors.batch,
comp.unix.shell etc.

 
Reply With Quote
 
 
 
 
Jordan Abel
Guest
Posts: n/a
 
      03-21-2006
On 2006-03-21, santosh <(E-Mail Removed)> wrote:
> Pardha wrote:
>> Hi all,
>>
>> I am lookig for a SED script file which parses any .C source code file
>> to pick up all the funcions that are defined in it.
>> The functions are to be identified and are supposed to be moved in to
>> another file with two columns...the function name and the number of
>> arguments the function is being passed to.
>>
>> i would be glad if any of the users wud supply me the relevant
>> scripts...as soon as possible.

>
> This is the wrong group. Try comp.editors, alt.comp.editors.batch,
> comp.unix.shell etc.


For what it's worth, what he's asking for is impossible, so it doesn't
matter where he posts it.
 
Reply With Quote
 
jacob navia
Guest
Posts: n/a
 
      03-21-2006
Pardha a écrit :
> Hi all,
>
> I am lookig for a SED script file which parses any .C source code file
> to pick up all the funcions that are defined in it.
> The functions are to be identified and are supposed to be moved in to
> another file with two columns...the function name and the number of
> arguments the function is being passed to.
>
> i would be glad if any of the users wud supply me the relevant
> scripts...as soon as possible.
>
>
> Thanks & Regards
> Pardha Saradhi
>


I can give you a C source file that will do that. This will cost you 1
day consulting fees.

jacob
 
Reply With Quote
 
John Bode
Guest
Posts: n/a
 
      03-21-2006

Pardha wrote:
> Hi all,
>
> I am lookig for a SED script file which parses any .C source code file
> to pick up all the funcions that are defined in it.
> The functions are to be identified and are supposed to be moved in to
> another file with two columns...the function name and the number of
> arguments the function is being passed to.
>
> i would be glad if any of the users wud supply me the relevant
> scripts...as soon as possible.
>
>
> Thanks & Regards
> Pardha Saradhi


The problem is that sed isn't smart enough to do that, unless your
source code is extremely simple and rigidly formatted.

What you need is a tool that actually understands the C grammar. You
can write one using lex and yacc (or their equivalents), but it's a
good weekend's worth of work.

 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      03-21-2006
John Bode wrote:
> Pardha wrote:
> > Hi all,
> >
> > I am lookig for a SED script file which parses any .C source code file
> > to pick up all the funcions that are defined in it.
> > The functions are to be identified and are supposed to be moved in to
> > another file with two columns...the function name and the number of
> > arguments the function is being passed to.
> >
> > i would be glad if any of the users wud supply me the relevant
> > scripts...as soon as possible.
> >
> >
> > Thanks & Regards
> > Pardha Saradhi

>
> The problem is that sed isn't smart enough to do that, unless your
> source code is extremely simple and rigidly formatted.
>
> What you need is a tool that actually understands the C grammar. You
> can write one using lex and yacc (or their equivalents), but it's a
> good weekend's worth of work.


Isn't that a bit of an overkill? Since the OP only wants the function
headers identified and extracted, it should probably be do-able as a
small C utility.

 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      03-21-2006
John Bode wrote:
> Pardha wrote:
> > Hi all,
> >
> > I am lookig for a SED script file which parses any .C source code file
> > to pick up all the funcions that are defined in it.
> > The functions are to be identified and are supposed to be moved in to
> > another file with two columns...the function name and the number of
> > arguments the function is being passed to.
> >
> > i would be glad if any of the users wud supply me the relevant
> > scripts...as soon as possible.
> >
> >
> > Thanks & Regards
> > Pardha Saradhi

>
> The problem is that sed isn't smart enough to do that, unless your
> source code is extremely simple and rigidly formatted.
>
> What you need is a tool that actually understands the C grammar. You
> can write one using lex and yacc (or their equivalents), but it's a
> good weekend's worth of work.


On second thoughts, ignore my previous reply. You're right. The tool
would need to know atleast some of C's grammar.

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      03-21-2006
Jordan Abel wrote:
> On 2006-03-21, santosh <(E-Mail Removed)> wrote:
>> Pardha wrote:
>>>
>>> I am lookig for a SED script file which parses any .C source
>>> code file to pick up all the funcions that are defined in it.
>>> The functions are to be identified and are supposed to be moved
>>> in to another file with two columns...the function name and the
>>> number of arguments the function is being passed to.
>>>
>>> i would be glad if any of the users wud supply me the relevant
>>> scripts...as soon as possible.

>>
>> This is the wrong group. Try comp.editors, alt.comp.editors.batch,
>> comp.unix.shell etc.

>
> For what it's worth, what he's asking for is impossible, so it
> doesn't matter where he posts it.


With a sed script, yes. However it is quite possible with the aid
of a lexical scanner and some elementary symbol table
creation/lookup/manipulation. The guts of such a package would be
quite useful for various purposes. The front end would also have
to handle macro expansion, possibly on a switch, so that functional
macros could appear as functions.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


 
Reply With Quote
 
Jordan Abel
Guest
Posts: n/a
 
      03-21-2006
On 2006-03-21, CBFalconer <(E-Mail Removed)> wrote:
> Jordan Abel wrote:
>> On 2006-03-21, santosh <(E-Mail Removed)> wrote:
>>> Pardha wrote:
>>>>
>>>> I am lookig for a SED script file which parses any .C source
>>>> code file to pick up all the funcions that are defined in it.
>>>> The functions are to be identified and are supposed to be moved
>>>> in to another file with two columns...the function name and the
>>>> number of arguments the function is being passed to.
>>>>
>>>> i would be glad if any of the users wud supply me the relevant
>>>> scripts...as soon as possible.
>>>
>>> This is the wrong group. Try comp.editors, alt.comp.editors.batch,
>>> comp.unix.shell etc.

>>
>> For what it's worth, what he's asking for is impossible, so it
>> doesn't matter where he posts it.

>
> With a sed script, yes. However it is quite possible with the aid
> of a lexical scanner and some elementary symbol table
> creation/lookup/manipulation.


Well, yeah - I didn't mean the task was impossible entirely, after all,
compilers do it. but sed can't do it. so pointing him to somewhere that
sed is more on-topic isn't really helpful.

> The guts of such a package would be quite useful for various purposes.
> The front end would also have to handle macro expansion, possibly on a
> switch, so that functional macros could appear as functions.


You'd also have to deal with conditional compilation, or you might trip
over unbalanced braces
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      03-22-2006
On 21 Mar 2006 20:25:26 GMT, in comp.lang.c , Jordan Abel
<(E-Mail Removed)> wrote:

>Well, yeah - I didn't mean the task was impossible entirely, after all,
>compilers do it. but sed can't do it. so pointing him to somewhere that
>sed is more on-topic isn't really helpful.


Except that somewhere SED is topical is also likely to consider perl,
python, lex, awk etc topical, and I suspect one can write some sort of
script to do this.
Mark McIntyre
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function versus pointer to function, in context of std::function,huh? Alf P. Steinbach C++ 10 07-27-2011 05:51 AM
Function pointer to void function and int function Giannis Papadopoulos C Programming 5 09-05-2005 09:06 PM
How override ALL function calls? (Is there a "function call function"?) seberino@spawar.navy.mil Python 2 08-01-2005 12:38 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
Passing a C++ object's member function to a C function expecing a function pointer! James Vanns C++ 7 01-21-2004 02:39 AM



Advertisments