Using TextPad Advanced Features with XJTAG
Introduction
The XJTAG Development System is supplied with TextPad, a fully featured and sophisticated text editor. This application note describes some of the advanced features of TextPad that can be used to help with the development and execution of XJEase files.
Sections
- Syntax highlighting
- Clip libraries
- Syntax checking
- Linking to errors and warnings
- Running XJEase scripts
Syntax Highlighting
TextPad incorporates syntax highlighting. Here's an example of how it can look when configured.

Syntax highlighting is done via syntax definition files (.syn); .syn files for XJEase are installed as part of the XJTAG installation.
You can configure the colours used for the highlighting. Select "Configure->Preferences…" from the TextPad menu, then select "Document Classes->XJEase->Colours".
You should not need to modify the syntax definition file itself but, if you wish to, select "Configure->Preferences...", then "Document Classes->XJEase->Syntax". Click on "Open" to view or modify the syntax definition file.
Additional syntax definition files for many other languages including VB, C, C++, VERILOG, VHDL, HTML and PERL can be downloaded from the TextPad add-ons download area on their website.
Clip Libraries
TextPad clip libraries allow you to insert script templates into your source files. The XJTAG Development System is supplied with a clip Library for XJEase. To display the XJEase clip library, first ensure that clip library is selected in the TextPad "View" menu.
Now select "XJEase" from the drop-down list at the top of the clip library frame.
To insert an XJEase template into your current document, double-click on the required clip name.
Additional clip libraries for hundreds of additional languages can be downloaded from the TextPad add-ons download area on their website.
Checking XJEase Syntax and Capturing Output
It can be very time consuming to keep returning to a command prompt and running XJDebug in order to check the syntax of an XJEase project or device file you are developing. The TextPad "Tools" facility allows you to do this within TextPad's environment.
TextPad allows you to define your own tools which will appear on the tools menu. The XJDebug syntax check option can be used to check the syntax of an XJEase project files within the TextPad environment using this feature.
To define the syntax checking tool, select "Configure"->"Preferences" from the TextPad menu. In the "Preferences" dialog box, select "Tools" from the list on the left and click "Add". Select "Program..." from the drop-down list. This will open a dialog for you to choose a program to run. Find XJDebug on your computer (e.g. C:\Program Files\XJTAG\bin\XJDebug.exe) and select it. This will add a tool called "XJDebug" to the list of available tools. Now click "Apply" to save the new tool.
Click on "Tools" on the left-hand side again and select the new "XJDebug" tool (in the right-hand pane). Click it again and rename it "XJEase Syntax Check".
Expanding the "Tools" section in the left-hand pane of the Preferences dialog should now reveal the new "XJEase Syntax Check" tool. Click once on this tool to select it and fill in the right-hand side as shown in the screenshot above.
The TextPad parameters $File and $FileDir refer to the current file and its directory respectively. Click on "OK" to accept the new settings.
The new "XJEase Syntax Check" tool can now be run at any time by selecting the XJEase project file for editing and then choosing "XJEase Syntax Check" from the "Tools" menu. The syntax check output will be captured by TextPad and displayed in a "Command Results" window.
N.B. If you have more than one version of XJTAG installed, you will need to create a separate TextPad tool for each version.
Linking to Errors and Warnings
The previous section shows how to check XJEase source files for syntax errors and display the results in a "Command Results" window. Syntax errors are indicated by a message such as:
D:\Projects\MyProject\Filename.xje(234): Syntax Error - Unexpected SYMBOL
which indicates the source of the error by file name and line number. By using the TextPad regular expression output expression matching, we can provide the ability to double-click on the error message and jump immediately to the appropriate line in the file.
Select "Configure"->"Preferences" from the TextPad menu to open the Preferences dialog box. Expand the "Tools" section on the left-hand side and select "XJEase Syntax Check".
Type ^\([^(]+\)(\([0-9]+\)): in the textbox marked "Regular expression to match output"; select '1' for "File" and '2' for "Line", as shown in the screenshot above.
Further explanation and information about matching regular expressions and compilation errors can be found in the "Regular Expressions to Match Compilation Errors" section of the TextPad help file.
Running XJEase Scripts
XJEase scripts can also be executed within the TextPad environment. To do this, add another TextPad Tool to run the current XJEase project file, in the same way as adding the syntax check tool above. Replace the parameters "-s $File" with "-run $File" to make XJDebug execute the script rather than performing a syntax check. Output is captured and errors can be located as for the syntax check.
TextPad is copyright and licensed from © Helios Software Solutions. Support, licenses, downloads and Support can be obtained from Helios Software Solutions.