Character Attributes - Enhanced

PRO/5 makes some basic assumptions about the way the terminal handles character attributes. PRO/5 assumes that character attributes "ride with the cursor" and that they leave no "magic cookies." If the terminal in question does not comply with these assumptions, then character attributes cannot be used.

The following fields may be used to describe character attributes. These fields may be used only if attributes are both additive and subtractive. In other words, these fields will work if the terminal can set and reset attributes independently of each other. For example, if the terminal was currently displaying characters blinking and underlined, it should be possible to turn off underline without turning off blinking. While this seems reasonable in concept, few terminals have this behavior.

Field

Description

MA=

Sets high intensity on

MB=

Sets high intensity off

MC=

Sets blink on

MD=

Sets blink off

ME=

Sets reverse video on

MF=

Sets reverse video off

us=

Sets underscore on

ue=

Sets underscore off

Many terminals conform to the ANSI standard for setting and resetting character attributes. In ANSI, character attributes are additive but not subtractive. This means if an application wants to turn off an attribute but leave any other attribute settings intact, it must turn off all of the attributes and then turn back on any attributes that are still in effect. The presence of an :AA: field tells PRO/5 to use ANSI sequences for attribute handling. The :AA: field is used in lieu of the above fields.

The ANSI escape sequence for establishing character attributes includes a list of desired attributes. The following ANSI modes are normally used:

Attribute

Mode

High-intensity

1

Reverse

7

Underline

4

Blink

5

Some terminals support a "low intensity" attribute as mode 2. This is usually as a replacement of "high intensity" mode 1. In this case, the field :AA=2745: should be used. Normal ANSI control simply requires :AA: as a Boolean field. As another example, if ANSI sequences were desired, but without underline, then :AA=1705: would be used.

Finally, as a last resort, PRO/5 may be explicitly told how to handle character attributes. PRO/5 supports four attributes: BRIGHT, REVERSE, UNDERLINE, and BLINK. This allows 16 possible combinations that means that PRO/5 must be taught 16 different escape sequences. The Wyse 60 manuals describe the escape sequences for setting character attributes as "ESC G attr". A legend in the manual explains the various values for attr that is used to set combinations of attributes as well as single attributes. Values are listed in the legend for all possible combinations of character attributes. Since the Wyse 60 supports more than the four attributes recognized by PRO/5, there are more than 16 possible values listed. However, only the 16 possibilities required by PRO/5 are of interest.

The first step is to assign numeric values to each attribute. The simplest way is to assign BRIGHT=1, REVERSE=2, UNDERLINE=4, and BLINK=8. Notice how powers of 2 were chosen. PRO/5 must be told what values were chosen for each attribute with:

:Cm=1248:

PRO/5 will use these values to establish a "composite value" for any combination of attributes. For example, if blinking and underlining were desired, PRO/5 would add the value for blinking (4) and the value for underlining (8) and come up with 12.

The next step is to tell PRO/5 how to begin an escape sequence to set attributes. This is done with the :Co=: string. On the Wyse 60 it would be given as:

:Co=\EG:

The :Cp=: string is then used to determine which of 16 possible sequences is to be sent for the desired attributes. This string is simply a concatenation of 16 smaller strings representing composite attribute values 0..15. On the Wyse 60, the actual attribute code comprises only one character so the :Cp=: string would be 16 characters long. The simplest way to determine what characters are used is to make a table with all attribute combinations:

Value

Meaning

0

normal

1

Bright

2

Reverse

3

Bright+Reverse

4

Underline

5

Bright+Underline

6

Reverse+Underline

7

Bright+Reverse+Underline

8

Blink

9

Bright+Blink

10

Reverse+Blink

11

Bright+Reverse+Blink

12

Underline+Blink

13

Bright+Underline+Blink

14

Reverse+Underline+Blink

15

Bright+Reverse+Underline+Blink

The table is then matched with the legend in the Wyse 60 manual. Unfortunately, the Wyse 60 has an attribute for DIM instead of BRIGHT. This means that any PRO/5 attribute that is NOT BRIGHT must contain the Wyse DIM attribute (since BRIGHT is the default on the Wyse).

Value

Meaning

Wyse Code

0

Normal

p (DIM only)

1

Bright

0 (Wyse normal, not DIM)

2

Reverse

t

3

Bright+Reverse

4

4

Underline

x

5

Bright+Underline

8

6

Reverse+Underline

|

7

Bright+Reverse+Underline

<

8

Blink

r

9

Bright+Blink

2

10

Reverse+Blink

v

11

Bright+Reverse+Blink

6

12

Underline+Blink

z

13

Bright+Underline+Blink

:

14

Reverse+Underline+Blink

~

15

Bright+Reverse+Underline+Blink

>

Now that the 16 codes are known in their proper order the :Cp=: string can be given as:

:Cp=p0t4x8|<r2v6z\072~>:

Notice the "\072" used for the ":".

After the :Cp=: string, the :Cq=: string is given to specify the trailing part of the escape sequence. Since the Wyse 60 does not require anything to follow the attribute code, the string :Cq=: should be empty:

:Cq=:

Finally, PRO/5 must be told how many attribute codes are actually contained in the :Cp=: string. This is done with the :Cr#: field:

:Cr#16:

PRO/5 assumes that each attribute code (in :Cp=:) is the same number of characters long.

If it is possible for the attribute code to be plugged directly into the escape sequence without the need for translation through the :Cp=: string, then the :Cn=: string can be used. The :Cn=: string replaces the :Co=:, :Cp=:, and :Cq=: strings. The :Cn=: string is processed in a manner similar to the :cm=: (cursor movement) string in which a "%" code is substituted with the desired attribute value.