Auto conversion from ProvideX pcode program and class files to text
Thanks to Terry Bauer who helped to integrate this functionality into WinPTE you can now open ProvideX program files directly in WinPTE. They will be automatically converted to text and optionally have the THEN/END_IF changed to { } syntax with the THEN keyword removed, remove the LET keyword, add blank lines above labels and re-indent the file. You get nicely formatted file without any effort.
Just drop a ProvideX program file on the WinPTE window (or open it any other way you want) and accept the text file path or change it to where you want the text file to reside:
Decompile Dialog |
|
|
Leave the "Remove Line Numbers" checked. Most of WinPTE's advanced functionality in support of ProvideX language requires no line numbers in the text file. |
If you change the file name from the default which is the same as the program or class file, ignoring the extension, then WinPTE will not auto format it when it is loaded. Simply right click and select "Auto Format File" in the ProvideX sub menu. |
Here is an example of a converted file with and without auto formatting:
Unformatted Text |
Formatted with all the fixings enabled |
|
The Compiler and Decompiler tools are configured as External Tools in WinPTE. They launch the pvxwin32.exe to run the tool programs. By default the pvxwin32.exe path is hard coded to the default ProvideX installation path for Version 6.1 being 'C:\Program Files\Best\ProvideX V6.10\pvxwin32.exe'. If your installation is in a different directory you will need to edit the external tools configuration (Tools/External Tools/Customize... menu item) and change the Command: argument by editing or browsing for the location of the executable file.
![]() |
The tools are named 'PVX Compile Program' and 'PVX Program To Text' the automatic conversion functionality looks for these tool names so if you change their names then the default entries will be re-created the next time you run WinPTE.
NOTE: Password protected programs or programs with a package ID cannot be decompiled using this tool.
CAUTION: The THEN removal macro is new and uses heuristic parsing (as opposed to syntax driven) while all effort has been made to make sure it does not change the semantics of the code, under some conditions as yet not envisioned this may happen. You can turn off the THEN replacement option for verification just in case the THEN removal macro has a bug that changes the program semantics and you need to see the pre-formatting code. If you do encounter such a bug then please report and it will be promptly fixed. Otherwise, I won't know about it.
New Renumber Program Lines
Functionality to renumber program lines added to aid all those that are maintaining legacy line numbered code. The tool is called Pvx_Renumber and resides in the same Tools subdirectory as the compile/decompile tools. Accessible from the external tools menu or from the context menu in the ProvideX sub-menu. The Renumber Lines menu item is disabled if Auto Line Numbering is not enabled in the ProvideX language template options.
If you try to renumber a program with syntax errors then no renumbering will be performed and the cursor will be moved to the first line in the program that contains a syntax error.
The Renumber tools is configured as an External Tool in WinPTE. It launches the pvxwin32.exe to run the tool programs. By default the pvxwin32.exe path is hard coded to the default ProvideX installation path for Version 6.1 being 'C:\Program Files\Best\ProvideX V6.10\pvxwin32.exe'. If your installation is in a different directory you will need to edit the external tool configuration (Tools/External Tools/Customize... menu item) and change the Command: argument by editing or browsing for the location of the executable file.
The custom tool is named 'PVX Renumber Program' the renumber program menu item looks for this specific tool name so if you change its name then the default entry will be re-created the next time you run WinPTE.
The parameters after the $(FilePath) are the first line number followed by increment. These default to 10 10, if you want to number your program starting with line 20 and increment of 20 just change the command line parameters for the custom tool.
Auto Line Numbering
Auto line numbering is now off by default and was updated to work with Auto Format. To enable go to Tools/Options select Templates/ProvideX and toggle the Auto Line Numbering to on.
Inserting lines via ENTER key will add a new line with an incremented line number. The heuristics try to add a line between the line numbers of the line above and the line below. Failing that a string of spaces is inserted, at which point you should renumber the program lines.
No line number is inserted if the previous line has a \ line continuation character or ends in a ;
Space and Backspace will do indent/un indent operation if the cursor is right after the line number.
Checking for Missing Closing Brace
ProvideX compiler tools only report this error at run time not compile time, so you don't know how many of them lie dormant in your code until you look.
WinPTE will now check for missing closing braces either from the context menu or automatically when the file is saved. If the "Check Missing } on file save" is enabled then every time you save your files they will be checked for this error. If an opening brace without a matching closing brace is found you will be prompted whether you want to save anyway or stop and fix the error. A version of the macro that runs in batch mode on an arbitrary list of files is being prepared. If you use the { } syntax it is highly recommended that you run it against all source files that you have. You may be surprised how many missing closing braces you will find.
The check missing brace on file save is enabled by default.
New Bulk Label Renaming Functionality
Tag all the labels you wish to rename with a comment of the following format:
LabelName: !%NewLabelName%
Text after the %NewLabelName% is ignored so if you have a comment on the label you wish to tag, insert the tag at the start of the comment. There can be no spaces between ! and the %. Otherwise the tag will be ignored.
When you have tagged all the labels you wish to rename select "Rename Tagged Labels" from the context menu and all occurences of the old label name will be replaced with the new label name and the tags removed. If the comment becomes empty after the tag is removed then the comment ! character will also be deleted. This operation, like all others that modify the text, can be undone.
HINT: If you turn on "Outline" mode then all the code between labels will be collapsed and it will be easier to see the labels and their tags.
This will only allow you to tag labels that do not have any code following the label. The label renaming is not syntax aware but will not modify any text that matches the label name if:
- It is in a comment or a string
- Proceeded or followed by any of the following characters: $%.'
This functionality is intended to aid rework of legacy code that used line numbers and the decompiler generates numbered, meaningless labels. This will allow you to go through the file and assign meaningful names via label tags and then replace all occurrences of the old labels with the tagged value in one step.
The macro will do some rudimentary error checking and abort with an error message if you have duplicate tags for different labels or if you have duplicate labels in the source. Also, any tags that are the same as the label will be ignored.
Default extensions
The ProvideX template defines extensions of .pvt and .pvo for providex files. Changing the providex.pte contents will no longer affect the run-time configuration. The providex.pte template values are only used as defaults during the first (very first) installation of WinPTE. To change these open the Options Pane (Tools/Options... menu) and edit the Associated Extensions property under Language Templates/ProvideX. The first extension will be used for Class file by the Compiler and Decompiler tools, the second for Program files. Any other extensions will be opened and syntax colorized but will not affect the external tools.
The .pvo extension is used to identify macro and key definitions in the providex.pte file with the ProvideX language template. If you change the extension list for the template please make sure that you add .pvo somewhere in the extension list. Otherwise you will get load errors because the macro definition extension will no longer be associated with any defined language template.
Outline Mode
Outline mode now supported for ProvideX. Only 1 level of outlining is done. Outlines will be created for DEF CLASS .... END DEF, and for all labels in the file that don't have code following the label declaration. For labels the text contained by the outline will be all lines from one label to the next label or bottom of file less blank and comment lines preceding the next label. Try it it looks better than it sounds. Use the View/Show Outlines to toggle outline mode.
A file is re-parsed for outlining only when it is opened or switched to from another file. No re-parsing for outlines is done while the file is being edited. This will be changed in a future release.
Auto Format
Auto Format has been added to the template.
Right now a line that ends with \ is considered a continued line and the line following it will indent to 2x the indentation setting to make it stand out from regular indentations. Also a line ending in ; will cause the next line to be treated as a continued line unless the next line starts with an indenting keyword. In which case the ; at the end of the previous line will be ignored.
Labels that don't have any code following the : will be formatted flush left. Any code after the : even a ; will cause the label to indent with the rest of the code.
Comments that start at column 1 will remain in column 1 after reformatting. All other comments will follow the indentation of the code.
Undo after format will restore previous file contents. So it is safe to do a Ctrl+A (select all text) and Alt+ENTER to re indent the whole file quickly.
Frequent Code Completion
These keywords fill in data automatically when a space key is hit directly after the keyword. This has the effect of completing code after the keyword during normal typing. Each code completion template can have up to 10 insertion points where template parameter text can be inserted after the template is expanded. To navigate between these insertion points use the ENTER key. Additionally code templates can specify that text entered at an insertion point should be copied somewhere in the template. There is no limit on to how many places the template parameter text can be replicated.
Insertion points in the template are specified with \v for the default insertion and first insertion point, and \v1 for the next, \v2, ... \v9. The ordering of cursor movement is determined by the insertion point numbers and not their location within the template. An example is the REPEAT/UNTIL expansion where the cursor first moves to the UNTIL condition, then to the body of the loop.
\a is used to designate the location where text entered for the default insertion point will be copied (if any), \a1 for the next, etc.
The FOR command expansion is a good example of useful replication of template parameter text. The text entered for the default insertion point (being the loop variable) will be replicated after the keyword NEXT when the enter key is hit after entering the text for that insertion point.
You can always move away from the insertion point at any time, however doing so will clear out any incomplete insertion points and will not replicate entered text into the rest of the template.
| Keyword | Type |
|---|---|
| END | New: Auto completes IF, SWITCH, based on context. Will also replace END with WEND for WHILE termination, UNTIL for REPEAT termination. |
| NEXT | New: Auto completes RECORD for SELECT and name of the loop variable for FOR. |
GOTO |
New: Code completion with global labels in the file when a space is typed after the GOTO or GOSUB keywords. |
| IF | IF \v {
\v1
} |
| ELSE | ELSE {
\v
} |
| FOR | FOR \v = \v1 TO \v2 NEXT \a |
| WHILE | WHILE \v
\v1
WEND |
| REPEAT | REPEAT
\v2
UNTIL \v |
Key assignments specific to ProvideX and how they are used:
Short List of time saving keyboard shortcuts well worth trying out.
| Key | Action |
|---|---|
| Space | Line Numbering Off: If before first non-blank of the line will indent to the next indentation level. Otherwise standard space behavior. Line Numbering On: Indents by the indentation setting if the cursor is after the line number but before any non space characters. Otherwise inserts a space |
| Backspace | Line Numbering Off: If before first non-blank of the line will un indent to the previous indentation level. Otherwise standard backspace behavior. Line Numbering On: Un indents by the indentation setting if the cursor is after the line number but before any non space characters. Otherwise deletes the previous character. |
| ENTER | Line Numbering Off: Insert a new line. Note no splitting of text is done. Use Alt+S to split text into two lines. Line Numbering On: Insert a new line with and incremented line number and moves the indentation to the same level as previous line. |
Ctrl+ENTER Ctrl+Shift+ENTER Shift+Alt+S |
Move the contents from cursor to end of line to a new line as a continuation of the current line. Quick way of splitting a long line into two lines with the second being the continuation of the first. |
| Alt+ENTER | Re-Indent selection or current line if there is no selection. |
| Ctrl+Shift+F7 | Delete extra blank lines. Double blank lines will be removed to leave only one blank line. No blank lines will be left after labels or indenting keywords. No blank lines will be left before un-indenting keywords. |
| Alt+S | Move text from cursor to end of line to a new line. i.e. Split a line at cursor position. |
| Ctrl+J | Jump to function declaration. Builds a list of labels and shows it in a popup. Use arrow keys to select desired function and hit ENTER to move the cursor to the code after the label. |
| Ctrl+Shift+J | Jump to switch case label. The cursor should be in or on the Switch statement. Select the desired label and hit ENTER to move to the Case statement for that label. Additional entries: .switch - moves to switch statement itself, .default to the default case, .end switch to the END SWITCH statement. |
Alt+J Shift+Alt+J |
Join lines, Append content of the next line to the current line and delete the next line. If the current line has a continuation \ will delete it prior to join operation. If the next line has a line number it will be deleted and a ; will be inserted at the end of the current line. This is useful for creating a compound statement from two separate statements. |
| Alt+Left | Un indent selected lines by 1 space. |
| Alt+Right | Indent selected lines by 1 space. |
| Alt+Shift+Left | Un indent selected lines by the indentation setting. Default is 4 |
| Alt+Shift+Right | Indent selected lines by by the indentation setting. Default is 4 |
| Alt+Up | Move the selection or current line if there is no selection, one line above. Useful for moving lines in/out of compound statements. However no line renumbering is done. No line renumbering is done. |
| Alt+Down | Move the selection or current line if there is no selection, one line below. Useful for moving lines in/out of compound statements. No line renumbering is done. |
| Alt+X | Change number under cursor from Hexadecimal <--> Decimal. |
| Alt+Back Quote | Comment/Uncomment a block of lines |






