The Palette

redet provides one more tool to help the user construct regular expressions. Clicking the Palette button in the menu bar causes a palette of regular expression components to be displayed in a popup window. (This menu botton toggles display of the palette - clicking it again removes the palette.) The palette consists of two parts. On the right are listed regular expression components. On the left are brief descriptions of their use.

The illustrations of notation consist of a mixture of fixed and variable parts. The variable parts represent material that the user must fill in. For example, in the expression (a|b), the parentheses and pipe symbol are fixed; the user must substitute his or her own expressions for a and b. Variable portions of illustrations of notation are distinguished from fixed portions by their color.

Pressing the left mouse button on either side of the palette while the pointer is over an entry selects it. Pressing the right mouse button while the pointer is on the left side pops up additional information about the selected entry. Pressing the right mouse button on the right side copies the selected entry and inserts it into the substitution window, if it has the focus, or the regular expression window, otherwise. Double-clicking with the left mouse button on the righthand side of the palette undoes the most recent entry in the target window (that is, the substitution window or regular expression window). There is no limit to the number of levels of erasure, but the undo facility works only for entries made by copying from the palette, not for material entered by other means.

A separate palette is constructed for each program, so that the palette always reflects the devices and notation used by the chosen program. Whether a particular component is included in the palette is determined by testing the chosen program to see if it supports that feature. You can therefore be confident that if a feature is included in the palette it is available and will work. On the other hand, the absence of a component in the palette does not guarantee that the corresponding feature is not available in the program. Although the test suite is fairly comprehensive, it is possible that there are features that are not accounted for, or that differ from the similar features in other programs in such a way that the test fails for the program in question. (Some tests depend on more than one feature, so an unanticipated combination of features can cause a test to fail for a reason other than the absence of the feature in question.)

The test suite is run when the program starts up, whenever a new program is selected, and whenever a new locale is selected. In most cases the tests are executed very rapidly, but in a few cases, in particular, when the selected program is a shell, execution of the tests is rather slow and there may be a noticeable delay. When the test suite is run, a placard appears explaining the delay. It also shows the time elapsed and estimated time remaining.

The placard that appears when feature tests are run

Under most circumstances you can just leave the test suite to do its work. However, now and then something will go wrong, or you will discover that the version of the program executed is outdated. You can cause the tests to be re-executed by using the Test Features command on the Feature Testing submenu of the Configure menu. The command Enable Feature Test Debugging on the same menu causes Redet to write out a log of the feature tests, in each case showing the regular expression executed, the data, the actual result, and the intended result. This is also useful or debugging if you add or modify feature tests yourself. The -t command line option has the same effect as pressing Enable Feature Test Debugging.

The Feature Testing submenu

It is also possible to record the results of the tests by using the Write Feature List to File command on the Feature Testing submenu. You may set the internal feature list by re-reading such a file using the command Read Feature List. The command line option -F allows you to read feature lists from the command line. Feature lists may also be read from the init file by means of the command ReadFeatureList. Note that each feature list file contains the parameters for a particular program in a particular locale. It is therefore permissible to read multiple feature list files using either the Read Feature List command or the command line option.

Reading features from a file instead of determining them empirically has the disadvantage that changes in the program or errors in the file may result in incorrect feature settings and palette entries. It is therefore recommended that in general this option not be used. One situation in which you may want to use it is with programs that take a long time to complete the test suite. So long as the program does not change and Redet does not change its feature tests, you can speed things up by running the test just once, saving the features to a file, and thereafter reading them from the file on startup. In this case you will want to suppress execution of the test suite using the -n command line option.

The user may create additional palette entries by specifying them in his or her .redetrc file. It is up to the user to see to it that these entries are correct. User-defined palette entries appear after those created by Redet, separated from them by a dashed line. To create a palette entry, use the command AddUserPaletteEntry with the program as first argument, the name of the entry as second argument, the regular expression as third argument and the explanatory text to be popped up as fourth argument. For example:

AddUserPaletteEntry egrep Vowels \[AaEeIiOoUu\] "The English vowel letters."

creates an entry glossed Vowels for the program egrep whose content is the set of English letters upper- and lower-case. Right-clicking on the gloss will bring up a popup containing the text The English vowel letters.

The Palette Displayed


Back to Table of Contents