NAME
C::Scan - scan C language files for easily recognized constructs.
SYNOPSIS
$c = new C::Scan 'filename' => $filename, 'filename_filter' => $filter,
'add_cppflags' => $addflags;
$c->set('includeDirs' => [$Config::Config{shrpdir}]);
my $fdec = $c->get('parsed_fdecls');
DESCRIPTION
This description is VERY incomplete.
This module uses Data::Flow interface, thus one uses it in the following fashion:
$c = new C::Scan(attr1 => $value1, attr2 => $value2);
$c->set( attr3 => $value3 );
$value4 = $c->get('attr4');
Attributes are depending on some other attributes. The only required attribute, i.e., the attribute which should be set, is filename, which denotes which file to parse.
All other attributes are either optional, or would be calculated basing on values of required and optional attributes.
Output attributes
includes-
Value: reference to a list of included files.
defines_args-
Value: reference to hash of macros with arguments. The values are references to an array of length 2, the first element is a reference to the list of arguments, the second one being the expansion. Newlines are not unescaped, thus
#define C(x,y) E\ Fwill finish with
("C" => [ ["x", "y"], "E\nF"]). defines_no_args-
Value: reference to hash of macros without arguments. Newlines are not escaped, thus
#define A Bwill finish with
("A" => "B"). fdecls-
Value: reference to list of declarations of functions.
inlines-
Value: reference to list of definitions of functions.
parsed_fdecls-
Value: reference to list of parsed declarations of functions.
A parsed declaration is a reference to a list of
(rt, nm, args, ft, mod). Herertis return type of a function,nmis the name,argsis the list of arguments,ftis the full text of the declaration, andmodis the modifier (which is alwaysundef).Each entry in the list
argsis of the same form(ty, nm, args, ft, mod), heretyis the type of an argument,nmis the name (a generated one if missing in the declaration),argsisundef, andmodis the string of array modifiers. typedef_hash-
Value: a reference to a hash which contains known
typedefs as keys. typedef_texts-
Value: a reference to a list which contains known expansions of
typedefs. typedefs_maybe-
Value: a reference to a list of
typedefed names. (Syncronized withtypedef_texts). vdecls-
Value: a reference to a list of
externvariable declarations.