C/C++, C#, Java and JSP flow charts
Help » Languages » C/C++, C#, Java, JSP
Visustin generates flow charts from code written in any of C, C++, C#, Java and JSP.
- C support covers ANSI C and ISO C11.
- C++ support covers C++14 and Microsoft Visual C++ extensions. Microsoft support is current up to Visual C++ 2015. C++/CLI is supported.
- C# support covers C# 1.0–6.0 (Visual Studio 2002 to 2015).
- Java support is current up to Java 8. J# support is assumed but not verified.
- JSP support conforms to Sun JavaServer Pages (JSP) Syntax version 2.3. XML style JSP is not supported (write us if you need support).
Older language versions are generally supported.
Other languages. Try Visustin with dialects and variants of the above languages. As long as the basic syntax is equal, Visustin may work to a reasonable extent. Naturally, syntax extensions are not supported, but should not cause a major failure either. You may see isolated effects such as individual statements not doing what you expect. We would be interested in your findings.
- MQL (MetaQuotes Language) is not supported, but it appears to work in C/C++ mode. MQL4 and MQL5 are very close to C/C++ syntax.
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..case..default
- while, do..while
- for
- for each (C++), foreach (C#)
- break
- continue
- goto (C/C++, C#)
- return
- yield (C#)
- lock, using, checked, unchecked, unsafe (C#)
- assert, synchronized (Java)
- 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++)
- function declarations
- property, indexer and event accessor declarations (C++, C#)
- class, interface, struct, union, enum and namespace declarations
- static initializers (Java)
- line labels
- comments
Other statements are supported but have no specific visualization. Certain non-executable blocks are not visualized, because they contain no control flow. Special cases include:
- enum (C/C++, C#) and interface (C#) definitions are hidden.
- Java enums and interfaces and C++ interface classes are not hidden as they may contain nested classes or executable code.
JSP server side tags
JSP is a server-side scripting language that embeds source code in an HTML page. Visustin looks for opening and closing tags to extract source code from HTML. All text outside these tags is treated as HTML content. If there are no opening or closing tags, the code is assumed to be pure source code instead of HTML.
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. XML style JSP tags are not supported (<jsp:scriptlet>
etc.). Write us if you require support for them.
Pre-processor directives
#if..#elif..#else..#endif -style conditional directives are supported in C/C++, C# and Java mode. Even if regular Java has no pre-processor, conditional directives are supported for non-standard implementations, such as Microsoft J++ and J#.
There are 2 options to choose from in the Options menu: 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, this mode may cause some unwanted effects. If it doesn't work out well, use the Show as comments options.
#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 displayed, but the included file is not fetched.
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: Nested functions are not supported. Nested functions are a compiler extension (gcc), not part of standard C.
- 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 { }.
- C/C++: lambda expressions are not supported.
- C/C++: escape character at end-of-line inside a raw string literal
R"..\
.."
is not supported.
- C#: anonymous functions (delegate keyword) are not supported.
- C#: anonymous functions (lambda) are not flowcharted.
- Java: instance initializer is not shown as a separate procedure, but among other class member declarations.
- Java: Anonymous classes are not supported.
- Java: 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.
C/C++ digraphs and trigraphs
Visustin fully supports C/C++ digraph and trigraph sequences, which may appear in legacy code:
<% %> <: :> %: %:%: ??= ??/ ??' ??( ??) ??! ??< ??> ??-
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 – Visustin Help