-- [Ivy]<Swinehart>Inscript>Interminal.mesa -- Last Edited by Maureen Stone, June 5, 1982 12:57 pm, pen and color cursor -- Last Edited by Swinehart, 24-Nov-81 9:26:43, mouse grains DIRECTORY ClassInscript USING [Inscript], Intime USING [MsTicks]; Interminal: DEFINITIONS = BEGIN InterminalImpl: PROGRAM [inscript: ClassInscript.Inscript]; --color=true indicates that the mouse is on the colordisplay MousePosition: TYPE = MACHINE DEPENDENT RECORD [ mouseX: INTEGER, color: BOOLEAN, mouseY: [-16383..16383]]; PenPosition: TYPE = MousePosition; CursorArray: TYPE = ARRAY [0..16) OF WORD; updown: TYPE = {down, up}; KeyView: TYPE = {keyNames, keyFields, words, bits}; KeyState: TYPE = MACHINE DEPENDENT RECORD [ SELECT OVERLAID KeyView FROM bits => [bits: PACKED ARRAY KeyName OF updown], words => [words: KeyArray], keyNames => [keyNames: KeyNames], keyFields => [keyFields: KeyFields], ENDCASE]; --added pen instead of x7 m.stone KeyName: TYPE = { x0, x1, x2, x3, x4, x5, x6, pen, Keyset1, Keyset2, Keyset3, Keyset4, Keyset5, Red, Blue, Yellow, Five, Four, Six, E, Seven, D, U, V, Zero, K, Dash, P, Slash, BackSlash, LF, BS, Three, Two, W, Q, S, A, Nine, I, X, O, L, Comma, Quote, RightBracket, Spare2, BW, One, ESC, TAB, F, Ctrl, C, J, B, Z, LeftShift, Period, SemiColon, Return, Arrow, DEL, FL3, R, T, G, Y, H, Eight, N, M, Lock, Space, LeftBracket, Equal, RightShift, Spare3, FL4, -- FR5, -- allUp}; -- allUp is generated when full keyboard state is entered; action readers should -- interpret keyStillDown[allUp] as a request to clear the current state in preparation -- for starting over. Kn: PROCEDURE [value: UNSPECIFIED] RETURNS [kN: KeyName] = INLINE { kN ← LOOPHOLE[value]}; Kv: PROCEDURE [value: UNSPECIFIED] RETURNS [kV: CARDINAL] = INLINE { kV ← LOOPHOLE[value]}; KbdKeyName: TYPE = KeyName [Five..allUp]; ButtonKeyName: TYPE = KeyName [Red..Yellow]; PaddleKeyName: TYPE = KeyName [Keyset1..Keyset5]; KeyArray: TYPE = ARRAY [0..5) OF WORD; KeyNames: TYPE = MACHINE DEPENDENT RECORD [ blank: [0..177B], pen: updown, Keyset1, Keyset2, Keyset3, Keyset4, Keyset5: updown, Red, Blue, Yellow: updown, Five, Four, Six, E, Seven, D, U, V, Zero, K, Dash, P, Slash, BackSlash, LF, BS: updown, Three, Two, W, Q, S, A, Nine, I, X, O, L, Comma, Quote, RightBracket, Spare2, BW: updown, One, ESC, TAB, F, Ctrl, C, J, B, Z, LeftShift, Period, SemiColon, Return, Arrow, DEL, FL3: updown, R, T, G, Y, H, Eight, N, M, Lock, Space, LeftBracket, Equal, RightShift, Spare3, FL4, -- FR5 -- allUp: updown]; KeyFields: TYPE = MACHINE DEPENDENT RECORD [ mesaMemorialBlankField: [0..177B], pen: [0..1], paddles: Paddles, buttons: Buttons, keys: ARRAY [0..3] OF WORD]; ButtonView: TYPE = {buttonChord, buttonNames, buttonValue}; Buttons: TYPE = MACHINE DEPENDENT RECORD [ SELECT OVERLAID ButtonView FROM buttonChord => [buttonChord: [0..10B)], buttonNames => [buttonNames: ButtonNames], buttonValue => [buttonValue: ButtonValue], ENDCASE]; ButtonNames: TYPE = MACHINE DEPENDENT RECORD [Red, Blue, Yellow: updown]; ButtonName: TYPE = MACHINE DEPENDENT{Red(0), Blue(1), Yellow(2)}; ButtonValue: TYPE = MACHINE DEPENDENT{ RedYellowBlue(0), RedBlue(1), RedYellow(2), Red(3), BlueYellow(4), Blue(5), Yellow(6), None(7)}; PaddleView: TYPE = {paddleChord, paddleNames, paddleValue}; Paddles: TYPE = MACHINE DEPENDENT RECORD [ SELECT OVERLAID PaddleView FROM paddleChord => [paddleChord: [0..40B)], paddleNames => [paddleNames: PaddleNames], paddleValue => [paddleValue: PaddleValue], ENDCASE]; PaddleNames: TYPE = RECORD [ Keyset1, Keyset2, Keyset3, Keyset4, Keyset5: updown]; PaddleName: TYPE = MACHINE DEPENDENT{ Keyset1(0), Keyset2(1), Keyset3(2), Keyset4(3), Keyset5(4)}; PaddleValue: TYPE = MACHINE DEPENDENT{ Keyset1(17B), Keyset2(27B), Keyset3(33B), Keyset4(35B), Keyset5(36B), None(37B)}; allUp: KeyState; Spare1: CHARACTER=LOOPHOLE[201B]; Spare2: CHARACTER=LOOPHOLE[202B]; Spare3: CHARACTER=LOOPHOLE[203B]; ShiftSpare1: CHARACTER=LOOPHOLE[204B]; ShiftSpare2: CHARACTER=LOOPHOLE[205B]; ShiftSpare3: CHARACTER=LOOPHOLE[206B]; -- Offsets origin of cursor bitmap by the specified number of screen points -- doTrack←FALSE to disable automatic cursor tracking. SetCursorOffset: PROC[deltaX, deltaY: INTEGER, enableTracking: BOOLEAN←TRUE]; GetCursorOffset: PROC RETURNS[deltaX, deltaY: INTEGER, trackingEnabled: BOOLEAN]; -- modifies hardware interpretation of mouse position; to be used at own peril!! -- possibly useful for locking mouse into nearby position, etc. SetMousePosition: PROC[pos: MousePosition]; -- returns the current position, may be out of synch with inscript fetches!! GetMousePosition: PROC RETURNS [pos: MousePosition]; -- Recording grain hints. This are provided by higher levels at the time -- those levels are created. Subsequent recorded events will be entered -- at the specified grain. Unless the higher levels are running in more -- or less real time, these hints will not be too valuable. DefaultMouseGrain: PROC RETURNS [ticks: Intime.MsTicks, dots: INTEGER]; SetMouseGrain: PROC[ticks: Intime.MsTicks, dots: INTEGER]; --changes the cursor bit array SetCursorPattern: PROCEDURE [cursorPattern: CursorArray]; GetCursorPattern: PROCEDURE RETURNS [cursorPattern: CursorArray]; --this initializes the Color display. If onLeft is false, it is assumed that --the display is on the right. --The mouse and cursor will slide between the two displays TurnOnColorCursor: PROC[nbits: NAT, onLeft: BOOLEAN ← TRUE]; TurnOffColorCursor: PROC; --this declares on which display the pen is located HasPenType: TYPE = {main, color, turnoff}; HasPen: PROC [display: HasPenType]; END.