DEFINITION MODULE Screen; (* Library module for screen handling. Author: John Forester Copyright: John Forester, 1986, 1988 Last edit: 8 Dec 1988 *) EXPORT QUALIFIED InVid, RegVid, PlaceCursor, CursorUp, CursorDown, CursorRight, CursorLeft, SaveCursor, RestoreCursor, Clear, ClearDown, EraseLn, FillBlank, InBool, ScreenBool, NulString, ChgString, ChgCard, ChgInt, BlankReal, FillReal, ScreenReal, ChgReal; PROCEDURE InVid; (* Turns on inverse video. *) PROCEDURE RegVid; (* Restores regular video. *) PROCEDURE PlaceCursor(line, col : CARDINAL); (* Places cursor at specified line and column. *) PROCEDURE CursorUp(lines : CARDINAL); (* Moves cursor up the specified number of lines. *) PROCEDURE CursorDown(lines : CARDINAL); (* Moves cursor down the specified number of lines. *) PROCEDURE CursorRight(cols : CARDINAL); (* Moves the cursor right the specified number of columns. *) PROCEDURE CursorLeft(cols : CARDINAL); (* Moves the cursor left the specified number of columns. *) PROCEDURE SaveCursor; (* Saves the current cursor position. *) PROCEDURE RestoreCursor; (* Restores the cursor to the saved position. *) PROCEDURE Clear; (* Clears the screen and puts the cursor home. *) PROCEDURE ClearDown(line : CARDINAL); (* Clears the screen below and to the right of cursor position. The current line value must be input as line. *) PROCEDURE EraseLn; (* Erases the rest of the line from the cursor position. *) PROCEDURE FillBlank(spaces : CARDINAL); (* Creates inverse video blank to fill with data. *) PROCEDURE InBool(VAR status : BOOLEAN; show : BOOLEAN); (* Reads a single-character input from keyboard until y or Y or n or N or t or T or n or N is received. It then returns a Boolean value for variable status. Show determines whether the previous value of status is displayed in the window. *) PROCEDURE ScreenBool(status : BOOLEAN; show : CHAR); (* When show is F or T, Displays F or T as value of Boolean status. When show is Y or N, Displays Y or N as value of Boolean status. *) PROCEDURE NulString(VAR str : ARRAY OF CHAR); (* Changes all cells of string str to nulls, 0C. *) PROCEDURE ChgString(VAR str : ARRAY OF CHAR; width : CARDINAL); (* Displays string str for editing. Width is maximum length. The cursor must be at the start of the line. If the first character input is a RETURN, the existing value is accepted without change. *) PROCEDURE ChgCard(VAR x : CARDINAL; width : CARDINAL); (* Displays cardinal x for possible change in value. Width is maximum width. Cursor must be at start position of number. If the first character input is a RETURN, the existing value is accepted without change. *) PROCEDURE ChgInt(VAR x : INTEGER; width : CARDINAL); (* Displays integer x for possible change in value. Width is maximum width. Cursor must be at start position of number. If the first character input is a RETURN, the existing value is accepted without change. *) PROCEDURE BlankReal(digits, width : CARDINAL); (* Forms inverse video blanks with decimal point in correct place. Digits is number of digits to right of decimal point, width is total width. For width allow for possible minus sign and decimal place. If zero decimal places are desired, inverse video blank will still produce a place for the decimal point. *) PROCEDURE FillReal(VAR x : REAL; digits, width : CARDINAL); (* Accepts keyboard input of real number. May use blanks created by BlankReal or FillBlanks. Digits is number of digits to right of decimal point, width is total width. For width allow for possible minus sign and decimal point. If zero decimal places are desired, inverse video blank will still produce a place for the decimal point. Allows backspace corrections. Entry of a RETURN after the decimal point has been entered completes the transaction without fillng in trailing zeroes. This is reliable; it allows input only in the designated format. *) PROCEDURE ScreenReal(x : REAL; digits, width : INTEGER); (* Writes a REAL to the screen in a field of width w and with d digits to right of decimal point. *) PROCEDURE ChgReal(VAR x : REAL; digits, width : CARDINAL); (* Displays real x for possible change in value. Width is total maximum width, digits is number of digits to right of decimal point. Cursor must be at starting position of number. If the first character input is a RETURN, the existing value is accepted without change. *) END Screen.