The Minimum Entry

When creating a new termcap entry, begin with the essentials and gradually enhance the entry. If an application program is readily available that uses termcap (such as PRO/5), use that program to "test" the new termcap entry during each step of the creation.

Although each application program has its own requirements for a termcap entry, many will accept a minimum entry. The following fields provide a starting point with a termcap entry:

Field

Description

li#

Number of lines on the screen. The Wyse 60 can be set for 24 or 25 lines. For this example, a 24 line display is assumed with :li#24:

co#

Number of columns on the screen. An 80 column display is normal and given as :co#80:

am

Automatic margin. This field should be present if the terminal automatically wraps the cursor from the end of one line to the beginning of the next line when outputting text. Many applications make important assumptions based on the presence or absence of :am:.

 

NOTE:Automatic wrap is frequently found as a user option on display terminals; therefore, this field may differ between two identical terminals. Automatic wrap is recommended, if the terminal has the capability.

cl=

Sequence to clear the entire screen display. The Wyse manual describes the sequence "ESC *" as a clear display command. This translates to termcap as :cl=\E*:

cm=

Sequence to address the cursor. This field enables the application to move the cursor to any position on the screen allowing "composition" of the display by placing text at any desired location. In this situation, a single escape sequence is not adequate. An 80 by 24 character display has 1920 character positions. This means that 1920 different escape sequences are necessary to address each position on the screen. In reality, a cursor-addressing escape sequence will include a desired line and column number as part of the sequence. These two values are "plugged in" to the sequence according to a special notation in the termcap string. This is a special instance where termcap will scan the output string and make special substitutions.

 

The Wyse 60 manual shows the cursor address sequence as "ESC =line col". This example suggests that the sequence must be completed with the desired line number and column number. A legend in the manual further describes that the ASCII code for a space (code 32) represents the first line or column on the display. In other words, the desired line and column numbers must be offset by 32 in the actual escape sequence sent to the terminal. The termcap :cm=: entry for the Wyse 60 could look like :cm=\E=%+\040%+\040:.

 

The above string indicates that a cursor address sequence begins with an ESCAPE followed by "=". The first "%+\040" means to send the desired line number as a single character code with the value 32 added (the 32 is expressed in octal as \040). The second "%+\040" means to do the same but with the desired column number. Since an octal \040 is the same as the space character, the sequence could also be described as :cm=\E=%+ %+ :. Notice the use of spaces in place of the \040.

 

There are many different methods of specifying a line and column in a cursor address sequence. Termcap considers the upper-left corner of the screen to be line 0, column 0. The following are some of the notations that may be used in the :cm=: string to allow specification of line/column. (Some rarely used codes are omitted here. See your system's termcap manual for a complete list).

%.

Replaced by the actual line or column number as a single character code. Line 0 will be represented as a null character.

%+x

Replaced by the actual line or column number added to the character code indicated by x. This is used for terminals that require line and column specifications to be offset by a certain value.

%i

Causes both the line and column positions to be incremented. It is not output. This code should be present for terminals requiring a 1-based line/column address, as opposed to 0-based assumed by termcap. This code otherwise does nothing.

%r

Causes the line and column positions to be reversed but causes no output. Termcap normally outputs the line number first. This code should be present if the terminal expects the column number first.

%d

Replaced by a string of digits representing the desired line or column number. For example line 30 would be represented as "30" in the output, as opposed to a single character code 30.

%2

Same as %d, except that 2 digits are always output. Line 5 would be specified as "05".

%3

Similar to %d, except that 3 digits are always output. Line 5 would be represented as "005" in the actual output.

%%

Outputs a single "%".

The minimum termcap entry for a Wyse 60 would look like this:

wyse60|wy60|Wyse 60 terminal:\
:li#24:co#80:am:cl=\E*:cm=\E=%+ %+ :

While this entry does not utilize the full capabilities of the Wyse 60 terminal, an application using this entry is able to determine the size of the screen (li#, co#), the effects of end-of-line wrap (am), how to clear the display (cl=), and how to move the cursor around (cm=).

Enhancing the Minimum Entry

Once the minimum termcap entry is established, it can be made more complete. The more an application knows about a terminal, the more it can make use of the terminal's features, resulting in faster display speed.