KeyNamesImpl.mesa
Copyright Ó 1988, 1990, 1991, 1992 by Xerox Corporation. All rights reserved.
Bier, May 3, 1990 9:42 am PDT
JKF, May 30, 1990 9:05:24 am PDT
Willie-s, October 11, 1991 2:34 pm PDT
Doug Wyatt, December 19, 1991 12:32 pm PST
Christian Jacobi, February 26, 1992 6:22 pm PST
Kenneth A. Pier, August 12, 1992 5:55 pm PDT
DIRECTORY CardTab, ConvertUnsafe, KeySyms1, KeySymsKB, KeyNamesBackdoor, KeySymsPublish, KeySymsCedar, KeySymsPhysicalSuns, KeySymsHP, KeySymsOSF, KeySymsPrincOpsConvention, KeySymsSun, KeySymsTrackball, KeyTypes, KeyNames, Rope, SpecialKeySyms, SymTab;
KeyNamesImpl:
CEDAR
PROGRAM
IMPORTS CardTab, ConvertUnsafe, SymTab
EXPORTS KeyNames, KeyNamesBackdoor =
BEGIN
KeySym: TYPE = KeyTypes.KeySym;
NameFromKeySym:
PUBLIC
PROC [keySym: KeySym]
RETURNS [name: Rope.
ROPE ←
NIL] = {
val: CardTab.Val; found: BOOL ¬ FALSE;
[found, val] ¬ CardTab.Fetch[keyNames, keySym];
IF found THEN name ¬ NARROW[val];
};
KeySymFromName:
PUBLIC
PROC [name: Rope.
ROPE]
RETURNS [KeySym] = {
WITH SymTab.Fetch[keySymFromName, name].val
SELECT
FROM
k: REF KeySym => RETURN [k];
ENDCASE => RETURN [SpecialKeySyms.NoSym];
};
Define:
PUBLIC PROC [keySym: KeySym, s:
LONG
STRING] = {
name: Rope.ROPE = ConvertUnsafe.ToRope[s];
[] ¬ CardTab.Insert[keyNames, keySym, name];
[] ¬ SymTab.Insert[x: keySymFromName, key: name, val: NEW[KeySym ¬ keySym]];
};
AdditionalName:
PUBLIC PROC [keySym: KeySym, s:
LONG
STRING] = {
name: Rope.ROPE = ConvertUnsafe.ToRope[s];
[] ¬ SymTab.Insert[x: keySymFromName, key: name, val: NEW[KeySym ¬ keySym]];
};
keyNames: CardTab.Ref;
keySymFromName: SymTab.Ref;
DefineSpecialKeySyms:
PROC = {
Define[SpecialKeySyms.NoSym, "NoSym"];
Define[SpecialKeySyms.Button1, "Button1"];
AdditionalName[SpecialKeySyms.Button1, "PointerButton1"];
Define[SpecialKeySyms.Button2, "Button2"];
AdditionalName[SpecialKeySyms.Button1, "PointerButton2"];
Define[SpecialKeySyms.Button3, "Button3"];
AdditionalName[SpecialKeySyms.Button1, "PointerButton3"];
Define[SpecialKeySyms.Button3, "Button4"];
AdditionalName[SpecialKeySyms.Button1, "PointerButton4"];
Define[SpecialKeySyms.Button3, "Button5"];
AdditionalName[SpecialKeySyms.Button1, "PointerButton5"];
};
DefineKeySyms1:
PROC = {
--Latin-1 KEYSYM Set
OPEN KeySyms1;
Define[Space, "Space"];
Define[ExclamationPoint, "ExclamationPoint"];
Define[QuotationMark, "Quote"];
AdditionalName[QuotationMark, "QuotationMark"];
Define[NumberSign, "NumberSign"];
Define[DollarSign, "DollarSign"];
Define[PercentSign, "PercentSign"];
Define[Ampersand, "Ampersand"];
Define[Apostrophe, "Apostrophe"];
Define[LeftParen, "LeftParen"];
AdditionalName[LeftParen, "LeftParenthesis"];
Define[RightParen, "RightParen"];
AdditionalName[RightParen, "RightParenthesis"];
Define[Asterisk, "Asterisk"];
Define[PlusSign, "PlusSign"];
Define[Comma, "Comma"];
Define[Hyphen, "Hyphen"];
Define[Period, "Period"];
AdditionalName[Period, "FullStop"];
Define[Slash, "Slash"];
AdditionalName[Slash, "Solidus"];
Define[Zero, "Zero"];
Define[One, "One"];
Define[Two, "Two"];
Define[Three, "Three"];
Define[Four, "Four"];
Define[Five, "Five"];
Define[Six, "Six"];
Define[Seven, "Seven"];
Define[Eight, "Eight"];
Define[Nine, "Nine"];
Define[Colon, "Colon"];
Define[SemiColon, "SemiColon"];
Define[LessThanSign, "LessThanSign"];
AdditionalName[LessThanSign, "LeftAngleBracket"];
Define[Equal, "Equal"];
AdditionalName[Equal, "EqualSign"];
Define[GreaterThanSign, "GreaterThanSign"];
AdditionalName[GreaterThanSign, "RightAngleBracket"];
Define[QuestionMark, "QuestionMark"];
Define[AtSign, "AtSign"];
Define[A, "A"];
Define[B, "B"];
Define[C, "C"];
Define[D, "D"];
Define[E, "E"];
Define[F, "F"];
Define[G, "G"G];
Define[H, "H"];
Define[I, "I"];
Define[J, "J"];
Define[K, "K"];
Define[L, "L"];
Define[M, "M"];
Define[N, "N"];
Define[O, "O"];
Define[P, "P"];
Define[Q, "Q"];
Define[R, "R"];
Define[S, "S"];
Define[T, "T"];
Define[U, "U"];
Define[V, "V"];
Define[W, "W"];
Define[X, "X"];
Define[Y, "Y"];
Define[Z, "Z"];
Define[LeftBracket, "LeftBracket"];
Define[BackSlash, "BackSlash"];
AdditionalName[BackSlash, "ReverseSolidus"];
Define[RightBracket, "RightBracket"];
Define[CircumflexAccent, "CircumflexAccent"];
Define[LowLine, "LowLine"];
Define[GraveAccent, "GraveAccent"];
Define[a, "a"];
Define[b, "b"];
Define[c, "c"];
Define[d, "d"];
Define[e, "e"];
Define[f, "f"];
Define[g, "g"];
Define[h, "h"];
Define[i, "i"];
Define[j, "j"];
Define[k, "k"];
Define[l, "l"];
Define[m, "m"];
Define[n, "n"];
Define[o, "o"];
Define[p, "p"];
Define[q, "q"];
Define[r, "r"];
Define[s, "s"];
Define[t, "t"];
Define[u, "u"];
Define[v, "v"];
Define[w, "w"];
Define[x, "x"];
Define[y, "y"];
Define[z, "z"];
Define[LeftCurly, "LeftCurly"];
AdditionalName[LeftCurly, "LeftCurlyBracket"];
Define[VerticalLine, "VerticalLine"];
AdditionalName[VerticalLine, "VerticalBar"];
Define[RightCurly, "RightCurly"];
AdditionalName[RightCurly, "RightCurlyBracket"];
Define[Tilde, "Tilde"];
Define[CircumflexAccent, "Circumflex"];
};
DefineKeySymsKB:
PROC = {
--KEYBOARD KEYSYM Set
OPEN KeySymsKB;
Define[
BS, "BackSpace"];
AdditionalName[BS, "BS"];
Define[
TAB, "Tab"];
AdditionalName[TAB, "TAB"];
Define[
LF, "LineFeed"];
AdditionalName[LF, "LF"];
Define[Clear, "Clear"];
Define[Return, "Return"];
AdditionalName[Return, "CR"];
AdditionalName[Return, "Enter"];
Define[Pause, "Pause"];
AdditionalName[Pause, "Hold"];
AdditionalName[Pause, "ScrollLock"];
Define[
ESC, "Esc"];
AdditionalName[ESC, "ESCAPE"];
AdditionalName[ESC, "ESC"];
Define[Home, "Home"];
Define[LeftArrow, "LeftArrow"];
AdditionalName[LeftArrow, "Arrow"];
AdditionalName[LeftArrow, "Left"];
AdditionalName[LeftArrow, "MoveLeft"];
Define[UpArrow, "UpArrow"];
AdditionalName[UpArrow, "Up"];
AdditionalName[UpArrow, "MoveUp"];
Define[RightArrow, "RightArrow"];
AdditionalName[RightArrow, "Right"];
AdditionalName[RightArrow, "MoveRight"];
Define[DownArrow, "DownArrow"];
AdditionalName[DownArrow, "Down"];
AdditionalName[DownArrow, "MoveDown"];
Define[Prior, "Prior"];
AdditionalName[Prior, "PRIOR"];
Define[Next, "Next"];
AdditionalName[KeySymsKB.Next, "NEXT"];
Define[End, "End"];
AdditionalName[KeySymsKB.End, "END"];
AdditionalName[KeySymsKB.End, "EOL"];
Define[Begin, "Begin"];
AdditionalName[KeySymsKB.End, "BEGIN"];
AdditionalName[KeySymsKB.End, "BOL"];
Define[Print, "Print"];
Define[Execute, "Execute"];
AdditionalName[Execute, "Run"];
AdditionalName[Execute, "Do"];
Define[Insert, "Insert"];
Define[Undo, "Undo"];
AdditionalName[Undo, "UNDO"];
AdditionalName[Undo, "Oops"];
Define[Again, "Again"];
AdditionalName[Again, "AGAIN"];
AdditionalName[Again, "REDO"];
Define[Menu, "Menu"];
AdditionalName[Menu, "MENU"];
Define[Find, "Find"];
AdditionalName[Find, "FIND"];
AdditionalName[Find, "Search"];
Define[Stop, "Stop"];
AdditionalName[Stop, "Cancel"];
AdditionalName[Stop, "Abort"];
AdditionalName[Stop, "Exit"];
Define[Help, "Help"];
AdditionalName[Help, "HELP"];
Define[Break, "Break"];
AdditionalName[Break, "BREAK"];
Define[KeySymsKB.ModeSwitch, "ModeSwitch"];
AdditionalName[KeySymsKB.ModeSwitch, "ScriptSwitch"];
AdditionalName[KeySymsKB.ModeSwitch, "CharacterSetSwitch"];
Define[KeySymsKB.NumLock, "NumLock"];
Define[KeySymsKB.KeypadSpace, "KeypadSpace"];
Define[KeySymsKB.KeypadTAB, "KeypadTab"];
Define[KeySymsKB.KeypadEnter, "KeypadEnter"];
Define[KeySymsKB.KeypadF1, "KeypadF1"];
Define[KeySymsKB.KeypadF2, "KeypadF2"];
Define[KeySymsKB.KeypadF3, "KeypadF3"];
Define[KeySymsKB.KeypadF4, "KeypadF4"];
Define[KeySymsKB.KeypadMultiplication, "KeypadMultiplication"];
AdditionalName[KeySymsKB.KeypadMultiplication, "KeypadMultiplicationSign"];
AdditionalName[KeySymsKB.KeypadMultiplication, "KeypadAsterisk"];
Define[KeySymsKB.KeypadPlus, "KeypadPlus"];
Define[KeySymsKB.KeypadPlus, "KeypadPlusSign"];
Define[KeySymsKB.KeypadComma, "KeypadComma"];
AdditionalName[KeySymsKB.KeypadComma, "KeypadSeparator"];
Define[KeySymsKB.KeypadMinus, "KeypadMinus"];
AdditionalName[KeySymsKB.KeypadMinus, "KeypadMinusSign"];
AdditionalName[KeySymsKB.KeypadMinus, "KeypadHyphen"];
Define[KeySymsKB.KeypadDecimalPoint, "KeypadDecimalPoint"];
AdditionalName[KeySymsKB.KeypadDecimalPoint, "KeypadFullStop"];
Define[KeySymsKB.KeypadDivision, "KeypadDivision"];
AdditionalName[KeySymsKB.KeypadDivision, "KeypadDivisionSign"];
AdditionalName[KeySymsKB.KeypadDivision, "KeypadSolidus"];
Define[KeySymsKB.KeypadZero, "KeypadZero"];
Define[KeySymsKB.KeypadOne, "KeypadOne"];
Define[KeySymsKB.KeypadTwo, "KeypadTwo"];
Define[KeySymsKB.KeypadThree, "KeypadThree"];
Define[KeySymsKB.KeypadFour, "KeypadFour"];
Define[KeySymsKB.KeypadFive, "KeypadFive"];
Define[KeySymsKB.KeypadSix, "KeypadSix"];
Define[KeySymsKB.KeypadSeven, "KeypadSeven"];
Define[KeySymsKB.KeypadEight, "KeypadEight"];
Define[KeySymsKB.KeypadNine, "KeypadNine"];
Define[KeySymsKB.KeypadEqual, "KeypadEqual"];
Define[F1, "F1"];
Define[F2, "F2"];
Define[F3, "F3"];
Define[F4, "F4"];
Define[F5, "F5"];
Define[F6, "F6"];
Define[F7, "F7"];
Define[F8, "F8"];
Define[F9, "F9"];
Define[F10, "F10"];
Define[
L1, "L1"];
AdditionalName[L1, "F11"];
Define[
L2, "L2"];
AdditionalName[L2, "F12"];
Define[
L3, "L3"];
AdditionalName[L3, "F13"];
Define[
L4, "L4"];
AdditionalName[L4, "F14"];
Define[
L5, "L5"];
AdditionalName[L5, "F15"];
Define[
L6, "L6"];
AdditionalName[L6, "F16"];
Define[
L7, "L7"];
AdditionalName[L7, "F17"];
Define[
L8, "L8"];
AdditionalName[L8, "F18"];
Define[
L9, "L9"];
AdditionalName[L9, "F19"];
Define[
L10, "L10"];
AdditionalName[L10, "F20"];
Define[
R1, "R1"];
AdditionalName[R1, "F21"];
Define[
R2, "R2"];
AdditionalName[R2, "F22"];
Define[
R3, "R3"];
AdditionalName[R3, "F23"];
Define[
R4, "R4"];
AdditionalName[R4, "F24"];
Define[
R5, "R5"];
AdditionalName[R5, "F25"];
Define[
R6, "R6"];
AdditionalName[R6, "F26"];
Define[
R7, "R7"];
AdditionalName[R7, "F27"];
Define[
R8, "R8"];
AdditionalName[R8, "F28"];
Define[
R9, "R9"];
AdditionalName[R9, "F29"];
Define[
R10, "R10"];
AdditionalName[R10, "F30"];
Define[
R11, "R11"];
AdditionalName[R11, "F31"];
Define[
R12, "R12"];
AdditionalName[R12, "F32"];
Define[
R13, "R13"];
AdditionalName[R13, "F33"];
Define[
R14, "R14"];
AdditionalName[R14, "F34"];
Define[
R15, "R15"];
AdditionalName[R15, "F35"];
Define[LeftShift, "LeftShift"];
Define[RightShift, "RightShift"];
Define[LeftControl, "LeftControl"];
AdditionalName[LeftControl, "CONTROL"];
AdditionalName[LeftControl, "Control"];
AdditionalName[LeftControl, "Ctrl"];
Define[RightControl, "RightControl"];
Define[CapsLock, "CapsLock"];
AdditionalName[CapsLock, "LOCK"];
AdditionalName[CapsLock, "Lock"];
Define[LeftMeta, "LeftMeta"];
Define[RightMeta, "RightMeta"];
Define[KeySymsKB.LeftAlt, "LeftAlt"];
Define[KeySymsKB.RightAlt, "RightAlt"];
Define[KeySymsKB.LeftSuper, "LeftSuper"];
Define[KeySymsKB.RightSuper, "RightSuper"];
Define[KeySymsKB.LeftHyper, "LeftHyper"];
Define[KeySymsKB.RightHyper, "RightHyper"];
Define[Delete, "Delete"];
AdditionalName[Delete, "DELETE"];
AdditionalName[Delete, "DEL"];
AdditionalName[Delete, "RUBOUT"];
};
DefineKeySymsPublish:
PROC = {
--I don't understand why this particular subset had been chosen.
Define[KeySymsPublish.EmDash, "EmDash"];
AdditionalName[KeySymsPublish.EmDash, "Dash"];
Define[KeySymsPublish.EnDash, "EnDash"];
};
DefineKeySymsSun:
PROC = {
--Defined by Sun.
It is only indirect that these keys have nice keys on sun keyboards. As much as KeyNames.mesa is considered the registration counts; the keyboard does not.
--I have sofar only used the subset whicjh looked useful.
Define[KeySymsSun.Props, "Props"];
Define[KeySymsSun.Front, "Front"];
Define[KeySymsSun.Copy, "Copy"];
Define[KeySymsSun.Open, "Open"];
Define[KeySymsSun.Paste, "Paste"];
Define[KeySymsSun.Cut, "Cut"];
};
DefineKeySymsHP:
PROC = {
--subset
Define[KeySymsHP.Cut, "Cut"];
Define[KeySymsHP.Paste, "Paste"];
Define[KeySymsHP.Copy, "Copy"];
Define[KeySymsHP.Move, "Move"];
};
DefineKeySymsOSF:
PROC = {
--subset
Define[KeySymsOSF.Cut, "Cut"];
Define[KeySymsOSF.Paste, "Paste"];
Define[KeySymsOSF.Copy, "Copy"];
};
DefineKeySymsCedar:
PROC = {
--Extras which I believe are used by Cedar.
--
--The actual names for the following keysyms are defined with SpecialKeySyms; however these additional names are not blessed outside the concept of KeySymsCedar.
AdditionalName[SpecialKeySyms.Button1, "LeftMouse"];
AdditionalName[SpecialKeySyms.Button1, "Red"];
AdditionalName[SpecialKeySyms.Button2, "MiddleMouse"];
AdditionalName[SpecialKeySyms.Button2, "Yellow"];
AdditionalName[SpecialKeySyms.Button3, "RightMouse"];
AdditionalName[SpecialKeySyms.Button3, "Blue"];
--
Define[KeySymsCedar.CharCode0LeftArrow, "CharCode0LeftArrow"];
Define[KeySymsCedar.CharCode0UpArrow, "CharCode0UpArrow"];
Define[KeySymsCedar.Look, "Look"];
AdditionalName[KeySymsCedar.Look, "LOOK"];
Define[KeySymsCedar.Swat, "Swat"];
AdditionalName[KeySymsCedar.Swat, "SWAT"];
};
DefineKeySymsPhysicalSun:
PROC = {
--So all the keys on our keyboards can be addressed somehow
--
Define[KeySymsPhysicalSuns.UniqueF11, "UniqueF11"];
AdditionalName[KeySymsPhysicalSuns.UniqueF11, "F11"];
Define[KeySymsPhysicalSuns.UniqueF12, "UniqueF12"];
AdditionalName[KeySymsPhysicalSuns.UniqueF12, "F12"];
Define[KeySymsPhysicalSuns.KeypadIns, "KeypadIns"];
Define[KeySymsPhysicalSuns.KeypadDel, "KeypadDel"];
Define[KeySymsPhysicalSuns.Compose, "Compose"];
};
DefineKeySymsCedarMaybeOld:
PROC = {
--Extras which might still be used by Cedar on Suns but I don't propose to do so
--
--complete
Define[KeySymsPrincOpsConvention.Move, "Move"];
AdditionalName[KeySymsPrincOpsConvention.Move, "MOVE"];
AdditionalName[KeySymsPrincOpsConvention.Move, "FL4"]; --Why?
Define[KeySymsPrincOpsConvention.Expand, "Expand"];
AdditionalName[KeySymsPrincOpsConvention.Expand, "EXPAND"];
AdditionalName[KeySymsPrincOpsConvention.Expand, "DefnExpand"];
Define[KeySymsPrincOpsConvention.Attention, "Attention"];
AdditionalName[KeySymsPrincOpsConvention.Attention, "ATTENTION"];
--
--additionals
AdditionalName[SpecialKeySyms.Button1, "Point"];
AdditionalName[SpecialKeySyms.Button2, "Menu"]; --conflict !!
AdditionalName[SpecialKeySyms.Button3, "Adjust"];
AdditionalName[KeySymsKB.ESC, "COMPLETE"];
AdditionalName[KeySymsKB.ESC, "Center"];
AdditionalName[KeySymsKB.Next, "Spare2"];
AdditionalName[KeySymsKB.Next, "Keyboard"];
AdditionalName[KeySymsKB.Next, "STUFF"];
AdditionalName[KeySymsKB.Execute, "DOIT"]; -- DLion MARGINS (right group)
AdditionalName[KeySymsKB.R9, "Spare1"];
AdditionalName[KeySymsKB.R9, "BW"];
AdditionalName[KeySymsKB.R9, "COMMAND"];
AdditionalName[KeySymsKB.R15, "Spare3"];
AdditionalName[KeySymsKB.R15, "USERABORT"]; -- KeySymsKB.Stop would make more sense
};
DefineKeySymsPrincOpsConvention:
PROC [] = {
--Extras which I believe should not be used on Suns anymore
OPEN KeySymsPrincOpsConvention;
Define[Unused0, "Unused0"];
Define[Unused1, "Unused1"];
Define[Unused2, "Unused2"];
Define[Unused3, "Unused3"];
Define[Unused4, "Unused4"];
Define[Unused5, "Unused5"];
Define[Unused6, "Unused6"];
Define[Keyset1, "Keyset1"];
Define[Keyset2, "Keyset2"];
Define[Keyset3, "Keyset3"];
Define[Keyset4, "Keyset4"];
Define[Keyset5, "Keyset5"];
Define[Bold, "Bold"];
AdditionalName[Bold, "SCROLLBAR"];
Define[Italics, "Italics"];
AdditionalName[Italics, "JFIRST"];
Define[Superscript, "Superscript"];
AdditionalName[Superscript, "RESERVED"];
Define[Subscript, "Subscript"];
AdditionalName[Subscript, "CLIENT1"];
Define[LargerSmaller, "LargerSmaller"];
AdditionalName[LargerSmaller, "CLIENT2"];
Define[Underline, "Underline"];
AdditionalName[Underline, "JSELECT"];
Define[
A10, "A10"];
AdditionalName[A10, "Font"];
Define[A8, "A8"];
Define[A9, "A9"];
Define[A11, "A11"];
Define[A12, "A12"];
Define[D1, "D1"];
Define[D2, "D2"];
Define[T1, "T1"];
Define[T10, "T10"];
Define[Key47, "Key47"];
Define[Pen, "Pen"];
};
DefineKeySymsFrom2p0To10p0:
PROC [] = {
--This stuff might make the release from PCedar2.0 to Cedar10.0 easier.
--It defines the (very illegal) keysyms used with PCedar2.0 which might still lurk in a few peoples keyboard mapping files.
Define[[66200], "Look"];
Define[[66201], "Move"];
Define[[66202], "Copy"];
Define[[66203], "Paste"];
Define[[66213], "Swat"];
};
DefineKeySymsTrackball:
PROC = {
OPEN KeySymsTrackball;
Define[TrackballLeft, "TrackballLeft"];
Define[TrackballMiddle, "TrackballMiddle"];
Define[TrackballRight, "TrackballRight"];
Define[Trackball, "Trackball"];
Define[Thumbwheel, "Thumbwheel"];
};
keyNames ¬ CardTab.Create[256];
keySymFromName ¬ SymTab.Create[256];
Order is important because some keysyms have conflicts and we want the standard version be registered.
DefineSpecialKeySyms[];
DefineKeySyms1[];
DefineKeySymsKB[];
DefineKeySymsPublish[];
DefineKeySymsSun[];
DefineKeySymsHP[];
DefineKeySymsOSF[];
DefineKeySymsCedar[];
DefineKeySymsPhysicalSun[];
DefineKeySymsCedarMaybeOld[];
DefineKeySymsPrincOpsConvention[];
DefineKeySymsFrom2p0To10p0[];
DefineKeySymsTrackball[];
END.