|
C::Scan - scan C language files for easily recognized constructs. |
C::Scan - scan C language files for easily recognized constructs.
$c = new C::Scan 'filename' => $filename, 'filename_filter' => $filter,
'add_cppflags' => $addflags;
$c->set('includeDirs' => [$Config::Config{shrpdir}]);
my $fdec = $c->get('parsed_fdecls');
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.
includesdefines_args
#define C(x,y) E\
F
will finish with ("C" => [ ["x", "y"], "E\nF"]).
defines_no_args#define A B
will finish with ("A" => "B").
fdeclsinlinesparsed_fdeclsA parsed declaration is a reference to a list of (rt, nm, args, ft,
mod). Here rt is return type of a function, nm is the name,
args is the list of arguments, ft is the full text of the
declaration, and mod is the modifier (which is always undef).
Each entry in the list args is of the same form (ty, nm, args,
ft, mod), here ty is the type of an argument, nm is the name (a
generated one if missing in the declaration), args is undef, and
mod is the string of array modifiers.
typedef_hashtypedefs as keys.
Values of the hash are array references of length 2, with what should
be put before/after the type for a standalone typedef declaration (but
without the typedef substring).
Parse uses naive heuristics.
typedef_textstypedefs.
typedefs_maybetypedefed names. Heuristics are used.
vdeclsextern variable declarations.
vdecl_hashextern variable declarations,
containing the variable names as keys. Values of the hash are array
references of length 2, with what should be put before/after the name
for a standalone extern variable declaration (but without the extern
substring).
typedef_structsundef if not a struct or union,
else an array reference of definitions of the elements of the structure;
each definition is itself an array reference of length 3, consisting of
what should be put before/after the name for a standalone variable
declaration, followed by the name of the element. Anonymous structs and
unions used within the definitions are given an arbitrary name including
the string ANON, and referred to using that name.
|
C::Scan - scan C language files for easily recognized constructs. |