bubulik has asked for the wisdom of the Perl Monks concerning the following question:

I was planning to write a Perl script that wud extract some fn prototypes frm my org's src code base (significantly huge). The code is mostly in C and some in C++. While some fns have prototypes, others r simply declared and defined in same spot. Some code even use old school C style fn declarations (ie not writing fn params within round brackets). I have a sneaky feeling that there r utils or tools out there that accomplish this task (besides the Perl script would be hairy/scary given the inconsistencies in coding standards here). Any idea/suggestions? Thnx.

Replies are listed 'Best First'.
Re: Extracting fn prototypes
by dragonchild (Archbishop) on Aug 31, 2004 at 19:30 UTC
    Essentially, you're looking something akin to HTML::Parser, but for the C++ language. A quick scan of c parser provides the following possibilities:

    I have never used these modules, but that should provided you with a starting point. Good luck!

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re: Extracting fn prototypes
by jfroebe (Parson) on Aug 31, 2004 at 19:31 UTC

    Hi,

    I would refer you to the ctags as it is made for what you are trying to do.

    Jason L. Froebe

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      Uh, it isn't really. Tags are there to help you locate the function implementation, not the prototype declaration. They don't contain functions that are declared only in headers and have no imlementation (in available source). Tag files don't contain accurate function signature information, so if you're going to use them you still have to do some scanning of the source code data yourself to fix it up.
Re: Extracting fn prototypes
by Anonymous Monk on Aug 31, 2004 at 19:19 UTC
    mayb u cud tell us WTF a fn is?
      "fn" is an old (mathematical?) abbrieviation for "function". That's probably the only acceptable abbrieviation in the bunch.
      wl fst u rm a fw chrs frm ech wrd, th u wrte lk u r pyng pr bit f dta u snd. Blah, why do people write questions like they are speaking over a SMS link?


      -Waswas