The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

new

 Usage     : my $analyzer = new Analyzer(
                        _inputPath => "/home/sindhu/test/afs", # folder path
            _cppPath => "/usr/bin",     # GNU C preprocessor path
                        _inputOption => "dir_and_subdir", # if dir or dir/subdir
                        );
 Purpose   : Constructors, Static method that return an object
 Returns   : Object
 Argument  : _inputPath, _inputOption, _cppPath, _functionName 
 Throws    : None
 Comment   : Can be extended for other important inputs as well in future.
See Also   : 

init

 Usage     : init()
 Purpose   : initializes variables, gets C files in dir/subdirs, 
                         runs GNU C Preprocessor and updates functions and 
                         calls in each C file
 Returns   : None
 Argument  : None 
 Throws    : None
 Comment   : None
See Also   : 

calltree

 Usage     : calltree()
 Purpose   : Initial preperations for calltree generation for
                         user given functions.
 Returns   : None
 Argument  : Takes a reference to list of functions 
 Throws    : None
 Comment   : None
See Also   : 

getListOfCFiles

 Usage     : getListOfCFiles()
 Purpose   : Takes folder name and GNU C Preprocessor options
                         and returns list of C files in dir/subdir
 Returns   : reference to array of C files
 Argument  : folder name and GNU C Preprocessor options 
 Throws    : None
 Comment   : None
See Also   : 
None

prepareCalltreeInit

 Usage     : prepareCalltreeInit()
 Purpose   : final preparations for calltree generation
 Returns   : none
 Argument  : function name
 Throws    : None
 Comment   : None
See Also   : 
None

generateCalltree

 Usage     : generateCalltree()
 Purpose   : Functions that actually generates the functional calltree
 Returns   : none
 Argument  : function name and tab count
 Throws    : None
 Comment   : None
See Also   : 
None

runGnuPreprocessor

 Usage     : runGnuPreprocessor()
 Purpose   : runs GNU C preprocessor in the user given path
 Returns   : returns a reference to list of names of preprocessed files
 Argument  : reference of list of C files, CPP Path, Options
 Throws    : None
 Comment   : None
See Also   : 
None

identifyFunctionsAndCalls

 Usage     : identifyFunctionsAndCalls()
 Purpose   : initial preperation for parsing each C file to identify
                         functions and calls
 Returns   : none
 Argument  : reference to list of preprocessor files, options and folder
                         names.
 Throws    : None
 Comment   : None
See Also   : 
None

parseCFile

 Usage     : parseCFile()
 Purpose   : Parser module to identify functions and calls in C files.
 Returns   : reference to array of funs and calls.
 Argument  : reference to filename, options and foldername
 Throws    : None
 Comment   : None
See Also   : 
None

updateHashTable

 Usage     : updateHashTable()
 Purpose   : updates function wise calls hash table
 Returns   : reference to hash table containing functions and calls
 Argument  : None
 Throws    : None
 Comment   : None
See Also   : 
None

trim

 Usage     : trim()
 Purpose   : trims leading and trailing white spaces in strings
 Returns   : trimmed string
 Argument  : string
 Throws    : None
 Comment   : None
See Also   : 
None

clean

 Usage     : clean()
 Purpose   : safe exit
 Returns   : none
 Argument  : none
 Throws    : None
 Comment   : None
See Also   : 
None

progress_bar

 Usage     : progress_bar()
 Purpose   : simple and neat progress bar
 Returns   : none
 Argument  : none
 Throws    : None
 Comment   : None
See Also   : 
None

NAME

C::Analyzer - Generates C Call Control Flow tree for C source code

SYNOPSIS

    use warnings;
    use strict;
    use C::Analyzer;

    my @functions  = qw(afs_CheckServers afs_cv2string);
    my $analyzer   = new Analyzer(
        _inputPath => "/home/foo",
        _cppPath   => "/usr/local/bin",
    );
    $analyzer->init();
    # "main" function taken if no parameter passed to this method.
    $analyzer->calltree( \@functions ); 

    $analyzer->clean();

The synopsis above only lists the major methods and parameters. Keep checking for new additions

DESCRIPTION

Creates Call stack/tree of C source code

GETTING HELP

If you have questions about Analyzer you can get help from the analyzer-users@perl.org mailing list. You can get help on subscribing and using the list by emailing analyzer-users-help@perl.org.

NOTES

The Analyzer is evolving and there are plans to add more features, so it's good to have the latest copy.

Architecture of Analyzer

  |-Input folder of C files-|                                |----Call Stack Output---|   

  .------------------------.                                                              
  | 1. #include <stdio.h>  |                       .-.                                    
  | 2.                     |       .-------.       |A|                                    
  | 3. void main(void)     |       | Perl  |       |N|       .------------------------.   
  | 4. {                   |       | script|  |A|  |A|       |<0>main(3, a.c)         |   
  | 5.    foo();           |-------| using |--|P|--|L|-------|    <1>foo(5, a.c)      |   
  | 6. }                   |       | API   |  |I|  |Y|       |        <2>bar(10, a.c) |   
  | 7.                     |       |methods|       |Z|        `-----------------------/    
  | 8. int foo()           |       |       |       |E|                                  
  | 9. {                   |       `-------'       |R|                                    
  | 10.   bar();           |                       `-'                                    
  | 11. }                  |                                                              
  `-----------------------/                                                               

Outline Usage

mandatory inputs

 Analyzer expects couple of mandatory inputs. One, folder that contains C/H files. Second, path for GNU C Preprocessor.

 for example:
    my $analyzer   = new Analyzer(
        _inputPath => "/home/foo",
        _cppPath   => "/usr/local/bin",
    );

optional inputs

 Analyzer expects optional inputs as well. 
 
 It allows directory and sub directory parsing. Default is directory processing. To tell analyzer module to recursively process 
 C files in all directories and sub directories, use _inputOption
 
 for example:
    my $analyzer   = new Analyzer(
        _inputPath => "/home/foo",
        _cppPath   => "/usr/local/bin",
        _inputOption => "dir_and_subdir",
    );

 There is an option to provide additional GNU C Preprocessor options using "_cppOptions"
 
 for example:
    my $analyzer   = new Analyzer(
        _inputPath => "/home/foo",
        _cppPath   => "/usr/local/bin",
        _inputOption => "dir_and_subdir",
        _cppOptions => "-DMACRO1 -DMACRO2",
    );

BUGS

None.

SUPPORT

The Analyzer is free Open Source software. IT COMES WITHOUT WARRANTY OF ANY KIND. Please let me know if you could add more features for this module.I will be more than happy to add them.

AUTHOR

    Sreekanth Kocharlakota
    CPAN ID: bmpOg
    Sreekanth Kocharlakota
    sreekanth@cpan.org
    http://www.languagesemantics.com

COPYRIGHT

The Analyzer module is Copyright (c) 1994-2007 Sreekanth Kocharlakota. USA. This program is free software licensed under the...

        The General Public License (GPL)
        Version 2, June 1991

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

perl(1).