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

Greetings your worthiness(es):

I am trying to use the C::Scan module to extract function names, argument lists, and macros from C source file, but am having difficulty making it work. I am using the source supplied in the module review on perlmonks (here!) and it fails when I try to extract the fdecls -- it reports:
'cppstdin' is not recognized as an internal or external command, operable program or batch file."

I found a post burried here that reported the same problem, but there was no solution provided. I must assume that I have done something wrong, but don't know what.

The C code to be parsed was extremely trivial (and omitted).

Any help would be greatly appreciated. Of course, if there is a better way, I would like to know that as well.
My perl isn't good enough (yet) to know how to fix this --

You may contact me directly at: raz@poetworld.net Thanks you (all) very much!

use C::Scan; $c = new C::Scan(filename => 'test.c', filename_filter => 'test.c' ); # # Fetch and iterate through information about function declarations. # my $array_ref = $c->get('fdecls'); foreach my $func (@$array_ref) { my ($type, $name, $args, $full_text, undef) = @$func; foreach my $arg (@$args) { my ($atype, $aname, $aargs, $full_text, $array_modifiers) = @$a +rg; } } # # Fetch and iterate through information about #define macros w/args. # my $hash_ref = $c->get('defines_args'); foreach my $macro_name (keys %$hash_ref) { print "$macro_name \n"; my $array_ref = $macros_hash{$macro_name}; my ($arg_ref, $macro_text) = @$array_ref; my @macro_args = @$arg_ref; }
# right?

Replies are listed 'Best First'.
Re: C::Scan help request
by Roger (Parson) on Feb 19, 2004 at 03:22 UTC
    The C::Scan module uses an external filter program, called cppstdin to do it's filtering bits. cppstdin is a filter. It takes text redirected from a file, or piped into it, runs that text through any recognized and available C preprocessor, and outputs that text to standard output.

    The error message means that this program is missing on your box, which I presume is a Windows box.

      Thank you! I really appreciate your help/response.