Marco wrote:[color=blue]
> I am looking for an open-source or free tool that parses a C header
> file (.h) for a module and creates a .c file with the functions stubbed
> out ( ideally with dummy returns for non-void). This will be used for
> testing purposes.
>
> I have googled with little success. ( for a C++ class example google
> "stubgen").[/color]
I think you can cannibalize this stubgen using a couple of scripts:
1. The first script adds a line
class TemporaryUglyClass {
before the .h file, and the line
};
after the .h file. Don't change the file, just send all the stuff to
to the standard output. It's just 3 lines of awk or shell script.
2. The 2nd script reads the result of 'stubgen', changes any
"Method: TemporaryUglyClass::" string to :Function: " string and
removes all other "TemporaryUglyClass::" strings. It's also 3 lines of
awk.
3. The 3rd script runs the first script on your .h file, runs 'stubgen'
on the result of the 1st script, and runs the 2nd script on the result
of 'stubgen'. This can be one line of a shell script.
1st_scr Input_file_name | stubgen | 2nd_scr > stubs_file_name.c
Michael
--
comp.lang.c.moderated - moderation address:
clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.