Help contents
C/C++, C#, Java, JSP, JavaScript and PHP flow charts
Supported languages
Visustin generates flow charts from code written in any of C, C++, C#, Java, J#, JSP, JavaScript, JScript .NET and PHP. These languages have quite similar syntax, so they are all handled here.
- C support covers ANSI C and ISO C99.
- C++ support covers Microsoft Visual C++ up to version 2005. Visual C++ 2005 is compatible with C++98. The support has been built according to the C/C++ grammars in MSDN (VC++ 2005). Although C and C++ are different languages, they are similar enough to visualize with the same settings.
- C# support is current as of C# 2.0 (Visual Studio 2005).
- Java support has been built according to Sun Java Language Specification Second Edition (v2.0). We assume J# is also supported because it uses Java syntax, but we haven't verified it.
- JSP support is built according to Sun JavaServer Pages (JSP) Syntax version 2.0. XML style JSP is not supported, though.
- JavaScript support is built according to the ECMAScript standard (ECMA-262 3rd Edition 1999). JScript in Microsoft Internet Explorer implements this standard. JScript .NET works too although we haven't tested it thoroughly.
- PHP support covers PHP4 and PHP5. It has been built according to PHP Manual dated 13-01-2005.
Supported statements
- if..else
- #if..#elif..#else..#endif (C/C++, C#, Java)
- switch
- while, do..while
- for
- for (element in collection) (JavaScript)
- foreach (C#, PHP)
- break
- continue
- goto (C/C++, C#)
- return
- yield return, yield break (C#)
- lock, using, checked, unchecked (C#)
- synchronized (Java)
- with (JavaScript)
- try..catch..finally, throw
- __try, __finally, __except and __leave (Microsoft extensions for C/C++)
- abort, exit, _exit, _cexit, _c_exit (C/C++)
- die (PHP)
- declare (PHP)
- function declarations
- property, indexer and event accessor declarations (C++, C#)
- class, interface, struct, union and namespace declarations
- static initializers (Java)
- line labels
- comments
Multi-procedure visualization is supported. Certain non-executable blocks are not visualized, because they contain no control flow:
- const definitions are hidden (PHP).
- var blocks are usually hidden (JavaScript, PHP). var blocks are displayed if they define an initial value.
- enum (C/C++, C#) and interface (C#, PHP) definitions are suppressed. Java interfaces and C++ interface classes are not suppressed as they may contain nested classes.
Tags, digraphs and trigraphs
JSP server-side scripting tag support.
Visustin supports the server-side code in Java Server Pages (JSP). The following tags are supported: <%..%> <%!..%> <%--..--%>. Code within these tags is parsed as Java or JSP comments. All other tags are treated as HTML. In particular, XML style JSP tags are not supported (<jsp:scriptlet> etc.).
PHP tags.
Visustin supports the following tags in PHP mode: <?..?> <?php..?> <%..%>. Code within these tags is parsed as PHP code. All other tags are treated as HTML. In particular, HTML "script" tags are not supported (<script language="php">).
C/C++ digraphs and trigraphs.
Visustin fully supports C/C++ digraph and trigraph sequences: <% %> <: :> %: %:%: ??= ??/ ??' ??( ??) ??! ??< ??> ??-
Pre-processor directives
#if..#elif..#else..#endif -style conditional directives are supported for C/C++, C# and Java (J++/J#). There are 2 modes to choose from: show as comments and show as flow symbols. Show as comments displays pre-processor directives "as is" at the location they appear in the code. Show as flow symbols treats the pre-processor directives as if they were regular conditional statements (if..elif..else). This works well in many cases. Because pre-processor directives are not really executable code, though, this mode may cause some unwanted effects. If it doesn't work out well, use the Show as comments mode.
#define macros are not expanded. If the flow chart doesn't appear correct (say the logic depends on the value of a constant), you need to manually remove any uncompiled branches and expand macros to visualize the run-time logic correctly.
Limitations
The following syntax is unsupported or only limited support is provided. The chart may display a normal statement, not a branch or a jump.
- Visustin works at the statement level. The internal structure of complex expressions is not visualized. The conditional expression :? is not split, nor is any short-circuited logic such as && or ||.
- Code inside string literals (for the eval() function, for example) is not analyzed.
- C# 2.0: anonymous functions (delegate keyword) are not supported.
- C#: [attributes] are often hidden.
- JavaScript: Conditional compilation directives such as @if are not supported. You need to remove them from the code to visualize it correctly.
- C/C++: case labels are supported only immediately within switch context. It's syntactically legal, although not recommended, to nest case labels inside other blocks within switch { }.
- "Catchall" exception handling blocks (catch/__except blocks) may display an extra "Not caught" edge even though the handler catches all possible exceptions. This happens because Visustin can't know what type of exceptions can occur with the given piece of code at run-time. — For the purposes of illustration, you can remove the extra "Not caught" edge by rewriting the last catch statement as catch(), catch(...) or catch without parameters depending on the language.
- Java: instance initializer is not shown as a separate procedure, but among other class member declarations.
- Java: Anonymous classes are not supported.
- Java/JavaScript: the "break label" statement is visualized correctly only if the block that "label" refers to has been visualized by Visustin. You can expect that "break label" works with structures such as while, do and for, but not with structures such as { } that have no specific visualization.
- JavaScript:
Two slashes /.../ on the same line may rarely be mistaken for a regex. If a statement break falls between the slashes, Visustin may not notice the two statements correctly. If this happens, add a newline between the slashes.
- JavaScript: Function expressions are not supported (where the keyword function appears in the middle of a statement). Regular and nested JavaScript functions are supported.
- PHP function declarations nested in code are not displayed at the original location. For example,
if (foo) { function bar() {} } is displayed as two separate control flows.
- PHP cfunction and old_function declarations are not supported.
Inline assembly language
Inlined assembler instructions need to be charted separately. To flowchart assembly language code embedded in C/C++ files, process it in assembler mode.
- C/C++: Standard asm statements and blocks are not supported. They are likely to cause problems in the chart.
- C/C++: __asm statements and blocks (Microsoft extension) are supported. They are not analyzed, but they are noticed and added to the chart "as is".
©Aivosto Oy