C to HTML Auto-Documentor


The C2HTML utility analyzes source-code files and automatically generates hyper-text documentation of your C-programs.

Use to document CSIM models, or any C-code, as:

        c2html  your.c
or
        c2html  dir/*.c
It will produce an HTML document that you can view from any web-browser. (Firefox is recommended.) By convention, the output file is called docu.html .
Example:       firefox   docu.html &

The generated document contains three sections. The first is a concise alphabetized index of your defined subroutines. Each is hot-linked to its definition within the third section, which is the source-code. The second section is the calling-tree of your code. It shows the hierarchy of your subroutines, what-calls-what, etc.. The third section is a hyper-text annotated version of your source code. Within the source-code, calls (instances) to your subroutines are also hot-linked to their definitions.

  1. Subroutine Index (In alphabetical order)
  2. Calling Tree
  3. Source Code Listing (Hyper-text linked)

This tool leverages familiar capabilities of the WWW-browsers to make C programs easy to understand and manipulate. The c2html utility is now included as part of the standard CSIM tool-set. It is under   csim/tools/platform/general_utilities. You can also invoke it by:   $CSIM_ROOT/tools/$CSIM_MTYPE/general_utilities/c2html.

In the future, we plan to add capabilities such as a hyper-text index of variables to their definitions, data-structures, nesting-levels, etc.. C2HTML uses simple rules for determining subroutine definitions and calls, based primarily on tracking nesting level of braces {}, and detecting parenthesis. Compiler directives, such as #ifdef/#ifndef can confuse the parser, since it may not know the state of the conditionals. Although it was originally designed to operate on ANSI-C code, C2HTML has been shown to work reasonably well with C++ and Java code as well, since all these languages use brackets and parenthesis in similar ways.