Spell check in EPM with easily changeable dictionary files

The extended editor (EPM.EXE) is an universal tool which is not only suitable for
processing simple text files but, e. g., as a front-end for LaTeX.

The integrated dictionary function can be applied to spell checking the LaTeX source text. Apart
from the possibility of checking the *.DVI file with
ISPELL, it is more convenient to use
the integrated function in EPM because necessary corrections can be made immediately in the editor. The dictionary
files distributed with IBMWORKS (Bonuspak), e.g., US.DCT, have proven usable.

The possibility arose of easily switching between different dictionary configurations in
EPM, especially between old and new German orthography, or even other languages.

Since the programming of additional menu calls—including the appropriate routines with the macro language
E—for EPM is not a problem, it also seemed obvious to add a menu item for switching the currently used
dictionary file together with the appropriate user generated dictionary files.

The goals for the version presented here are:

no new entries in the file EPM.INI must be created

no recompilation of the file EPM.EX is necessary

the overhead for the administration of several dictionary files should be as small as possible

Creating a Dictionary Menu

With a correctly installed spell-checking support (for the English version: Options >
Preferences > Settings > Paths) the dictionary adjustments are recorded by EPM in the file
EPM.INI.

With the following source code, placed in SwitchDict.E, the switching function can be integrated into the
menu.

The Constants

First we need a definition for text constants which appear in the status line when the
new functions are called:

The procedures in definit are executed at the start of EPM
(more exactly when each new window is opened) and contain the default values.
The access to variables and constants used in EPM is done via the
keyword universal.

The Variables

The definition of global variables which are accessible by multiple procedures is also possible. One
needs:

Table 1. Variables to implement dictionary switching

Variable

Description

Internal variables

defaultmenu

handle to the standard menu

APP_HINI

handle to the file EPM.INI

DICTIONARY_FILENAME

internal variable of EPM, contains the path and file name of the dictionary

ADDENDA_FILENAME

internal variable EPM, contains the path and file name of the supplement dictionary created by the
user

New variables

Dict_ID

defined variable, field index for dictionary files

Add_ID

defined variable, field index for supplemental dictionary files

SwDict

defined variable, switch for current files and index for array variables

For the access to the different files with a single procedure, it is best to use an array
structure. Arrays in the language E require a bit of work.

The transfer to the arrays can only take place via variables which are assigned the paths
to the dictionary files.
The paths must be assigned according to the current environment. The inclusion of these default settings into the menu structure of
EPM is possible. It does, however, require additional administration effort, e.g., additional entries in the EPM.INI.

It is convenient to use a HOME directory for the storage of the dictionary files.

If HOME does not exist on your system, create a directory like x:\my\home,
add set home=x:\my\home to CONFIG.SYS, and reboot
your system.

The path of the current dictionary file is derived from the keyword DICTIONARY in
EPM.INI and the variable SwDict is set to that value. The value of SwDict is needed for the
indexing the array variables and for indication in the menu.

The identifications 2000. . .2003 are necessary for EPM to distinguish between the structures and needn't
be numbered as shown. (That is taken into account with further menu expansions.) The command which is executed after
the selection of the designated submenu item is called SetDict here and is defined later. After
this command a comment follows which contains the constant ActDicMSG. The comment is displayed in
the message window of EPM during the selection of the appropriate submenu-item.

The style of the submenu is defined by the second to last value in the "defaultmenu" list, in this case, 0x31; it is the logical OR of these constants:
MIS_TEXT | MIS_SUBDMENU | MIS_MULTMENU = 0x31. The inclusion of the appropriate header file from the [OS/2] programming toolkit (pmwin.h)
allows the use of symbolic constants such as MIS_TEXT.

The last value in the list, 0 (zero), represents the attribute which is set during the menu-initialization.

With the inclusion of the appropriate header-files from the programming toolkit (PMWIN.H), it is also possible to use the symbolic constants.

After adding the Help menu:

call readd_help_menu()

the whole menu is displayed:

showmenu defaultmenu

If more dictionaries (three in this example) are required, the array variables and submenus have to be
expanded accordingly.

Menu Actions

The next part is defining of the routine to execute when the submenu item is selected:

With the selection of the new submenu item EPM executes the following routine which ensures here that the
selected language is marked with a CHECK label. The attribute MIA_CHECKED
= 0x2000 is set with the internal routine SetMenuAttribute (defined in STDCTRL.E) in such way that in each case a selection is marked. A prerequisite for this is that the
menu style already set with the definition repeated here: