DIRECTORY Ascii, KeyChars, KeyCharsBackdoor, KeySymsKB, KeyTypes, IntToIntTab; KeyCharsImpl: CEDAR PROGRAM IMPORTS IntToIntTab EXPORTS KeyChars, KeyCharsBackdoor = BEGIN OPEN KeyChars, KeyCharsBackdoor; ks2c: IntToIntTab.Table ~ IntToIntTab.Create[100]; c2ks: REF ARRAY CHAR OF KeySym ~ NEW[ARRAY CHAR OF KeySym ฌ ALL[[0]]]; AdditionalChar: PUBLIC PROC [keySym: KeyTypes.KeySym, char: CHAR] = { IF c2ks[char]=0 THEN c2ks[char] ฌ keySym; [] ฌ IntToIntTab.Insert[ks2c, LOOPHOLE[keySym], ORD[char]]; }; CharFromKeySym: PUBLIC PROC [keySym: KeySym] RETURNS [char: CHAR ฌ 0c] = { IF keySym.val>=32 AND keySym.val<=127 THEN char ฌ VAL[keySym.val] ELSE { val: INT; found: BOOL; [found, val] ฌ IntToIntTab.Fetch[ks2c, keySym]; IF found AND val>=0 AND val<256 THEN char ฌ VAL[val]; }; }; KeySymFromChar: PUBLIC PROC [char: CHAR] RETURNS [keySym: KeySym] = { keySym ฌ c2ks[char]; }; Init: PROC [] = { FOR i: BYTE IN [32..127] DO c2ks[VAL[i]] ฌ [i] ENDLOOP; AdditionalChar[KeySymsKB.BS, Ascii.BS]; AdditionalChar[KeySymsKB.TAB, Ascii.TAB]; AdditionalChar[KeySymsKB.LF, Ascii.LF]; AdditionalChar[KeySymsKB.CR, Ascii.CR]; AdditionalChar[KeySymsKB.ESC, Ascii.ESC]; AdditionalChar[KeySymsKB.LeftArrow, 'ฌ]; AdditionalChar[KeySymsKB.UpArrow, 'ญ]; AdditionalChar[KeySymsKB.DownArrow, 'ฏ]; AdditionalChar[KeySymsKB.RightArrow, 'ฎ]; }; Init[]; END. ช KeyCharsImpl.mesa Copyright ำ 1992 by Xerox Corporation. All rights reserved. Christian Jacobi, March 23, 1992 3:10 pm PST Willie-s, March 19, 1992 1:05 pm PST สL–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ ฯeœ0™4