OS/2 eZine - http://www.os2ezine.com
Spacer
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.



Spacer
Previous Article
Home
Next Article


coolfm v2.0 supports USB, TV-onboard and ISA fm-tuners!


Netlabs EPM Distribution - NED

The Netlabs EPM Distribution is a project to standardize and simplify the installation and configuration of EPM, which is also known as the Enhanced Editor. Before we can talk about the Netlabs EPM Distribution, we need to know something about EPM itself.


EPM is an editor developed by IBM, based on an editor core or engine that was developed for other platforms. The editor is known as the E editor on other platforms; when it was ported to OS/2 a PM interface was added - hence the name EPM. The E editor is available in PC-DOS, and the editor engine used in EPM is also used in the command line editor TEDIT.

EPM consists of a core edit engine, and a macro language called E (I guess once they found a letter that worked they decided to stick with it. I personally think the macro language should have been called L, or maybe even M.) The editor can be extensively configured with E language statements and programs, and much of the function of EPM is provided through E. The user interface to EPM is a somewhat strange combination of graphical and command line; the graphical part of the interface being the menus, mouse actions, etc. and the command line part through a dialog box where where editor commands are typed. Some of the editor commands come from the editor core, but the majority of the commands are built from E language routines.

The E language is specific to the editor, and is based on Rexx but with some differences. In E variables contain an undefined value until they are initialized, in Rexx all uninitiated variables are set to the name of the variable. In E all variables are local in scope, but can be declared to be global, where in Rexx variables are global in scope, but can be made local with the PROCEDURE statement. E macros must be compiled before they can be used; Rexx programs are not compiled. Other than those differences the two languages are very, very similar.

The E language is used to configure the editor, and to write commands that can either be issued from the command dialog, or associated with menu items; events such as dropping of a file, or mouse actions. The commands are really E routines the perform some action in the editor. Because the E language is fairly easy to use, and because the E editor has been around a long time, there are a whole slew of macros/commands available for use in EPM, many of them available on Hobbes.

What the Netlabs EPM distribution does is bundle up most of the add-on EPM macros and commands, and provides a WarpIN install program for installing EPM with the bundled add-ons in a structured, uniform manner. The Netlabs EPM Distribution (hereafter called NED) also simplifies configuring EPM and maintaining that customized configuration while using the various add-on packages, which is not always so easy to do. NED also provides a slick interface to the EPM compiler (ETPM) along with some customizations to EPM.

Installing NED

Currently NED can only be installed by WarpIN version 1.19; it wants this exact version of WarpIN. This is a bug that the developers recognize and will change in a future release. So the first step is to install version 1.19 of WarpIN on your machine. If this is the very first version of WarpIN to be installed on your machine you will have to install WarpIN twice before it registers its own version number in its own database, so that it will be recognized as the correct version by NED. If you already have WarpIN installed, any version, you only have to install WarpIN version 1.19 once.

If you don't already have the Enhanced Editor (EPM) installed on your machine, you need to install it. NED does not include EPM itself, just the add-on packages and the documentation. You can install the Enhanced Editor with the OS/2 install program; run the Selective Install and select the Tools and Games check box, then click on MORE, then select the Enhanced Editor. Alternatively you can download EPM from Hobbes.

After installing WarpIN, download NED and double-click on the downloaded file to start the installation. The installation program allows you to pick some of the add-on packages to be installed, such as the VoiceType interface. Once you get done you will have a folder that looks like this. The folder will be located in the PROGRAMS - APPLICATIONS folder.

NED1
Netlabs EPM Distribution folder - All Install Packages

You can execute the NED version of EPM by clicking on the Netlabs EPM icon, or you can execute your "regular" Enhanced Editor by using your existing EPM icon.

NED creates a set of directories designed to keep configuration files created by you separate from standard EPM files and files provided by Netlabs. The directory structure looks like this:

NED2
NED Directory Structure

I used the directory EPM as my top level directory, which is different from the default. The three subdirectories are:

  1. EPMBBS - which contains all the add-on packages distributed with NED.
  2. NETLABS - which contains the files that are NED specific.
  3. MYEPM - which is where you place the files you create or modify to change the configuration of EPM, or to add new commands.

What is NED?

NED is a bundle of stuff, including

  1. A version of EPM with:
    • A new menu item for compiling EPM.

      NED4

    • A changed message/status line that shows the hex and decimal values of the character under the cursor. The status line changes colors when the file is modified and needs to be saved.

      NED5

    • Altered title bar.
    • Changed color for the find results - instead of the almost impossible to see light blue circle, a solid black circle is used.

      NED6

    • Syntax highlighting for a number of file types is enabled, including Config.sys, Rexx, C, etc.

      NED8

    • Double-clicking on a line in EPM containing a URL opens that URL in Netscape, or your default browser.
  2. A graphical interface to ETPM, the compiler used for compiling E language files.

    NED7

  3. Documentation: user guide, reference manual, and NED manual.
  4. Automatic linking of modules - place a compiled E language macro in the MYEPM\AUTOLINK directory and it is automatically linked into EPM when EPM starts up. This saves you having to manually type the LINK xxx command. See Writing Macros for how macros are built and used.
  5. Methods for changing colors and other configuration items used by EPM without recompiling any EPM.
  6. A uniform, structured directory structure for separating out your configuration files and macros from the files included in the standard distribution, thereby allowing the standard files to be upgraded without affecting your stuff.

    NED3
    Subdirectories of MYEPM

Changing the Configuration of EPM

Currently the way EPM is designed is that in order to change most of the configuration items, you must create a file, add entries to the file, and recompile EPM. This is one of the areas the NED project is trying to change; they are trying to make configuration of EPM changeable without recompiling the editor. The have made some strides in that area, but doing so is a complex, time consuming affair. For a comparison of the current EPM method for changing configuration and a menu or dialog box method, see the LPEX editor article in this month's issue of OS/2 eZine.

Currently, to change most of the configuration items you have to create one of two files: mycnf.e or mykeys.e, place those files in the MYEPM\MACROS directory, and recompile EPM. With NED, this is much easier than it sounds.

The file mykeys.e is where you change the behavior assigned to keys in EPM. All other configuration changes go into the mycnf.e. When I installed NED and brought across my configuration settings I have been using since EPM v 5.51, I discovered that most of what I had set was already in the standard NED configuration. My configuration file, with most of the stuff commented out because it isn't needed any more, is shown below. The -- characters are the beginning of a comment.

set insert_state 0 -- I prefer to have insert initially off const -- HOST_SUPPORT = 'EMUL' -- ('STD') Use E3EMUL. Following are for it: -- USING = 'IBM' -- ('CM') Send/Receive protocol Needed for MVS -- MVS = 0 -- (0) Include MVS support -- HOST_LT_REQUIRED = 0 -- (0) H: refers to PC; HA: refers to host. -- REXX_SYNTAX_ASSIST = 0 -- (0) Include Rexx syntax assist -- E_SYNTAX_ASSIST = 0 -- (1) The product doesn't need E syntax assist! Example of a Configuration File

The file mykeys.e that I have sets the key mappings to what I prefer. F2 brings up the Save dialog, F5 brings up the search dialog, F6 brings up the undo dialog, and F9 duplicates a line leaving the cursor in its original position. I also changed the Page-Up and Page-Down keys so that they scroll the page so that the line the cursor is on is moved to the top (or the bottom) of the screen. Subsequent uses of Page-Up and Page-Down scroll a full screen's worth of lines.

def a_u, c_u= unmark compile if EVERSION > 5 'ClearSharBuff' /* Remove Content in EPM shared text buffer */ compile endif def f2 'save' def f5= 'searchdlg' -- search dialog def f6 = 'undodlg' -- undo dialog def f9= -- duplicate current line getline line insertline line,.line+1 sayerror "Dup line" def pgup= -- Cursor type page up if (.cursory >= 1) and (.cursory < (.windowheight-1)) then line = .line .cursory = (.windowheight+1) .line = line else page_up .cursory = .windowheight endif def pgdn= -- Cursor type page down if (.cursory > 1) and (.cursory <=.windowheight) then line = .line .cursory = 1 .line = line else page_down .cursory = 1 endif Example of MYKEYS.E Configuration File

As we said above, one of the goals of the NED project is to make configuration changes possible without recompiling the editor. However with NED, recompiling is really quite painless. The steps are:

  1. Create your mycnf.e and mykeys.e files in the MYEPM\MACROS directory. If all you want to change is the keys, don't create a mycnf.e file.
  2. Select Recompile EPM.E from the Command menu in EPM.
  3. If the compile fails because of some error, the file it failed on will be displayed in EPM with the cursor on the line that caused the failure. If the compile succeeded, EPM will be closed so that when it opens the new configuration will be used.
That's all there is to it.

Writing Macros

Macros in EPM can be written in Rexx, or in E. E macros are compiled into a file with an extension of *.EX, and must be "linked" into EPM before they can be used. When they are linked into EPM they become a command that can be typed from the command dialog.

Compiling E macros is only slightly more complicated than recompiling EPM. To compile an E macro:

  1. Open a Command Prompt window.
  2. Execute the file EPMENV.CMD from the NETLABS\BIN directory.
  3. Run the ETPM compiler against the E macro file.

When the macro is finished compiling you will have a file with an *.EX extension. To use the file you can either:

  1. Move the file to the MYEPM\MACROS directory and link the file into EPM manually by typing LINK macroFileName from the command dialog
  2. Or - move the file to the MYEPM\AUTOLINK directory. The file will automatically be linked into EPM the next time EPM starts.

Conclusion

EPM is a very powerful editor, and there are numerous add-on packages to enhance EPM for specific tasks. For example with the spell checker added and the kHTML package added it becomes a very nice HTML editor - which is what I am using to write this article.

The Netlabs EPM Distribution is a very welcome "standardization" of the EPM package, and a very nice enhancement to EPM. I highly recommend it for anyone that uses EPM. And I congratulate the NED team for a fine product.

Previous Article
Home
Next Article

Copyright (C) 2003. All Rights Reserved.