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, JSP, JavaScript, ASP and PHP.
- C support covers ANSI C and ISO C99.
- C++ support covers C++98 and Microsoft Visual C++ extensions. Microsoft support is current up to Visual C++ 2008. C++/CLI is supported.
- C# support covers C# 1.0–3.0 (Visual Studio 2002 to 2008).
- Java support covers Java Language Specification, Third Edition. J# support is assumed but not verified.
- JSP support conforms to Sun JavaServer Pages (JSP) Syntax version 2.1. XML style JSP is not supported, though.
- JavaScript, ASP covers plain JavaScript (*.js), server-side (ASP) and client-side (HTML) scripting. The support conforms to the ECMAScript standard (ECMA-262 3rd Edition 1999). Browsers such as Internet Explorer (JScript), Firefox and Opera implement this standard. JScript .NET works too although we haven't tested it thoroughly. ActionScript 3.0, while not fully supported, works to a certain extent in JavaScript mode.
- PHP support covers PHP4 and PHP5. The support is current up to PHP 5.3.0 of 2009.
Older versions than those listed above are generally supported.
Other versions. Try Visustin with other versions and dialects of the above languages. Visustin works reasonably with many other enviroments than just the ones listed above. Syntax extensions of such versions are not supported, but should not cause major failure. You may see isolated effects such as individual statements not doing what you expect. If you find any issues, please report your findings to us.
Supported statements
The syntax of these "semicolon" languages is quite similar. Naturally, there are some important differences as well. The following statements are supported.
- if..else
- #if..#elif..#else..#endif (C/C++, C#, Java)
- switch
- while, do..while
- for
- for each (C++), foreach (C#, PHP)
- break
- continue
- goto (C/C++, C#, PHP)
- return
- yield return, yield break (C#)
- lock, using, checked, unchecked, unsafe (C#)
- assert, 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++)
- __if_exists, __if_not_exists (C++)
- die (PHP)
- declare (PHP)
- function declarations
- property, indexer and event accessor declarations (C++, C#)
- class, interface, struct, union, enum and namespace declarations
- static initializers (Java)
- line labels
- comments
- <<<HEREDOC and <<<NOWDOC (PHP)
Other statements are supported but have no specific visualization. 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 hidden.
- Java enums and interfaces and C++ interface classes are not hidden as they may contain nested classes or executable code.
Note:
- C++ and C# [attributes] are displayed as comments.
- Java @attributes() are displayed as comments.
Scripting languages (JavaScript, JSP, PHP)
JavaScript/ASP
In mode JavaScript, ASP, Visustin flowcharts plain JavaScript and also JavaScript embedded on HTML or ASP pages. Visustin automatically detects the language mode, which is one of the following:
- ASP Server-side JavaScript (*.asp)
- Everything within
<%...%> is assumed to be JavaScript.
- Used when:
<% or %> are found.
- HTML Client-side JavaScript (*.html)
- Flowchart the code within
<SCRIPT>...</SCRIPT> tags. Everything else is HTML.
- Used when: Code is HTML but no ASP
<% tag exists.
- Plain (*.js)
- The code is flowcharted "as is" without HTML.
- Used when: Code is not HTML.
When flowcharting a code snippet (not an entire file), select only the JavaScript code, no HTML tags. Alternatively, include the opening tag <% or <SCRIPT> to make Visustin correctly detect the language mode.
If the code contains both server-side and client-side scripts, server-side scripts are flowcharted while client-side scripts are ignored. Remove <%...%> to flowchart as client-side script.
Where the code mixes several scripting languages, only JavaScript is flowcharted. Use VBScript mode to flowchart VBScript code.
The file extension (*.asp, *.html, *.js) has no actual meaning to Visustin.
JSP
Visustin supports the server-side code on JavaServer 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
Visustin supports the following tags in PHP mode: <?..?> <?php..?> <%..%>. Code within these tags is parsed as server-side PHP code. All other tags are treated as HTML. In particular, client-side HTML SCRIPT tags are not supported (<script language="php">).
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.
#include statements, or similar, are not supported.
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.
- "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.
- C# 2.0+: anonymous functions (delegate keyword) are not supported.
- C# 3.0: anonymous functions (lambda) are not flowcharted.
- 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 { }.
- Java: instance initializer is not shown as a separate procedure, but among other class member declarations.
- Java: Anonymous classes are not supported.
- JavaScript: Visustin works best with code using semicolons to terminate statements. If you notice a glitch due to a missing semicolon, please add one.
- 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.
- JavaScript (Microsoft JScript): Conditional compilation directives (
@if) are not supported. /*@..@*/ blocks display as regular comments.
- PHP function declarations nested in code are not displayed at the original location.
Example: if (foo) { function bar() {} } is displayed as two separate control flows.
- PHP cfunction and old_function declarations are not supported.
- PHP 5.3: anonymous (lambda) functions i.e. closures are not well supported.
C/C++ digraphs and trigraphs
Visustin fully supports C/C++ digraph and trigraph sequences:
<% %> <: :> %: %:%: ??= ??/ ??' ??( ??) ??! ??< ??> ??-
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