<<>> <> <> <> <> <<>> 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.