Coder Social home page Coder Social logo

htags2callgraph's Introduction

htags2callgraph

Overview

htags2callgraph is a tool that generates a callgraph from 'htags' output files as shown in the following figure:

Big Picture

Example

An extracted graph can help you understand how the files(e.g. class files) you specify in the configuration file are called. In the example below, the graph shows you the relations of classes in this project:

Call graph example

Preparation

To begin with, you need to create HTML files based on tag files using 'htags' in GNU GLOBAL source code tagging system. In addition, please make sure you have got Graphviz in your machine as the tool leverages it so as to draw a graph. Setting up the following XML configuration, you can tell its analyzer how you would like to construct a graph:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- htags HTML directory -->
    <htags_dir>/project/src/HTML</htags_dir>
    <!-- output directory -->
    <output_dir>/project/callgraph</output_dir>
    <!-- regular expression that matchs file names you focus on(i.e. callees) -->
    <regex>.*</regex>
    <graphviz>
        <!-- Graphviz commands -->
        <command>/opt/local/bin/dot</command>
        <command>/opt/local/bin/neato</command>
        <command>/opt/local/bin/fdp</command>
        <command>/opt/local/bin/sfdp</command>
        <command>/opt/local/bin/twopi</command>
        <command>/opt/local/bin/circo</command>
        <command>/opt/local/bin/osage</command>
        <nodes>
            <!-- Graphviz node settings for nodes meeting regex condition -->
            <specified shape="box" fillcolor="#ff00ff">                     <!-- default setting -->
                <node shape="box" fillcolor="#33ffff">.*Model.*</node>      <!-- setting for specific nodes -->
                <node shape="box" fillcolor="#33ff00">.*View.*</node>
                <node shape="box" fillcolor="#ff6633">.*Controller.*</node>
            </specified>
            <!-- Graphviz node settings for unspecified nodes calling specified ones -->
            <unspecified shape="hexagon" fillcolor="#ff00ff">
                <node shape="hexagon" fillcolor="#33ffff">.*Model.*</node>
                <node shape="hexagon" fillcolor="#33ff00">.*View.*</node>
                <node shape="hexagon" fillcolor="#ff6633">.*Controller.*</node>
            </unspecified>
        </nodes>
    </graphviz>
</configuration>

Execution

To run it, simply execute command :

java -jar <JAR file> <Configuration.xml>

htags2callgraph's People

Contributors

savvan0h avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.