<> <> DIRECTORY Keys USING [KeyBits], PrincOps USING [BBTable]; Terminal: CEDAR DEFINITIONS LOCKS terminalLock = BEGIN terminalLock: PRIVATE MONITORLOCK; <<>> <> Virtual: TYPE = REF Object; Object: TYPE = RECORD [ <> keyboard: PRIVATE LONG POINTER TO READONLY Keys.KeyBits, mouse: PRIVATE LONG POINTER TO READONLY Position, <> hasBlackAndWhiteDisplay: --READONLY-- BOOL, bwWidth: --READONLY-- NAT, bwHeight: --READONLY-- NAT, bwHasBorder: --READONLY-- BOOL, bwPixelsPerInch: --READONLY-- NAT, bwCursor: PRIVATE LONG POINTER TO Position, <> hasColorDisplay: --READONLY-- BOOL, colorWidth: --READONLY-- NAT, colorHeight: --READONLY-- NAT, colorPixelsPerInch: --READONLY-- NAT, colorDisplayType: --READONLY-- ColorDisplayType, colorMode: PRIVATE ColorMode, <> colorBitmapA: --READONLY-- LONG POINTER, -- channel A bitmap base colorBitmapB: --READONLY-- LONG POINTER, -- channel B bitmap base colorWordsPerLineA: --READONLY-- NAT, -- channel A bitmap width colorWordsPerLineB: --READONLY-- NAT, -- channel B bitmap width <> impl: PRIVATE REF ANY ]; SwapAction: TYPE = {coming, here, going, gone}; SwapNotifier: TYPE = PROC [Virtual, SwapAction]; Position: TYPE = MACHINE DEPENDENT RECORD [x, y: INTEGER]; BitmapState: TYPE = {none, allocated, displayed}; <> BWBackground: TYPE = {white, black}; BWBorder: TYPE = [0..256); BWCursorBitmap: TYPE = ARRAY [0..16) OF WORD; ColorDisplayType: TYPE = {ramtek525, hitachi3619}; ChannelValue: TYPE = [0..256); maxBitsPerChannelValue: NAT = --Log2 ChannelValue.LAST+1-- 8; ColorMode: TYPE = RECORD [ full: BOOL, bitsPerPixelChannelA: [0..maxBitsPerChannelValue], bitsPerPixelChannelB: [0..maxBitsPerChannelValue] ]; ChannelsVisible: TYPE = {none, aOnly, bOnly, all}; Color: TYPE = [0..256); bitsPerColorValue: NAT = --Log2 Color.LAST+1-- 8; ColorCursorBitmap: TYPE = ARRAY [0..16) OF WORD; <> ColorCursorPresentation: TYPE = {onesAreWhite, onesAreBlack}; ColorCursorBitmapState: TYPE = {visible, invisible}; <> <<>> <> <<1) The human user at the keyboard can cycle through the extant virtual terminals by a particular key combination (control-shift-shift). (This is equivalent to an implicit call of Select[NIL]; see below.)>> <<2) A client program can select which virtual terminal is to be connected to the physical terminal, and can prevent a change of virtual terminal by clients or the user.>> <<3) Clients may register procedures to be invoked whenever the virtual-to-physical terminal correspondance changes.>> <> <<>> Create: PROC RETURNS [vt: Virtual]; <> <> <> <> <> <> <> <> Select: PROC [vt: Virtual _ NIL, lock: BOOL _ FALSE] RETURNS [worked: BOOL]; <> <> Current: PROC RETURNS [vt: Virtual, lockCount: NAT]; <> <> PreventSwaps: PROC [vt: Virtual]; <> <> PermitSwaps: PROC [vt: Virtual]; <> RegisterNotifier: PROC [vt: Virtual, notifier: SwapNotifier]; <> <<1) Notifiers for current terminal are called with SwapAction[going].>> <<2) Notifiers for the new terminal are called with SwapAction[coming].>> <<3) The actual terminal swap occurs.>> <<4) Notifiers for the former current terminal are called with SwapAction[gone].>> <<5) Notifiers for the new current terminal are called with SwapAction[here].>> <> <> <> UnregisterNotifier: PROC [vt: Virtual, notifier: SwapNotifier]; <> <> <> GetKeys: ENTRY PROC [vt: Virtual] RETURNS [Keys.KeyBits] = <> TRUSTED INLINE {RETURN[vt.keyboard^]}; <<>> GetKeysRef: ENTRY PROC [vt: Virtual, keys: REF Keys.KeyBits] = <> TRUSTED INLINE {keys^ _ vt.keyboard^}; <> GetMousePosition: ENTRY PROC [vt: Virtual] RETURNS [Position] = <> TRUSTED INLINE {RETURN[vt.mouse^]}; SetMousePosition: PROC [vt: Virtual, position: Position]; <> <> <<>> <> GetBWCursorPosition: ENTRY PROC [vt: Virtual] RETURNS [Position] = <> TRUSTED INLINE {RETURN[vt.bwCursor^]}; SetBWCursorPosition: ENTRY PROC [vt: Virtual, position: Position] = <> TRUSTED INLINE {vt.bwCursor^ _ position}; GetBWCursorPattern: PROC [vt: Virtual] RETURNS [pattern: BWCursorBitmap]; <> SetBWCursorPattern: PROC [vt: Virtual, pattern: BWCursorBitmap]; <> <> <> GetBWBitmapState: PROC [vt: Virtual] RETURNS [BitmapState]; SetBWBitmapState: PROC [vt: Virtual, new: BitmapState] RETURNS [old: BitmapState]; <> <> <> <> <> GetBWBackground: PROC [vt: Virtual] RETURNS [BWBackground]; SetBWBackground: PROC [vt: Virtual, new: BWBackground] RETURNS [old: BWBackground]; <> GetBWBorder: PROC [vt: Virtual] RETURNS [oddPairs, evenPairs: BWBorder]; SetBWBorder: PROC [vt: Virtual, oddPairs, evenPairs: BWBorder]; <> GetBitBltTable: UNSAFE PROC [vt: Virtual] RETURNS [bbt: PrincOps.BBTable]; <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <<]>> <<]>> WaitForBWVerticalRetrace: PROC [vt: Virtual]; <> BlinkBWDisplay: PROC [vt: Virtual]; <> <> <> GetColorBitmapState: PROC [vt: Virtual] RETURNS [BitmapState]; SetColorBitmapState: PROC [ vt: Virtual, newState: BitmapState, newMode: ColorMode, newVisibility: ChannelsVisible] RETURNS [oldState: BitmapState, oldMode: ColorMode, oldVisibility: ChannelsVisible]; <> <> <> <> <> < and . However, these two situtions have different performance characteristics. When newMode = displayed, the bitmap and colormap are pinned in memory; that is, the real memory they occupy cannot be stolen by the virtual memory machinery. In other modes, the bitmap and colormap (if any) can be swapped out. Therefore, should be used only for short-term disabling of the display, since the bitmap and colormap remained pinned.>> <> <> GetColorMode: ENTRY PROC [vt: Virtual] RETURNS [ColorMode] = TRUSTED INLINE {RETURN[vt.colorMode]}; SetColorMode: PROC [vt: Virtual, new: ColorMode] RETURNS [old: ColorMode] = INLINE {RETURN[SetColorBitmapState[vt, allocated, new, all].oldMode]}; LegalColorMode: PROC [vt: Virtual, mode: ColorMode] RETURNS [BOOL]; <> TurnOnColorDisplay: PROC [vt: Virtual] = INLINE {[] _ SetColorBitmapState[vt, displayed, GetColorMode[vt], all]}; TurnOffColorDisplay: PROC [vt: Virtual] = INLINE {[] _ SetColorBitmapState[vt, allocated, GetColorMode[vt], none]}; GetVisibility: PROC [vt: Virtual] RETURNS [ChannelsVisible]; SetVisibility: PROC [vt: Virtual, visibility: ChannelsVisible] = INLINE {[] _ SetColorBitmapState[vt, GetColorBitmapState[vt], GetColorMode[vt], visibility]}; <> GetRedMap: PROC [vt: Virtual, in: Color] RETURNS [Color]; GetGreenMap: PROC [vt: Virtual, in: Color] RETURNS [Color]; GetBlueMap: PROC [vt: Virtual, in: Color] RETURNS [Color]; SetRedMap: PROC [vt: Virtual, in: Color, out: Color]; SetGreenMap: PROC [vt: Virtual, in: Color, out: Color]; SetBlueMap: PROC [vt: Virtual, in: Color, out: Color]; <> GetColor: PROC [vt: Virtual, aChannelValue, bChannelValue: ChannelValue _ 0] RETURNS [red, green, blue: Color]; SetColor: PROC [ vt: Virtual, aChannelValue, bChannelValue: ChannelValue _ 0, red, green, blue: Color]; <> <<>> <<>> <> <> GetColorCursorPosition: PROC [vt: Virtual] RETURNS [Position]; <> SetColorCursorPosition: PROC [vt: Virtual, position: Position]; <> GetColorCursorPattern: PROC [vt: Virtual] RETURNS [pattern: ColorCursorBitmap]; <> SetColorCursorPattern: PROC [vt: Virtual, pattern: ColorCursorBitmap]; <> GetColorCursorPresentation: PROC [vt: Virtual] RETURNS [ColorCursorPresentation]; SetColorCursorPresentation: PROC [vt: Virtual, new: ColorCursorPresentation] RETURNS [old: ColorCursorPresentation]; <> <<>> GetColorCursorState: PROC [vt: Virtual] RETURNS [ColorCursorBitmapState]; SetColorCursorState: PROC [vt: Virtual, new: ColorCursorBitmapState] RETURNS [old: ColorCursorBitmapState]; <> <> <<>> <> <<>> CantDoIt: ERROR; END.