]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/term.5
ncurses 4.1
[ncurses.git] / man / term.5
1 .TH TERM 5
2 .ds n 5
3 .ds d @DATADIR@/terminfo
4 .SH NAME
5 term \- format of compiled term file.
6 .SH SYNOPSIS
7 .B term
8 .SH DESCRIPTION
9 .PP
10 Compiled terminfo descriptions are placed under the directory \fB\*d\fP.
11 In order to avoid a linear search of a huge \s-1UNIX\s+1 system directory, a
12 two-level scheme is used: \fB\*b/c/name\fP
13 where
14 .I name
15 is the name of the terminal, and
16 .I c
17 is the first character of
18 .IR name .
19 Thus,
20 .I act4
21 can be found in the file \fB\*d/a/act4\fP.
22 Synonyms for the same terminal are implemented by multiple
23 links to the same compiled file.
24 .PP
25 The format has been chosen so that it will be the same on all hardware.
26 An 8 or more bit byte is assumed, but no assumptions about byte ordering
27 or sign extension are made.
28 .PP
29 The compiled file is created with the
30 .I tic 
31 program, and read by the routine
32 .IR setupterm .
33 The file is divided into six parts:
34 the header,
35 terminal names,
36 boolean flags,
37 numbers,
38 strings,
39 and
40 string table.
41 .PP
42 The header section begins the file.
43 This section contains six short integers in the format
44 described below.
45 These integers are
46 (1) the magic number (octal 0432);
47 (2) the size, in bytes, of the names section;
48 (3) the number of bytes in the boolean section;
49 (4) the number of short integers in the numbers section;
50 (5) the number of offsets (short integers) in the strings section;
51 (6) the size, in bytes, of the string table.
52 .PP
53 Short integers are stored in two 8-bit bytes.
54 The first byte contains the least significant 8 bits of the value,
55 and the second byte contains the most significant 8 bits.
56 (Thus, the value represented is 256*second+first.)
57 The value \-1 is represented by the two bytes 0377, 0377; other negative
58 values are illegal. This value generally 
59 means that the corresponding capability is missing from this terminal.
60 Note that this format corresponds to the hardware of the \s-1VAX\s+1
61 and \s-1PDP\s+1-11 (that is, little-endian machines).
62 Machines where this does not correspond to the hardware must read the
63 integers as two bytes and compute the little-endian value.
64 .PP
65 The terminal names section comes next.
66 It contains the first line of the terminfo description,
67 listing the various names for the terminal,
68 separated by the `|' character.
69 The section is terminated with an \s-1ASCII NUL\s+1 character.
70 .PP
71 The boolean flags have one byte for each flag.
72 This byte is either 0 or 1 as the flag is present or absent.
73 The capabilities are in the same order as the file <term.h>.
74 .PP
75 Between the boolean section and the number section,
76 a null byte will be inserted, if necessary,
77 to ensure that the number section begins on an even byte (this is a
78 relic of the PDP-11's word-addressed architecture, originally
79 designed in to avoid IOT traps induced by addressing a word on an
80 odd byte boundary).
81 All short integers are aligned on a short word boundary.
82 .PP
83 The numbers section is similar to the flags section.
84 Each capability takes up two bytes,
85 and is stored as a little-endian short integer.
86 If the value represented is \-1, the capability is taken to be missing.
87 .PP
88 The strings section is also similar.
89 Each capability is stored as a short integer, in the format above.
90 A value of \-1 means the capability is missing.
91 Otherwise, the value is taken as an offset from the beginning
92 of the string table.
93 Special characters in ^X or \ec notation are stored in their
94 interpreted form, not the printing representation.
95 Padding information $<nn> and parameter information %x are
96 stored intact in uninterpreted form.
97 .PP
98 The final section is the string table.
99 It contains all the values of string capabilities referenced in
100 the string section.
101 Each string is null terminated.
102 .PP
103 Note that it is possible for
104 .I setupterm
105 to expect a different set of capabilities
106 than are actually present in the file.
107 Either the database may have been updated since
108 .I setupterm
109 has been recompiled
110 (resulting in extra unrecognized entries in the file)
111 or the program may have been recompiled more recently
112 than the database was updated
113 (resulting in missing entries).
114 The routine
115 .I setupterm
116 must be prepared for both possibilities \-
117 this is why the numbers and sizes are included.
118 Also, new capabilities must always be added at the end of the lists
119 of boolean, number, and string capabilities.
120 .PP
121 Despite the consistent use of little-endian for numbers and the otherwise
122 self-describing format, it is not wise to count on portability of binary
123 terminfo entries between commercial UNIX versions.  The problem is that there
124 are at least three versions of terminfo (under HP-UX, AIX, and OSF/1) which
125 diverged from System V terminfo after SVr1, and have added extension
126 capabilities to the string table that (in the binary format) collide with
127 System V and XSI Curses extensions.  See \fBterminfo\fR(\*n) for detailed
128 discussion of terminfo source compatibility issues.
129 .PP
130 As an example, here is a hex dump of the description for the Lear-Siegler
131 ADM-3, a popular though rather stupid early terminal:
132 .nf
133 .sp
134 adm3a|lsi adm3a, 
135         am, 
136         cols#80, lines#24, 
137         bel=^G, clear=\032$<1>, cr=^M, cub1=^H, cud1=^J, 
138         cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, 
139         home=^^, ind=^J, 
140 .sp
141 .ft CW
142 \s-20000  1a 01 10 00 02 00 03 00  82 00 31 00 61 64 6d 33  ........ ..1.adm3
143 0010  61 7c 6c 73 69 20 61 64  6d 33 61 00 00 01 50 00  a|lsi ad m3a...P.
144 0020  ff ff 18 00 ff ff 00 00  02 00 ff ff ff ff 04 00  ........ ........
145 0030  ff ff ff ff ff ff ff ff  0a 00 25 00 27 00 ff ff  ........ ..%.'...
146 0040  29 00 ff ff ff ff 2b 00  ff ff 2d 00 ff ff ff ff  ).....+. ..-.....
147 0050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
148 0060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
149 0070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
150 0080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
151 0090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
152 00a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
153 00b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
154 00c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
155 00d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
156 00e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
157 00f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
158 0100  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
159 0110  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
160 0120  ff ff ff ff ff ff 2f 00  07 00 0d 00 1a 24 3c 31  ....../. .....$<1
161 0130  3e 00 1b 3d 25 70 31 25  7b 33 32 7d 25 2b 25 63  >..=%p1% {32}%+%c
162 0140  25 70 32 25 7b 33 32 7d  25 2b 25 63 00 0a 00 1e  %p2%{32} %+%c....
163 0150  00 08 00 0c 00 0b 00 0a  00                       ........ .\s+2
164 .ft R
165 .fi
166 .sp
167 .PP
168 Some limitations: total compiled entries cannot exceed 4096 bytes.
169 The name field cannot exceed 128 bytes.
170 .SH FILES
171 \*d/*/* compiled terminal capability data base
172 .SH "SEE ALSO"
173 curses(3X), terminfo(\*n).
174 .\"#
175 .\"# The following sets edit modes for GNU EMACS
176 .\"# Local Variables:
177 .\"# mode:nroff
178 .\"# fill-column:79
179 .\"# End: