Part 3Ú@-lÿÿÿþˆ€„&ÿþ@-h‚ËÔ¬Àm @tËÔ2TEXT????,1-™`<Þ™`=HnÿüNºH/+N­ª/+,N­MACINTOSH KERMIT (Chapter of Kermit User Guide) (Part 3 of 4) 10.7. CKMKEY - Macintosh Kermit's Keyboard Configurator This describes CKMKEY V0.8(0), May 1985. The version number of CKMKEY indicates compatability with the like version of CKMKER -- Macintosh Kermit, referred to simply as "Kermit" from now on. Edit numbers (within parentheses) may differ. If Kermit is used with a settings file containing a key configuration produced by an incompatible version of CKMKEY, then that configuration will be ignored. 10.7.1. What is CKMKEY? CKMKEY is a keyboard configurator program for use with Macintosh Kermit (versions 0.8 and greater). CKMKEY allows: - Redefinitions of keys - Definitions of multicharacter function keys - Selection of long and short BREAK keys CKMKEY is a separate program from Kermit. It may be thought of as an editor for Kermit's terminal emulator key definition resource, which is kept in a Ker- mit settings file. Before you can use CKMKEY, you must already have used Ker- mit to create a settings file to operate on. The reason CKMKEY is separate from Kermit is that there is not enough room in the memory of a 128K Macintosh to hold a program that can do both. CKMKEY dis- plays and changes key settings, Kermit uses them. Once you have started Kermit with a given set of key definitions, there is no way to examine or change them. Some familiarity with the ASCII alphabet is assumed in the following discus- sion. 10.7.2. Modifier vs Normal Keys The Macintosh keyboard is composed of normal keys and modifier keys. Modifier keys are SHIFT, CAPS LOCK, OPTION, and COMMAND (also known as APPLE, CLOVER, or FAN). Only one normal key can be selected at a time, but one or more modifier keys can be depressed along with it. 10.7.3. Key Maps When a key on the keyboard or numeric keypad is depressed the result is a scan code -- a number between 0 and 127 (see Inside Mac Event Manager for details if you're interested). A table indexed by scan code resulting in the character to be displayed or transmitted will be referred to as a "keymap" or "key mapping." On the standard Mac many keymaps exist -- the modifier keys (such as SHIFT) specify which keymap is selected. For example, when no modifer keys are depressed the keymap contains the lowercase alphabet, numbers and some punctua- tion. The keymap in use when the SHIFT modifer is depressed contains the capi- tal letters and special characters. All in all it is possible to select 16 different keymaps by depressing from zero to four modifier keys. Normally however, 6 or so distinct keymaps will suffice. CKMKEY allows you to redefine 6 keymaps: shifted and unshifted combinations of keymaps named "normal", "capslock", and "control". These keymaps are predefined with the expected values -- the control map is preloaded with con- trol codes, the capslock preloaded with the unmodifed keymap but with all let- ters uppercase. In this document modifier keys are written in capital letters and key map names are written in lowercase. SHIFT, CAPS LOCK, COMMAND, and OPTION are modifier keys, "normal" "capslock" and "control" are key maps internal to CKMKER. Since one of the major functions of CKMKEY is to change maps invoked by modifier keys, it is important to keep this distinction in mind. 10.7.4. What's in CKMKEY's Keymaps A keymap is a list of 128 numbers. Which keymap is selected depends upon which modifier keys are depressed, and the entry within the key map is determined by the scan code. A keymap entry is an 8-bit quantity: if the high order bit is 0, then the entry is the 7-bit ASCII character to be transmitted through the serial port; if the high bit is 1, then the remaining 7 bits are an index into the function-key table. Notice that only single 7-bit values can be directly translated through the CKMKEY keymap. If you want a single key to transmit multiple characters, then you can designate that key to be a "function key", and the key map will contain an indirect reference to the function-key table. If you want a key to transmit an 8-bit value, assign the "meta" operation to one of the modifier keys and use the meta key together with the desired key (see below). Functions are numbered 0-127 with the highest few being reserved for special use. Currently functions 126 and 127 send a short 250 millisecond BREAK signal and a long 3.5 second BREAK respectively. In the future more special functions may be allocated so (since it is arbitrary anyway) please use low numbered functions when defining your own. 10.7.5. Menus CKMKEY has two menus, File and Set. First you must use the File menu to select and open a Macintosh Kermit settings file, which in turn has been created using the Kermit Save Settings option from its own File menu. Then use the Set menu to establish or alter key definitions, then use the File menu again to save the settings file back for Kermit. A variety of Kermit settings files can be kept, each with its own collection of settings and key definitions; Kermit can be started with the desired settings by double clicking on one of these settings files from the Macintosh desktop. Menus consist of options. If an option is followed by an ellipsis (three dots...) then clicking it will produce a dialog box of some kind; otherwise, clicking it causes the indicated action to be performed immediately. If an op- tion is dimmed then it is not available for some reason -- for instance, you can't set any keys until you open a settings file. 10.7.6. MENU: Set The Set menu includes dialogs for setting keys, defining functions, and reas- signing modifier keys. 10.7.6.1. DIALOG: Set Modifer Keys Background: Skip ahead to the next section if you already know about things like SHIFT, CAPS LOCK, CONTROL, and META. On a typewriter the only modifier key is SHIFT. Typing a character with no modifier key depressed selects a lowercase letter or the character printed on the lower face of the keytop (say, the digit "4"). Typing a character with SHIFT depressed selects an uppercase letter or the character printed on the up- per face of the keytop (say, a dollar sign). Some keyboards also have a SHIFT LOCK key, which stays down once pressed and pops up the next time it's pressed; its operation is equivalent to holding down SHIFT. And some keyboards have a CAPS lock key which operates like SHIFT LOCK, but only upon letters. Computer terminals also have a modifier key called CONTROL (or CTRL). Its function is a little less obvious: it is intended to produce one of the 33 characters in the "control range" of the ASCII alphabet. Control characters are not graphic -- they are intended for use as format effectors (like carriage return, formfeed, tab, backspace), for transmission control, or for device con- trol. The remaining 95 characters -- letters, digits, and punctuation -- are the graphic characters. When a character is typed with the CONTROL modifier pressed, its "control equivalent" is transmitted. By convention, the control equivalent of A is Control-A, B is Control-B, etc, and there are also seven special control characters generally associated with punctuation characters or special keys. For the "alphabetic" control characters Control-A through Control-Z, SHIFT or CAPS LOCK modifiers are ignored; for the others, operation varies from terminal to terminal. The SHIFT and CONTROL modifiers allow all 128 ASCII characters to be sent from a normal typewriter-like keyboard that has about 50 keys. However, certain host-resident computer applications -- notably the full screen text editor EMACS and its descendents -- can be used to greater advantage with a 256 character alphabet (EMACS responds to single-character commands, and the more characters a terminal can send, the more commands are directly available). For this purpose, some terminals also provide a META modifier key. This key simply causes the high-order ("8th") bit of the selected ASCII value to be set to 1 upon transmission. META characters can only be transmitted when the communica- tion path allows all 8 bits to pass transparently; when this is not possible, software like EMACS allows a sequence of two 7-bit ASCII characters to represent a single meta character. The advantage of having a real META modifier key is that it can be held down while the actual key is struck repeatedly or even autorepeats, whereas a use of a "meta prefix" requires much more typing. To illustrate, suppose META-F is the command to go forward one word. If you want to execute this operation repeatedly, just hold down META and F and let it autorepeat. If you don't have a META key, then you have to use a "meta prefix" character (usually escape), and to enter META-F repeatedly in this case, you'd have to type FFF...etc. Macintosh Kermit Modifier Keys: You can define the modifier key to keymap correspondence in CKMKEY by selecting the "Modifer Keys..." menu item under SET, or by double clicking on a modifier key while in the SET KEYS dialog. The SET MODIFIERS dialog lets you define what map OPTION, CAPS LOCK and COMMAND refer to. Notice that SHIFT is missing -- SHIFT always references the shifted equivalents to the normal, control and caps lock maps. The dialog is layed out in columns with the three modifier keys as column head- ings and the three map names below. Also under each column is a "pseudo" key map for "meta." Meta is not a map, but an operation: it augments the value being transmitted after it has been read from its map. Meta can either be set to send a prefix string before the character or to turn the high order (8th) bit on in the transmitted character. The default prefix for meta is set to be 033 (escape). If a meta modifier key is depressed and the key results in a function reference then no modification occurs; functions are not "metized". However, functions can be defined to include 8-bit values. Notice that meta can be set in conjunction with a key map. Since meta is an operation as described above there is no ambiguity. Consider for example set- ting OPTION to reference the "control" map and selecting "meta" for this modifier key as well. The result is a control-meta key. CAUTION: If you have used Kermit's communications settings menu to select any parity other than "none", then any high order bits that may be set by CKMKER's key mapping will be superseded when Kermit applies the selected parity to outbound characters. The SET MODIFIER KEYS dialog also lets you select your meta preferences: whether you want to use the 8th bit toggled on, or a prefix string. The prefix string is entered in the same manner as a function definition (backslash fol- lowed by 3 octal digits for non-printable characters, see below). Note that it is possible to cause ambiguities when selecting and using modifier keys. For example say you set OPTION to refer to the control map, and you set CAPS LOCK to refer to the caps map; at this point if you hold both OPTION and CAPS LOCK down it is unclear which map you want your character to come from. To try to prevent this type of ambiguity the SET KEY dialog will beep when you are holding down or mousing an ambigous set of modifier keys. The Kermit code itself references maps in this precendence: if a control map modifier is depressed then use control map, else if a capslock modifier is depressed use capslock, otherwise use the normal map. A sample modifier key configuration is shown in Figure 10-1: ------------------------------------------------------------------------- OPTION COMMAND CAPS LOCK o Normal * Normal o Normal * Control o Control * Control o Caps o Caps o Caps [X] Meta [X] Meta [ ] Meta Figure 10-1: Macintosh Kermit Modifier Key Dialog ------------------------------------------------------------------------- Here the CAPS LOCK key is used to reference "control", the COMMAND key to do the "meta" operation, and OPTION is "control-meta". Holding down COMMAND and CAPS LOCK together will also result in control-meta. "meta" operation, and OPTION is "control-meta". Holding down COMMAND and CAPS LOC