DIRECTORY Devices, DeviceClassTypes, DeviceTypes, RefTab; DevicesImpl: CEDAR PROGRAM IMPORTS RefTab EXPORTS Devices, DeviceTypes = BEGIN Device: TYPE = DeviceTypes.Device; DeviceClass: TYPE = DeviceClassTypes.DeviceClass; DeviceClassObj: PUBLIC TYPE = DeviceClassTypes.DeviceClassObj; DeviceState: TYPE = DeviceTypes.DeviceState; globalDevices: RefTab.Ref ¬ RefTab.Create[]; QuaClass: PUBLIC PROC [ref: REF] RETURNS [class: DeviceClass] = { WITH ref SELECT FROM dc: DeviceClass => class ¬ dc; ENDCASE => class ¬ NIL; }; NameOfClass: PUBLIC PROC [class: DeviceClass] RETURNS [name: ATOM] = { name ¬ class.name; }; ClassOfDevice: PUBLIC PROC [device: Device] RETURNS [class: DeviceClass] = { class ¬ device.class; }; RegisterClass: PUBLIC PROC [class: DeviceClass, name: ATOM] = { [] ¬ RefTab.Store[globalDevices, name, class]; }; ClassFromName: PUBLIC PROC [name: ATOM] RETURNS [class: DeviceClass ¬ NIL] = { found: BOOL; val: REF; [found, val] ¬ RefTab.Fetch[globalDevices, name]; IF found THEN class ¬ NARROW[val]; }; InitialDeviceState: PUBLIC PROC [device: Device] RETURNS [DeviceState] = { RETURN[device.class.getDeviceState[device]]; }; END.  DevicesImpl.mesa Copyright Σ 1991, 1992 by Xerox Corporation. All rights reserved. Bier, November 6, 1991 10:21 am PST Contents: Routines on devices and device classes (e.g., keyboards, mice, pens, etc.). Narrows ref to DeviceClass. Clients can't do this themselves because DeviceTypes.DeviceClass is an Opaque type. Returns NIL if ref is the wrong type. For keyboards and mice, this returns the state with all keys up. For pointing devices, the device begins at position [0,0] in 2D, [0,0,0] in 3D, etc. Κ –(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ Οeœ6™BKšœ#™#KšœV™VK™—šΟk ˜ Kšœ/˜/—K˜šΟn œžœž˜Kšžœ˜Kšžœ˜—Kšž˜K˜Kšœžœ˜"Kšœ žœ ˜1Kšœž œ#˜>Kšœ žœ˜,K˜K˜,K˜š Ÿœžœžœžœžœ˜AKšœ—™—šžœžœž˜K˜Kšžœ žœ˜—K˜K™—š Ÿ œžœžœžœžœ˜FK˜K˜—šŸ œžœžœžœ˜LK˜K˜—K˜šŸ œžœžœžœ˜?K˜.K˜K˜—š Ÿ œžœžœžœžœžœ˜NKšœžœ˜ Kšœžœ˜ K˜1Kšžœžœ žœ˜"K˜—K˜šŸœžœžœžœ˜JK™–Kšžœ&˜,K˜K™—Kšžœ˜K˜—…—„–