DIRECTORY DeviceClassTypes, DeviceTypes, Rope; FastTRAPDevice: CEDAR DEFINITIONS = BEGIN Device: TYPE = DeviceTypes.Device; DeviceClass: TYPE = DeviceClassTypes.DeviceClass; DeviceState: TYPE = DeviceTypes.DeviceState; DeviceStateChange: TYPE = DeviceTypes.DeviceStateChange; KeyName: TYPE = {left, middle, right}; CreateFastTRAP: PROC [name: Rope.ROPE] RETURNS [device: Device]; AllocateState: PROC [device: Device] RETURNS [deviceState: DeviceState]; KeyChange: PROC [key: KeyName, down: BOOL] RETURNS [change: DeviceStateChange]; TrackballChange: PROC [deltaX, deltaY: INTEGER] RETURNS [change: DeviceStateChange]; ThumbwheelChange: PROC [delta: INTEGER] RETURNS [change: DeviceStateChange]; StateAfterChange: PROC [deviceState: DeviceState, change: DeviceStateChange] RETURNS [newDeviceState: DeviceState]; ChangeKind: TYPE = {key, trackball, wheel}; ExpandedChange: TYPE = RECORD [ contents: SELECT kind: ChangeKind FROM key => [key: KeyName, down: BOOL], trackball => [deltaX, deltaY: INTEGER], wheel => [delta: INTEGER] ENDCASE ]; UnpackChange: PROC [change: DeviceStateChange] RETURNS [expanded: ExpandedChange]; KeyNewState: PROC [deviceState: DeviceState, key: KeyName, down: BOOL] RETURNS [newDeviceState: DeviceState]; TrackballNewState: PROC [deviceState: DeviceState, deltaX, deltaY: INTEGER] RETURNS [newDeviceState: DeviceState]; ThumbwheelNewState: PROC [deviceState: DeviceState, delta: INTEGER] RETURNS [newDeviceState: DeviceState]; IsDown: PROC [deviceState: DeviceState, key: KeyName] RETURNS [BOOL]; GetTrackball: PROC [deviceState: DeviceState] RETURNS [x, y: INTEGER]; GetThumbwheel: PROC [deviceState: DeviceState] RETURNS [wheel: INTEGER]; END. – FastTRAPDevice.mesa Copyright Σ 1991, 1992 by Xerox Corporation. All rights reserved. Bier, November 6, 1991 10:42 am PST Contents: Routines for creating instances of the FastTRAP trackball and representing the state of such a device. Class Routines Create a data structure representing a particular physical FastTRAP. Calls class.create[class]. Allocates storage representing the state of this keyboard when all of its keys are up, the trackball is at 0,0, and the thumbwheel is at 0. Each DeviceState is immutable, so they may be freely stored in long-term storage. Representing FastTRAP State Changes Convenience State Changes Inspecting State Κv–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ Οeœ7™BKšœ#™#Kšœq™qK™—šΟk ˜ Kšœ$˜$K˜—šœžœž œž˜)K˜Kšœžœ˜"Kšœ žœ ˜1Kšœ žœ˜,Kšœžœ!˜8Kšœ žœ˜&K˜—K™šΟnœžœ žœžœ˜@Kšœ`™`—šŸ œžœžœ˜HKšœή™ή—K™šœ#™#K˜—KšŸ œžœžœžœ˜OKšŸœžœžœžœ˜TKšŸœžœ žœžœ˜LK˜KšŸœžœ7žœ˜sK˜Kšœ žœ˜+šœžœžœ˜šœ žœž˜&Kšœžœ˜"Kšœžœ˜'Kšœžœ˜Kšž˜—K˜K˜—KšŸ œžœžœ˜RK˜™K™—KšŸ œžœ0žœžœ˜mKšŸœžœ,žœžœ˜rKšŸœžœ#žœžœ˜jK˜™K™—KšŸœžœ*žœžœ˜EKšŸ œžœžœžœ˜FKšŸ œžœžœ žœ˜HK˜Kšžœ˜K˜—…—”