HPlogo MPE/iX Developer's Kit Reference Manual Volume 2: HP 3000 MPE/iX Computer Systems > Chapter 3 TERMINFO Database

TERMINFO Source File

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

One or more devices are described in a TERMINFO source file. This section describes the contents of the source file.

Syntax of Device Descriptions

Each device entry in the TERMINFO source file has the following format:

    alias1 | alias2 | ... | aliasn | fullname,

         capability1, capability2,

         .

         .

         .

         capabilityn,

The first line in the device description is called the header; it must start in column one of the file. The header contains the commonly-used aliases for the device being described and the full name, which by convention appears last on the line. The environmental variable TERM can be set to any one of the terminal aliases. Each name is separated by a vertical bar, (|). The aliases must be unique in the database. They must follow normal MPE/iX HFS naming conventions (avoid a hyphen in the alias name as it is used to append a suffix as described below). All lines in the file must end with a comma (,).

A sample header of the model 33 teletype follows:

   33|tty33|tty|model 33 teletype

A special convention exists for naming terminals that have special hardware modes or user preferences (for example, a VT-100 with 132 columns). Attach a suffix to the alias name with a hyphen, as shown in the following example.

   vt100-w|vt100 132 column,

More than one suffix can be used by concatenating them together. When using multiple suffixes, repeat the alias with the suffixes in the opposite order so the user does not have to remember which is the correct order. The following example shows a terminal in wide mode with no automatic margins:

   vt100-w-nam|vt100-nam-w|vt100 132 column,

The suffix conventions used are shown in Table 3-1 “Suffixes for Mode and User Preferences”.

Table 3-1 Suffixes for Mode and User Preferences

SuffixMeaning
-amAuto margins (usually the default)
-naNo arrow keys (leave in local mode)
-namNo auto margins
-wWide mode (more than 80 columns)
-rvReverse video
-nNumber of lines on the screen
-npNumber of pages of memory

 

After the header come the descriptions of the capabilities, separated by commas (white space after the comma is ignored). Each line after the header is indented one or more spaces or tabs. An example that shows the syntax of the capabilities segment of the file follows:

   dumb|Dumb terminal,

   am, xon,

   cols#80, it#8,

   bel=^G, cr=\r, cudl=\n, ind=\n$<15>,

There are three types of capabilities: Boolean, numeric, and string. The first line in the example shows Boolean capabilities; the second line shows numeric capabilities; and the third shows string capabilities.

The Boolean capabilities indicate the presence or absence of a capability. They take no arguments. The terminal in the example has automatic margins (am)and uses the XON/XOFF handshaking protocols (xon).

The numeric capabilities show size, spacing, or some other measurement. The capability is followed immediately by a pound sign (#) character and a positive integer. The terminal in the example has a screen with 80 columns (cols#80) and tab stops initially set to every 8 characters (it#8).

The string capabilities describe a terminal operation. The capability is followed immediately by an equals sign (=), and the string that performs the operation. The terminal in the previous example beeps the terminal when sent a ^G sequence, performs a carriage return when sent a return character, moves the cursor down a line when sent a newline character, and scrolls forward from the bottom line of the screen when sent a newline character. (Control characters are entered in the device description as a caret (^), followed by a letter, as opposed to entered as the actual control character.)

Padding

Padding is used to delay further output to terminals that need extra time to process the current command. Some terminals use the XON/XOFF protocol instead of padding to tell the sending computer not to send the next command until the terminal is ready to receive it. Padding can still be used with the XON/OFF protocol so that programs can calculate the speed of functions. Padding can be specified for all string capabilities with the exception of input capabilities (names preceded with key_).

Padding is specified by a dollar sign ($) followed by a number enclosed within angle brackets (for example, $<15>). A forward slash (/) after the number specifies that padding is mandatory; that is, it should be applied regardless of the XON/XOFF setting. An asterisk (*) after the number specifies proportional padding; that is, it is applied to each line affected.

The syntax of padding specifications is summarized in Table 3-2 “Syntax of Padding Specifications”.

Table 3-2 Syntax of Padding Specifications

Padding SyntaxMeaning
$<|nIndicates a delay in n milliseconds
$<|n/Indicates the delay is mandatory
$<|n*Indicates the padding to be applied for each line affected
$<|n/*Indicates the mandatory padding to be applied for each line affected

 

NOTE: The tputs() routine performs the necessary padding for output.

Parameterized Strings

Strings that require run-time parameters are described using printf-like escapes (%x). Calculations are done on a stack using Reverse Polish Notation. Parameters are pushed onto the stack, manipulated in some way, and a result is output. The left-most operators are pushed first; for example, to subtract 10 from the first parameter, you would use:

   %p1%{10}%-.

A complex example that describes cursor movement for the Wyse-50 follows:

   cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c,

This parameterized string is described in Table 3-3 “Explanation of Parameter Description”.

Table 3-3 Explanation of Parameter Description

ExpressionMeaning
\E=Send cursor addressing command ^[=
%p1Push the first parameter onto stack
%'\s'Push a space onto stack
%+Pop the first two values on stack, add them, and push sum back on stack
%cPop the value on top of stack as an ASCII character; send to terminal
%p2Push the second parameter onto stack
%'\s'Push a space onto stack
%+Pop the first two values on stack, add them, and push sum back on stack
%cPop the value on top of stack as ASCII character; send to terminal

 

Stack Operators

The stack operators are defined as follows:

%%

Outputs the % character.

%char

Pop and print character on top of stack.

%[ [:]flags] [field_width[.precision] ] [doxXs]

Pop the topmost value and output as specified by the printf-like format.Flags are [- + #] and space.

NOTE: When using the- flag with %[doxXs], a colon (:), must be put between the % and- to distinguish the flag from the binary %- operator, for example, %:-16.16s.
%pn

Push nth parameter onto stack where n is a number from 1 to 9.

%'c'

Push character constant c onto stack.

%{nn}

Push decimal constant nn onto the stack.

%l

Pop a pointer to a string and push the length of the string onto the stack.

%+ %- %* %/ %m

Pop the top two values; add (int2 + int1), subtract (int2 - int1), multiply (int2 * int1), divide (int2 / int1), or modulo (int2 mod int1), and push the result.

%& %| %^

Pop the top two values, perform bitwise AND (int2 & int1), bitwise OR (int2 | int1), or bitwise XOR (int2 ^ int1)

%= %> < %A %O

Pop the top two values, push TRUE or FALSE depending on whether operators are equal, second is greater than first, second is less than first, both are true, either are true, respectively.

%!

Pop the top value and push its logical NOT.

%~

Pop the top value and push its bitwise NOT.

%i

For ANSI terminals, increment first parameter by one, if one parameter present, or increment first two parameters by one, if more than one parameter present.

%? expr %t thenpart %e elsepart %;

Execute thenpart if expr is TRUE; otherwise execute elsepart (elsepart is optional). Else-if's are possible:

 %? c1 %t b1 %e c2 %t b2 %e c3 %t b3, %e c4 %t b4

 %e b5 %;
where ci are conditions and bi are bodies.

The following example describes more complex cursor movements using some of the stack operators described previously. For example, the hp2392a terminal needs to be sent the column before the row for cursor addressing. See Table 3-4 “hp2392a Terminal Cursor Movement” following the example for a complete explanation.

  cup=\E&a%p2%dc%p1%dY,

Table 3-4 hp2392a Terminal Cursor Movement

ExpressionMeaning
\E&aSend ^[&a
%p2\Push the second parameter onto the stack
%dPrint top of stack as decimal number
cSend character c
%p1Push the first parameter onto the stack
%dPrint top of stack as decimal number
YSend character Y

 

The following is an example of a cursor movement string for the ANSI terminal. The explanation of each argument is shown in Table 3-5 “ANSI Terminal Cursor Movement”.

   cup=\E[%i%p1%d;%p2%dH,

Table 3-5 ANSI Terminal Cursor Movement

ExpressionMeaning
\E[Send ^[[
%iIncrement the first and second parameter by one
%p1Push the first parameter onto the stack
%dPrint top of stack as a decimal number
;Send character ;
%p2Push the second parameter onto the stack
%dPrint top of stack as decimal number
HSend character H

 

Feedback to webmaster