February 16, 2003 Douglas Clark is a program management consultant who first started using OS/2 version 1.3. He's married, with 2 girls, and is old enough to remember when 4 color mainframe terminals were a big thing. If you have a comment about the content of this article, please feel free to vent in the OS/2 eZine discussion forums. There is also a Printer Friendly version of this page. |
|
LPEX - The 'Other' Programmer's Editor
LPEX may be one of the best kept secrets in the OS/2 world. While
EPM gets all the glory as the editor of choice on OS/2, its successor
LPEX gets no respect. This is too bad because in many ways LPEX is a
better editor than EPM. This article is a short look at LPEX, and how
it compares with EPM.
| ||||||||
Where to Find LPEXLPEX is bundled as part of the VisualAge C++ products. In VAC V 3 the editor appears as a standalone application that could be integrated into the WorkFrame. In VAC v 4 the editor appears in the VAC IDE. In both products the editor can be started and run by itself by executing the file IBMCPP/BIN/lxpm.cmd where IBMCPP/ is the directory where VAC is installed. The editor also runs on Windows, and I guess in AIX, although I have never used AIX.
Both LPEX in VAC version 3 and in version 4 can be separated from the VAC package and run by itself if you have enough patience to find all the DLL's used by the editor. LPEX - The Parsing EditorLPEX gets its initials from the name "live parsing editor." It parses the lines you type, as your type them, and displays syntax errors immediately; you don't have to run the source code through the compiler or interpreter to catch simple syntax errors. This can be a huge time saver regardless of whether you are writing C code or Rexx code. LPEX comes with "profiles" for C, C++, Cobol with and without embeded SQL, Fortran, JCL, Pascal, OS/2 .RC type files, and Rexx to name a few.
Complex syntax errors, such as missing an ending bracket or END statement, are beyond the ability of the parser. The parsing of the source file also allows the editor to offer some unique features, such as: the ability to find a function quickly in a file by hiding all the lines in the file except those that define or start functions, placing your cursor on the function you want, and then showing all the lines in the file.
Since the editor has parsed the source file you can use that intelligence to move forward or backward to the next/previous function or class in the file. Other FeaturesLPEX has a number of other features that can help in writing code. The split view allows you to view two different files in the same window (handy for viewing the header file with a class definition while coding the methods in the CPP file), or it can load the same file into both views allowing you to see and work on different parts of the file at the same time.
LPEX also has a compare feature that will load two files up in side by side views and show the differences between the files.
Programming the EditorLPEX uses two languages for writing macros: Rexx and C. The E language used by EPM is history.The editor configuration can be modified by various "profile" files that are loaded at different events as the editor starts and as it loads a file. There are three types of profile files:
The editor searches along the path defined by the environment variable CPPLPATH (version 3) or CPPLPATH4 (version 4) for macros and profile files. The profile files contain Rexx code and editor commands which can modify the appearance and function of the editor. The following is an example of a profile file I use for version 4 of LPEX, in this case profsys.lxu, which is read each time a file is loaded in the editor. In it I set the key mapping to what I am familiar with, which is also the same key mapping I use in EPM. This file also shows an example of changing the File Open icon on the tool bar so that it opens a standard File Dialog instead of the one normally used by LPEX. The line
The openfile.lx macro retrieves the last directory displayed in the File Dialog, opens the file dialog using that directory, and then opens each file in LPEX that was selected in the File Dialog. I am using the VRFileDialog function from VX-Rexx to display a file dialog, mainly because it was handy. (The reasons I want to replace the LPEX file dialog are because the LPEX version is slightly broken, and because I want to use the XFILE dialog enhancer loaded on my system.) Writing macros for LPEX is actually easier than for EPM because it uses pure Rexx, rather than the E language. LPEX verses EPMWhile I think LPEX is a better editor than EPM, I am not ready to retire EPM. In fact EPM is probably the one OS/2 application I use the most. There are still some areas in which EPM is better than LPEX. A comparison between the two is:
ConclusionIf you have access to LPEX by owning one of the applications LPEX is bundled in, you ought to take a look at it. LPEX can be configured to work very similarly to EPM, making the transition between the two painless. Plus LPEX runs on Windows, for the occasions when you can't avoid working in the evil empire. In many ways LPEX is more powerful than EPM, which is what you would expect from EPM's successor. |
||||||||||
|