Function Protoytpe Identifier....

Discussion in 'C Programming' started by Pardha, Mar 21, 2006.

  1. Pardha

    Pardha Guest

    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
     
    Pardha, Mar 21, 2006
    #1
    1. Advertising

  2. Pardha

    santosh Guest

    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.
     
    santosh, Mar 21, 2006
    #2
    1. Advertising

  3. Pardha

    Jordan Abel Guest

    On 2006-03-21, santosh <> 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.
     
    Jordan Abel, Mar 21, 2006
    #3
  4. Pardha

    jacob navia Guest

    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
     
    jacob navia, Mar 21, 2006
    #4
  5. Pardha

    John Bode Guest

    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.
     
    John Bode, Mar 21, 2006
    #5
  6. Pardha

    santosh Guest

    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.
     
    santosh, Mar 21, 2006
    #6
  7. Pardha

    santosh Guest

    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.
     
    santosh, Mar 21, 2006
    #7
  8. Pardha

    CBFalconer Guest

    Jordan Abel wrote:
    > On 2006-03-21, santosh <> 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/>
     
    CBFalconer, Mar 21, 2006
    #8
  9. Pardha

    Jordan Abel Guest

    On 2006-03-21, CBFalconer <> wrote:
    > Jordan Abel wrote:
    >> On 2006-03-21, santosh <> 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
     
    Jordan Abel, Mar 21, 2006
    #9
  10. On 21 Mar 2006 20:25:26 GMT, in comp.lang.c , Jordan Abel
    <> 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
     
    Mark McIntyre, Mar 22, 2006
    #10
  11. Pardha

    Jordan Abel Guest

    On 2006-03-22, Mark McIntyre <> wrote:
    > On 21 Mar 2006 20:25:26 GMT, in comp.lang.c , Jordan Abel
    > <> 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,


    Not comp.editors.batch [except possibly awk, but that's a huge stretch],
    which was suggested.

    > and I suspect one can write some sort of script to do this.
    > Mark McIntyre
     
    Jordan Abel, Mar 22, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kobu
    Replies:
    7
    Views:
    470
  2. Replies:
    9
    Views:
    294
    Michael Mair
    Jan 20, 2006
  3. Replies:
    2
    Views:
    1,789
  4. Replies:
    2
    Views:
    922
    Owen Jacobson
    Dec 11, 2007
  5. S_K
    Replies:
    0
    Views:
    672
Loading...

Share This Page