The Visual Basic Code Analyst
by
Ken Bergmann
B Elegant Software
Copyright 1994-1995

This readme file is for the Visual Basic Code Analyst.

The VB Code Analyst will tokenize an entire Visual Basic project.  It will print out many detailed reports on the contents of a Visual Basic project.  The main purpose is to illustrate the breakdown and architecture of a project.

The Visual Basic Code Analyst includes four (4) additional tools to help the development process.

1) The Visual Basic Code Sculptor - This tool is built into The Code Analyst to allow you to reorganize your code during the Analysis portion.  The Visual Basic Code Sculptor will recreate your project in a SEPERATE output directory.  All globals, global constants, declarations, and types will be stripped out of the code and assembled in two clean files.  The listings will be formatted, sorted alphabetically, and grouped.  Unreferenced objects will be neatly commented out.  The perfect way to clean up your code after long 'hack sessions'.  Ideal for getting your code in top condition for code reviews, walk-throughs, etc.

2) The Visual Basic Code Printer - This tool does 'pretty' printing of your source code.  You choose the fonts, the headers, margins, footers,  and all the rest.  Then it prints out a beautiful copy of your code with page numbers, date-time stamps, seperate fonts for code lines, headers, footers, and comment lines.  You have three lines for header and three for footer.  There is also an additional project name line. PLUS! An INDEX at the end which gives the pages numbers for all procedures listed in alphabetical order.

3) The Visual Basic Code Architect - This tool will print out a listing of all caller relationships for both the file and the procedure levels.  NO MORE GUESSING, if your project is load optimized in memory.  This helpful tool will tell you who calls who and allow you to organize your code so it IS load optimized!

4) The Visual Basic Code Scribe - This tool will store everything learned by the Visual Basic Code Analyst and the Visual Basic Code Architect.  You can then later retrieve all the information for viewing in the frontend, printing reports, or generating call trees.  Without having to re-analyze your project!  PLUS! Brand new, the Scribe will dump this information optionally to an access database!  This means you can write your own queries or reports against all the data.  Work with the information the way YOU want to!

OverView
=========

During the analysis phase the Visual Basic Code Analyst tokenizes all objects in the project.  It will build a library of all objects, with their relations to other objects, the number of references, and other information.  This information can be viewed through the front-end.  However, the REAL power of the Visual Basic Code Analyst is in the many reports it can generate.
Some of the information you can get from the Visual Basic Code Analyst is as follows:
	* Files - size, # lines (executable, comment, form definition, etc), # variables - all types, more!
	* VBXs - all version information, size, more!
	* Types, Variables, Procedures, etc - ALL FULLY DETAILED WITH REFERENCE COUNTS AND RELATIONSHIP INFORMATION!!!

The Visual Basic Code Sculptor will allow you strip out all global vars, global constants, declarations, and types and assemble these in formatted, alphabetically sorted order.  The comment after each declaration is the number of references to that particalur object.
The Visual Basic Code Sculptor during reconstruction will EXPLICITLY declare the types of all functions, and variables.  It will break apart multiple dims on the same line, into seperate lines.

The Visual Basic Code Sculptor will NOT modify anything in the original project.  All files are opened for READ ONLY access only.  Under the options tab you can specify a seperate OUTPUT directory.  The Visual Basic Code Sculptor will reconstruct a COPY of the project in this directory with all global vars, global constants, declarations and types moved to new modules.  You can specify what to move and what to leave.

*** NOTE: If you choose to use the Visual Basic Code Sculptor to reconstruct the project, you should change the OUTPUT directory.  If you do not make the OUTPUT directory different than the project directory, the project WILL BE modified in place.

The Visual Basic Code Sculptor will also compile a list of all string literals.  The Visual Basic Code Sculptor will sort this list and output it to a str_*.txt file.  This file can be used as a reference if you are optimizing string usage with global string constants, or searching for embedding SQL, etc.

If you choose, when the Visual Basic Code Sculptor reconstructs a COPY of the project, it can strip all blank lines.


Basic Operations
=================

To switch the working directory or output directory.  Click in the appropriate box.  Then either enter the text for the new directory, or manipulate the directory and drive controls to change this to the right directory.

To turn on the background process log. Choose Output analyze.log file.  This will output a file called analyze.log which has a log of the analysis.  It includes the time it takes to complete.

To analyze a project, double click on the Project caption.  (The panel at the top of the form.) It will load the Choose Project form.  Navigate to the project.  Either choose the project .mak file and press analyze project, or double click the filename.

To output reports, press the button for the report you are interested in.  You can generate full reports for the project, or for a file, and you can generate object reports for the project or for a file.

If you don't want hints generated, clear the check box for the appropriate hint.

Tools -

The Visual Basic Code Printer - Setup the print configuration by choosing Code Printing Setup from the Tools tab.  Choose a seperate font for each section.  A sample is illustrated in the sample text box.

The Visual Basic Code Architect - To use the Visual Basic Code Architect, you must first generate the architecture information by choosing Generate Architecture from the Tools tab.  Once this has been generated, you can save this information along with all other information, using the Visual Basic Code Scribe.  Once architecture information is loaded, either through generation or using the Visual Basic Code Scribe, you can generate an architecture report.

There are two types of architecture reports.  A text file by choosing Printing Architecture - Text File, and a VISIO diagram.
To Generate a Visio file, you must have a full installation of Visio 3.0.  You must also copy the template files - analyst.vss and analyst.vst - to the Visio Templates directory. You can choose to print out several types of diagrams.  They all will interlink together on the same page.  You can choose a procedure and print who it calls.  Or choose a file and print who it calls.  You can also choose to print all call relationships in the project.  Successive prints of various files will all combine on the same page.  So printing the relationship of every procedure in a file has the same affect as printing the file level.  And printing each file has the same affect as printing the project level.  The configuration levels have no effect on the Text File output.

If you require further combinations...
You can choose to enable the custom file printing.  The setup button will bring up the list of files in the project. By Choosing Yes for the files you want to see you include them in any print outs where they are the caller or the called.  By Choosing No for the files you don't want to see, you exclude them from the diagram.  They will not show up as a caller or as called.  This leaves potential orphans. If a file is excluded and it is the only file calling a file, the file it calls will not appear either.  If it is the only file called by a file, the file that calls it will appear but there will be no relationship line.

You can configure the spacing on the output sheet, but changing two .ini file lines. Under the Architect Section, the entries are DifferenceX, and DifferenceY.  This is the number of inches from left to left of each box, and from top to top of each box, respectively.

Files Required
===============

THREED.VBX
SSIDXTAB.VBX
CMDIALOG.VBX
CURTIME.VBX


Caveats
========

The only hint generation done at this time, is to suggest using control arrays for controls with similar names.
If you want to update your project in place, make the ouput directory the same as the project directory.
Ken Bergmann is not responsible for anything in any way, shape or form, for whatever happens by installation, ownership, or use (incorrect or otherwise) of this application.

Everything else
================

All credit for the concept of a graphical output for the architecture goes to Rick Raddatz.

If you have suggestions or ideas, please contact:

Ken Bergmann
B Elegant Software
NET: 74441,163@compuserve.com
PHN: (206) 557-4279

Thanks!!!!
