Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 Library:
Screen


NAME

Screen - simple screen operations

SYNOPSIS

TYPE Screen;
TYPE CursorVisibility = (normal, invisible, morevisible);


VAR Done: BOOLEAN;

PROCEDURE OpenScreen(VAR scr: Screen; outfp: StdIO.FILE; baudrate: CARDINAL; lines, columns: CARDINAL; terminal: ARRAY OF CHAR) : BOOLEAN; PROCEDURE OpenScreenTI(VAR scr: Screen; outfp: StdIO.FILE; baudrate: CARDINAL; lines, columns: CARDINAL; tinfo: TermInfo.Term); PROCEDURE InitScreen(scr: Screen; lines, columns: CARDINAL); PROCEDURE CloseScreen(VAR scr: Screen); PROCEDURE Lines(scr: Screen) : CARDINAL; PROCEDURE Columns(scr: Screen) : CARDINAL; PROCEDURE ClearScreen(scr: Screen); PROCEDURE SetCursor(scr: Screen; line, column: CARDINAL); PROCEDURE MoveCursor(scr: Screen; (* from *) line1, column1, (* to *) line2, column2: CARDINAL); PROCEDURE Scroll(scr: Screen; down: BOOLEAN; line, column: CARDINAL; lines, columns: CARDINAL); PROCEDURE ResetScrollRegions(scr: Screen); PROCEDURE SetCursorVisibility(scr: Screen; visibility: CursorVisibility);

DESCRIPTION

Screen bases on TermInfo and offers some optimized screen operations. Done is set to FALSE if no capability is found to do the work. A Screen can be opened by either OpenScreen or OpenScreenTI. Both return on success a screen-pointer scr which is to be given on subsequently operations on it. Any output is sent to outfp. Padding depends on baudrate. If baudrate is zero no padding will be done. OpenScreen sends an initialization sequence to the terminal but does not clear the screen. No ioctl(2) system call is done. So output setting like switch-off of tab-expansion and newline-mapping are to be done previously. Thus, outp needs not to be associated with a terminal. InitScreen repeats the initialization sequence of OpenScreen.

CloseScreen deallocates the space used for scr but does not close the output file-pointer outfp which has been given to OpenScreen or OpenScreenTI.

Lines and Columns return the number of lines and columns of the given screen. If the associated capability is not set 1 is returned. ClearScreen clears the screen. SetCursor moves the cursor to the given position. Some optimizations (e.g. home position and last line) are done. MoveCursor takes line1 and column1 as the current position of the cursor and outputs an optimized sequence to move to line2 and column2.

Scroll scrolls a given window of a screen one line downward (down set to TRUE) or upward (forward). The window is defined by the upper left corner given by line and column and the number of lines and columns. The cursor position is undefined if successful.

ResetScrollRegions undoes all former settings for scroll regions and is useful in a sequence of operations to restore a terminal to a sane state. Note that this operation is not needed for any of the operations above except for cases of abnormal termination in the middle of a sequence that creates a scroll region temporarily.

The cursor visibility can be modified by calling SetCursorVisibility. Supported are normal, invisible, and morevisible.

SEE ALSO

TermInfo interface to the terminfo database
Windows high-level interface

Edited by: borchert, last change: 1998/06/22, revision: 1.3, converted to HTML: 1998/06/22

Modula-2 || Compiler & Tools || Library || Search Engine