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


Ulm's Modula-2 Library:
TermInfo


NAME

TermInfo - interface to terminal capability data base

SYNOPSIS

TYPE OutProc = PROCEDURE (CHAR);
TYPE DelayProc = PROCEDURE (CARDINAL);
TYPE Term = RECORD (* ... *) END;


PROCEDURE SetupTerm(tname: ARRAY OF CHAR; VAR tinfo: Term) : BOOLEAN; PROCEDURE Tparm(VAR out: ARRAY OF CHAR; fmt: ARRAY OF CHAR); PROCEDURE Tparm1(VAR out: ARRAY OF CHAR; fmt: ARRAY OF CHAR; arg1: ARRAY OF BYTE); PROCEDURE Tputs(str: ARRAY OF CHAR; affcnt: CARDINAL; outc: OutProc); PROCEDURE TputsDelay(str: ARRAY OF CHAR; affcnt: CARDINAL; outc: OutProc; delay: DelayProc);

DESCRIPTION

TermInfo allows to access the terminfo database as described in terminfo(4). The routines are similar to the terminfo level routines of curses(3x) but no output is generated nor any ioctl-calls are done. This allows TermInfo to work for more than one terminal at a time.

SetupTerm looks for a terminal description for tname (an empty string causes the environment parameter TERM to be taken). On success tinfo is filled and TRUE is returned. Failures result from unknown terminals or corrupted terminfo database entries.

The type Term is generated from /usr/include/term.h. Each component name starts with an upper case letter. Underlines followed by lower case letters are replaced by upper case (e.g. cursor_address becomes CursorAddress). Capabilities are of three different types: String (fixed length character array), INTEGER, and BOOLEAN. Capabilities in Term which are not defined in the database are set accordingly to empty strings, -1, and FALSE.

Tparm, are used to decode the capability fmt and to instantiate the parameters into out. Delay information still remains in out. These routines abort with a message on StdIO.stderr on errors in fmt or on too few parameters.

Tputs prints str using outc and interprets the delay information which sometimes depends on the number of lines affected affcnt (give 1 if not applicable). Because the baud-rate is not known no padding will be done. Instead, a busy-loop with system calls (resolution see Clock.UnitsPerSecond) does the work.

TputsDelay works like Tputs but calls delay if delay informations are found. The delay time is given in tenth of milliseconds.

CAVEAT

This module is not available for older BSD-systems.

SEE ALSO

curses(3X), term(4), terminfo(4)
Edited by: borchert, last change: 1997/02/25, revision: 1.2, converted to HTML: 1997/04/28

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