The terminal database file, which is similar to the termcap file supplied with many UNIX systems, may be edited to add new terminals to the ones it currently supports. Existing entries in the file may also be edited, if needed, to describe your terminal.
Each line of this file is either blank, a comment (marked by a "#" in column 1), or a definition of a terminal. You can continue a "line" on following lines by ending the line to be continued with a "\" (see below for an example). The "\" character must be the last character on the line.
A terminal definition consists of several fields, separated by colons. The end of the line marks the end of the definition. The first field is always the name of the terminal. Several names can be placed here, separated by a vertical bar ("|"). The rest of the fields consist of codes that describe various terminal functions. Most of these codes are followed by an equals sign and a coded string that describes how to operate that particular function.
Here is a generic representation of a terminal database file entry, where TNnis a terminal name, tf is a terminal function code, and cs is a coded string to accomplish the function (some terminal function codes are self-defining and do not need a coded string):
TN1|TN2|TN3:\ :tf[=cs]:tf[=cs]:tf[=cs]:\ :tf[=cs]:tf[=cs]:
The coded string that describes a function is just a representation of the control-sequence (or sequences) that the terminal uses to activate that function. These strings consist of the literal characters used in the control-sequence. Several special forms are recognized to aid in describing the control-sequence. The following abbreviations are supported:
\E | an escape character |
\n | a newline (control-J) |
\r | a carriage return (control-M) |
\t | a tab (control-I) |
\b | a backspace (control-H) |
\f | a form-feed (control-L) |
^X | X is any character, treated as control-X |
\nnn | three digits treated as an octal value |
The following is a list of all of the supported function codes.
AC | Attributes used by clear screen |
AT | Special color for IBM 3164 terminal |
B1 - B8 | Background color 1-8 |
BL | Blink |
C1 - C8 | Foreground color 1-8 |
DI | De-initialization string |
DL | Default intensity is low |
DP | Disable print mode |
EP | Enable print mode |
GA | Graphics on and off are characters |
GE | Graphic escape |
GF | Graphics off |
GM | Graphics map |
GO | Graphics on |
GX | Graphics movement glitch |
HI | High-intensity, normal video |
LO | Low-intensity, normal video |
NM | Normal Video (only if ìsgî set) |
NS | Screen does not scroll when corner is used |
OC | One color can be displayed at a time |
RA | Reverse video, alternate intensity |
RB | Reverse video, blink |
RU | Reverse video, underline |
RV | Reverse video |
UL | Underline |
W3 | Set terminal width to 132 columns |
W8 | Set terminal width to 80 columns |
al | Insert (add) line |
bc | Backspace cursor (defaults to ^H) |
cd | Clear to end-of-screen |
ce | Clear to end-of-line |
cl | Clear screen |
cm | Cursor positioning |
co | Number of screen columns (default 80) |
dl | Delete line |
do | Down one line (defaults to ^J) |
is | Initialization string |
is1 | Additional initialization string |
is2 | Additional initialization string |
li | Number of screen lines (default 24) |
nd | Non-destructive space |
sg | Standout-mode glitch (uses magic cookies) |
tc | Continue description with another entry |
up | Cursor up one line |
ve | Set cursor to normal |
vi | Set cursor to invisible |
vs | Set cursor to bright |
The following codes are also available to represent various keys. Most terminals have only a subset of this full set.
K1 - K0 | Function keys 11 - 20 |
K? | Help |
KA | Attention |
KB | Bottom |
KC | Clear |
KD | Do (command) |
KE | End |
KF | Find |
KI | Insert character |
KL | Page left |
KM | Mark (select) |
KP | |
KR | Page right |
KS | Send |
KT | Top |
KV | Save |
KX | Delete character |
Kc | Cancel |
Kl | Word left |
Kr | Word right |
Kx | Exit |
k1 - k0 | Function keys 1 - 10 |
kA | Insert line |
kB | Tab left |
kE | Clear to end |
kL | Delete line |
kN | Page Down |
kP | Page Up |
kd | Down arrow |
kh | Home |
kl | Left arrow |
kr | Right arrow |
ku | Up arrow |
U1 - U0 | User defined key 1 - 10 |
A1 - A0 | User defined key 11 - 20 |
All of the function codes described with lower-case characters are identical to ones found in the UNIX termcap file. These sequences can be taken verbatim from termcap and included in the ACUCOBOL-GT terminal database file when you are adding a new terminal entry.
To help with this discussion, an example of an entry for a DEC VT-100 will be developed. At each step of the example, the new portion of the entry will be in bold type. Initially, we need to assign a set of names that we want to use to refer to the terminal. For example:
vt100|vt-100|DEC VT-100:
This allows for any of the names vt100, vt-100 or DEC VT-100 to be used for the TERM or A_TERM variable. By convention, the last name in the list is a long, descriptive name.