This appendix summarizes the ANSI code extension techniques defined in standards X3.41-1974 and X3.64-1979. Those specifications cover many special cases and details not included here.
The ANSI standards define types of characters used for specific purposes. You can determine a character's type by its position in the ASCII table (Table D-1). There are two general categories of characters:
This table and the ANSI system can work for either a 7-bit or 8-bit character environment. The VT102 uses only 7-bit characters.
NOTE: The ASCII 7-bit table corresponds to International Standards Organization (ISO) standard 646 and International Telegraph and Telephone Consultive Committee (CCITT) alphabet 5.
All control characters and groups of characters (sequences) not intended for display on the screen are control functions. Not all control functions perform an action in every ANSI device, but each device can recognize all control functions and discard any that do not apply to it. Therefore, each device performs a subset of the ANSI functions.
Because different devices use different subsets, compliance with ANSI does not mean compatibility between devices. Compliance only means that a particular function, if defined in the ANSI standard, is invoked by the same control function in all devices. If an ANSI device does not perform an action that has a control function defined in the ANSI standard, it cannot use that control function for any other purpose.
Escape and control sequences provide more controls in addition to the control characters in the ASCII 7-bit table. These multiple-character control sequences are not displayed but control the displaying, processing, and transmission of characters. At the end of a sequence or during an error condition, the terminal continues to display received characters. See Error Recovery in Chapter 5 for specific error conditions.
The format for an escape sequence is as follows.
ESC I.....I F 033 040-057 060-176 Escape Intermediate Final sequence characters character introducer (0 or more (1 character) characters)
This is the ESC character (octal 033) defined by ANSI X3.4-1977. After receiving ESC, the terminal stores (but does not display) all control characters received in the proper range.
These are characters received after ESC in the octal range of 040 - 057 (column 2 of the ASCII table). The terminal stores intermediate characters as part of the control function.
This is a character received after ESC in the octal range of 060 - 176 (columns 3 - 7 of the ASCII table). The final character indicates the end of the control function. The intermediate and final characters together define the function of the sequence. The terminal then performs the specified function and continues to display received characters. ANSI standard control functions have a final character in the octal range of 100 - 176 (columns 4 - 7 of the ASCII table). Private sequences have a final character in the octal range of 060 - 077 (column 3 of the ASCII table).
Action: Designate ASCII character set as G0.
ESC ( B 033 050 102 | | | | | +------- Final Character | +------------ Intermediate Character +----------------- Escape Sequence Introducer
The format of a control sequence is as follows.
CSI P.....P I.....I F 033 133 060-077 040-057 100-176 Control Parameter Intermediate Final character sequence characters characters (1 character) introducer (0 or more (0 or more characters) characters)
The CSI is the ESC (octal 033) and [ (octal 133) characters defined by ANSI X3.41-1977. These characters provide 8-bit control functions by using 7-bit characters. The VT102 supports only 7-bit characters. After receiving CSI characters, the terminal stores (but does not display) all control characters received in the proper range.
These are characters received after the CSI character, in the octal range of 060 - 077 (column 3 of the ASCII table). The parameter characters modify the action or interpretation of the control function. The terminal interprets parameter characters as private when the < = > ? characters (octal 074 - 077) begin the paramter string. The : character (octal 072) is reserved. This means an ANSI-specified control sequence can have a parameter function with a private interpretation.
The terminal uses two types of parameter characters, numeric and selective. A numeric parameter represents a decimal number, designated by Pn. The decimal characters have a range of 0 - 9 (octal 060 - 071). A selective parameter comes from a list of specified parameters, designated by Ps.
If a control sequence includes more than one parameter, the parameters are separated by a delimiter, the ; character (octal 073).
These are characters received after the CSI character, in the octal range of 040 - 057 (column 2 of the ASCII table). The terminal stores these characters as part of the control function.
NOTE: The terminal does not use intermediate characters in control functions.
This is a character received after the CSI character, in the octal range of 100 - 176 (columns 4 - 7 of the ASCII table). The final character indicates the end of the control function. The intermediate and final characters together define the function of the sequence. The terminal then performs the specified function and continues to display received characters. ANSI standard control functions have a final character in the octal range of 100 - 157 (columns 4 - 6 of the ASCII table). Private sequences have a final character in the octal range of 160 - 176 (column 7 of the ASCII table).
Action: Clear all horizontal tabs.
ESC [ 3 g 033 133 063 147 | | | | +--+-+ | | | | +----- Final Character | +---------- Parameter Character +----------------- Control Sequence Introducer
These examples show the use of multiple functions selected in one sequence, private parameters and private sequences.
ESC [ ? 4 h Set smooth scroll mode 033 133 077 064 150 (? = ANSI private parameter) ESC [ 2 ; 1 y Invoke self-test 033 133 062 073 061 171 (y = ANSI private sequence)