EPM startpage Homepage Contact me SiteMap

EPM 6.03b Basics - by Jörg Tiemann

On this Page:

Distributions
Installation
Customization
1. Creating a mycnf.e file
2. Creating a mystuff.e file
3. Creating a mykeys.e file
4. Including vs. linking
5. Recompiling the EPM
6. Compiling macros
Links to EPM articles

 

Distributions  

EPM is part of the standard Warp 4 installation. But we need some more ingredients to make EPM do all the marvelous things we want it to do. First of all we need ETPM, the compiler for the e macros we're going to use. Next some more documentation wouldn't be too bad. Finally it is a good idea to get all the samples for EPM, especially the e macros, because source is the ultimate documentation - and can be fun, too. The samples showing how to combine the powers of E and Rexx (.erx) are also quite interesting.

In short: Warp 4 EPM is good for fixpack updates, but you better get the real stuff!

Source: CD

If you own an IBM ServicePac CD it it a good idea to search it for epm603b.zip (I found it at x:\image\epm603b\epm603b.zip). This archive (3 MB) contains all those things I've been writing about in the last paragraph, and more. A short description of the included files is given in epmbbs.txt (ASCII, 11K).

For those unfortunately enough not to own such a CD I've put this file in my Downloads area.

 

Installation  

There isn't much to be installed, however as a complete EPM installation can consist of several hundred files, it might be a good idea to use a directory structure like the following:

    EPM              for he main stuff, bitmaps, exe, epmkwds.*, *.bar etc
    |
    +--E_MACROS      the *.e macros in use
    |
    +--E_REXX        for *.erx macros
    |
    +--E_SAMPLES     *.e macros currently not used, reservoir of ideas
Assuming you follow this advice, these are the steps of installation:
  1. unpack epmapp.zip into EPM
  2. unpack epmmac.zip into EPM\E_MACROS
  3. unpack epmmac2.zip into EPM\E_MACROS
  4. unpack epmrex.zip into EPM\E_REXX
  5. unpack epmsmp.zip into EPM\E_SAMPLES
  6. unpack epmbk.zip into x:\OS2\BOOK (x being your OS/2 bootdrive)
  7. unpack epmhlp.zip into x:\OS2\HELP (x being your OS/2 bootdrive)
  8. some files have been fixed in Warp 4 or its fixpacks, thus find the following files (either in W4 fixpack images or in an existing EPM installation) and copy them to your EPM directory:
    • EPM.EXE
    • ETKC603.DLL
    • ETKE603.DLL
    • ETKR603.DLL
    • ETKUCMS.DLL
  9.  point the EPMPATH entry in your config.sys to your new EPM directory:
    set EPMPATH=y:\EPM;y:\EPM\E_MACROS
    (adjust drive and path)
  10. shutdown OS/2 and reboot
 
Customization  

Reading the comp.os.os2.* or the de.comp.os.os2.* newsgroups I've come across the same misunderstandings about EPM customization again and again.  Thus I'll try to give a brief and easy to understand introduction on how to get started.

  • Check: You have the ETPM compiler?
  • Check: You have your EPMPATH set?
OK, then let's start customizing. EPM has three key files for customization:

mycnf.e
is the right place for all those EPM configuration constants mentioned in the User's Guide to be set to the value of your choice.

mystuff.e
is the file for your own commands and procedures written in E.

mykeys.e
will take up all your key definitions or redefinitions.


  1. Creating a mycnf.e file

It is a good idea to start building up your own mycnf.e by adapting an existing sample file. For that reason here comes an abridged version of my own mycnf.e:

const

; Most important: the help files at your fingertips
; i.e. built into the Help menu

 SUPPORT_USERS_GUIDE = 1  -- Include a reference to the
                          -- EPM User's Guide on the Help menu
 SUPPORT_TECHREF     = 1  -- Include a reference to the
                          -- EPM Macro Programmer's Tech. Ref.
                          -- on the Help menu
 WANT_KEYWORD_HELP   = 1  -- Include keyword lookup code

; The Look

 HIGHLIGHT_COLOR        = 1   -- has just to be set
 LOCATE_CIRCLE_STYLE    = 4   -- (1-5) wide circle, 2 colors
 LOCATE_CIRCLE_COLOR1   = 4   -- matches in red
 MENU_LIMIT             = 20  -- max number of entries in Ring menu
 TOP_OF_FILE_VALID      = 1   -- (0/1) cursor may be put in line 0

; Language Support

 CPP_SYNTAX_ASSIST         = 0   -- (0/1)
 C_SYNTAX_ASSIST           = 0   -- (0/1)
 C_KEYWORD_HIGHLIGHTING    = 0   -- (0/1)
 E_KEYWORD_HIGHLIGHTING    = 1   -- (0/1)
 HTML_KEYWORD_HIGHLIGHTING = 1   -- (0/1)
 IPF_KEYWORD_HIGHLIGHTING  = 0   -- (0/1)
 JAVA_KEYWORD_HIGHLIGHTING = 0   -- (0/1)
 JAVA_SYNTAX_ASSIST        = 0   -- (0/1)
 P_SYNTAX_ASSIST           = 0   -- (0/1)
 REXX_KEYWORD_HIGHLIGHTING = 1   -- (0/1)
 REXX_SYNTAX_ASSIST        = 1   -- (0/1)
 TEX_KEYWORD_HIGHLIGHTING  = 0   -- (0/1)

 WANT_PROFILE = 0  -- (0/1/SWITCH) Rexx profile support
 WANT_TAGS = 0     -- (0/1/LINK) include or link TAGS.E,
                   -- a nice tagline module for C, C++ und E

; Keys ...

 BLOCK_ALT_KEY         = 0  -- (0/1) Alt key does not activate
                            -- menu (Shift-Alt+key still does)
 RESPECT_SCROLL_LOCK   = 1  -- the text scrolls under the cursor

 ENHANCED_ENTER_KEYS   = 1  -- configure each enter key separately
 WANT_STREAM_INDENTED  = 1

 TOGGLE_TAB            = 1  -- Toggling Tab key action enabled
 MY_JOIN_AFTER_WRAP    = 1

; spelling:

 DYNASPELL_BEEP= 'ALARM' -- (0/1/ALARM) noise over the soundcard
 SPELL_SUPPORT = 1       -- spell support always there

; Filehandling and misc:

 SMARTFILE         = 1  -- F4 saves only changed files
 WANT_LONGNAMES    = 1  -- (0/1/SWITCH) longname support
 MY_SHOW_LONGNAMES = 0  -- (0/1) Show longnames in titlebar

 HOST_SUPPORT = ''   -- (STD/EMUL/SRPI/'') no host support
 INCLUDE_WORKFRAME_SUPPORT = 0   -- (0/1) no need for that here

 WANT_EPM_SHELL   = 1   -- (0/1) coolest thing to have
 WANT_BOOKMARKS   = 1   -- (0/1/LINK)

 WANT_DM_BUFFER = 0 -- (0/1) UNDO is good enough for me

 TRASH_TEMP_FILES = 1 -- (0/1)

 WANT_ALL = 1   -- include the all command, kind of grep
                -- with switching feature between grep
                -- output and original file

 WANT_SEARCH_PATH = 1      -- Include this; nice to have
 WANT_GET_ENV = 1
 WANT_BRACKET_MATCHING = 1 -- Include bracket matching code

  2. Creating a mystuff.e file

As this file is supposed to contain your own commands and procedures, I can of course give only an example of what might be written in it.  The following is a short excerpt from what can be found in my mystuff.e.  If you don't have any own stuff to put in it, you can just leave this file out.

const

defload
   universal load_ext
   nfqfname = substr(.filename,lastpos('\',.filename)+1)
   if wordpos(load_ext, 'TXT EPM') then
      'toggle_parse 2 epmkwds.txt'
      'margins 1 64 3'
      refresh
      if .keyset <> 'SPELL_KEYS'  then
         'dynaspell' -- This toggles it on or off.
      endif
   elseif wordpos(load_ext, 'CMD E ERX DAT') then
      'margins 1 512 1'
   elseif wordpos(load_ext, 'NRX') then -- NetRexx
      'margins 1 512 1'
      'toggle_parse 2 epmkwds.nrx'
   endif

-- Revert command: ignore changes and reload file
tryinclude 'revert.e'

-- Textonly command
tryinclude 'textonly.e'

-- now a command to load a toolbar. This has been 
-- posted by Larry Margolis in in comp.os.os2.apps.
-- It can be used as a toolbar action (to change
-- to another toolbar), in the defload/defselect
-- instructions or just in the command line
                          
defc load_toolbar
   universal app_hini, toolbar_loaded
   menuname = arg(1)
   call windowmessage(0, getpminfo(6 /*EPMINFO_EDITFRAME*/), 
                      5916, app_hini, put_in_buffer(menuname))
   toolbar_loaded = menuname


  3. Creating a mykeys.e file

Again, this file is optional.  It might contain your key settings or keyset settings.  Just for illustration here comes another example of how this file might look like:

def '[' =
   keyin '[]'
   executekey left

def '(' =
   keyin '()'
   executekey left

def '{' =
   keyin '{}'
   executekey left

def '"' =
   keyin '""'
   executekey left

def a_f2 = 'saveas_dlg'
def a_f3 = 'revert' 
-- you need to have included revert.e for this

def c_f9 = 'textonly off'
def c_f10 = 'textonly on'
-- you need to have included textonly.e for these
def c_J = 'jot'


  4. Including vs. linking

There are two different methods to "smuggle" your own code into EPM.

One way is to include it. That means that your E code is compiled together with the main code (epm.e, its buddies and your my*.e files). The resulting file is epm.ex and this contains all the executable code that makes your EPM so special.

To achieve including you have to add the appropriate statements in your mystuff.e (and then recompile EPM). As seen above, this could look like this:

include 'textonly.e'
tryinclude 'revert.e'

This commands are compilation directives. The difference between include and tryinclude is that if the former fails (say because the E is garbage) the compilation fails and is stopped, whereas the failure of the latter has only the effect that the file isn't included, but the compilation goes on (thus no revert command in this example).

In contrast to including you can also link an external module with the executable code. This module is nothing but an *.EX file. So say you have that cool macro revert.ex. You can open the EPM command prompt, enter link revert the revert command will be available in the EPM session. If you don't need that command any longer, you can unload it with unlink revert.

Both methods have their little pros and cons. I in most cases prefer to include own code. Then it's just one run of the compiler, relaunching EPM and the wanted features are permanentely available. On the other hand linking is faster and maybe more comfortable in some development situations (see the relink command in 6. Compiling macros).

Keep in mind however that not all files can or should be compiled and linked (my*.e not, some of the menu files not, ...).


  5. Recompiling the EPM

This one is easy. Just hit <Ctrl-I> or <ESC> to open the EPM command prompt and then enter etpm epm or just etpm

epm command prompt

You will get the message if the compilation completed successfully (down in the message-line).   If an error occurs EPM will try to load the *.E file which caused the error and you can try to detect and remove that error.  If there are no errors you have to quit all EPM instances and relaunch EPM for the changes to take effect.  Good Luck!


  6. Compiling macros

While in the above example we recompiled the EPM, there is the option to compile single *.E files, too. Say, we have that wonderful macro shellkram.e (source) and want to make an *.EX (compiled macro) file out of it (to link it). Then, we can do the following. We again open the EPM command prompt and this time enter etpm shellkram.

Let's assume the compilation goes through just fine, we link our macro, but then notice some minor glitches, fix them in the source and want to activate the changes ... It would be slightely embarrassing if we now had to unlink, compile and link that macro again (and again and again). Therefore there is a shortcut command with the surprisingly plausible name "relink". Thus we simply enter relink shellkram and the whole procedure is done in one step.

 

Links to EPM articles  

Finally here are links to some recommendable articles dealing with EPM by other authors:

Customizing the Enhanced Editor - written by Jörg Schwieder

A Look at EPM 6.0x - written by Paul Floyd

Adding syntax highlighting to EPM - written by Paul Floyd

More links to articles about the Enhanced Editor you can find on a separate page.


EPM startpage Top Homepage Contact me SiteMap

Copyright © 1998-2002 - Jörg Tiemann Last modified: Sat, 5 Jan 2002

gratis SMS verschicken im Uboot.com gratis HTML checken bei w3.org gratis quer denken mit Wau Holland