CHARWIN: Character-based Windowing API
Creating and Editing Border Maps
Go to:

TERCAP Option 2 (see The TERCAP Utility), allows you to define a border map. Although the border map is part of a terminal description, it has a separate option purely for convenience. For each border style, the programmer can specify which control sequence should be sent to the terminal to draw each of the border characters.

A terminal is assumed to have a maximum of three different character sets or alphabets, from which to choose the border characters. The first character set (zero) is assumed to be the default, where ASCII (and possibly the whole Latin 1) is found. The other two (1 and 2) may be used for semi-graphical characters.
For each style, the user is prompted for the character set (0, 1 or 2) that includes the characters for that style and for the code in that character set that maps to each of the border characters. The control sequences that select among the three character sets are entered as if they were mnemonics at option 1:
Original Character Set
Resulting Character Set
cs01 0 1
cs02 0 2
cs10 1 0
cs20 2 0
Consider the case of the Digital Equipment Corporation (DEC) VT320 terminal. During the /INIT command, you set the terminal to use the DEC Special Graphics Character Set (the one that contains the border characters) as G1. G0 is the default Latin 1. To switch from G0 to G1, you send a SO (shift out = ASCII 14) control and to switch from G1 to G0 a SI (shift in = ASCII 15). Therefore, the following definitions apply:
   cs01 = $c(14)
   cs10 = $c(15)
The upper left corner (UL) character occupies position 108 in the DEC Special Graphics Character Set. This is the code that must be supplied to the TERCAP utility. Caché then takes care of switching between the two character sets and optimizing the control sequences that are actually sent to the terminal. If two or more border characters occupy contiguous positions in a line (such as in the top and bottom borders), then a single SO is sent in the beginning, followed by the border codes in G1, ended by a single SI.
In general, cs01, cs02, cs10 and cs20 may be multi-byte character sequences.
Border Characters and Codes
Caché can be installed in either 8-bit or 16-bit (Unicode) mode. The 8-bit mode supports the display of the ISO Latin character sets while the 16-bit mode uses the Unicode 2.0 character set. These sets are used to store all the characters internally in globals, local variables and also in the window structures. By default, the Unicode collation is used for storage. External representations may be converted to the internal character set by I/O translation tables.
These internal character sets do not include the semi-graphical characters needed for drawing window borders. Arbitrary codes were chosen to internally represent border characters because they will be later converted to their corresponding external representations.
The table below and the TERCAP utility use the following abbreviations:
Generally, these eight characters are necessary to draw a complete window border. However, in practice, they can be reduced to six, four or even one, depending on the terminal at use and on the border style.
For those who want to provide their own output translation tables, the following list of internal codes for borders may be useful.
Style Character Code
1 BO 140
1 LE 138
1 LL 132
1 LR 134
1 RI 142
1 TO 136
1 UL 128
1 UR 130
2 BO 141
2 LE 139
2 LL 133
2 LR 135
2 RI 143
2 TO 137
2 UL 129
2 UR 131
3  — Style 3 (bold line) is like style 1 (single line) with the "bold" attribute forced on.
4 ALL 158
5 ALL 157
6 ALL 156
7 BO 149
7 LE 150
7 LL 146
7 LL 147
7 RI 151
7 TO 148
7 UL 144
7 UR 145
8  — Style 8 (medium bar) is the same as style 7 (light bar).
9 BO 155
9 TO 154
9 UL,LE,LL 152
9 UR,RI,LR 153