gbProcSort
gbProcSort is a code analysis utility which rebuilds a code listing, with non-procedural
code at the top followed by sorted procedural code 3 different sort methods). gbProcSort also
generates two types of call tree, one showing the sequence of procedure calls in the code and one
that shows all procedures which call another procedure. Procedures, non-procedure code, and a simple
list of procedure names may also be separately extracted.
In large applications, it's not unusual during development for procedures to be
added at random locations in the code listing. With gbProcSort, procedures
can be sorted, making it much easier to find a given procedure by browsing.
Especially when procedures have common name prefixes, sorted procedures makes it much
easier to browser/review the code.
And with Call Tree capability, gbProcSort provides additional methods for undestanding
how procedures within a code listing interact with one another.
The next image shows the main screen of gbProcSort. An application code
listing is shown on the left, with the extracted/sorted code procedures
shown on the right.
Key Features List
Key features of gbProcSort include:
- Build new code listing with procedures sorted by name
- Display list of procedure names (Sub and Functions)
- Display procedure code
- Display non-procedure code
- Sort procedures by ascending or descending procedure name
- Sort procedures by forward/reverse call sequence
- Call Tree (call and called by sequences)
- Open source code files (display in gbProcSort)
- Open source code files in PowerBASIC IDE
- Toggle display to use entire width for Input or Output
- Font selection
- Syntax highlighted source code display
- Highlight procedure names within code (separate from keywords)
- Upper/Lower/Mixed case code display
- Update EXE via online server
- Line numbers
- Online Help
As a safety feature, gbProcSort allows "Save-As" actions, but does not provide a "Save" feature.
This is to minimize the chance that a user might overwrite an existing source code file.
Using gbProcSort
To start using gbProcSort, you need a source code listing, which goes into the
INPUT Scintilla control. You can Open (toolbar button) an existing source code
file (*.bas or *.inc) or you can paste content into the INPUT side.
With source code available, you can take any of several actions.
Display procedure titles
- Display non-procedure code
- Display procedure code (un-sorted)
- Display procedure code (Ascending sort)
- Display procedure code (Descending sort)
- Display all code (Ascending, Forward Call, or Reverse Call sorts)
- Dipslay call tree (call or called by sequences)
Each of these actions are taken by using the corresponding toolbar button. The
results are displayed in the OUTPUT side of gbProcSort.
There are two ways to update the original source code to contain the sorted procedure
listings.
- Open the original code in an IDE, delete the procedures, paste in the sorted procedure
listing from gbProcSort
- In gbProcSort, display the non-procedure code and copy it all to the clipboard. Then
display the procedure code. Paste the non-procedure code at the top of the procedure code
listing. Use the OUTPUT context menu item "Save-As" to save the listing to a file
The Input/Output editors also provide standard Cut/Copy/Paste context menus.
That's it!
Toolbar
The gbProcSort interface includes the following toolbar.
The following options are available from the toolbar. Some buttons provide
additional dropdown menu options.
- Open
Select a source code file to display in Input
- Clear
Clear the Input and Output
- Reload
Display current file name in Input
- Titles
Display an unsorted list of procedure names in the Output
- Non-Proc
Display non-procedure code in the Output
- Proc
Display procedure code in the Output. It will be in the same
order as it was found in the Input.
- SortA
Display procedure code in the Output, sorted by ascending procedure name
- SortD
Display procedure code in the Output, sorted by descending procedure name
- Build
Build new code listing that include non-procedural code as well as
code procedures (sorted by procedure name)
- Call
Display call tree showing sequence of procedure calls
- Called By
Display call tree showing all procedures which call each procedure
- Copy Left
Copy the Output content to the Input editor.
Disabled when a call tree is displayed.
- Save As
Save the Output content to file
Disabled when a call tree is displayed.
- IDE
Open the current Input content in the PowerBASIC IDE.
Disabled when a call tree is displayed.
The associated dropdown menu offers the following menu items:
- Select IDE
Select the IDE in which to open the current file
- Font
Select a font to use in the Input/Output displays
- Settings
When pressed, reverses the Ignore PBMain/DlgProc settings.
The associated dropdown menu offers the following menu items:
- Build In Ascending Procedure Order
Places PBMain at top, followed by all procedures
in ascending procedure name order
- Build In Forward Call Order
Places PBMain at top, followed by procedures as they are called
- Build In Reverse Call Order
Places PBMain at bottom, preceded by procedures as they are called
- PBMain As Non-Procedure
Treat PBMain function as non-procedure code
- DlgProc As Non-Procedure
Tree DlgProc callback function as non-procedure code
- Syntax Highlighting
Enables syntax highlighting
- Procedure Name Highlighting
Highlights procedure names wherever they occur in
code, using a different color scheme than keywords
- Upper Case
Display syntax highlighted code in upper case
- Lower Case
Display syntax highlighted code in lower case
- Mixed Case
Display syntax highlighted code in mixed (as entered) case
- Help
Opens the online Help page. The associated dropdown menu offers
the following menu items:
- Online Update
Updates the gbProcSort EXE to the latest version
Keyboard Shortcuts
The following key combinations are available to the user to access gbThreads features:
- F1 - Help
- F2 - Show list of procedure names
- Ctrl-F - Select font
- Ctrl-L - Copy left
- Ctrl-N - Extract non-procedure code
- Ctrl-O - Select/open source code file
- Ctrl-P - Extract procedure code
- Ctrl-R - Reload source code from file
- Ctrl-S - Extract/Sort procedures
- Ctrl-T - Show list of procedure names
Other Comments
Miscellaneous information is provided in this section.
INI File
gbProcSort application settings are saved in an INI file,
kept in the same folder as the gbProcSort application.
Comments and suggestions are welcome!