Path: utzoo!mnetor!uunet!cbmvax!carolyn From: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Newsgroups: comp.sys.amiga Subject: Re: DEADKEYS Message-ID: <3048@cbmvax.UUCP> Date: 29 Dec 87 16:16:29 GMT References: <4863@well.UUCP> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Organization: Commodore Technology, West Chester, PA Lines: 273 Keywords: deakeys, DeadKeyConvert(), CATS In article <4863@well.UUCP> ans@well.UUCP (Anne Schweizer) writes: > >******* POSTING THIS FOR A FRIEND OF MINE *********************************** >[lots of ranting and raving] > >Why can't C-A mail the Amiga Mail's to usenet or BIX ?! We post some AmigaMail articles and programs to usenet and BIX. Of course, THEN we get complaints from developers that AmigaMail is "redundant" and contains "no new information". Can't win, I guess. I do feel that more AmigaMail articles should be posted, but perhaps after the issue is delivered. >How can I get them ?! If I want to have them, how long will I have to >wait ?!. AmigaMail subscription (1 year = 6 issues) is $20 US within US, $25 US outside of US. Make check out to Commodore Business Machines. Mail to: CATS - AmigaMail Lauren Brown CBM 1200 Wilson Drive West Chester, PA 19380 USA As for back issues, we plan to put together all issues through Dec 87 into a spiral bound book and sell it as a support item. We'll let everyone know when that's available. >How do I use DeadKeyConvert() ? How can the user take advantage of >Deadkeys ? > >THIS IS HELP CALL TO CATS PEOPLE.. DeadKeyConvert() has already been posted. For more info, here's the International Keyboard Input article that appeared in AmigaMail. --------------------------------------------------------------------------- INTERNATIONAL KEYBOARD INPUT ============================ Eric Cotton and Carolyn Scheppner The Amiga computers are sold internationally with a variety of local keyboards which match the standards of particular countries. The 1.2 Enhancer manual contains diagrams of the keyboards which are currently distributed. If you examine the diagrams, you will notice that some letters and special symbols are in different physical positions on various keyboards. For instance, on the German and Italian keyboards, the "Y" and "Z" keys are swapped when compared to the USA keyboard. Since the physical position of a key determines the raw key code that it generates, straight RAWKEY input is not internationally compatible. The 1.2 Amiga console device supports national keyboards by providing mapping of raw key codes to the proper acscii characters and strings as specified in a Keymap. In addition, the console device provides handling of the "deadkeys" used to generate accented characters. Any keyboard input which is processed by the console device will be automatically translated to the installed keymap. The new 1.2 Setmap command is used to install the default keymap to be used by the console device. If you wish to experiment with the national keymaps, the KeyToy program on Extras 1.2 provides a graphic simulation of the current various keyboards. All of the national Keymaps, including USA, contain "deadkeys". A deadkey is generally an ALT/letter combination which specifies that a particular accent mark is to be placed on the next character typed. The ASCII values for these characters are all greater than 127 and they can be seen in the International Character Codes table in the AmigaDOS manual. If a deadkey is used to request an invalid accent for a character, the normal unaccented character results. If you look at the "usa" keyboard diagram in the Enhancer manual, you'll see that the F, G, H, J, and K keys (shadowed) are defined as deadkeys. In the diagram, various accent marks are printed in the lower half of each of these keys. Pressing ALT and one of these shadowed keys is a request for the illustrated accent to be placed on the next character you type. For example, with the default usa keymap (try from CLI): ALT/F (') then A results in an A accented with ' ALT/H (^) then E results in an E accented with ^ ALT/J (~) then C results in a plain C (invalid accent for C) Under 1.2, the console.device, IDCMP VANILLAKEY, and AmigaDOS CON: and RAW: all provide automatic handling of deadkeys and translation of raw keycodes to ASCII based on the current keymap. If your software requires non-VANILLA keys such as the cursor and function keys, using console device keyboard input in your Intuition window will allow you to receive the escape sequences generated by these keys. If you are using IDCMP RAWKEY input in international software, you must properly use the console devices's RawKeyConvert() function to get keymap translation and deadkey handling. See the example DeadKeyConvert() in the 1.2 Enhancer manual (P. 65) or the 1.2 Readmes. Use NULL for the kmap argument to get translation to the currently installed Keymap. Be sure to test your code with ASCII characters > 127 (such as accented characters like ALT/F A) wherever your code accepts keyboard input to insure that your logic and data structures work properly with high ASCII values. In addition, test your code after using SetMap to install various keymaps, using the Enhancer manual keyboard diagrams as a guide for what the keycaps would show in that country. You won't be able to test all of the keys of some national keyboards, but you can test enough keys to be sure you are getting translation. The following information is a supplement to the Console Device chapter of the Rom Kernel Manual, describing the Keymap format and console.device handling of deadkeys. The page, section, and figure numbers in this supplement are correct for the Addison-Wesley ROM Kernel Manual: Libraries and Devices. Dead-Class Keys The term "dead-class key" refers to keys that either modify or can themselves be modified by other dead-class keys. There are two types of dead-class keys: dead and deadable. A dead key is one which can modify the key pressed im- mediately following. For example, on the German keyboard there is a dead key marked '` that when followed by (for instance) the 'A' key will produce the character 'a' (International Character Code $E0). A deadable key is one that can be prefixed by a dead key. The 'A' key in the previous example is a deadable key. Thus, a dead key can only affect the output of a deadable key. For any key that is to have a dead-class function, whether dead or deadable, the qualifier KCF_DEAD flag must be included in the entry for the key in the KeyMapTypes table. The KCF_DEAD type may also be used in conjunction with the other qualifiers. Furthermore, the key's KeyMap table entry must contain the longword address of the key's dead-key descriptor data area in place of the usual 4 ASCII character mapping. Below is an excerpt from the AMIGA 1000 German key map. It will be referenced in the following discussion. Example 4-2: Dead-Class Keys new LoKeyMapTypes: DC.B KCF_DEAD+KCF_SHIFT+KCF_ALT+KCF_CONTROL ;aA (Key 20) ... ;(more...) DC.B KCF_DEAD+KCF_SHIFT+KCF_ALT+KCF_CONTROL ;hH (Key 25) ... ;(more...) new LoKeyMap: DC.L key20 ; a, A, ae, AE ... ;(more...) DC.L key25 ;h, H, dead ^ ... ;(more...) ;------ possible dead keys key25: DC.B 0,'h',0,'H' ;h, H DC.B DPF_DEAD,3,DPF_DEAD,3 ;dead ^ DC.B 0,$08,0,$08,0,$88,0,$88 ;control translation ... ;(more...) ;------ deadable keys (modified by dead keys) key20: DC.B DPF_MOD,key20u-key20 ;deadable flag, number of ;bytes from start of key20 ;descriptor to start of un- ;shifted data DC.B DPF_MOD,key20s-key20 ;deadable flag, number of ;bytes from start of key20 ;descriptor to start of shift- ;ed data DC.B 0,$E6,0,$C6 ;null flags followed by rest DC.B 0,$01,0,$01,0,$81,0,$81 ;of values (ALT, CTRL...) key20u: DC.B 'a',$E0,$E1,$E2,$E3,$E4 ;'a' alone and characters to ;output when key alone is ;prefixed by a dead key key20s: DC.B 'A',$C0,$C1,$C2,$C3,$C4 ;SHIFTed 'a' and characters to ;output when SHIFTed key is ;prefixed by a dead key In the example, key 25 (the 'H' key) is a dead key and key 20 (the 'A' key) is a deadable key. Both keys use the addresses of their descriptor data areas as entries in the LoKeyMap table. The LoKeyMapTypes table says that there are four qualifiers for both: the requisite KCF_DEAD, as well as KCF_SHIFT, KCF_ALT, and KCF_CONTROL. The number of qualifiers determine length and arrangement of the descriptor data areas for each key. Table 4-8 below shows how to interpret the KeyMapTypes for various combinations of the qualifier bits. For each possible position a pair of bytes is needed. The first byte in each pair tells how to interpret the second byte (more about this below). Table 4-8: Dead Key Qualifier Bits If type is: Then the pair of bytes in this position in the dead-class key descriptor data is output when the key is pressed along with: NOQUAL alone - - - - - - - A alone A - - - - - - C alone C - - - - - - S alone S - - - - - - A+C alone A C A+C - - - - A+S alone S A A+S - - - - C+S alone S C C+S - - - - S+A+C (VANILLA) alone S A S+A C C+S C+A C+S+A NOTE: the abbreviations A, C, S stand for ALT, control, and SHIFT, respectively. Also note that the ordering is reversed from that in the normal KeyMap table. Because keys 20 and 25 each use three qualifier bits (not including KCF_DEAD), according to the table there must be 8 pairs of data, arranged as shown. Had only KCF_ALT been set, for instance, (not including KCF_DEAD), just two pairs would have been needed. As mentioned earlier, the first byte of data pair in the a descriptor data area specifies how to interpret the second byte. There are three possible values: 0, DPF_DEAD and DPF_MOD. In Example 4-2 DPF_DEAD appears in the data for key 25, while DPF_MOD is used for key 20. It is the use of these flags which determines whether a dead-class key has dead or deadable function. A value of zero causes the unrestricted output of the following byte. If the flag byte is DPF_DEAD, then that particular key combination (determined by the placement of the pair of bytes in the data table) is dead and will mod- ify the output of the next key pressed (if deadable). How it modifies is controlled by the second byte of the pair which is used as an index into into part(s) of the data area for ALL the deadable (DPF_MOD set) keys. Before going further, an understanding of the structure of a descriptor data area wherein DPF_MOD is set for one (or more) of its members is necessary. Referring to the example, we see that DPF_MOD is set for the first and second pairs of bytes. According to its LoKeyMapTypes entry, and using Table 4-8 as a guide, these pairs represent the alone and SHIFTed values for the key. When DPF_MOD is set, the byte immediately following the flag must be the offset from the start of the key's descriptor data area to the start of a table of bytes describing the characters to output when this key combination is preced- ed by any dead keys. This is where the index mentioned above comes in. The value of the index from a prefixing dead key is used to determine which of the bytes from the deadable keys special table to output. The byte in the index+1 position is sent out. (The very first byte is the value to output if the key was not prefixed by a dead key.) Thus, if ALT'ed H is pressed (dead) and then SHIFTed A, an 'A' will be output. This is because: o The byte pair for the ALT position of the H key (key 25) is DPF_DEAD,3 so the index is 3. o The byte pair for the SHIFT position of the A key (key 20) is DPF_MOD,key20s-key20, so we refer to the table-of-bytes at key20s. o The third+1 byte of the table-of-bytes is $C2, a 'A' character. Note that the number of bytes in the table-of-bytes for all deadable keys must be equal to the highest index value of all dead keys plus 1. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CATS >>Commodore Amiga Technical Support<< UUCP ...{allegra,ihnp4,rutgers}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=