ANSI X3.64 - Biblioteka.sk

Upozornenie: Prezeranie týchto stránok je určené len pre návštevníkov nad 18 rokov!
Zásady ochrany osobných údajov.
Používaním tohto webu súhlasíte s uchovávaním cookies, ktoré slúžia na poskytovanie služieb, nastavenie reklám a analýzu návštevnosti. OK, súhlasím


Panta Rhei Doprava Zadarmo
...
...


A | B | C | D | E | F | G | H | CH | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

ANSI X3.64
 ...

ANSI X3.64 (ISO/IEC 6429)
Output of the system-monitor htop, an ncurses-application (which uses SGR and other ANSI/ISO control sequences).
Standard
ClassificationISO/IEC 2022 based control code and control sequence set
Other related encoding(s)

Other control function standards:

ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as commands, rather than text to display verbatim.

ANSI sequences were introduced in the 1970s to replace vendor-specific sequences and became widespread in the computer equipment market by the early 1980s. They are used in development, scientific, commercial text-based applications as well as bulletin board systems to offer standardized functionality.

Although hardware text terminals have become increasingly rare in the 21st century, the relevance of the ANSI standard persists because a great majority of terminal emulators and command consoles interpret at least a portion of the ANSI standard.

History

Almost all manufacturers of video terminals added vendor-specific escape sequences to perform operations such as placing the cursor at arbitrary positions on the screen. One example is the VT52 terminal, which allowed the cursor to be placed at an x,y location on the screen by sending the ESC character, a Y character, and then two characters representing numerical values equal to the x,y location plus 32 (thus starting at the ASCII space character and avoiding the control characters). The Hazeltine 1500 had a similar feature, invoked using ~, DC1 and then the X and Y positions separated with a comma. While the two terminals had identical functionality in this regard, different control sequences had to be used to invoke them.

As these sequences were different for different terminals, elaborate libraries such as termcap ("terminal capabilities") and utilities such as tput had to be created so programs could use the same API to work with any terminal. In addition, many of these terminals required sending numbers (such as row and column) as the binary values of the characters; for some programming languages, and for systems that did not use ASCII internally, it was often difficult to turn a number into the correct character.

The ANSI standard attempted to address these problems by making a command set that all terminals would use and requiring all numeric information to be transmitted as ASCII numbers. The first standard in the series was ECMA-48, adopted in 1976.[1] It was a continuation of a series of character coding standards, the first one being ECMA-6 from 1965, a 7-bit standard from which ISO 646 originates. The name "ANSI escape sequence" dates from 1979 when ANSI adopted ANSI X3.64. The ANSI X3L2 committee collaborated with the ECMA committee TC 1 to produce nearly identical standards. These two standards were merged into an international standard, ISO 6429.[1] In 1994, ANSI withdrew its standard in favor of the international standard.

DEC VT100 terminal
The DEC VT100 video display terminal.

The first popular video terminal to support these sequences was the Digital VT100, introduced in 1978.[2] This model was very successful in the market, which sparked a variety of VT100 clones, among the earliest and most popular of which was the much more affordable Zenith Z-19 in 1979.[3] Others included the Qume QVT-108, Televideo TVI-970, Wyse WY-99GT as well as optional "VT100" or "VT103" or "ANSI" modes with varying degrees of compatibility on many other brands. The popularity of these gradually led to more and more software (especially bulletin board systems and other online services) assuming the escape sequences worked, leading to almost all new terminals and emulator programs supporting them.

In 1981, ANSI X3.64 was adopted for use in the US government by FIPS publication 86. Later, the US government stopped duplicating industry standards, so FIPS pub. 86 was withdrawn.[4]

ECMA-48 has been updated several times and is currently at its 5th edition, from 1991. It is also adopted by ISO and IEC as standard ISO/IEC 6429.[5] A version is adopted as a Japanese Industrial Standard, as JIS X 0211.

Related standards include ITU T.61, the Teletex standard, and the ISO/IEC 8613, the Open Document Architecture standard (mainly ISO/IEC 8613-6 or ITU T.416). The two systems share many escape codes with the ANSI system, with extensions that are not necessarily meaningful to computer terminals. Both systems quickly fell into disuse, but ECMA-48 does mark the extensions used in them as reserved.

Platform support

Xterm terminal emulator
The Xterm terminal emulator.

In the early 1980s, large amounts of software directly used these sequences to update screen displays. This included everything on VMS (which assumed Dec terminals), most software designed to be portable on CP/M home computers, and even lots of Unix software as it was easier to use than the termcap libraries, such as the shell script examples below in this article.

Terminal emulators for communicating with remote machines almost always implement ANSI escape codes. This includes anything written to communicate with bulletin-board systems on home and personal computers. On Unix terminal emulators such as xterm also can communicate with software running on the same machine, and thus software running in X11 under a terminal emulator could assume the ability to write these sequences.

As computers got more powerful even built-in displays started supporting them, allowing software to be portable between CP/M systems. There were attempts to extend the escape sequences to support printers[6] and as an early PDF-like document storage format, the Open Document Architecture.[citation needed]

DOS and Windows

The IBM PC, introduced in 1983, did not support these or any other escape sequences for updating the screen. Only a few control characters (BEL, CR, LF, BS) were interpreted by the underlying BIOS. Any display effects had to be done with BIOS calls, which were notoriously slow, or by directly manipulating the IBM PC hardware. This made any interesting software non-portable and led to the need to duplicate details of the display hardware in PC Clones.

DOS version 2.0 included optional support with a device driver named ANSI.SYS. Poor performance, and the fact that it was not installed by default, meant software rarely took advantage of it. Some other systems did try to address the need for these sequences, many clones of DOS handled them without a driver, and OS/2 had an ANSI command that enabled the sequences.

The Windows Console did not support ANSI escape sequences, nor did Microsoft provide any method to enable them. Some replacements or additions for the console window such as JP Software's TCC (formerly 4NT), Michael J. Mefford's ANSI.COM, Jason Hood's ANSICON[7] and Maximus5's ConEmu interpreted ANSI escape sequences printed by programs. A Python package named colorama[8] internally interprets ANSI escape sequences in text being printed, translating them to win32 calls to modify the state of the terminal, to make it easier to port Python code using ANSI to Windows. Cygwin performs similar translation to all output written to the console using Cygwin file descriptors, the filtering is done by the output functions of cygwin1.dll, to allow porting of POSIX C code to Windows.

In 2016, Microsoft released the Windows 10 version 1511 update which unexpectedly implemented support for ANSI escape sequences, over two decades after the debut of Windows NT.[9] This was done alongside Windows Subsystem for Linux, apparently to allow Unix-like terminal-based software to use the Windows Console. Windows PowerShell 5.1 enabled this by default, and PowerShell 6 made it possible to embed the necessary ESC character into a string with `e.[10]

Windows Terminal, introduced in 2019, supports the sequences by default, and Microsoft intends to replace the Windows Console with Windows Terminal.[11]

Description

C0 control codes

Almost all users assume some functions of some single-byte characters. Initially defined as part of ASCII, the default C0 control code set is now defined in ISO 6429 (ECMA-48), making it part of the same standard as the C1 set invoked by the ANSI escape sequences (although ISO 2022 allows the ISO 6429 C0 set to be used without the ISO 6429 C1 set, and vice versa, provided that 0x1B is always ESC). This is used to shorten the amount of data transmitted, or to perform some functions that are unavailable from escape sequences:

Popular C0 control codes (not an exhaustive list)
^ C0 Abbr Name Effect
^G 0x07 BEL Bell Makes an audible noise.
^H 0x08 BS Backspace Moves the cursor left (but may "backwards wrap" if cursor is at start of line).
^I 0x09 HT Tab Moves the cursor right to next multiple of 8.
^J 0x0A LF Line Feed Moves to next line, scrolls the display up if at bottom of the screen. Usually does not move horizontally, though programs should not rely on this.
^L 0x0C FF Form Feed Move a printer to top of next page. Usually does not move horizontally, though programs should not rely on this. Effect on video terminals varies.
^M 0x0D CR Carriage Return Moves the cursor to column zero.
^edit

If the ESC is followed by a byte in the range 0x40 to 0x5F, the escape sequence is of type Fe. Its interpretation is delegated to the applicable C1 control code standard.[12]: 13.2.1  Accordingly, all escape sequences corresponding to C1 control codes from ANSI X3.64 / ECMA-48 follow this format.[5]: 5.3.a 

The standard says that, in 8-bit environments, the control functions corresponding to type Fe escape sequences (those from the set of C1 control codes) can be represented as single bytes in the 0x80–0x9F range.[5]: 5.3.b  This is possible in character encodings conforming to the provisions for an 8-bit code made in ISO 2022, such as the ISO 8859 series. However, in character encodings used on modern devices such as UTF-8 or CP-1252, those codes are often used for other purposes, so only the 2-byte sequence is typically used. In the case of UTF-8, representing a C1 control code via the C1 Controls and Latin-1 Supplement block results in a different two-byte code (e.g. 0xC2,0x8E for U+008E), but no space is saved this way.

Some type Fe (C1 set element) ANSI escape sequences (not an exhaustive list)
Code C1 Abbr Name Effect
ESC N 0x8E SS2 Single Shift Two Select a single character from one of the alternative character sets. SS2 selects the G2 character set, and SS3 selects the G3 character set.[13] In a 7-bit environment, this is followed by one or more GL bytes (0x20–0x7F) specifying a character from that set.[12]: 9.4  In an 8-bit environment, these may instead be GR bytes (0xA0–0xFF).[12]: 8.4 
ESC O 0x8F SS3 Single Shift Three
ESC P 0x90 DCS Device Control String Terminated by ST.[5]: 5.6  Xterm's uses of this sequence include defining User-Defined Keys, and requesting or setting Termcap/Terminfo data.[13]
ESC 0x9B CSI Control Sequence Introducer Starts most of the useful sequences, terminated by a byte in the range 0x40 through 0x7E.[5]: 5.4 
ESC \ 0x9C ST String Terminator Terminates strings in other controls.[5]: 8.3.143 
ESC 0x9D OSC Operating System Command Starts a control string for the operating system to use, terminated by ST.[5]: 8.3.89 
ESC X 0x98 SOS Start of String Takes an argument of a string of text, terminated by ST.[5]: 5.6  The uses for these string control sequences are defined by the application[5]: 8.3.2, 8.3.128  or privacy discipline.[5]: 8.3.94  These functions are rarely implemented and the arguments are ignored by xterm.[13] Some Kermit clients allow the server to automatically execute Kermit commands on the client by embedding them in APC sequences; this is a potential security risk if the server is untrusted.[14]
ESC ^ 0x9E PM Privacy Message
ESC _ 0x9F APC Application Program Command

CSI (Control Sequence Introducer) sequencesedit

For Control Sequence Introducer, or CSI, commands, the ESC (written as \e or \033 in several programming languages) is followed by any number (including none) of "parameter bytes" in the range 0x30–0x3F (ASCII 0–9:;<=>?), then by any number of "intermediate bytes" in the range 0x20–0x2F (ASCII space and !"#$%&'()*+,-./), then finally by a single "final byte" in the range 0x40–0x7E (ASCII @A–Z\^_`a–z{|}~).[5]: 5.4 

All common sequences just use the parameters as a series of semicolon-separated numbers such as 1;2;3. Missing numbers are treated as 0 (1;;3 acts like the middle number is 0, and no parameters at all in ESCm acts like a 0 reset code). Some sequences (such as CUU) treat 0 as 1 in order to make missing parameters useful.[5]: F.4.2 

A subset of arrangements was declared "private" so that terminal manufacturers could insert their own sequences without conflicting with the standard. Sequences containing the parameter bytes <=>? or the final bytes 0x70–0x7E (p–z{|}~) are private.

The behavior of the terminal is undefined in the case where a CSI sequence contains any character outside of the range 0x20–0x7E. These illegal characters are either C0 control characters (the range 0–0x1F), DEL (0x7F), or bytes with the high bit set. Possible responses are to ignore the byte, to process it immediately, and furthermore whether to continue with the CSI sequence, to abort it immediately, or to ignore the rest of it.[citation needed]

Some ANSI control sequences (not an exhaustive list)
Code Abbr Name Effect
CSI n A CUU Cursor Up Moves the cursor n (default 1) cells in the given direction. If the cursor is already at the edge of the screen, this has no effect.
CSI n B CUD Cursor Down
CSI n C CUF Cursor Forward
CSI n D CUB Cursor Back
CSI n E CNL Cursor Next Line Moves cursor to beginning of the line n (default 1) lines down. (not ANSI.SYS)
CSI n F CPL Cursor Previous Line Moves cursor to beginning of the line n (default 1) lines up. (not ANSI.SYS)
CSI n G CHA Cursor Horizontal Absolute Moves the cursor to column n (default 1). (not ANSI.SYS)
CSI n ; m H CUP Cursor Position Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted. A sequence such as CSI ;5H is a synonym for CSI 1;5H as well as CSI 17;H is the same as CSI 17H and CSI 17;1H
CSI n J ED Erase in Display Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen (and moves cursor to upper left on DOS ANSI.SYS). If n is 3, clear entire screen and delete all lines saved in the scrollback buffer (this feature was added for xterm and is supported by other terminal applications).
CSI n K EL Erase in Line Erases part of the line. If n is 0 (or missing), clear from cursor to the end of the line. If n is 1, clear from cursor to beginning of the line. If n is 2, clear entire line. Cursor position does not change.
CSI n S SU Scroll Up Scroll whole page up by n (default 1) lines. New lines are added at the bottom. (not ANSI.SYS)
CSI n T SD Scroll Down Scroll whole page down by n (default 1) lines. New lines are added at the top. (not ANSI.SYS)
CSI n ; m f HVP Horizontal Vertical Position Same as CUP, but counts as a format effector function (like CR or LF) rather than an editor function (like CUD or CNL). This can lead to different handling in certain terminal modes.[5]: Annex A 
CSI n m SGR Select Graphic Rendition Sets colors and style of the characters following this code
CSI 5i AUX Port On Enable aux serial port usually for local serial printer
CSI 4i AUX Port Off Disable aux serial port usually for local serial printer

CSI 6n DSR Device Status Report Reports the cursor position (CPR) by transmitting ESCn;mR, where n is the row and m is the column.
Some popular private sequences
Code Abbr Name Effect
CSI s SCP, SCOSC Save Current Cursor Position Saves the cursor position/state in SCO console mode.[15] In vertical split screen mode, instead used to set (as CSI n ; n s) or reset left and right margins.[16]
CSI u RCP, SCORC Restore Saved Cursor Position Restores the cursor position/state in SCO console mode.[17]
CSI ? 25 h DECTCEM Shows the cursor, from the VT220.
CSI ? 25 l DECTCEM Hides the cursor.
CSI ? 1004 h Enable reporting focus. Reports whenever terminal emulator enters or exits focus as ESC I and ESC O, respectively.
CSI ? 1004 l Disable reporting focus.
CSI ? 1049 h Enable alternative screen buffer, from xterm
CSI ? 1049 l Disable alternative screen buffer, from xterm
CSI ? 2004 h Turn on bracketed paste mode.[18] In bracketed paste mode, text pasted into the terminal will be surrounded by ESC 200~ and ESC 201~; programs running in the terminal should not treat characters bracketed by those sequences as commands (Vim, for example, does not treat them as commands).[19] From xterm[20]
CSI ? 2004 l Turn off bracketed paste mode.

SGR (Select Graphic Rendition) parametersedit

The control sequence CSI n m, named Select Graphic Rendition (SGR), sets display attributes. Several attributes can be set in the same sequence, separated by semicolons.[21] Each display attribute remains in effect until a following occurrence of SGR resets it.[5] If no codes are given, CSI m is treated as CSI 0 m (reset / normal).

Zdroj:https://en.wikipedia.org?pojem=ANSI_X3.64
Text je dostupný za podmienok Creative Commons Attribution/Share-Alike License 3.0 Unported; prípadne za ďalších podmienok. Podrobnejšie informácie nájdete na stránke Podmienky použitia.






Text je dostupný za podmienok Creative Commons Attribution/Share-Alike License 3.0 Unported; prípadne za ďalších podmienok.
Podrobnejšie informácie nájdete na stránke Podmienky použitia.

Your browser doesn’t support the object tag.

www.astronomia.sk | www.biologia.sk | www.botanika.sk | www.dejiny.sk | www.economy.sk | www.elektrotechnika.sk | www.estetika.sk | www.farmakologia.sk | www.filozofia.sk | Fyzika | www.futurologia.sk | www.genetika.sk | www.chemia.sk | www.lingvistika.sk | www.politologia.sk | www.psychologia.sk | www.sexuologia.sk | www.sociologia.sk | www.veda.sk I www.zoologia.sk


n Name Note
0 Reset or normal All attributes become turned off
1 Bold or increased intensity As with faint, the color change is a PC (SCO / CGA) invention.[22][better source needed]
2 Faint, decreased intensity, or dim May be implemented as a light font weight like bold.[23]
3 Italic Not widely supported. Sometimes treated as inverse or blink.[22]
4 Underline Style extensions exist for Kitty, VTE, mintty, iTerm2 and Konsole.[24][25][26]
5 Slow blink Sets blinking to less than 150 times per minute
6 Rapid blink MS-DOS ANSI.SYS, 150+ per minute; not widely supported
7 Reverse video or invert Swap foreground and background colors; inconsistent emulation[27][dubious ]
8 Conceal or hide Not widely supported.
9 Crossed-out, or strike Characters legible but marked as if for deletion. Not supported in Terminal.app.
10 Primary (default) font
11–19 Alternative font Select alternative font n − 10
20 Fraktur (Gothic) Rarely supported
21 Doubly underlined; or: not bold Double-underline per ECMA-48,[5]: 8.3.117  but instead disables bold intensity on several terminals, including in the Linux kernel's console before version 4.17.[28]
22 Normal intensity Neither bold nor faint; color changes where intensity is implemented as such.
23 Neither italic, nor blackletter
24 Not underlined Neither singly nor doubly underlined
25 Not blinking Turn blinking off
26 Proportional spacing ITU T.61 and T.416, not known to be used on terminals
27 Not reversed
28