StructView

A viewer for structured C source code.

Introduction

StructView is a Java program to display source code that was created with structogram editors like X32 or Myfriend. These tools are now abandoned or sold as legacy tool chains for a lot of money.
My intention was to be at least able to display the source code the way it was meant to be.

 StructView

Note that StructView is neither an editor nor does it allow to automatically or manually transform normal source code into structured ones. It solely relies on certain C comments placed in the source code to display the source code as some kind of Nassi–Shneiderman with permanent contractions etc. 

Using StructView

You can either drag'n'drop files on the main window, use "Open" from the file menu or pass the file name from the command line. When using the command line, you can also specify the line to show initially by using the option "/l<line>".

Main Menu

In the File menu, you can open a file, select a recently opened file from a list, reload the current file, close all files and exit the program.

The Action menu allows to copy selected text to the clipboard, jump to a line or search for text.

The View menu allows to hide/show the console and refresh the view.

Popup menus

If multiple files are opened, they are displayed as tabs. If you hover over a tab, the full file name is displayed as Tooltip. By pressing the right mouse button on a tab, a popup menu opens that allows you to close this tab, copy the full path name or only the file name of the displayed file to the clipboard.

In the structogram panel, a right click opens up a popup menu that lets you copy selected text to the clipboard or start one of the configured editors in the currently selected line:

Note that the display of this popup menu is delayed a bit intentionally to allow the double right click. Also note the "Copy" from the Action menu id functionally identical to the Copy command from this popup menu, so also the accelerator Ctrl+C is the same.

In the console panel, a right click opens up a popup panel that let's you copy selected text from the console or clear the console.

Goto Line

By choosing "Goto Line" from the Action menu or pressing Ctrl+G, the "Goto Line" dialog opens:

Enter a line number there (starting with 1) and press "OK". If the line number exists, the according line will be displayed and highlighted. If the line is inside a contraction, the according contraction will be automaticall entered and displayed.
Note that lines can be invisible ad the structogram comments e.g. suppress the parentheses of a function, block or even the "else" instruction. So it might happen that the viewer jumps to a contraction but doesn't mark a line.

Search

By choosing "Search" from the Action menu or pressing Ctrl+F:

It should work as any other seach dialog, so enter text here and press Search. If the text was found, it is highlighted. Pressing Search again will find the next occurrence.

Command line options

With a proper Java runtime installed, the Java archive StructView.jar should be directly executable. Is this doesn't work, the official way to start a JAR from the command line is as follows:

     java -jar StructView.jar 
When using Windows, it's preferable to use  "javaw.exe" as otherwise a console (CMD) window is openen and stays open
     javaw -jar StructView.jar 

If a source file is passed as parameter, it's opened automatically at start up. Since StructView tries to run in a single instance by default, starting StructView again with another file will just open the new file in the already opened instance.
In addition to passing a file name, there are two command line options avilable:
	/l<line>] [/m] <sourcefile>"
When passing /l followed (directly) by a line number, StructView will display the according source code line after opening the file.
The option /m is mainly meant for debugging purposes as it suppresses the single instance behavior. I.e. when started with the option "/m", the instance will not try to prevent other instances from starting.
Note: StructView is meant to be used as external viewer in tools like tools like dnGrep. Just use "javaw" as executable name and "-jar StructView.jar /l%line %file" as parameters.

Icon

To allow using the internal Icon also as Windows Desktop icon, there is an "*.ICO" file in the repository. it can be used to assign as new icon for a desktop link.

Options

There is no configuration menu at this point, but several aspects of StructView can be configured. This e.g. involves the colors, number of spaces for tabs and the editors.
All the important options are located in the "[main]" section.

Note that the actual text colors are opaque while the selection colors use transparency.
it is relatively easy to make StructView more or les unusable by using according values. If this ever happens, just delete the INI file and a new one with default settings is automatically created.

Note! Use only monospace fonts. StructView won't work with cursive fonts!
Monospace fonts with free license that I can recommend are DejaVu Sans Mono and Liberation Mono. Note that even if a font is properly installed, it might not be available in every Java Runtime Environment necessarily.
If the selected font is not found, StructView will fall back to a default monospaced fault. The actually selected font is displayed in the console at startup.

Archive/Repository/Project

A compiled JAR can be downloaded from there:

https://bitbucket.org/fade0ff/structview/downloads/

Just unzio the 7z-Archive into any folder and execute the JAR from there.

All necessary files can be found in the BitBucket archive
https://bitbucket.org/fade0ff/structview

For the single instance implementation, StructView uses the Unique4j library. It is relased under the Apache License 2.0. To compile the project you need to download the Jar from there and include it into the project.
In Eclipse this is possible through Project->Properties->Java Build Path->Libraries->Add external JARs.

Disclaimer/License information

StructView is provided "as is" without warranty of any kind. Use it at your own risk.

All the parts that I did on my own are released under the Creative Commons CC-BY license.

Creative Commons License

In a nutshell this means that you can do share, modify and use everything released under this license even for commercial projects.
You just need to give me appropriate credit, indicate what changes you made and agree not to try to force a more restrictive license on my work.
See the CC BY license for details.

StructView uses the Unique4j library. It is relased under the Apache License 2.0.


Home