ISO/IEC 2022 decoder

ISO/IEC 2022 decoder

[1949] This is an experimental English implementation of ISO/IEC 2022 receiving device's input byte stream interpreter.

ISO/IEC 2022

ISO/IEC 2022 Decoder

[99] The ISO/IEC 2022 decoder steps, with byte getter byte getter and state initialization steps initialization steps, are as follows:

  1. [8] Let state be a new state.
  2. [1464] Let state's input getter be the 8-bit input getter.
  3. [327] Modify character sets of state for « "fixed", "fallback", "iso2022" ».
  4. [6] Let output stream be a new output stream.
  5. [9] Run initialization steps with state.
  6. [1468] Let next be null.
  7. [1456] While next is not end-of-file:
    1. [1457] If state's current frame length is 0:
      1. [1455] Set state's current frame length to null.
      2. [1458] Set next to an end-of-frame (false).
    2. [1459] Otherwise:
      1. [1460] Set next to the result of running input getter with byte getter.
      2. [1461] If next is end-of-file:
        1. [1462] If state's current frame length is not null:
          1. [1463] Set next to an end-of-frame (true).
        2. [1466] Set state's input getter to the empty input getter.
      3. [1469] Otherwise:
        1. [1471] If state's current frame length is not null:
          1. [1470] Set state's current frame length to state's current frame length - 1.
        2. [1761] If state's current capturing byte is not null:
          1. [1762] Set state's macro set [ state's current capturing byte ] to state's macro set [ state's current capturing byte ] followed by next.
          2. [1792] If state's macro set [ state's current capturing byte ]'s length is greater than the maximum sequence length:
            1. [1793] Error.
            2. [1942] Set state's input getter to the 8-bit input getter.
            3. [1794] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
            4. [1795] Set state's decoder state to opaque state.
    3. [1467] Process the next input character with state, next.
  8. [7] Return output stream.

[1] A state is:

fixed set
Character set.
escape set
Character set.
macro set
Ordered map. Initially, an empty ordered map.
94 final set
Ordered map. Initially, an empty ordered map.
96 final set
Ordered map. Initially, an empty ordered map.
94n final set
Ordered map. Initially, an empty ordered map.
96n final set
Ordered map. Initially, an empty ordered map.
94n final RL set
Ordered map. Initially, an empty ordered map.
C0 designated
C0 set. Initially, the initial C0 set.
C1 designated
C1 set. Initially, the empty C1 set.
C1 override designated
C1 set or null. Initially, null.
G0 designated
G set, unknown-94, or unknown-96. Initially, unknown-96.
G1 designated
G set, unknown-94, or unknown-96. Initially, unknown-96.
G2 designated
G set, unknown-94, or unknown-96. Initially, unknown-96.
G3 designated
G set, unknown-94, or unknown-96. Initially, unknown-96.
G0 RL designated
942 set or unknown-94. Initially, unknown-94.
G1 RL designated
942 set or unknown-94. Initially, unknown-94.
G2 RL designated
942 set or unknown-94. Initially, unknown-94.
G3 RL designated
942 set or unknown-94. Initially, unknown-94.
Gj designated
94 set. Initially, unknown-94.
S1 designated
942 set.
S2 designated
942 set.
left designated
G set or 128 set.
right designated
128 set. Initially, the result of getting a 128 set unknown-byte, null.
opaque designated
256 set.
CR invoked
C element. Initially, C1.
GL invoked
G element or null. Initially, null.
GR invoked
G element or null. Initially, null.
CL mode
CL mode. Initially, iso2022.
GL mode
GL mode. Initially, iso2022.
right mode
A right mode. Initially, iso2022.
shift plane 2 mode
normal or jisx0213. Initially, normal.
bits
8-bit or 7-bit. Initially, 8-bit.
XON/XOFF flag
Boolean. Initially, false.
VT response flag
Boolean. Initially, false.
ISO 4873 Latin-1 flag
Boolean. Initially, false.
Unicode 1.1 flag
Boolean. Initially, false.
UTF-8 GL flag
Boolean. Initially, false.
LS0 by G0 designation flag
Boolean. Initially, false.
data syntax 2 default mode
serial or parallel. Initially, serial.
videotex basic kernel flag
Boolean. Initially, false.
lib flag
Boolean. Initially, false.
current byte sequence
Byte sequence.
current element
C element or G element.
current size
94 or 96.
current bytes
1, 2, or 3.
current I byte
Byte.
current J byte
Byte or null.
current revision byte
Byte or null. Initially, null.
current segment length
Non-negative integer or null.
current segment data
Byte sequence.
current capturing byte
Byte or null. Initially, null.
current macro
Macro or null. Initially, null.
current frame length
Non-negative integer or null. Initially, null.
current control sequence
Character string.
decoder state
One of decoder states. Initially, default state.
previous state
State or null. Initially, null.
previous GL mode
GL mode or null. Initially, null.
previous left designated
G set or 128 set.
previous code point
Code point or null. Initially, null

[223] A C element is C0 or C1.

[100] A G element is G0, G1, G2, G3, or Gj.

[2242] A CL mode is one of: iso2022, single-esc, single-most-c0, and single-right-esc.

[1704] A GL mode is one of: iso2022, captain, unicode, telesoftware, single, and single-right.

[1291] A right mode is one of: iso2022, iso2022jp, unicode, utf-1, utf-8, single, sjis, big5, uhc, johab, hangultalk, gb18030, and x-moe-internal.

[117] A maximum sequence length is an implementation-specific integer, e.g. 15.

[94] A maximum chunk length is an implementation-specific integer, e.g. 230 - 1.

[315] To get invoked set with state state and G element or null element, run these steps:

  1. [302] If element is null:
    1. [303] Return unknown-96.
  2. [304] Otherwise, if element is G0:
    1. [305] Return state's G0 designated.
  3. [306] Otherwise, if element is G1:
    1. [307] Return state's G1 designated.
  4. [308] Otherwise, if element is G2:
    1. [309] Return state's G2 designated.
  5. [310] Otherwise, if element is G3:
    1. [311] Return state's G3 designated.

[796] To get RL invoked set with state state and G element or null element, run these steps:

  1. [797] If element is null:
    1. [798] Return unknown-94.
  2. [799] Otherwise, if element is G0:
    1. [800] Return state's G0 RL designated.
  3. [801] Otherwise, if element is G1:
    1. [802] Return state's G1 RL designated.
  4. [803] Otherwise, if element is G2:
    1. [804] Return state's G2 RL designated.
  5. [805] Otherwise, if element is G3:
    1. [806] Return state's G3 RL designated.

Initialization

[20] When the ISO/IEC 2022 decoder steps are invoked, a set of steps, referred to as the state initialization steps, can be specified. There are the following requirements for them, with state given by the ISO/IEC 2022 decoder steps:

Input stream

input stream:

[1791] An input item is a byte, a character, end-of-frame, or end-of-file.

[1818] To get a UCS input item for c, with state of the steps to process the next input character, run these steps:

  1. [1819] If c is in [ 0x00, 0xFF ]:
    1. [1820] Return a bit combination whose value is c.
  2. [1905] Otherwise, if c is greater than 0x7FFFFFFF:
    1. [1906] Return character (unicode, non-10646, c).
  3. [1821] Otherwise, if c is greater than 0x10FFFF:
    1. [1822] Return character (unicode, non-unicode, c).
  4. [1823] Otherwise:
    1. [1825] If state's Unicode 1.1 flag is true and c is in [ 0x3400, 0x4DFF ]:
      1. [1826] Return character (unicode, 1.1, c).
    2. [1824] Return a code point whose value is c.

[1472] An end-of-frame is a tuple of incomplete (boolean).


[1574] A byte getter is a steps that returns a byte or null. It represents an input byte stream. Whenever invoked, it is expected to return a byte from the stream it represents, in order. It is expected to return a null after the end of the stream is reached.

[1780] An input getter is the empty input getter, the 8-bit input getter, the SCSU input getter, the UCS-2BE input getter, the UCS-2LE input getter. the UCS-4BE input getter, the UCS-4LE input getter, the UTF-16BE input getter, and the UTF-16LE input getter.

[1779] The empty input getter run these steps:

  1. [1790] Return end-of-file.

[1775] An 8-bit input getter run these steps with state and byte getter byte getter:

  1. [1785] Let byte be the result of running getter.
  2. [1786] If byte is null:
    1. [1787] Return end-of-file.
  3. [1788] Otherwise:
    1. [1789] Return byte.

[1069] To get input bytes with byte getter byte getter and integer n, run these steps:

  1. [1070] Let bytes be an empty list.
  2. [1101] Let m be n.
  3. [1827] While m is greater than 0:
    1. [1828] Let byte be the result of running byte getter.
    2. [1829] If byte is null:
      1. [1830] Return bytes.
      2. [1832] Abort these steps.
    3. [1831] Otherwise:
      1. [1833] Append byte to bytes.
      2. [1900] Set m to m - 1.
  4. [1834] Return bytes.

[2181] The SCSU input getter run these steps with state and byte getter byte getter:

[1796] The UCS-2BE input getter run these steps with state and byte getter byte getter:

  1. [1835] Let bytes be the result of running the steps to get input bytes with 2 and byte getter.
  2. [1836] If bytes's length is 2:
    1. [1805] Let c be bytes [ 0 ] × 0x100 + bytes [ 1 ].
    2. [1806] Return the result of getting a UCS input item c.
  3. [1799] Otherwise, if bytes's length is 0:
    1. [1800] Return end-of-file.
  4. [1797] Otherwise:
    1. [1465] Set state's input getter to the empty input getter.
    2. [1798] Return U+FFFD.

[1807] The UCS-2LE input getter run these steps with state and byte getter byte getter:

  1. [1801] Let bytes be the result of running the steps to get input bytes with 2 and byte getter.
  2. [1802] If bytes's length is 2:
    1. [1803] Let c be bytes [ 1 ] × 0x100 + bytes [ 0 ].
    2. [1804] Return the result of getting a UCS input item c.
  3. [1808] Otherwise, if bytes's length is 0:
    1. [1809] Return end-of-file.
  4. [1810] Otherwise:
    1. [1811] Set state's input getter to the empty input getter.
    2. [1849] Return U+FFFD.

[1812] The UCS-4BE input getter run these steps with state and byte getter byte getter:

  1. [1813] Let bytes be the result of running the steps to get input bytes with 4 and byte getter.
  2. [1814] If bytes's length is 4:
    1. [1815] Let c be bytes [ 0 ] × 0x1000000 + bytes [ 1 ] × 0x10000 + bytes [ 2 ] × 0x100 + bytes [ 3 ].
    2. [1816] Return the result of getting a UCS input item c.
  3. [1817] Otherwise, if bytes's length is 0:
    1. [1837] Return end-of-file.
  4. [1838] Otherwise:
    1. [1839] Set state's input getter to the empty input getter.
    2. [1850] Return U+FFFD.

[1840] The UCS-4LE input getter run these steps with state and byte getter byte getter:

  1. [1841] Let bytes be the result of running the steps to get input bytes with 4 and byte getter.
  2. [1842] If bytes's length is 4:
    1. [1843] Let c be bytes [ 3 ] × 0x1000000 + bytes [ 2 ] × 0x10000 + bytes [ 1 ] × 0x100 + bytes [ 0 ].
    2. [1844] Return the result of getting a UCS input item c.
  3. [1845] Otherwise, if bytes's length is 0:
    1. [1846] Return end-of-file.
  4. [1847] Otherwise:
    1. [1848] Set state's input getter to the empty input getter.
    2. [1851] Return U+FFFD.

[1852] The UTF-16BE input getter run these steps with state and byte getter byte getter:

  1. [1860] If state's previous character is not null:
    1. [1861] Let char be state's previous character.
  2. [1862] Otherwise:
    1. [1853] Let char be the result of running the UCS-2BE input getter with state and byte getter.
  3. [1854]
    If char is in [ XXX ]:
    1. [1857] Set char2 be the result of running the UCS-2BE input getter with state and byte getter.
    2. If char is in [ XXX ]:
      1. [1876] Set state's previous code point to null.
      2. Return XXX.
    3. [1855] Otherwise:
      1. [1856] Set state's previous code point to char.
      2. [1863] Return char.
  4. [1858] Otherwise:
    1. [1877] Set state's previous code point to null.
    2. [1859] Return char.

[1864] The UTF-16LE input getter run these steps with state and byte getter byte getter:

  1. [1865] If state's previous character is not null:
    1. [1866] Let char be state and state's previous character.
  2. [1867] Otherwise:
    1. [1868] Let char be the result of running the UCS-2LE input getter with byte getter.
  3. [1869]
    If char is in [ XXX ]:
    1. [1870] Set char2 be the result of running the UCS-2LE input getter with state and byte getter.
    2. If char is in [ XXX ]:
      1. [1878] Set state's previous code point to null.
      2. Return XXX.
    3. [1871] Otherwise:
      1. [1872] Set state's previous code point to char.
      2. [1873] Return char.
  4. [1874] Otherwise:
    1. [1879] Set state's previous code point to null.
    2. [1875] Return char.

[1778] To process the next input character with state and bc, run these steps:

  1. [1784] Run state's decoder state's switch by bc, with state.
  2. [1766] If the previous step asked to reconsume bc:
    1. [1767] Go to the first step of these steps.

[1783] The variable state in these steps is accessible from the steps to get a UCS input item, to emit a character, and to process a control character.

Output stream

[97] An output stream is a list. The variable output stream of the steps of the ISO/IEC 2022 decoder steps represents the output of the decoder. It is accessible from the steps to emit a character and to emit the EOF.

[1768] When ISO/IEC 2022 decoder steps returns, output stream contains zero or more characters followed by an EOF.

[4] To emit a character with character char, with state of the steps to process the next input character, run these steps:

  1. [115] If char is character (videotex, 96, 7/0, bc) where bc is a bit combination:
    1. [116] If state's macro set [ bc ] exists:
      1. [1782] Run a macro with state, state's macro set [ bc ].
  2. [1781] Otherwise:
    1. [2184] If char is CSI:
      1. [2185] Set state's current control sequence to a character string of char.
    2. [2186] Otherwise, if char is character (param, bc):
      1. [2187] Append char to state's current control sequence.
      2. [2188] If bc is in [ 4/0, 7/14 ]:
        1. [2189] Run the control sequence for state.
    3. [5] Append char to output stream.

[1769] To emit the EOF, run these steps:

  1. [1770] Append an EOF to output stream.

[1774] Although the steps of the ISO/IEC 2022 decoder steps is written in the form of the steps to return an output stream, any character or EOF in output stream MAY be made accessible from the application as soon as it is appended to output stream. The steps of the ISO/IEC 2022 decoder steps never modify or rearrange appended characters.

[355] When error, run these steps:

  1. [356] An error may be reported to a developer console.
  2. [153] Emit a character U+FFFD.
[386] There is an illegal sequence.

[58] When deprecated, run these steps:

  1. [59] A warning may be reported to a developer console.
[385] There is a sequence that is discouraged by a relevant specification, or that is an extension to the ISO/IEC 2022 standard.

Control characters

[719] To process a control character char, with state of the steps to process the next input character, switch by char:

ESC
  1. [30] Set state's decoder state to escape state.
CSI
  1. [2087] Emit char.
  2. [2085] Set state's decoder state to CSI state.
LS0
  1. [209] Set state's GL invoked to G0.
LS1
  1. [1280] If state's GL invoked is Gj:
    1. [1281] Set state's GL invoked to G0.
  2. [1282] Otherwise:
    1. [212] Set state's GL invoked to G1.
LS2
  1. [750] Set state's GL invoked to G2.
LS3
  1. [752] Set state's GL invoked to G3.
LS1R
  1. [61] If state's bits is 7-bit:
    1. [101] Set state's GL invoked to G1.
  2. [102] Otherwise:
    1. [127] Set state's GR invoked to G1.
LS2R
  1. [129] If state's bits is 7-bit:
    1. [130] Set state's GL invoked to G2.
  2. [131] Otherwise:
    1. [132] Set state's GR invoked to G2.
LS3R
  1. [754] If state's bits is 7-bit:
    1. [133] Set state's GL invoked to G3.
  2. [134] Otherwise:
    1. [135] Set state's GR invoked to G3.
SS2
  1. [226] Set state's current element to G2.
  2. [214] Set state's decoder state to SS state.
SS3
  1. [227] Set state's current element to G3.
  2. [216] Set state's decoder state to SS state.
EXT1
  1. [1718] Set state's decoder state to EXT1 state.
(marc, esc, bc) where bc is a bit combination
  1. [103] Deprecated.
  2. [31] Set state's G0 designated to state's 94 final set [ 1/11 followed by bc ].
  3. [968] Set state's G0 RL designated to unassigned-94.
  4. [1973] If state's LS0 by G0 designation flag is true:
    1. [1974] Set state's GL invoked to G0.
(vt, C1, bc) where bc is 8/6 or 8/7
  1. [789] Set state's G0 designated to state's 94 final set [ bc ].
  2. [969] Set state's G0 RL designated to unassigned-94.
  3. [1975] If state's LS0 by G0 designation flag is true:
    1. [1976] Set state's GL invoked to G0.
(vt, esc, 3/12)
  1. [785] Modify character sets of state for « "iso2022", "vt" ».
  2. [786] Emit char.
(tektronix, esc, 0/3)
  1. [718] Set state's C1 designated to the result of getting a C set with C1, vt, C1.
  2. [677] Modify character sets of state for « "noescc0", "vt" ».
  3. [738] Emit char.
(vt, esc, 7/11)
  1. [679] Set state's decoder state to file state.
(C0, bytes, 1/15) where bytes is in [ 4/9, 4/11 ]
  1. [182] Set state's current I byte to bytes.
  2. [199] Set state's decoder state to US state.
(videotex, sound-control, bytes) where bytes is one of 8/0, 8/1, 8/2, 8/8, 8/9, 8/12, 9/0, and 9/12
  1. [1497] Emit char.
  2. [1483] Set state's decoder state to sound control parameter state.
(videotex, sound-control, bytes) where bytes is 8/10 or 8/11
  1. [1498] Emit char.
  2. [1484] Set state's decoder state to sound control state.
(vt52, esc, 6/2), (vt52, esc, 6/3), (C0, 4/9, 1/4), (C1, 4/4, bc) where bc is 8/11, 9/0, 9/1, or 9/2, (C0, 4/10, 1/2), (dtvcc, C0, bc) where bc is in [ 1/0, 1/7 ], (dtvcc, C1, bc) where bc is in [ 8/8, 8/13 ], (dtvcc, C2, bc) where bc is in [ 0/8, 0/15 ]
  1. [210] Emit char.
  2. [211] Set state's decoder state to control parameter state.
  3. [1742] Set state's current segment length to 1.
(vt52, C1, 9/9), (C0, C0, 1/12), (dtvcc, C0, bc) where bc in [ 1/8, 1/15 ], (dtvcc, C1, bc) where bc is 9/0 or 9/2, (dtvcc, C2, bc) where bc is in [ 1/0, 1/7 ]
  1. [1499] Emit char.
  2. [722] Set state's decoder state to control parameter state.
  3. [1743] Set state's current segment length to 2.
(dtvcc, C1, 9/1), (dtvcc, C2, bc) where bc is in [ 1/8, 1/15 ]
  1. [229] Emit char.
  2. [681] Set state's decoder state to control parameter state.
  3. [1744] Set state's current segment length to 3.
(dtvcc, C1, 9/7), (dtvcc, C3, bc) where bc is in [ 8/0, 8/7 ]
  1. [724] Emit char.
  2. [732] Set state's decoder state to control parameter state.
  3. [1745] Set state's current segment length to 4.
(dtvcc, C3, bc) where bc is in [ 8/8, 8/15 ]
  1. [735] Emit char.
  2. [736] Set state's decoder state to control parameter state.
  3. [1746] Set state's current segment length to 5.
(dtvcc, C1, bc) where bc is in [ 9/8, 9/15 ]
  1. [737] Emit char.
  2. [771] Set state's decoder state to control parameter state.
  3. [1747] Set state's current segment length to 6.
(dtvcc, C3, bc) where bc is in [ 9/0, 9/15 ]
  1. [772] Emit character (dtvcc, C3, bc & 0b11100000).
  2. [771] Set state's decoder state to control parameter state.
  3. [1747] Set state's current segment length to bc & 0b00011111.
(dtvcc, C2, bc) where bc in [ 0/8, 0/15
(C1, 4/0, bc) where bc is in [ 8/0, 8/7 ]
  1. [1538] Emit char.
  2. [1539] Set state's GL mode to iso2022.
(C1, 4/0, bc) where bc is in [ 9/0, 9/7 ]
  1. [1536] Emit char.
  2. [1537] Set state's GL mode to single.
  3. [1112] Set state's left designated to the result of getting a G set with 96, 1, videotex, l.
P-MACRO
  1. [1166] Set state's decoder state to macro state.
DCS, OSC, PM, APC
  1. [2010] Emit char.
  2. [2009] Set state's decoder state to command state.
SOS
  1. [1707] Emit char.
  2. [1705] Set state's previous GL mode to state's GL mode.
  3. [1713] Set state's previous left designated to state's left designated.
  4. [1706] Set state's GL mode to iso2022.
ST
  1. [1711] Emit char.
  2. [1709] If state's previous GL mode is not null:
    1. [1708] Set state's GL mode to state's previous GL mode.
    2. [1714] Set state's left designated to state's previous left designated.
    3. [1710] Set state's previous GL mode to null.
(esc, 6/3)
  1. [2123] Emit char.
  2. [2124] Set state's GL invoked to G0.
  3. [2125] Set state's G0 designated to the result of getting a G set with 94, 1, 94, 4/2.
PCD
  1. [729] Emit char.
  2. [65] Set state's decoder state to PCD state.
SCI
  1. [2017] Set state's decoder state to SCI state.
CMD
  1. [730] Emit char.
  2. [1943] Set state's input getter to the 8-bit input getter.
  3. [1272] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
  4. [48] Set state's decoder state to opaque state.
(unknown-control, null, bytes) where bytes is a byte sequence
  1. [660] Emit char.
  2. [1944] Set state's input getter to the 8-bit input getter.
  3. [1273] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
  4. [659] Set state's decoder state to opaque state.
(deprecated, c) where c is a character
  1. [756] Deprecated.
  2. [755] Process c.
Otherwise
  1. [13] Emit char.

[2220] A SGR is a character string which is the concatenation of the followings, in order:

  1. CSI
  2. Zero or more sequence of character (param, bc) where bc is a bit combination
  3. Character (param, 6/13)

and the concatenation of bc, in order, is referred to as params of the SGR.

[2229] To process SGR attribute attr with state, run these steps:

  1. [2230] Switch by attr:
    3/1 followed by 3/0
    1. [2234] If state's right mode is single:
      1. [2255] Set state's CL mode to iso2022.
      2. [2235] Set state's GL mode to single.
    2. [2258] Otherwise:
      1. [2259] Set state's G0 designated to the result of getting a G set with 94, 1, 94, 4/2.
      2. [2260] Set state's GL invoked to G0.
    3/1 followed by 3/1
    1. [2236] If state's right mode is single:
      1. [2256] Set state's CL mode to single-esc.
      2. [2239] Set state's GL mode to single.
    3/1 followed by 3/2
    1. [2240] If state's right mode is single:
      1. [2257] Set state's CL mode to single-right-esc.
      2. [2241] Set state's GL mode to single-right.
    2. [2261] Otherwise:
      1. [2264] Let set be the result of getting invoked set with state and state's GR invoked.
      2. [2262] Set state's G2 designated to set.
      3. [2263] Set state's GR invoked to G2.

[2192] A DECPCTERM is a character string which is the concatenation of the followings, in order:

  1. CSI
  2. Character (param, 3/15)
  3. Optionally, character (param, ps1)
  4. Character (param, 3/11)
  5. Optionally, either:
  6. Character (param, 7/2)

... where each of ps1, ps2, ps21, ps22, and ps23 is a bit combination. If omitted, they are considered as null.

[2215] A DECSFC is a character string which is the concatenation of the followings, in order:

  1. CSI
  2. Optionally, character (param, ps1)
  3. Character (param, 3/11)
  4. Optionally, character (param, ps2)
  5. Character (param, 3/11)
  6. Optionally, character (param, ps3)
  7. Character (param, 3/11)
  8. Optionally, character (param, ps4)
  9. Character (param, 3/11)
  10. Character (param, 2/10)
  11. Character (param, 7/3)

... where each of ps1, ps2, ps3, and ps4 is a bit combination. If omitted, they are considered as null.

[2265] A DECSPPCS is a character string which is the concatenation of the followings, in order:

  1. CSI
  2. Zero or more sequence of character (param, bc) where bc is a bit combination
  3. Character (param, 2/10)
  4. Character (param, 7/0)

and the concatenation of bc, in order, is referred to as pn of the DECSPPCS.

[2190] To run the control sequence for state, run these steps:

  1. [2231] If state's current control sequence's length is greater than the maximum sequence length:
    1. [2232] Abort these steps.
  2. [2191] Switch by state's current control sequence:
    DECPCTERM with ps1, ps2, ps21, ps22, ps23
    1. [2193] If ps1 is null or ps1 is 3/1:
      1. [2195] Set state's GL mode to iso2022.
      2. [2209] Set state's right mode to iso2022.
    2. [2194] Otherwise, if ps1 is 3/2:
      1. [2210] Set state's GL mode to single.
      2. [2196] Set state's right mode to single.
    3. [2197] If either ps2 is null and ps21 is null, or ps2 is 3/0:
      1. [2206] Do nothing.
    4. [2198] Otherwise, if ps21 is null:
      1. [2202] If state's right mode is single:
        1. [2237] Set state's GL mode to iso2022.
        2. [2200] Set state's left designated to the result of getting a 128 set with vt-left, ps2.
        3. [2201] Set state's right designated to the result of getting a 128 set with vt-right, ps2.
      2. [2211] Set state's G0 designated to the result of getting a 94 set with vt-left, ps2.
      3. [2212] Set state's G1 designated to the result of getting a 94 set with vt-right, ps2.
      4. [2213] Set state's GL invoked to G0.
      5. [2214] Set state's GR invoked to G1.
    5. [2199] Otherwise, if ps2 is null]:
      1. [2208] If state's right mode is single:
        1. [2238] Set state's GL mode to single.
        2. [2204] Set ps2 to ps21 followed by ps22 followed by ps23.
        3. [2207] Set state's left designated to the result of getting a 128 set with vt-left, ps2.
        4. [2205] Set state's right designated to the result of getting a 128 set with vt-right, ps2.
    DECSFC with ps3
    1. [2216] If ps3 is null, 3/0, or 3/1:
      1. [2217] Set state's XON/XOFF flag to true.
    2. [2218] Otherwise:
      1. [2219] Set state's XON/XOFF flag to false.
    SGR with params
    1. [2221] Let item be an empty byte sequence.
    2. [2222] For each byte in params:
      1. [2223] If byte is 3/11:
        1. [2224] Process SGR attribute item with state.
        2. [2226] Set item to an empty byte sequence.
      2. [2225] Otherwise:
        1. [2227] Append byte to item.
    3. [2228] Process SGR attribute item with state.
    DECSPPCS with pn
    1. [2266] Set state's left designated to the result of getting a 128 set with pcs-left, pn.
    2. [2267] Set state's right designated to the result of getting a 128 set with pcs-right, pn.

Macros

[1764] A macro is a byte sequence.

[1765] In this document, a macro might be represented as a string, which is a list of tokens separated by a U+0020 character. A token is either a bit combination or a token from the following table. A bit combination represents itself. One of token values in the following table represents the cell value of the bytes column in the same table row. The list represents a macro that is the concatenation of the bit combinations (including those in bytes), in order.

token bytes
ESC1/11
LS00/15
LS10/14
LS1R1/11 followed by 7/14
LS2R1/11 followed by 7/13
LS3R1/11 followed by 7/12

[1429] To run a macro with state and bytes, run these steps:

  1. [1776] For each bc in the bit combinations of bytes, in order:
    1. [1777] Process the next input character with state, bc.

[1451] To initialize by DI state, run these steps:

  1. [1452] If state's current I byte is 2/0:
    1. [932] Set state's GL mode to iso2022.
    2. [1437] Set state's decoder state to default state.
    3. [1422] Run a macro with state, "ESC 2/1 4/9 ESC 2/2 4/4 ESC 2/6 4/0 ESC 2/4 4/2 ESC 2/9 4/10 ESC 2/14 3/8 ESC 2/11 2/0 4/1 LS0 LS2R".
  2. [1424] Otherwise, if state's current I byte is 4/1:
    1. [1475] Set state's GL mode to iso2022.
    2. [1476] Set state's decoder state to default state.
    3. [1477] Run a macro with state, "ESC 2/1 4/9 LS0".
    4. [1478] Set state's C1 designated to the result of getting a C set with C1, videotex, sound-control.
    5. [1479] Set state's G0 designated to the result of getting a G set with 96, 1, videotex, sound-tone.
  3. [1425] Otherwise, if state's current I byte is 4/0:
    1. [1482] Set state's GL mode to iso2022.
    2. [1481] Set state's decoder state to default state.
    3. [1480] Run a macro with state, "ESC 2/1 4/9 ESC 2/2 4/4 ESC 2/8 4/9 ESC 2/6 4/0 ESC 2/4 2/9 4/2 ESC 2/10 4/10 LS0 LS2R".
  4. [1426] Otherwise:
    1. [1945] Set state's input getter to the 8-bit input getter.
    2. [1445] Set state's opaque designated to the result of getting a 256 set captain, state's current I byte.
    3. [1454] Set state's decoder state to opaque state.

[1527] To initialize data syntax 2 with state and serial, parallel, or null mode, run these steps:

  1. [1651] Modify character sets of state for « "iso2022", "videotex" ».
  2. [1543] Set state's GL mode to iso2022.
  3. [1528] Run a macro with state, "ESC 2/1 4/10 ESC 2/8 4/0 ESC 2/9 6/3 ESC 2/10 6/2 ESC 2/11 6/4 LS0 LS2R".
  4. [1529] If mode is serial:
    1. [1530] Run a macro with state, "ESC 2/2 4/0".
  5. [1531] Otherwise, if mode is parallel:
    1. [1532] Run a macro with state, "ESC 2/2 4/1".
  6. [1533] Set state's decoder state to default state.

Decoder states

[27] The decoder has several decoder states for processing input bit combinations.

[2] Each decoder state has its switch. There are the following decoder states:

Default state

[3] The default state switches by the bit combination bc:

[ 0/0, 1/15 ]
  1. [2243] If state's CL mode is single-esc or single-right-esc:
    1. [2248] If bc is 1/11:
      1. [2249] Process a control character ESC.
    2. [2252] Otherwise, if bc is 1/1 or 1/3 and state's XON/XOFF flag is true:
      1. [2253] Let set be state's C0 designated.
      2. [2254] Process a control character set [ bc ].
    3. [2250] Otherwise:
      1. [2245] If state's CL mode is single-right-esc:
        1. [2244] Set set to state's right designated.
      2. [2251] Otherwise:
        1. [2244] Set set to state's left designated.
      3. [2246] Emit a character set [ bc ].
  2. [2268] Otherwise, if state's CL mode is single-most-c0:
    1. [2269] If bc is one of: 0/7, 0/8, 0/9, 0/10, 0/13, and 1/11:
      1. [2270] Process a control character set [ bc ].
    2. [2271] Otherwise:
      1. [2272] Emit a character set [ bc ].
  3. [2247] Otherwise:
    1. [11] Let set be state's C0 designated.
    2. [717] Process a control character set [ bc ].
[ 2/0, 7/15 ]
  1. [1420] If state's GL mode is captain:
    1. [1427] Set state's current I byte to bc.
    2. [1428] Set state's decoder state to CAPTAIN DI state.
  2. [1613] Otherwise, if state's GL mode is telesoftware:
    1. [1577] Emit character (videotex, telesoftware-ci, bc).
    2. [1612] If state's videotex basic kernel flag is false:
      1. [1578] Set state's decoder state to TELESOFTWARE CI state.
  3. [1915] Otherwise, if state's GL mode is unicode:
    1. [1916] Emit a code point whose value is bc.
  4. [1712] Otherwise:
    1. [1109] If state's GL mode is single:
      1. [1079] Let set be state's left designated.
    2. [2203] Otherwise, if state's GL mode is single-right:
      1. [2233] Let set be state's right designated.
    3. [1080] Otherwise, if state's GL mode is iso2022:
      1. [314] Let set be the result of getting invoked set with state and state's GL invoked.
    4. [1288] If state's right mode is iso2022jp and bc is 7/15:
      1. [1289] Set state's decoder state to foreign right state.
      2. [1290] Reconsume bc.
    5. [507] Otherwise, if is 96 size set is false and bc is 2/0 or 7/15:
      1. [318] Emit a character state's fixed set [ bc ].
    6. [422] Otherwise, if set is unknown-94 or unknown-96:
      1. [440] Set state's decoder state to left unassigned state.
      2. [441] Reconsume bc.
    7. [424] Otherwise:
      1. [448] Set state's current bytes to set's byte length.
      2. [449] If state's current bytes is 1:
        1. [185] Emit a character set [ bc ].
      3. [450] Otherwise:
        1. [451] Set state's current I byte to bc.
        2. [487] Set state's current J byte to null.
        3. [452] Set state's decoder bytes to left leading byte state.
[ 8/0, 9/15 ]
  1. [1081] If state's right mode is iso2022 or unicode:
    1. [834] If state's CR invoked is C1:
      1. [1559] If state's C1 override designated is null:
        1. [26] Let set be state's C1 designated.
      2. [1560] Otherwise:
        1. [1561] Let set be state's C1 override designated.
      3. [28] Process a control character set [ bc ].
    2. [835] Otherwise, if state's CR invoked is C0:
      1. [836] Let set be state's C0 designated.
      2. [837] Process a control character set [ bc & 0b01111111 ].
  2. [1914] Otherwise:
    1. [1082] Set state's decoder state to foreign right state.
    2. [1083] Reconsume bc.
[ 10/0, 15/15 ]
  1. [334] Let set be the result of getting invoked set with state and state's GR invoked.
  2. [1084] If state's right mode is iso2022:
    1. [312] If is 96 size set is false and bc is 10/0 or 15/15:
      1. [317] Emit a character state's fixed set [ bc ].
    2. [313] Otherwise, if set is unknown-94 or unknown-96:
      1. [423] Set state's decoder state to right unassigned state.
      2. [430] Reconsume bc.
    3. [431] Otherwise:
      1. [432] Set state's current bytes to set's byte length.
      2. [471] If state's current bytes is 1:
        1. [473] Emit a character set [ bc & 0b01111111 ].
      3. [474] Otherwise:
        1. [475] Set state's current I byte to bc & 0b01111111.
        2. [490] Set state's current J byte to null.
        3. [476] Set state's decoder bytes to right leading byte state.
  3. [1911] Otherwise, if state's right mode is unicode:
    1. [1912] Emit a code point whose value is bc.
  4. [1913] Otherwise:
    1. [1085] Set state's decoder state to foreign right state.
    2. [1086] Reconsume bc.
end-of-frame
  1. [1473] If bc's incomplete is true:
    1. [1474] Error.
  2. [1423] Set state's GL mode to captain.
  3. [1421] Set state's decoder state to default state.
end-of-file
  1. [1772] Emit the EOF.
Otherwise
  1. [1773] Emit a character bc.

SS state

[217] The SS state switches by the bit combination bc:

0/14, 0/15
  1. [2046] Let set be state's C0 designated.
  2. [2047] Set char be set [ bc ].
  3. [2048] If char is LS0 or LS1:
    1. [2049] Process char.
  4. [2050] Otherwise:
    1. [2051] Set state's decoder state to default state.
    2. [2052] Reconsume bc.
[ 2/0, 7/15 ], [ 10/0, 15/15 ]
  1. [344] If state's current element is G2:
    1. [343] Let set be state's G2 designated.
  2. [345] If state's current element is G3:
    1. [346] Let set be state's G3 designated.
  3. [528] If is 96 size set is false and bc is 2/0, 7/15, 10/0, or 15/15:
    1. [349] Error.
    2. [354] Set state's decoder state to default state.
    3. [364] Reconsume bc.
  4. [444] Otherwise, if set is unknown-94 or unknown-96:
    1. [271] Error.
    2. [438] Set state's decoder state to SS unassigned state.
    3. [442] Reconsume bc.
  5. [447] Otherwise:
    1. [272] Set state's current bytes to set's byte length.
    2. [316] If state's current bytes is 1:
      1. [326] Emit a character set [ bc & 0b01111111 ].
      2. [443] Set state's decoder state to default state.
    3. [329] Otherwise:
      1. [332] Set state's current I byte to bc & 0b01111111.
      2. [341] Set state's current J byte to null.
      3. [347] Set state's decoder bytes to SS leading byte state.
8/14, 8/15
  1. [2053] If state's right mode is iso2022 or unicode and state's CR invoked is C0:
    1. [2054] Let set be state's C0 designated.
    2. [2055] Set char be set [ bc & 0b01111111 ].
    3. [2056] If char is LS0 or LS1:
      1. [2057] Process char.
    4. [2058] Otherwise:
      1. [2059] Set state's decoder state to default state.
      2. [2060] Reconsume bc.
  2. [2061] Otherwise:
    1. [2062] Set state's decoder state to default state.
    2. [2063] Reconsume bc.
Otherwise
  1. [357] Error.
  2. [359] Set state's decoder state to default state.
  3. [358] Reconsume bc.

EXT1 state

[1719] The EXT1 state switches by the bit combination bc:

[ 0/0, 1/15 ]
  1. [1720] Let set be the result of getting a C set C0, dtvcc, C2.
  2. [1722] Process a control character set [ bc ].
[ 2/0, 7/15 ]
  1. [1721] Let set be the result of getting a G set 96, 1, dtvcc, G2.
  2. [1722] Emit set [ bc ].
[ 8/0, 9/15 ]
  1. [1723] Let set be the result of getting a C set C1, dtvcc, C3.
  2. [1724] Process a control character set [ bc ].
[ 10/0, 15/15 ]
  1. [1725] Let set be the result of getting a G set 96, 1, dtvcc, G3.
  2. [1726] Emit set [ bc ].
Otherwise
  1. [1727] Error.
  2. [1728] Set state's decoder state to default state.
  3. [1729] Reconsume bc.

Left leading byte state

[482] The left leading byte state switches by the bit combination bc:

[ 2/0, 7/15 ]
  1. [495] Let set be the result of getting invoked set with state and state's GL invoked.
  2. [320] If is 96 size set is false and bc is 2/0 or 7/15:
    1. [323] Emit character (unknown-byte, null, state's current I byte).
    2. [324] If state's current J byte is not null:
      1. [325] Emit character (unknown-byte, null, state's current J byte).
    3. [328] Set state's decoder state to default state.
    4. [330] Reconsume bc.
  3. [321] Otherwise:
    1. [496] Set state's current bytes to set's byte length.
    2. [449] If state's current bytes is 2:
      1. [331] Let bytes be state's current I byte followed by bc.
      2. [498] Emit a character set [ bytes ].
      3. [336] Set state's decoder state to default state.
    3. [499] Otherwise, if state's current bytes is 3:
      1. [502] If state's current J byte is null:
        1. [503] Set state's current J byte to bc.
      2. [504] Otherwise:
        1. [335] Let bytes be state's current I byte followed by state's current J byte followed by bc.
        2. [501] Emit a character set [ bytes ].
        3. [337] Set state's decoder state to default state.
Otherwise
  1. [492] Emit character (unknown-byte, null, state's current I byte).
  2. [493] If state's current J byte is not null:
    1. [494] Emit character (unknown-byte, null, state's current J byte).
  3. [483] Set state's decoder state to default state.
  4. [485] Reconsume bc.

Right leading byte state

[338] The right leading byte state switches by the bit combination bc:

[ 2/1, 7/14 ]
  1. [648] Let set be the result of getting RL invoked set with state and state's GR invoked.
  2. [649] If set is unassigned-94:
    1. [792] Emit character (unknown-byte, null, state's current I byte).
    2. [793] Set state's decoder state to default state.
    3. [794] Reconsume bc.
  3. [795] Otherwise:
    1. [650] Let bytes be state's current I byte followed by bc.
    2. [651] Emit a character set [ bytes ].
    3. [687] Set state's decoder state to default state.
[ 10/0, 15/15 ]
  1. [339] Let set be the result of getting invoked set with state and state's GR invoked.
  2. [340] If is 96 size set is false and bc is 10/0 or 15/15:
    1. [421] Emit character (unknown-byte, null, state's current I byte).
    2. [426] If state's current J byte is not null:
      1. [427] Emit character (unknown-byte, null, state's current J byte).
    3. [428] Set state's decoder state to default state.
    4. [429] Reconsume bc.
  3. [433] Otherwise:
    1. [434] Set state's current bytes to set's byte length.
    2. [436] If state's current bytes is 2:
      1. [437] Let bytes be state's current I byte followed by bc & 0b01111111.
      2. [453] Emit a character set [ bytes ].
      3. [454] Set state's decoder state to default state.
    3. [455] Otherwise, if state's current bytes is 3:
      1. [456] If state's current J byte is null:
        1. [457] Set state's current J byte to bc & 0b01111111.
      2. [458] Otherwise:
        1. [459] Let bytes be state's current I byte followed by state's current J byte followed by bc & 0b01111111.
        2. [461] Emit a character set [ bytes ].
        3. [462] Set state's decoder state to default state.
Otherwise
  1. [464] Emit character (unknown-byte, null, state's current I byte).
  2. [465] If state's current J byte is not null:
    1. [466] Emit character (unknown-byte, null, state's current J byte).
  3. [467] Set state's decoder state to default state.
  4. [468] Reconsume bc.

SS leading byte state

[469] The SS leading byte state switches by the bit combination bc:

[ 2/0, 7/15 ], [ 10/0, 15/15 ]
  1. [470] If state's current element is G2:
    1. [525] Let set be state's G2 designated.
  2. [526] If state's current element is G3:
    1. [527] Let set be state's G3 designated.
  3. [477] If is 96 size set is false and bc is 2/0, 7/15, 10/0, or 15/15:
    1. [478] Error.
    2. [479] Emit character (unknown-byte, null, state's current I byte).
    3. [480] If state's current J byte is not null:
      1. [481] Emit character (unknown-byte, null, state's current J byte).
    4. [486] Set state's decoder state to default state.
    5. [488] Reconsume bc.
  4. [489] Otherwise:
    1. [491] Set state's current bytes to set's byte length.
    2. [505] If state's current bytes is 2:
      1. [506] Let bytes be state's current I byte followed by bc & 0b01111111.
      2. [509] Emit a character set [ bytes ].
      3. [510] Set state's decoder state to default state.
    3. [511] Otherwise, if state's current bytes is 3:
      1. [512] If state's current J byte is null:
        1. [513] Set state's current J byte to bc & 0b01111111.
      2. [514] Otherwise:
        1. [515] Let bytes be state's current I byte followed by state's current J byte followed by bc & 0b01111111.
        2. [517] Emit a character set [ bytes ].
        3. [518] Set state's decoder state to default state.
Otherwise
  1. [519] Error.
  2. [520] Emit character (unknown-byte, null, state's current I byte).
  3. [521] If state's current J byte is not null:
    1. [522] Emit character (unknown-byte, null, state's current J byte).
  4. [523] Set state's decoder state to default state.
  5. [524] Reconsume bc.

Left unassigned state

[446] The left unassigned state switches by the bit combination bc:

[ 2/0, 7/15 ]
  1. [536] Let set be the result of getting invoked set with state and state's GL invoked.
  2. [532] If is 96 size set is false and bc is 2/0 or 7/15:
    1. [533] Set state's decoder state to default state.
    2. [534] Reconsume bc.
  3. [535] Otherwise:
    1. [531] Emit a character (unassinged, bc).
Otherwise
  1. [529] Set state's decoder state to default state.
  2. [530] Reconsume bc.

Right unassigned state

[537] The right unassigned state switches by the bit combination bc:

[ 10/0, 15/15 ]
  1. [538] Let set be the result of getting invoked set with state and state's GR invoked.
  2. [539] If is 96 size set is false and bc is 10/0 or 15/15:
    1. [540] Set state's decoder state to default state.
    2. [541] Reconsume bc.
  3. [542] Otherwise:
    1. [543] Emit a character (unassinged, bc & 0b01111111).
Otherwise
  1. [544] Set state's decoder state to default state.
  2. [545] Reconsume bc.

SS unassigned state

[546] The SS unassigned state switches by the bit combination bc:

[ 2/0, 7/15 ]
  1. [547] Let set1 be the result of getting invoked set with state and state's GL invoked.
  2. [548] If state's current element is G2:
    1. [549] Let set2 be state's G2 designated.
  3. [550] If state's current element is G3:
    1. [551] Let set2 be state's G3 designated.
  4. [552] If is 96 size set1 is false and is 96 size set2 is false and bc is 2/0 or 7/15:
    1. [553] Set state's decoder state to default state.
    2. [554] Reconsume bc.
  5. [555] Otherwise:
    1. [556] Emit a character (unassinged, bc).
[ 10/0, 15/15 ]
  1. [559] Let set1 be the result of getting invoked set with state and state's GR invoked.
  2. [560] If state's current element is G2:
    1. [561] Let set2 be state's G2 designated.
  3. [562] If state's current element is G3:
    1. [563] Let set2 be state's G3 designated.
  4. [564] If is 96 size set1 is false and is 96 size set2 is false and bc is 10/0 or 15/15:
    1. [565] Set state's decoder state to default state.
    2. [566] Reconsume bc.
  5. [567] Otherwise:
    1. [568] Emit a character (unassinged, bc).
Otherwise
  1. [557] Set state's decoder state to default state.
  2. [558] Reconsume bc.

Escape state

[32] The escape state switches by the bit combination bc:

[ 0/0, 1/15 ]
  1. [204] If state's escape set [ bc ] exists:
    1. [720] Set state's decoder state to default state.
    2. [225] Process a control character state's escape set [ bc ].
  2. [206] Otherwise:
    1. [207] Set state's current byte sequence to an empty byte sequence.
    2. [208] Set state's decoder state to escape unassigned state.
    3. [224] Reconsume bc.
2/0
  1. [136] Set state's decoder state to escape announce state.
2/1
  1. [218] Set state's current element to C0.
  2. [157] Set state's decoder state to escape control state.
2/2
  1. [230] Set state's current element to C1.
  2. [158] Set state's decoder state to escape control state.
2/3
  1. [388] Set state's decoder state to escape 3 state.
2/4
  1. [598] Set state's decoder state to escape multiple state.
2/5
  1. [999] Set state's decoder state to escape coding system state.
2/6
  1. [978] Set state's decoder state to escape revision state.
2/8
  1. [104] Set state's current element to G0.
  2. [294] Set state's current size to 94.
  3. [105] Set state's decoder state to escape graphic state.
2/9
  1. [111] Set state's current element to G1.
  2. [168] Set state's current size to 94.
  3. [170] Set state's decoder state to escape graphic state.
2/10
  1. [169] Set state's current element to G2.
  2. [235] Set state's current size to 94.
  3. [295] Set state's decoder state to escape graphic state.
2/11
  1. [234] Set state's current element to G3.
  2. [296] Set state's current size to 94.
  3. [297] Set state's decoder state to escape graphic state.
2/12
  1. [279] Deprecated.
  2. [277] Set state's current element to G0.
  3. [278] Set state's current size to 96.
  4. [281] Set state's decoder state to escape graphic state.
2/13
  1. [280] Set state's current element to G1.
  2. [283] Set state's current size to 96.
  3. [285] Set state's decoder state to escape graphic state.
2/14
  1. [282] Set state's current element to G2.
  2. [298] Set state's current size to 96.
  3. [299] Set state's decoder state to escape graphic state.
2/15
  1. [284] Set state's current element to G3.
  2. [300] Set state's current size to 96.
  3. [301] Set state's decoder state to escape graphic state.
[ 3/0, 3/15 ], [ 6/0, 7/14 ]
  1. [40] Set state's decoder state to default state.
  2. [35] Process a control character char be state's escape set [ bc ].
[ 4/0, 5/15 ]
  1. [36] If state's C1 override designated is null:
    1. [1562] Let set be state's C1 designated.
  2. [1563] Otherwise:
    1. [1564] Let set be state's C1 override designated.
  3. [39] Set state's decoder state to default state.
  4. [38] Process a control character set [ bc + 0x40 ].
Otherwise
  1. [33] Set state's current byte sequence to an empty byte sequence.
  2. [34] Set state's decoder state to escape unassigned state.
  3. [156] Reconsume bc.

Escape announce state

[137] The escape announce state switches by the bit combination bc:

[ 3/0, 3/5 ], [ 3/8, 3/15 ]
  1. [828] Set state's decoder state to default state.
  2. [829] Process character (unknown-control, null, 1/11 followed by 2/0 followed by bc).
3/6
  1. [387] Deprecated.
  2. [833] Set state's CR invoked to C0.
  3. [381] Set state's decoder state to default state.
3/7
  1. [830] Deprecated.
  2. [832] Set state's CR invoked to C1.
  3. [831] Set state's decoder state to default state.
[ 4/1, 7/14 ]
  1. [138] Let announce be bc - 0x40.
  2. [139] If announce is one of: 1, 3, 12, 13, or 14:
    1. [140] Set state's GL invoked be G0.
  3. [141] If announce is 1 or 2:
    1. [142] Set state's GR invoked be null.
  4. [143] If announce is one of: 3, 12, 13, or 14:
    1. [144] Set state's GR invoked be G1.
  5. [145] If announce is one of: 12, 13, or 14:
    1. [146] Set state's 2/0 designated be SP.
    2. [147] Set state's 7/14 designated be DEL.
    3. [838] If state's ISO 4873 Latin-1 flag is true:
      1. [839] Run a macro with state, "ESC 2/8 4/2 ESC 2/13 4/1".
  6. [148] If announce is one of: 11, 12, 13, or 14:
    1. [149] Set state's bits be 8-bit.
  7. [150] If announce is 10:
    1. [151] Set state's bits be 7-bit.
  8. [380] Set state's decoder state to default state.
Otherwise
  1. [152] Set state's current byte sequence to 2/0.
  2. [155] Set state's decoder state to escape unassigned state.
  3. [154] Reconsume bc.

Escape 3 state

[389] The escape 3 state switches by the bit combination bc:

[ 2/0, 2/15 ]
  1. [397] Set state's current I byte to bc.
  2. [398] Set state's decoder state to escape ctext version state.
[ 3/0, 3/9 ]
  1. [396] Emit character (vt, 2/3, bc).
  2. [390] Set state's decoder state to default state.
[ 3/10, 3/15 ]
  1. [749] Set state's decoder state to default state.
  2. [747] Process character (unknown-control, null, 1/11 followed by 2/3 followed by bc).
Otherwise
  1. [392] Set state's current byte sequence to 2/3.
  2. [394] Set state's decoder state to escape unassigned state.
  3. [395] Reconsume bc.

Escape ctext version state

[399] The escape ctext version state switches by the bit combination bc:

3/0
  1. [401] Set state's decoder state to default state.
3/1
  1. [400] Error.
  2. [403] Set state's decoder state to default state.
[ 3/2, 3/15 ]
  1. [751] Set state's decoder state to default state.
  2. [753] Process character (unknown-control, null, 1/11 followed by 2/3 followed by state's current I byte followed by bc).
[ 4/0, 5/15 ]
  1. [1363] If state's current I byte is 2/0 or 2/1:
    1. [1369] Let set be the result of getting a C set with C1, videotex, state's current I byte.
    2. [1370] Emit a character [ bc + 0x40 ].
    3. [1371] Set state's decoder state to default state.
  2. [1364] Otherwise:
    1. [1365] Error.
    2. [1946] Set state's input getter to the 8-bit input getter.
    3. [1366] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
    4. [1367] Set state's decoder state to opaque state.
    5. [1368] Reconsume bc.
Otherwise
  1. [404] Error.
  2. [1947] Set state's input getter to the 8-bit input getter.
  3. [1274] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
  4. [407] Set state's decoder state to opaque state.
  5. [408] Reconsume bc.

Escape revision state

[979] The escape revision state switches by the bit combination bc:

[ 3/0, 7/14 ]
  1. [980] Set state's current revision byte to bc.
  2. [984] Set state's decoder state to IRR state.
Otherwise
  1. [981] Set state's current byte sequence to 2/6.
  2. [982] Set state's decoder state to escape unassigned state.
  3. [983] Reconsume bc.

IRR state

[985] The IRR state switches by the bit combination bc:

1/11
  1. [986] Set state's decoder state to IRR escape state.
Otherwise
  1. [989] Error.
  2. [987] Set state's decoder state to default state.
  3. [988] Reconsume bc.

IRR escape state

[990] The IRR state switches by the bit combination bc:

2/1, 2/2, 2/4, [ 2/8, 2/15 ]
  1. [991] Set state's decoder state to escape state.
  2. [992] Reconsume bc.
Otherwise
  1. [993] Error.
  2. [996] Set state's current revision byte to null.
  3. [994] Set state's decoder state to escape state.
  4. [995] Reconsume bc.

Escape control state

[159] The escape control state switches by the bit combination bc:

[ 3/0, 7/14 ]
  1. [1373] If state's current revision byte is null:
    1. [1374] Let bytes be bc.
  2. [1375] Otherwise:
    1. [1372] Let bytes be bc followed by state's current revision byte.
  3. [231] If state's current element is C0:
    1. [164] Set state's C0 designated to the result of getting a C set with C0, C0, bytes.
  4. [232] Otherwise, if state's current element is C1:
    1. [1534] If bytes is 4/0 or 4/1:
      1. [1535] Emit character (videotex, protocol, bytes).
      2. [1540] Set state's GL mode to iso2022.
    2. [233] Set state's C1 designated to the result of getting a C set with C1, C1, bytes.
    3. [1570] Set state's C1 override designated to null.
  5. [382] Set state's decoder state to default state.
Otherwise
  1. [787] If state's current element is C0:
    1. [713] Set state's C0 designated to the empty C0 set.
  2. [167] Otherwise, if state's current element is C1:
    1. [714] Set state's C1 designated to the empty C1 set.
    2. [1571] Set state's C1 override designated to null.
  3. [162] Set state's decoder state to escape trailer state.
  4. [163] Reconsume bc.

Escape graphic state

[236] The escape graphic state switches by the bit combination bc:

[ 2/0, 2/6 ]
  1. [254] Set state's current I byte to bc.
  2. [255] Set state's decoder state to escape graphic I state.
[ 3/0, 7/14 ]
  1. [1298] If state's current revision byte is null:
    1. [1301] Set bytes be bc.
  2. [1300] Otherwise:
    1. [1299] Set bytes be bc followed by state's current revision byte.
  3. [237] If state's current element is G0:
    1. [402] If state's VT response flag is true, state's current size is 94, and bc is 3/1:
      1. [410] Emit a character (vt, 2/8, bc).
    2. [411] Otherwise:
      1. [41] If state's current size is 94:
        1. [238] Set state's G0 designated to state's 94 final set [ bytes ].
      2. [46] Otherwise, if state's current size is 96:
        1. [47] Set state's G0 designated to state's 96 final set [ bytes ].
      3. [964] Set state's G0 RL designated to unassigned-94.
      4. [1977] If state's LS0 by G0 designation flag is true:
        1. [1978] Set state's GL invoked to G0.
  4. [239] Otherwise, if state's current element is G1:
    1. [412] If state's VT response flag is true, state's current size is 94, and bc is 3/1:
      1. [413] Emit a character (vt, 2/9, bc).
    2. [414] Otherwise:
      1. [64] If state's current size is 94:
        1. [66] Set state's G1 designated to state's 94 final set [ bytes ].
      2. [119] Otherwise, if state's current size is 96:
        1. [183] Set state's G1 designated to state's 96 final set [ bytes ].
      3. [965] Set state's G1 RL designated to unassigned-94.
  5. [286] Otherwise, if state's current element is G2:
    1. [184] If state's current size is 94:
      1. [200] Set state's G2 designated to state's 94 final set [ bytes ].
    2. [201] Otherwise, if state's current size is 96:
      1. [202] Set state's G2 designated to state's 96 final set [ bytes ].
    3. [966] Set state's G2 RL designated to unassigned-94.
  6. [288] Otherwise, if state's current element is G3:
    1. [417] If state's VT response flag is true and state's current size is 96:
      1. [418] Emit a character (vt, 2/15, bc).
    2. [419] Otherwise:
      1. [203] If state's current size is 94:
        1. [219] Set state's G3 designated to state's 94 final set [ bytes ].
      2. [220] Otherwise, if state's current size is 96:
        1. [221] Set state's G3 designated to state's 96 final set [ bytes ].
      3. [967] Set state's G3 RL designated to unassigned-94.
  7. [383] Set state's decoder state to default state.
Otherwise
  1. [166] If state's current size is 94:
    1. [241] Let set be unknown-94.
  2. [415] Otherwise, if state's current size is 96:
    1. [416] Let set be unknown-96.
  3. [242] If state's current element is G0:
    1. [243] Set state's G0 designated to set.
    2. [960] Set state's G0 RL designated to unassigned-94.
    3. [1979] If state's LS0 by G0 designation flag is true:
      1. [1980] Set state's GL invoked to G0.
  4. [244] Otherwise, if state's current element is G1:
    1. [160] Set state's G1 designated to set.
    2. [961] Set state's G1 RL designated to unassigned-94.
  5. [246] Otherwise, if state's current element is G2:
    1. [161] Set state's G2 designated to set.
    2. [962] Set state's G2 RL designated to unassigned-94.
  6. [248] Otherwise, if state's current element is G3:
    1. [165] Set state's G3 designated to set.
    2. [963] Set state's G3 RL designated to unassigned-94.
  7. [251] Set state's decoder state to escape trailer state.
  8. [252] Reconsume bc.

Escape graphic I state

[253] The escape graphic I state switches by the bit combination bc:

[ 3/0, 7/14 ]
  1. [1302] If state's current revision byte is null:
    1. [1303] Set bytes be state's current I byte followed by bc followed by state's current revision byte.
  2. [1304] Otherwise:
    1. [1305] Set bytes be state's current I byte followed by bc.
  3. [257] If state's current element is G0:
    1. [222] If state's current size is 94:
      1. [240] Set state's G0 designated to state's 94 final set [ bytes ].
    2. [256] Otherwise, if state's current size is 96:
      1. [275] Set state's G0 designated to state's 96 final set [ bytes ].
  4. [258] Otherwise, if state's current element is G1:
    1. [259] If state's current size is 94:
      1. [276] Set state's G1 designated to state's 94 final set [ bytes ].
    2. [287] Otherwise, if state's current size is 96:
      1. [289] Set state's G1 designated to state's 96 final set [ bytes ].
  5. [290] Otherwise, if state's current element is G2:
    1. [291] If state's current size is 94:
      1. [293] Set state's G2 designated to state's 94 final set [ bytes ].
    2. [678] Otherwise, if state's current size is 96:
      1. [690] Set state's G2 designated to state's 96 final set [ bytes ].
  6. [292] Otherwise, if state's current element is G3:
    1. [691] If state's current size is 94:
      1. [692] Set state's G3 designated to state's 94 final set [ bytes ].
    2. [693] Otherwise, if state's current size is 96:
      1. [694] Set state's G3 designated to state's 96 final set [ bytes ].
  7. [384] Set state's decoder state to default state.
Otherwise
  1. [247] If state's current size is 94:
    1. [260] Let set be unknown-94.
  2. [250] Otherwise, if state's current size is 96:
    1. [249] Let set be unknown-96.
  3. [261] If state's current element is G0:
    1. [262] Set state's G0 designated to set.
    2. [956] Set state's G0 RL designated to unassigned-94.
    3. [1981] If state's LS0 by G0 designation flag is true:
      1. [1982] Set state's GL invoked to G0.
  4. [263] Otherwise, if state's current element is G1:
    1. [264] Set state's G1 designated to set.
    2. [957] Set state's G1 RL designated to unassigned-94.
  5. [265] Otherwise, if state's current element is G2:
    1. [266] Set state's G2 designated to set.
    2. [958] Set state's G2 RL designated to unassigned-94.
  6. [267] Otherwise, if state's current element is G3:
    1. [268] Set state's G3 designated to set.
    2. [959] Set state's G3 RL designated to unassigned-94.
  7. [269] Set state's decoder state to escape trailer state.
  8. [270] Reconsume bc.

Escape multiple state

[599] The escape multiple state switches by the bit combination bc:

2/8
  1. [606] Set state's current element to G0.
  2. [607] Set state's current size to 94.
  3. [608] Set state's decoder state to escape multiple graphic state.
2/9
  1. [609] Set state's current element to G1.
  2. [610] Set state's current size to 94.
  3. [611] Set state's decoder state to escape multiple graphic state.
2/10
  1. [612] Set state's current element to G2.
  2. [613] Set state's current size to 94.
  3. [614] Set state's decoder state to escape multiple graphic state.
2/11
  1. [618] Deprecated.
  2. [619] Set state's current element to G3.
  3. [620] Set state's current size to 94.
  4. [621] Set state's decoder state to escape multiple graphic state.
2/12
  1. [622] Set state's current element to G0.
  2. [623] Set state's current size to 96.
  3. [624] Set state's decoder state to escape multiple graphic state.
2/13
  1. [625] Set state's current element to G1.
  2. [626] Set state's current size to 96.
  3. [627] Set state's decoder state to escape multiple graphic state.
2/14
  1. [628] Set state's current element to G2.
  2. [629] Set state's current size to 96.
  3. [630] Set state's decoder state to escape multiple graphic state.
2/15
  1. [631] Set state's current element to G3.
  2. [615] Set state's current size to 96.
  3. [616] Set state's decoder state to escape multiple graphic state.
3/0, [ 3/2, 4/4 ], [ 4/8, 4/14 ], [ 5/2, 7/14 ]
  1. [1310] If state's current revision byte is null:
    1. [1311] Set bytes be bc.
  2. [1312] Otherwise:
    1. [1313] Set bytes be bc followed by state's current revision byte.
  3. [605] If bc is not 4/0, 4/1, or 4/2:
    1. [788] Deprecated.
  4. [695] Set state's G0 designated to state's 94n final set [ bytes ].
  5. [637] Set state's G0 RL designated to state's 94n final RL set [ bytes ].
  6. [1983] If state's LS0 by G0 designation flag is true:
    1. [1984] Set state's GL invoked to G0.
  7. [1286] Set state's decoder state to default state.
3/1
  1. [902] Set state's G0 designated to the result of getting a G set with 94, 3, marc, 3/1.
  2. [1715] Set state's G0 RL designated to unassigned-94.
  3. [1985] If state's LS0 by G0 designation flag is true:
    1. [1986] Set state's GL invoked to G0.
[ 4/5, 4/6, 4/7, 4/15, 5/0, 5/1 ]
  1. [1314] If state's current revision byte is not null:
    1. [1315] Error.
  2. [1283] Deprecated.
  3. [1284] Set state's Gj designated to getting a G set with 94, 1, jphone, bc.
  4. [1285] Set state's GL invoked to Gj.
  5. [1287] Set state's decoder state to default state.
Otherwise
  1. [1316] If state's current revision byte is not null:
    1. [1317] Error.
  2. [601] Set state's current byte sequence be 2/4.
  3. [603] Set state's decoder state to escape unassigned state.
  4. [604] Reconsume bc.

Escape multiple graphic state

[617] The escape multiple graphic state switches by the bit combination bc:

[ 2/0, 2/5 ]
  1. [632] Set state's current I byte to bc.
  2. [633] Set state's decoder state to escape multiple graphic I state.
[ 3/0, 7/14 ]
  1. [1306] If state's current revision byte is null:
    1. [1307] Set bytes be bc.
  2. [1308] Otherwise:
    1. [1309] Set bytes be bc followed by state's current revision byte.
  3. [634] If state's current element is G0:
    1. [635] If state's current size is 94 and bc is 4/0, 4/1, or 4/2:
      1. [636] Deprecated.
    2. [696] If state's current size is 94:
      1. [698] Set state's G0 designated to state's 94n final set [ bytes ].
      2. [699] Set state's G0 RL designated to state's 94n final RL set [ bytes ].
      3. [1987] If state's LS0 by G0 designation flag is true:
        1. [1988] Set state's GL invoked to G0.
    3. [700] Otherwise, if state's current size is 96:
      1. [701] Set state's G0 designated to state's 96n final set [ bytes ].
      2. [702] Set state's G0 RL designated to unassigned-94.
      3. [1989] If state's LS0 by G0 designation flag is true:
        1. [1990] Set state's GL invoked to G0.
  4. [639] Otherwise, if state's current element is G1:
    1. [638] If state's current size is 94:
      1. [640] Set state's G1 designated to state's 94n final set [ bytes ].
      2. [703] Set state's G1 RL designated to state's 94n final RL set [ bytes ].
    2. [704] Otherwise, if state's current size is 96:
      1. [705] Set state's G1 designated to state's 96n final set [ bytes ].
      2. [706] Set state's G1 RL designated to unassigned-94.
  5. [641] Otherwise, if state's current element is G2:
    1. [642] If state's current size is 94:
      1. [707] Set state's G2 designated to state's 94n final set [ bytes ].
      2. [708] Set state's G2 RL designated to state's 94n final RL set [ bytes ].
    2. [709] Otherwise, if state's current size is 96:
      1. [710] Set state's G2 designated to state's 96n final set [ bytes ].
      2. [711] Set state's G2 RL designated to unassigned-94.
  6. [643] Otherwise, if state's current element is G3:
    1. [644] If state's current size is 94:
      1. [712] Set state's G3 designated to state's 94n final set [ bytes ].
      2. [790] Set state's G3 RL designated to state's 94n final RL set [ bytes ].
    2. [791] Otherwise, if state's current size is 96:
      1. [811] Set state's G3 designated to state's 96n final set [ bytes ].
      2. [812] Set state's G3 RL designated to unassigned-94.
  7. [645] Set state's decoder state to default state.
Otherwise
  1. [245] If state's current size is 94:
    1. [362] Let set be unknown-94.
  2. [363] Otherwise, if state's current size is 96:
    1. [322] Let set be unknown-96.
  3. [365] If state's current element is G0:
    1. [366] Set state's G0 designated to set.
    2. [952] Set state's G0 RL designated to unassigned-94.
    3. [1991] If state's LS0 by G0 designation flag is true:
      1. [1992] Set state's GL invoked to G0.
  4. [367] Otherwise, if state's current element is G1:
    1. [368] Set state's G1 designated to set.
    2. [953] Set state's G1 RL designated to unassigned-94.
  5. [369] Otherwise, if state's current element is G2:
    1. [370] Set state's G2 designated to set.
    2. [954] Set state's G2 RL designated to unassigned-94.
  6. [371] Otherwise, if state's current element is G3:
    1. [372] Set state's G3 designated to set.
    2. [955] Set state's G3 RL designated to unassigned-94.
  7. [375] Set state's decoder state to escape trailer state.
  8. [376] Reconsume bc.

Escape multiple graphic I state

[662] The escape multiple graphic I state switches by the bit combination bc:

[ 3/0, 7/14 ]
  1. [1318] If state's current revision byte is null:
    1. [1319] Set bytes be state's current I byte followed by bc.
  2. [1320] Otherwise:
    1. [1321] Set bytes be state's current I byte followed by bc followed by state's current revision byte.
  3. [663] If state's current element is G0:
    1. [664] If state's current size is 94:
      1. [813] Set state's G0 designated to state's 94n final set [ bytes ].
      2. [814] Set state's G0 RL designated to state's 94n final RL set [ bytes ].
      3. [1993] If state's LS0 by G0 designation flag is true:
        1. [1994] Set state's GL invoked to G0.
    2. [815] Otherwise, if state's current size is 96:
      1. [816] Set state's G0 designated to state's 96n final set [ bytes ].
      2. [820] Set state's G0 RL designated to unassigned-94.
      3. [1995] If state's LS0 by G0 designation flag is true:
        1. [1996] Set state's GL invoked to G0.
  4. [665] Otherwise, if state's current element is G1:
    1. [666] If state's current size is 94:
      1. [817] Set state's G1 designated to state's 94n final set [ bytes ].
      2. [821] Set state's G1 RL designated to state's 94n final RL set [ bytes ].
    2. [822] Otherwise, if state's current size is 96:
      1. [823] Set state's G1 designated to state's 96n final set [ bytes ].
      2. [824] Set state's G1 RL designated to unassigned-94.
  5. [667] Otherwise, if state's current element is G2:
    1. [668] If state's current size is 94:
      1. [818] Set state's G2 designated to state's 94n final set [ bytes ].
      2. [825] Set state's G2 RL designated to state's 94n final RL set [ bytes ].
    2. [826] Otherwise, if state's current size is 96:
      1. [938] Set state's G2 designated to state's 96n final set [ bytes ].
      2. [943] Set state's G2 RL designated to unassigned-94.
  6. [669] Otherwise, if state's current element is G3:
    1. [670] If state's current size is 94:
      1. [819] Set state's G3 designated to state's 94n final set [ bytes ].
      2. [944] Set state's G3 RL designated to state's 94n final RL set [ bytes ].
    2. [945] Otherwise, if state's current size is 96:
      1. [946] Set state's G3 designated to state's 96n final set [ bytes ].
      2. [947] Set state's G3 RL designated to unassigned-94.
  7. [671] Set state's decoder state to default state.
Otherwise
  1. [377] If state's current size is 94:
    1. [378] Let set be unknown-94.
  2. [379] Otherwise, if state's current size is 96:
    1. [391] Let set be unknown-96.
  3. [393] If state's current element is G0:
    1. [406] Set state's G0 designated to set.
    2. [948] Set state's G0 RL designated to unassigned-94.
    3. [1997] If state's LS0 by G0 designation flag is true:
      1. [1998] Set state's GL invoked to G0.
  4. [409] Otherwise, if state's current element is G1:
    1. [420] Set state's G1 designated to set.
    2. [949] Set state's G1 RL designated to unassigned-94.
  5. [425] Otherwise, if state's current element is G2:
    1. [435] Set state's G2 designated to set.
    2. [950] Set state's G2 RL designated to unassigned-94.
  6. [439] Otherwise, if state's current element is G3:
    1. [445] Set state's G3 designated to set.
    2. [951] Set state's G3 RL designated to unassigned-94.
  7. [460] Set state's decoder state to escape trailer state.
  8. [463] Reconsume bc.

Escape coding system state

[1000] The escape coding system state switches by the bit combination bc:

2/0
  1. [1004] Set state's decoder state to escape coding system 0 state.
2/1
  1. [1005] Set state's decoder state to escape coding system moe state.
2/15
  1. [1006] Set state's decoder state to escape coding system wo state.
3/0
  1. [2142] If state's lib flag is true:
    1. [2158] Set state's input getter to the 8-bit input getter.
    2. [2143] Set state's right mode to sjis.
    3. [2144] Set state's S1 designated to the result of getting a G set with 94, 2, 942, 4/2 followed by 4/0.
    4. [2145] Set state's S2 designated to the result of getting a G set with 94, 2, sjis2, ms.
    5. [2146] Set state's shift plane 2 mode to normal.
  2. [2147] Otherwise:
    1. [1121] Emit character (protocol, 4/0).
    2. [1691] Modify character sets of state for « "iso2022" ».
    3. [1940] Set state's input getter to the 8-bit input getter.
    4. [1040] Set state's GL mode to iso2022.
    5. [1035] Set state's right mode to iso2022.
    6. [1507] Set state's decoder state to default state.
3/1
  1. [2162] Set state's input getter to the 8-bit input getter.
  2. [2163] Set state's right mode to uhc.
  3. [2164] Set state's decoder state to the default state.
3/2
  1. [2165] Set state's input getter to the 8-bit input getter.
  2. [2166] Set state's right mode to gb18030.
  3. [2167] Set state's decoder state to the default state.
3/3
  1. [2171] Set state's input getter to the 8-bit input getter.
  2. [2173] Set state's right mode to single.
  3. [2172] Set state's decoder state to default state.
3/4
  1. [2154] If state's lib flag is true:
    1. [2158] Set state's input getter to the 8-bit input getter.
    2. [2156] Set state's right mode to big5.
    3. [2157] Set state's decoder state to the default state.
  2. [2155] Otherwise:
    1. [1024] Modify character sets of state for « "iso2022", "videotex" ».
    2. [1939] Set state's input getter to the 8-bit input getter.
    3. [1907] Set state's GL mode to iso2022.
    4. [1908] Set state's right mode to iso2022.
    5. [1118] Run a macro with state, "ESC 2/1 4/11 ESC 2/2 4/6 ESC 2/8 4/2 ESC 2/9 5/7 ESC 2/10 7/12 ESC 2/15 5/7 LS0 LS1R".
    6. [1703] Set state's decoder state to default state.
3/5
  1. [2159] Set state's input getter to the 8-bit input getter.
  2. [2160] Set state's right mode to big5.
  3. [2161] Set state's decoder state to the default state.
3/6
  1. [2168] Set state's input getter to the 8-bit input getter.
  2. [2169] Set state's right mode to hangultalk.
  3. [2170] Set state's decoder state to the default state.
3/8
  1. [1119] Emit character (protocol, bc).
  2. [1938] Set state's input getter to the 8-bit input getter.
  3. [1037] If state's UTF-8 GL flag is true:
    1. [1072] Set state's GL mode to iso2022.
  4. [1073] Otherwise:
    1. [1074] Set state's GL mode to single.
    2. [1078] Set state's left designated to the result of getting a G set with 94, 1, 94, 4/2.
  5. [1036] Set state's right mode to utf-8.
  6. [1508] Set state's decoder state to default state.
3/13
  1. [1120] Emit character (protocol, bc).
  2. [1509] Set state's decoder state to default state.
4/0
  1. [2136] Emit character (protocol, 4/0).
  2. [2137] Modify character sets of state for « "iso2022" ».
  3. [2138] Set state's input getter to the 8-bit input getter.
  4. [2139] Set state's GL mode to iso2022.
  5. [2140] Set state's right mode to iso2022.
  6. [2141] Set state's decoder state to default state.
4/1
  1. [2148] Modify character sets of state for « "iso2022", "videotex" ».
  2. [2149] Set state's input getter to the 8-bit input getter.
  3. [2150] Set state's GL mode to iso2022.
  4. [2151] Set state's right mode to iso2022.
  5. [2152] Run a macro with state, "ESC 2/1 4/11 ESC 2/2 4/6 ESC 2/8 4/2 ESC 2/9 5/7 ESC 2/10 7/12 ESC 2/15 5/7 LS0 LS1R".
  6. [2153] Set state's decoder state to default state.
4/2
  1. [1937] Set state's input getter to the 8-bit input getter.
  2. [1039] Set state's GL mode to single.
  3. [1110] Set state's left designated to the result of getting a G set with 94, 1, 94, 4/2.
  4. [1038] Set state's right mode to utf-1.
  5. [1510] Set state's decoder state to default state.
4/3
  1. [1687] Modify character sets of state for « "iso2022", "videotex" ».
  2. [1936] Set state's input getter to the 8-bit input getter.
  3. [1419] Set state's GL mode to captain.
  4. [1917] Set state's right mode to iso2022.
  5. [1418] Set state's decoder state to default state.
4/4
  1. [1935] Set state's input getter to the 8-bit input getter.
  2. [1918] Set state's GL mode to iso2022.
  3. [1919] Set state's right mode to iso2022.
  4. [1506] Set state's decoder state to data syntax 2 state.
4/5, 4/6, 4/8
  1. [1688] Modify character sets of state for « "iso2022", "videotex" ».
  2. [1934] Set state's input getter to the 8-bit input getter.
  3. [1690] Set state's GL mode to iso2022.
  4. [1920] Set state's right mode to iso2022.
  5. [1689] Set state's decoder state to default state.
4/7
  1. [1933] Set state's input getter to the 8-bit input getter.
  2. [1075] If state's UTF-8 GL flag is true:
    1. [1076] Set state's GL mode to iso2022.
  3. [1077] Otherwise:
    1. [1012] Set state's GL mode to single.
    2. [1111] Set state's left designated to the result of getting a G set with 94, 1, 94, 4/2.
  4. [1041] Set state's right mode to utf-8.
  5. [1511] Set state's decoder state to default state.
[ 5/0, 5/15 ]
  1. [1932] Set state's input getter to the 8-bit input getter.
  2. [975] Set state's G1 designated to the result of getting a G set with 96, 1, videotex, t100alphageometric.
  3. [1362] Set state's decoder state to default state.
Otherwise
  1. [1001] Set state's decoder state to escape coding system unassigned state.
  2. [1002] Reconsume bc.

Escape coding system 0 state

[1007] The escape coding system 0 state switches by the bit combination bc:

3/0
  1. [1931] Set state's input getter to the 8-bit input getter.
  2. [1011] Set state's GL mode to single.
  3. [1105] Set state's right mode to single.
  4. [1108] Set state's left designated to the result of getting a 128 set with single, barcode.
  5. [1107] Set state's right designated to state's left designated.
  6. [1106] Set state's decoder state to default state.
Otherwise
  1. [1008] Set state's decoder state to escape coding system unassigned state.
  2. [1003] Reconsume bc.

Escape coding system moe state

[1013] The escape coding system moe state switches by the bit combination bc:

[ 2/0, 2/15 ]
  1. [1022] Set state's current I byte to bc.
  2. [1014] Set state's decoder state to escape coding system moe I state.
Otherwise
  1. [1015] Set state's decoder state to escape coding system unassigned state.
  2. [1009] Reconsume bc.

Escape coding system moe I state

[1018] The escape coding system moe I state switches by the bit combination bc:

[ 3/0, 3/15 ]
  1. [1023] Let n be (state's current I byte - 0x20) × 16 + bc - 0x30.
  2. [1930] Set state's input getter to the 8-bit input getter.
  3. [1043] Set state's GL mode to iso2022.
  4. [1045] If n is in 1:
    1. [1047] Set state's right mode to single.
    2. [1048] Set state's right designated to the result of getting a 128 set with ct, koi8-r.
  5. [1170] Otherwise, if n is in 2:
    1. [1171] Set state's right mode to single.
    2. [1172] Set state's right designated to the result of getting a 128 set with ct, koi8-u.
  6. [1173] If n is in [ 3, 11 ]:
    1. [1174] Set state's right mode to single.
    2. [1175] Set state's right designated to the result of getting a G set with 128, 1, cp, 1250 + n - 3.
  7. [1049] Otherwise, if n is 12:
    1. [1050] Set state's right mode to sjis.
    2. [1292] Set state's S1 designated to the result of getting a G set with 94, 2, 942, 4/2 followed by 4/0.
    3. [1294] Set state's S2 designated to the result of getting a G set with 94, 2, sjis2, ms.
    4. [1297] Set state's shift plane 2 mode to normal.
  8. [1046] Otherwise, if n is 13:
    1. [1051] Set state's right mode to sjis.
    2. [1295] Set state's S1 designated to the result of getting a G set with 94, 2, 942, 4/15.
    3. [1293] Set state's S2 designated to the result of getting a G set with 94, 2, 942, 5/0.
    4. [1296] Set state's shift plane 2 mode to jisx0213.
  9. [1052] Otherwise, if n is 14:
    1. [1053] Set state's right mode to big5.
  10. [1054] Otherwise, if n is 15:
    1. [1055] Set state's right mode to johab.
  11. [1056] Otherwise, if n is 16:
    1. [1057] Set state's right mode to uhc.
  12. [1058] Otherwise, if n is 17:
    1. [1059] Set state's right mode to iso2022.
    2. [1060] Set state's G1 designated to the result of getting a G set with 94, 3, cns, 1.
    3. [1061] Set state's G2 designated to the result of getting a G set with 94, 2, cns, euctw2.
  13. [1062] Otherwise, if n is 18:
    1. [1063] Set state's right mode to iso2022.
    2. [1064] Set state's G1 designated to to the result of getting a G set with 94, 2, 942, 4/15.
    3. [1065] Set state's G2 designated to to the result of getting a G set with 94, 1, 94, 4/9.
    4. [1066] Set state's G3 designated to to the result of getting a G set with 94, 2, jis, jisx0212jisx0213.
  14. [1067] Otherwise, if n is 19 or 20:
    1. [1068] Set state's right mode to gb18030.
  15. [1042] Otherwise:
    1. [1044] Set state's right mode to x-moe-internal.
  16. [1071] Set state's decoder state to default state.
Otherwise
  1. [1019] Set state's decoder state to escape coding system unassigned state.
  2. [1010] Reconsume bc.

Escape coding system wo state

[1021] The escape coding system wo state switches by the bit combination bc:

3/0
  1. [2174] If state's lib flag is true:
    1. [2134] Set state's GL mode to unicode.
    2. [2178] Set state's right mode to unicode.
    3. [2179] Set state's input getter to the SCSU input getter.
    4. [2180] Set state's decoder state to default state.
  2. [2175] Otherwise:
    1. [2176] Set state's current I byte to bc.
    2. [2177] Set state's decoder state to extended segment state.
[ 3/1, 3/15 ]
  1. [1025] Set state's current I byte to bc.
  2. [1139] Set state's decoder state to extended segment state.
4/0, 4/3, 4/5
  1. [1923] Set state's GL mode to unicode.
  2. [1924] Set state's right mode to unicode.
  3. [1880] Set state's input getter to the UCS-2BE input getter.
  4. [1881] Set state's decoder state to default state.
4/1, 4/4, 4/6
  1. [1925] Set state's GL mode to unicode.
  2. [1926] Set state's right mode to unicode.
  3. [1882] Set state's input getter to the UCS-4BE input getter.
  4. [1883] Set state's decoder state to default state.
4/10, 4/11, 4/12
  1. [1927] Set state's GL mode to unicode.
  2. [1928] Set state's right mode to unicode.
  3. [1884] Set state's input getter to the UTF-16BE input getter.
  4. [1886] Set state's previous code point to null.
  5. [1885] Set state's decoder state to default state.
4/2
  1. [1929] Set state's input getter to the 8-bit input getter.
  2. [1279] Set state's opaque designated to the result of getting a 256 set with vts, opaque.
  3. [1921] Set state's decoder state to opaque state.
Otherwise
  1. [1027] Set state's decoder state to escape coding system unassigned state.
  2. [1028] Reconsume bc.

Escape coding system unassigned state

[1033] The escape coding system unassigned state switches by the bit combination bc:

[ 2/0, 2/15 ]
  1. [1030] Do nothing.
[ 3/0, 3/15 ]
  1. [1034] Error.
  2. [1909] Set state's input getter to the 8-bit input getter.
  3. [1275] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
  4. [1025] Set state's decoder state to opaque state.
Otherwise
  1. [1029] Error.
  2. [1031] Set state's decoder state to default state.
  3. [1032] Reconsume bc.

Escape unassigned state

[106] The escape unassigned state switches by the bit combination bc:

[ 2/0, 2/15 ]
  1. [107] Set state's current byte sequence to state's current byte sequence followed by bc.
  2. [110] If state's current byte sequence's length is equal to the maximum sequence length:
    1. [500] Error.
    2. [508] Set state's decoder state to escape trailer state.
[ 3/0, 7/14 ]
  1. [108] Set state's current byte sequence to state's current byte sequence followed by bc.
  2. [114] Emit a character (esc, state's current byte sequence).
  3. [109] Set state's decoder state to default state.
Otherwise
  1. [472] Error.
  2. [484] Set state's decoder state to default state.
  3. [497] Reconsume bc.

Escape trailer state

[516] The escape trailer state switches by the bit combination bc:

[ 2/0, 2/15 ]
  1. [600] Do nothing.
[ 3/0, 7/14 ]
  1. [602] Set state's decoder state to default state.
Otherwise
  1. [647] Set state's decoder state to default state.
  2. [646] Reconsume bc.

Foreign right state

[1087] The foreign right state switches by the bit combination bc:

[ 7/15, 15/15 ]
  1. [1090] If state's right mode is single:
    1. [1091] Let set be state's right designated.
    2. [1092] Emit a character set [ bc & 0b01111111 ].

      [1117] Control characters are not interpreted.

    3. [1094] Set state's decoder state to default state.
  2. [1097] Otherwise, if state's right mode is iso2022jp:
    1. [1335] If state's current I byte is in [ 10/1, 14/15 ], 15/13, 15/14:
      1. [1336] Let set be state's 94 final set [ 4/9 ].
      2. [1337] Emit a character set [ bc & 0b01111111 ].
      3. [1341] Set state's decoder state to default state.
    2. [1340] Otherwise:
      1. [1324] Set state's current I byte to bc.
      2. [1325] Set state's decoder state to foreign right first state.
  3. [1093] Otherwise, if state's right mode is utf-1:
  4. [1104] Otherwise, if state's right mode is utf-8:
  5. [1096] Otherwise, if state's right mode is sjis:
    1. [1342] If state's current I byte is in [ 10/1, 13/15 ]:
      1. [1343] Let set be state's 94 final set [ 4/9 ].
      2. [1344] Emit a character set [ bc & 0b01111111 ].
      3. [1345] Set state's decoder state to default state.
    2. [1346] Otherwise:
  6. [1098] Otherwise, if state's right mode is big5:
  7. [1099] Otherwise, if state's right mode is uhc:
  8. [2135] Otherwise, if state's right mode is hangultalk:
  9. [1100] Otherwise, if state's right mode is johab:
  10. [1102] Otherwise, if state's right mode is gb18030:
  11. [1103] Otherwise, if state's right mode is x-moe-internal:
Otherwise
  1. [1088] Set state's decoder state to default state.
  2. [1089] Reconsume bc.

Foreign right first state

[1326] The foreign right first state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1327] If state's right mode is iso2022jp:
    1. [1322] If state's current I byte is in [ 7/15, 9/8 ] and bc is in [ 2/1, 7/14 ]:
      1. [1323] Let first be state's current I byte - 0x7F.
      2. [1332] Let bytes be first followed by bc.
      3. [1334] Let set be state's S2 designated.
      4. [1333] Emit a character set [ bytes ].
      5. [1347] Set state's decoder state to default state.
    2. [1348] Otherwise, if state's current I byte is in [ 15/0, 15/12 ] and bc is
      ...:
      1. [1349] Let set be the result of getting a G set with 94, 2, sjis2, docomo.
      2. [1339] Let bytes be
        ...
      3. [1350] Emit a character set [ bytes ].
      4. [1351] Set state's decoder state to default state.
    3. [1352] Otherwise:
      1. [1338] If state's current I byte is in [ 7/15, 9/15 ]:
        1. [1353] Emit a code point whose value is state's current I byte.
      2. [1354] Otherwise:
        1. [1355] Emit character (unknown-byte, null, state's current I byte).
      3. [1357] Set state's decoder state to default state.
      4. [1356] Reconsume bc.
  2. [1329] Otherwise:
Otherwise
  1. [1328] Emit character (unknown-byte, null, state's current I byte).
  2. [1330] Set state's decoder state to default state.
  3. [1331] Reconsume bc.

Extended segment state

[1140] The extended segment state switches by the bit combination bc:

[ 8/0, 15/15 ]
  1. [1144] Set state's current J byte to bc.
  2. [1145] Set state's decoder state to extended segment length state.
Otherwise
  1. [1141] Error.
  2. [1142] Set state's decoder state to default state.
  3. [1143] Reconsume bc.

Extended segment length state

[1146] The extended segment length state switches by the bit combination bc:

[ 8/0, 15/15 ]
  1. [1147] Set state's current segment length to ((state's current J byte - 128) × 128) + (bc - 128).
  2. [1148] Set state's current segment data to the empty byte sequence.
  3. [1149] If state's current segment length is 0:
    1. [1151] Error.
    2. [1152] Set state's decoder state to default state.
  4. [1150] Otherwise:
    1. [1145] Set state's decoder state to extended segment data state.
Otherwise
  1. [1153] Error.
  2. [1154] Set state's decoder state to default state.
  3. [1155] Reconsume bc.

Extended segment data state

[1156] The extended segment data state switches by the bit combination bc:

0/0, 0/1, [ 0/3, 15/15 ]
  1. [1158] Set state's current segment data to state's current segment data followed by bc.
  2. [1159] Set state's current segment length to state's current segment length - 1.
  3. [1160] If state's current segment length is 0:
    1. [92] Emit character (ct, extended-segment-f, state's current I byte).
    2. [93] For each bc in the bit combinations in state's current segment data, in order:
      1. [95] Emit character (ct, extended-segment-data, bc).
    3. [1161] Set state's decoder state to default state.
0/2
  1. [1217] Let set be the result of getting a CT character set with state's current I byte and state's current segment data.
  2. [1212] Set state's current segment data to state's current segment data followed by bc.
  3. [1213] Set state's current segment length to state's current segment length - 1.
  4. [1218] If set is not null:
    1. [1224] Set state's current CT set to set.
    2. [1228] Set state's current segment data to the empty byte sequence.
    3. [1225] Set state's decoder state to extended segment text state.
    4. [1219] If state's current segment length is 0:
      1. [1220] Set state's decoder state to default state.
  5. [1221] Otherwise:
    1. [773] Emit character (ct, extended-segment-f, state's current I byte).
    2. [774] For each bc in the bit combinations in state's current segment data, in order:
      1. [1157] Emit character (ct, extended-segment-data, bc).
    3. [1164] Emit character (ct, extended-segment-data, bc).
    4. [1214] If state's current segment length is 0:
      1. [1216] Set state's decoder state to default state.
    5. [1215] Otherwise:
      1. [1572] Set state's current CT set to the result of getting a 256 set with ct, extended-segment-data.
      2. [1505] Set state's decoder state to extended segment text state.
Otherwise
  1. [98] Emit character (ct, extended-segment-f, state's current I byte).
  2. [731] For each bc in the bit combinations in state's current segment data, in order:
    1. [733] Emit character (ct, extended-segment-data, bc).
  3. [734] Error.
  4. [1162] Set state's decoder state to default state.
  5. [1163] Reconsume bc.

Extended segment text state

[1222] The extended segment text state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1223] Let set be state's current CT set.
  2. [1226] Set state's current segment data to state's current segment data followed by bc.
  3. [1227] Set state's current segment length to state's current segment length - 1.
  4. [1229] If set is a 94 set, 96 set, or 128 set:
    1. [1242] Let bytes be bc & 0b01111111.
    2. [1230] If set [ bytes ] exists:
      1. [1232] Let char be set [ bytes ].
    3. [1233] Otherwise:
      1. [1234] Let char be character (unknown-byte, null, bc).
    4. [1244] Emit char.
    5. [1235] Set state's current segment data to the empty byte sequence.
  5. [1573] Otherwise, if set is a 256 set:
    1. [1581] Emit set [ bc ].
    2. [1583] Set state's current segment data to the empty byte sequence.
  6. [1231] Otherwise, if set is a 942 set or 2562 set:
    1. [1237] If state's current segment data's length is 2:
      1. [1251] If set is a 942 set:
        1. [1238] Let bytes be state's current segment data's first byte & 0b01111111 followed by state's current segment data's second byte & 0b01111111.
      2. [1252] Otherwise, if set is a 2562 set:
        1. [1253] Let bytes be state's current segment data.
      3. [1243] If set [ bytes ] exists:
        1. [1241] Let char be set [ bytes ].
        2. [1246] Emit char.
      4. [1247] Otherwise:
        1. [1248] Emit character (unknown-byte, null, state's current segment data's first byte).
        2. [1249] Emit character (unknown-byte, null, state's current segment data's second byte).
      5. [1245] Set state's current segment data to the empty byte sequence.
    2. [1262] Otherwise, if state's current I byte is 3/0:
      1. [1264] If state's current segment data is in [ 0/0, 7/15 ]:
        1. [1265] Let char be a code point whose value is bc.
        2. [1267] Emit char.
        3. [1266] Set state's current segment data to the empty byte sequence.
  7. [1236] If state's current segment length is 0:
    1. [1239] If state's current segment data's length is not 0:
      1. [1240] Error.
    2. [1254] Set state's decoder state to default state.
Otherwise
  1. [1256] If state's current segment data's length is not 0:
    1. [1257] Emit character (unknown-byte, null, state's current segment data).
  2. [1255] Error.
  3. [1259] Set state's decoder state to default state.
  4. [1260] Reconsume bc.

Command state

[2011] The command state switches by the bit combination bc:

[ 0/8, 0/13 ], [ 2/0, 7/14 ], [ 10/0, 15/14 ]
  1. [2014] Emit character (param, bc & 0b01111111).
0/14, 0/15
  1. [2029] Let set be state's C0 designated.
  2. [2028] Set char be set [ bc ].
  3. [2030] If char is LS0 or LS1:
    1. [2031] Process char.
  4. [2032] Otherwise:
    1. [2033] Set state's decoder state to default state.
    2. [2034] Reconsume bc.
8/14, 8/15
  1. [2035] If state's right mode is iso2022 or unicode and state's CR invoked is C0:
    1. [2036] Let set be state's C0 designated.
    2. [2037] Set char be set [ bc & 0b01111111 ].
    3. [2038] If char is LS0 or LS1:
      1. [2039] Process char.
    4. [2040] Otherwise:
      1. [2041] Set state's decoder state to default state.
      2. [2042] Reconsume bc.
  2. [2043] Otherwise:
    1. [2044] Set state's decoder state to default state.
    2. [2045] Reconsume bc.
Otherwise
  1. [2012] Set state's decoder state to default state.
  2. [2013] Reconsume bc.

CSI state

[2064] The CSI state switches by the bit combination bc:

0/14, 0/15
  1. [2065] Let set be state's C0 designated.
  2. [2066] Set char be set [ bc ].
  3. [2067] If char is LS0 or LS1:
    1. [2068] Process char.
  4. [2069] Otherwise:
    1. [2071] Set state's decoder state to default state.
    2. [2072] Reconsume bc.
[ 2/0, 2/15 ], [ 10/0, 10/15 ]
  1. [2086] Emit charcter (param, bc).
  2. [2088] Set state's decoder state to CSI I state.
[ 3/0, 3/15 ], [ 11/0, 11/15 ]
  1. [2089] Emit charcter (param, bc).
[ 4/0, 7/14 ], [ 12/0, 15/14 ]
  1. [2090] Emit charcter (param, bc).
  2. [2091] Set state's decoder state to default state.
8/14, 8/15
  1. [2070] If state's right mode is iso2022 or unicode and state's CR invoked is C0:
    1. [2073] Let set be state's C0 designated.
    2. [2074] Set char be set [ bc & 0b01111111 ].
    3. [2075] If char is LS0 or LS1:
      1. [2076] Process char.
    4. [2077] Otherwise:
      1. [2078] Set state's decoder state to default state.
      2. [2079] Reconsume bc.
  2. [2080] Otherwise:
    1. [2081] Set state's decoder state to default state.
    2. [2082] Reconsume bc.
Otherwise
  1. [2083] Set state's decoder state to default state.
  2. [2084] Reconsume bc.

CSI I state

[2092] The CSI I state switches by the bit combination bc:

0/14, 0/15
  1. [2093] Let set be state's C0 designated.
  2. [2094] Set char be set [ bc ].
  3. [2095] If char is LS0 or LS1:
    1. [2096] Process char.
  4. [2097] Otherwise:
    1. [2098] Set state's decoder state to default state.
    2. [2099] Reconsume bc.
[ 2/0, 2/15 ], [ 10/0, 10/15 ]
  1. [2100] Emit charcter (param, bc).
[ 4/0, 7/14 ], [ 12/0, 15/14 ]
  1. [2101] Emit charcter (param, bc).
  2. [2102] Set state's decoder state to default state.
8/14, 8/15
  1. [2103] If state's right mode is iso2022 or unicode and state's CR invoked is C0:
    1. [2104] Let set be state's C0 designated.
    2. [2105] Set char be set [ bc & 0b01111111 ].
    3. [2106] If char is LS0 or LS1:
      1. [2107] Process char.
    4. [2108] Otherwise:
      1. [2109] Set state's decoder state to default state.
      2. [2110] Reconsume bc.
  2. [2111] Otherwise:
    1. [2112] Set state's decoder state to default state.
    2. [2113] Reconsume bc.
Otherwise
  1. [2114] Set state's decoder state to default state.
  2. [2115] Reconsume bc.

Macro state

[1576] The macro state switches by the bit combination bc:

4/0, 4/1
  1. [1759] If state's current capturing byte is not' null:
    1. [1760] Error.
  2. [1614] Set state's decoder state to macro start state.
  3. [1615] Set state's current I byte to bc.
[ 4/2, 4/14 ]
  1. [1597] Emit character (param, bc).
4/15
  1. [1902] If state's current capturing byte is not null:
    1. [1901] Let bytes be state's macro set [ state's current capturing byte ].
    2. [1903] Remove a byte sequence 9/5 4/15 or 1/11 5/5 4/15 at the end of bytes, if any.
    3. [1904] Set state's macro set [ state's current capturing byte ] to bytes.
    4. [1616] Set state's current capturing byte to null.
Otherwise
  1. [1604] Error.
  2. [1607] Set state's decoder state to default state.
  3. [1609] Reconsume bc.

Macro start state

[1732] The macro start state switches by the bit combination bc:

[ 2/0, 7/15 ]
  1. [1733] Set state's current capturing byte to bc.
  2. [1758] Set state's macro set [ state's current capturing byte ] to the empty byte sequence.
  3. [1734] If state's current I byte is 4/0:
    1. [1735] Set state's decoder state to macro data state.
  4. [1736] Otherwise, if state's current I byte is 4/1:
    1. [1737] Set state's decoder state to default state.
Otherwise
  1. [1738] Error.
  2. [1739] Set state's decoder state to default state.
  3. [1740] Reconsume bc.

Macro data state

[1741] The macro data state switches by the bit combination bc:

[ 0/0, 9/4 ], [ 9/6, 15/15 ]
  1. [1748] Do nothing.
9/5
  1. [1752] Set state's decoder state to macro data macro state.
Otherwise
  1. [1749] Error.
  2. [1750] Set state's decoder state to default state.
  3. [1751] Reconsume bc.

Macro data macro state

[1753] The macro data macro state switches by the bit combination bc:

4/15
  1. [1754] Set state's decoder state to macro state.
  2. [1755] Reconsume bc.
Otherwise
  1. [1756] Set state's decoder state to macro data state.
  2. [1757] Reconsume bc.

SCI state

[2018] The SCI state switches by the bit combination bc:

[ 0/8, 0/13 ], [ 2/0, 7/14 ]
  1. [2022] Emit SCI.
  2. [2023] Emit character (param, bc).
  3. [2024] Set state's decoder state to default state.
Otherwise
  1. [2019] Error.
  2. [2020] Set state's decoder state to default state.
  3. [2021] Reconsume bc.

Before BOM state

[1887] The before BOM state switches by the bit combination bc:

U+FEFF
  1. [1890] Set state's decoder state to default state.
U+FFFE
  1. [1892] If state's current input getter is the UCS-2BE getter:
    1. [1893] Set state's current input getter tp the UCS-2LE getter.
  2. [1894] Otherwise, if state's current input getter is the UCS-4BE getter:
    1. [1895] Set state's current input getter tp the UCS-4LE getter.
  3. [1896] Otherwise, if state's current input getter is the UTF-16BE getter:
    1. [1897] Set state's current input getter tp the UTF-16LE getter.
  4. [1891] Set state's decoder state to default state.
Otherwise
UTF-8 BOM
  1. [1888] Set state's decoder state to default state.
  2. [1889] Reconsume bc.

Data syntax 2 state

[1512] The data syntax 2 state switches by the bit combination bc:

4/0
  1. [1521] Let mode be state's data syntax 2 default mode.
  2. [1520] If state's current I byte is 6/3 or 6/4:
    1. [1522] Set mode to parallel.
  3. [1523] Run the steps to initialize data syntax 2 with state and mode.
[ 4/1, 7/14 ]
  1. [1513] If bc is in [ 6/0, 6/4 ]:
    1. [1514] Set state's bits to 7-bit.
  2. [1515] If bc is in [ 6/1, 6/4 ]:
    1. [1516] Set state's current I byte to bc.
  3. [1517] Emit character (videotex, profile, bc).
Otherwise
  1. [1518] Let mode be state's data syntax 2 default mode.
  2. [1519] If state's current I byte is 6/3 or 6/4:
    1. [1524] Set mode to parallel.
  3. [1525] Run the steps to initialize data syntax 2 with state and mode.
  4. [1526] Reconsume bc.

US state

[213] The US state switches by the bit combination bc:

2/0, 2/1
  1. [1403] Emit character (videotex, us, bc).
  2. [1580] Set state's GL mode to iso2022.
  3. [1404] Set state's decoder state to US terminal state.
[ 2/2, 2/14 ], 3/0, 3/11, 3/12, 3/13
  1. [655] If state's current I byte is 4/10:
    1. [1550] Set state's GL mode to single.
    2. [1552] Set state's left designated to the result of getting a G set with 96, 1, videotex, 1/15 followed by bc.
    3. [1567] Set state's C1 override designated to null.
    4. [1553] Set state's decoder state to default state.
  2. [656] Otherwise:
    1. [657] Emit character (C0, state's current I byte, 1/15).
    2. [1401] Set state's decoder state to default state.
    3. [658] Reconsume bc.
2/15
  1. [672] If state's current I byte is 4/10:
    1. [1660] Set state's GL mode to iso2022.
    2. [1640] Set state's decoder state to US reset state.
  2. [673] Otherwise:
    1. [675] Emit character (C0, state's current I byte, 1/15).
    2. [1400] Set state's decoder state to default state.
    3. [676] Reconsume bc.
3/1, 3/2
  1. [683] If state's current I byte is 4/10:
    1. [1541] Set state's GL mode to single.
    2. [1542] Set state's left designated to the result of getting a G set with 96, 1, videotex, 1/15 followed by bc.
    3. [1565] Set state's C1 override designated to the result of getting a C set with C1, videotex, geometric-c1.
    4. [1544] Set state's decoder state to default state.
  2. [684] Otherwise:
    1. [997] Emit character (C0, state's current I byte, 1/15).
    2. [1399] Set state's decoder state to default state.
    3. [998] Reconsume bc.
3/4, 3/5
  1. [1376] If state's current I byte is 4/10:
    1. [1545] Set state's GL mode to single.
    2. [1546] Set state's left designated to the result of getting a G set with 96, 1, videotex, 1/15 followed by bc.
    3. [1547] Set state's decoder state to default state.
  2. [1377] Otherwise:
    1. [1378] Emit character (C0, state's current I byte, 1/15).
    2. [1398] Set state's decoder state to default state.
    3. [1379] Reconsume bc.
3/14
  1. [1380] If state's current I byte is 4/10:
    1. [1579] Set state's GL mode to telesoftware.
    2. [1575] Set state's decoder state to default state.
  2. [1381] Otherwise:
    1. [1382] Emit character (C0, state's current I byte, 1/15).
    2. [1397] Set state's decoder state to default state.
    3. [1383] Reconsume bc.
3/15
  1. [1384] If state's current I byte is 4/10:
    1. [1628] Set state's GL mode to iso2022.
    2. [1617] Set state's decoder state to TRANSPARENT state.
  2. [1385] Otherwise:
    1. [1386] Emit character (C0, state's current I byte, 1/15).
    2. [1396] Set state's decoder state to default state.
    3. [1387] Reconsume bc.
[ 4/0, 7/15 ]
  1. [1388] If state's current I byte is 4/10:
    1. [1548] Emit character (videotex, protocol, 1/15 followed by bc).
    2. [1549] Set state's GL mode to iso2022.
    3. [1568] Set state's C1 override designated to null.
    4. [1551] Set state's decoder state to default state.
  2. [1389] Otherwise:
    1. [1390] Emit character (C0, state's current I byte, 1/15).
    2. [1395] Set state's decoder state to default state.
    3. [1391] Reconsume bc.
Otherwise
  1. [1392] If state's current I byte is 4/10:
    1. [1393] Error.
    2. [1566] Set state's GL mode to iso2022.
    3. [1569] Set state's C1 override designated to null.
  2. [654] Otherwise:
    1. [1394] Emit character (C0, state's current I byte, 1/15).
  3. [215] Set state's decoder state to default state.
  4. [273] Reconsume bc.

US terminal state

[1402] The US terminal state switches by the bit combination bc:

4/0
  1. [1405] Emit character (videotex, us, bc).
  2. [1406] Set state's decoder state to default state.
[ 4/1, 7/14 ]
  1. [1407] Emit character (videotex, us, bc).
7/15
  1. [1408] Emit character (videotex, us, bc).
  2. [1409] Set state's decoder state to US terminal delete state.
Otherwise
  1. [1411] Set state's decoder state to default state.
  2. [1410] Reconsume bc.

US terminal delete state

[1412] The US terminal delete state switches by the bit combination bc:

[ 4/0, 5/15 ]
  1. [1413] Emit character (videotex, us, bc).
  2. [1414] Set state's decoder state to default state.
[ 6/0, 7/15 ]
  1. [1415] Emit character (videotex, us, bc).
Otherwise
  1. [1416] Set state's decoder state to default state.
  2. [1417] Reconsume bc.

US reset state

[1641] The US reset state switches by the bit combination bc:

4/0, 4/5
  1. [1655] Set state's current I byte to bc.
  2. [1656] Set state's decoder state to US reset row state.
[ 4/1, 4/4 ]
  1. [1643] If bc is 4/1 or 4/3:
    1. [1644] Let mode be serial.
  2. [1645] Otherwise, if bc is 4/2 or 4/4:
    1. [1646] Let mode] be parallel.
  3. [1642] Run the steps to initialize data syntax 2 with state and mode.
  4. [1647] If bc is 4/1 or 4/2:
    1. [1648] Emit character (videotex, reset, bc).
4/15
  1. [1671] If state's previous state is not null:
    1. [1672] Set state's G0 designated to state's previous state's G0 designated.
    2. [1673] Set state's G2 designated to state's previous state's G2 designated.
    3. [1674] Set state's GL invoked to state's previous state's GL invoked.
    4. [1675] Set state's GR invoked to state's previous state's GR invoked.
    5. [1677] Set state's C1 designated to state's previous state's C1 designated.
    6. [1678] If state's C1 designated is equal to the result of getting a C set with C1, C1, 4/0:
      1. [1676] Run a macro with state, "ESC 2/2 4/0".
    7. [1679] Otherwise, if state's C1 designated is equal to the result of getting a C set with C1, C1, 4/1.
  2. [1680] Emit character] (videotex, reset, bc).
Otherwise
  1. [1657] Error.
  2. [1658] Set state's decoder state to default state.
  3. [1659] Reconsume bc.

US reset row state

[1661] The US reset row state switches by the bit combination bc:

[ 4/0, 7/15 ]
  1. [1649] Set state's previous state to a copy of decode.
  2. [1650] Set state's G0 designated to the result of getting a G set with 94, 1, 94, 4/0.
  3. [1652] Set state's G2 designated to the result of getting a G set with 94, 1, 94, 6/2.
  4. [1653] Set state's GL invoked to G0.
  5. [1654] Set state's GR invoked to G2.
  6. [1662] If state's current I byte is 4/0:
    1. [1664] Run a macro with state, "ESC 2/2 4/0".
  7. [1663] Otherwise, if state's current I byte is 4/5:
    1. [1665] Run a macro with state, "ESC 2/2 4/1".
  8. [1668] Emit character (videotex, resetrow, bc).
  9. [1666] Set state's decoder state to default state.
Otherwise
  1. [1667] Error.
  2. [1669] Set state's decoder state to default state.
  3. [1670] Reconsume bc.

Sound control state

[1485] The sound control state switches by the bit combination bc:

[ 3/0, 3/9 ]
  1. [1488] Emit character (param, bc).
3/11
  1. [1489] Emit character (param, bc).
  2. [1490] Set state's decoder state to sound control parameter state.
Otherwise
  1. [1486] Set state's decoder state to default state.
  2. [1487] Reconsume bc.

Sound control parameter state

[1491] The sound control parameter state switches by the bit combination bc:

[ 3/0, 3/9 ]
  1. [1492] Emit character (param, bc).
3/11
  1. [1493] Emit character (param, bc).
  2. [1494] Set state's decoder state to default state.
Otherwise
  1. [1495] Set state's decoder state to default state.
  2. [1496] Reconsume bc.

Control parameter state

[1500] The control parameter state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1501] Emit character (param, bc).
  2. [723] Set state's current segment length to state's current segment length - 1.
  3. [725] If state's current segment length is 0:
    1. [1502] Set state's decoder state to default state.
Otherwise
  1. [726] Error.
  2. [1503] Set state's decoder state to default state.
  3. [1504] Reconsume bc.

File state

[680] The file state switches by the bit combination bc:

[ 3/0, 7/14 ]
  1. [685] Emit character (vt, file, bc).
  2. [721] Set state's decoder state to default state.
Otherwise
  1. [742] Error.
  2. [745] Set state's decoder state to default state.
  3. [746] Reconsume bc.

CAPTAIN DI state

[1430] The CAPTAIN DI state switches by the bit combination bc:

[ 0/0, 15/14 ]
  1. [1431] Set state's current frame length to bc.
  2. [1450] Run the steps to initialize by DI state.
15/15
  1. [1432] Set state's decoder state to CAPTAIN DI first state.
Otherwise
  1. [1433] Error.
  2. [1438] Set state's decoder state to default state.
  3. [1434] Reconsume bc.

CAPTAIN DI first state

[1435] The CAPTAIN DI first state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1436] Set state's current J byte to bc.
  2. [1439] Set state's decoder state to CAPTAIN DI second state.
Otherwise
  1. [1440] Error.
  2. [1441] Set state's decoder state to default state.
  3. [1442] Reconsume bc.

CAPTAIN DI second state

[1443] The CAPTAIN DI second state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1444] Set state's current frame length to state's current J byte * 0x100 + bc.
  2. [1449] Run the steps to initialize by DI state.
Otherwise
  1. [1446] Error.
  2. [1447] Set state's decoder state to default state.
  3. [1448] Reconsume bc.

TELESOFTWARE CI state

[1582] The TELESOFTWARE CI state switches by the bit combination bc:

[ 0/0, 15/14 ]
  1. [1584] Set state's current segment length to bc.
  2. [1585] Set state's decoder state to TELESOFTWARE parameter state.
15/15
  1. [1586] Set state's decoder state to TELESOFTWARE LI state.
Otherwise
  1. [1587] Error.
  2. [1588] Set state's decoder state to default state.
  3. [1589] Reconsume bc.

TELESOFTWARE LI state

[1590] The TELESOFTWARE LI state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1592] Set state's current segment length to bc.
  2. [1591] Set state's decoder state to TELESOFTWARE LI first state.
Otherwise
  1. [1593] Error.
  2. [1594] Set state's decoder state to default state.
  3. [1595] Reconsume bc.

TELESOFTWARE LI first state

[1596] The TELESOFTWARE LI first state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1598] Set state's current segment length to state's current segment length * 0x100 + bc.
  2. [1599] Set state's decoder state to TELESOFTWARE parameter state.
Otherwise
  1. [1600] Error.
  2. [1601] Set state's decoder state to default state.
  3. [1602] Reconsume bc.

TELESOFTWARE parameter state

[1603] The TELESOFTWARE parameter state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [727] Emit character (videotex, videosoftware-data, bc).
  2. [1605] Set state's current segment length to state's current segment length - 1.
  3. [1606] If state's current segment length is 0:
    1. [1608] Set state's decoder state to default state.
Otherwise
  1. [728] Error.
  2. [1610] Set state's decoder state to default state.
  3. [1611] Reconsume bc.

TRANSPARENT state

[1618] The TRANSPARENT state switches by the bit combination bc:

0/0
  1. [1624] Set state's current segment length to null.
  2. [1619] Set state's decoder state to TRANSPARENT data state.
[ 0/1, 15/14 ]
  1. [1623] Set state's current segment length to bc.
  2. [1622] Set state's decoder state to TRANSPARENT data state.
15/15
  1. [1621] Deprecated.
  2. [1620] Set state's decoder state to TRANSPARENT data state.
Otherwise
  1. [1625] Error.
  2. [1627] Set state's decoder state to default state.
  3. [1626] Reconsume bc.

TRANSPARENT data state

[1629] The TRANSPARENT data state switches by the bit combination bc:

[ 0/0, 1/14 ], [ 2/0, 15/15 ]
  1. [1634] If state's current segment length is not null:
    1. [1635] Set state's current segment length to state's current segment length - 1.
  2. [1636] Emit character (videotex, transparent, bc).
  3. [1637] If state's current segment length is 0:
    1. [1638] Set state's decoder state to default state.
1/15
  1. [1639] Error.
  2. [1631] Set state's current I byte to 4/10.
  3. [1632] Set state's decoder state to US state.
Otherwise
  1. [1630] Error.
  2. [1633] Set state's decoder state to default state.

PCD state

[67] The PCD state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [68] Emit character (param, bc).
  2. [69] Set state's decoder state to PCD PM state.
Otherwise
  1. [1123] Error.
  2. [1122] Set state's decoder state to default state.
  3. [1128] Reconsume bc.

PCD PM state

[70] The PCD PM state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [71] Emit character (param, bc).
  2. [73] Set state's current segment length to 0.
  3. [72] Set state's decoder state to PCD PI state.
Otherwise
  1. [1124] Error.
  2. [1125] Set state's decoder state to default state.
  3. [1129] Reconsume bc.

PCD PI state

[74] The PCD PI state switches by the bit combination bc:

[ 10/0, 11/1 ]
  1. [75] Set state's current segment length to (state's current segment length << 5) + (bc & 0b11111).
  2. [77] If state's current segment length is greater than the maximum chunk length:
    1. [1131] Error.
    2. [1910] Set state's input getter to the 8-bit input getter.
    3. [1276] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
    4. [1132] Set state's decoder state to opaque state.
[ 8/13, 9/14 ]
  1. [78] Set state's current segment length to (state's current segment length << 5) + (bc & 0b11111).
  2. [79] If state's current segment length is greater than the maximum chunk length:
    1. [1133] Error.
    2. [1941] Set state's input getter to the 8-bit input getter.
    3. [1277] Set state's opaque designated to the result of getting a 256 set unknown-byte, null.
    4. [1134] Set state's decoder state to opaque state.
  3. [87] Set state's current segment data to the empty byte sequence.
  4. [82] If state's current segment length is 0:
    1. [83] Set state's decoder state to default state.
  5. [84] Otherwise:
    1. [80] Set state's decoder state to PCD LI state.
Otherwise
  1. [1126] Error.
  2. [1127] Set state's decoder state to default state.
  3. [1130] Reconsume bc.

PCD LI state

[81] The PCD LI state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [88] Emit (pcd, bc).
  2. [76] Set state's current segment length to state's current segment length - 1.
  3. [85] If state's current segment length is 0:
    1. [86] Set state's decoder state to default state.
Otherwise
  1. [1135] Error.
  2. [1136] Set state's decoder state to default state.
  3. [1137] Reconsume bc.

Opaque state

[50] The opaque state switches by the bit combination bc:

[ 0/0, 15/15 ]
  1. [1278] Let set be state's opaque designated.
  2. [51] Emit set [ bc ].
end-of-frame
  1. [1922] Do nothing.
Otherwise
  1. [674] Set state's decoder state to default state.
  2. [682] Reconsume bc.

Characters

[18] A character is one of followings:

[186] Interpretation of these tuples are application-specific.

[112] A character string is a list of zero or more characters.

[113] An empty character string is a character string whose length is 0.

[1771] An EOF is a tuple with no item.

Character sets

[17] A character set is an ordered map, where keys are byte sequences and values are a character.

[575] By definition, there are no duplicate keys.

[1730] A character set identifier is a pair of two values t1 and t2. It is an opaque identifier and uniquely identifies a character set within this document. A character set identifier is valid as t1 and t2 arguments for exactly one of the steps to get a C set, get a G set, get a 128 set, get a 256 set, or get a 2562 set.

[574] A character set set has 1-byte range range if any key in set is a bit combination in range and set's size is equal to range's end - range's start + 1.

[576] A character set set has 2-byte range range if any key in set is a bit combination in range followed by a bit combination in range and set's size is equal to (range's end - range's start + 1)2.

[577] A character set set has 3-byte range range if any key in set is a bit combination in range followed by a bit combination in range followed by a bit combination in range and set's size is equal to (range's end - range's start + 1)3.

[171] To get a 1-byte set with byte start, byte end, t1, and t2, run these steps:

  1. [172] Let set be a new character set.
  2. [173] For each c in [ start, end ]:
    1. [174] Let set [ c ] be a character (t1, t2, c).
  3. [175] Return set.

[583] To get a 2-byte set with byte start, byte end, t1, and t2, run these steps:

  1. [584] Let set be a new character set.
  2. [585] For each c1 in [ start, end ]:
    1. [586] For each c2 in [ start, end ]:
      1. [589] Let cc be c1 followed by c2.
      2. [587] Let set [ cc ] be a character (t1, t2, cc).
  3. [588] Return set.

[590] To get a 3-byte set with byte start, byte end, t1, and t2, run these steps:

  1. [591] Let set be a new character set.
  2. [592] For each c1 in [ start, end ]:
    1. [593] For each c2 in [ start, end ]:
      1. [594] For each c3 in [ start, end ]:
        1. [595] Let cc be c1 followed by c2 followed by c3.
        2. [596] Let set [ cc ] be a character (t1, t2, cc).
  3. [597] Return set.

[22] A C0 set is a character set that has 1-byte range [ 0/0, 1/15 ].

[23] A C1 set is a character set that has 1-byte range [ 8/0, 9/15 ].

[176] To get a C set with type, t1, and t2, run these steps:

  1. [652] If type is C0:
    1. [177] Let set be the result of getting a 1-byte set with 0/0, 1/15, t1, t2.
  2. [653] Otherwise, if type is C1:
    1. [181] Let set be the result of getting a 1-byte set with 8/0, 9/15, t1, t2.
  3. [180] If t1 is C0 and t2 is not 7/14:
    1. [178] Set set [ 1/11 ] to ESC.
  4. [187] If t1 is C0 and t2 is one of: 4/1 (ISO-IR 1), 4/3 (ISO-IR 26), 4/4 (ISO-IR 36), 4/6 (ISO-IR 74), 4/11 (ISO-IR 135), 4/12 (ISO-IR 140), 4/5 (ISO-IR 106), 4/8 (ISO-IR 130), or 4/10 (ISO-IR 134):
    1. [188] Set set [ 0/14 ] to LS1.
    2. [189] Set set [ 0/15 ] to LS0.
  5. [190] If t1 is C0 and t2 is 4/1 (ISO-IR 7), 4/3 (ISO-IR 26), or 4/4 (ISO-IR 36):
    1. [191] Set set [ 1/12 ] to SS2.
  6. [192] If t1 is C0 and t2 is one of: 4/5 (ISO-IR 106), 4/9 (ISO-IR 132), 4/10 (ISO-IR 134), or 4/12 (ISO-IR 135):
    1. [193] Set set [ 1/9 ] to SS2.
    2. [193] Set set [ 1/14 ] to SS3.
  7. [194] If t1 is C0 and t2 is 4/12 (ISO-IR 140):
    1. [195] Set set [ 1/9 ] to SS2.
  8. [1962] If t1 is gb8565 and t2 is C0:
    1. [1963] Set set [ 0/14 ] to LS1.
    2. [1964] Set set [ 0/15 ] to LS0.
    3. [1968] Set set [ 1/11 ] to ESC.
  9. [1965] If t1 is isiri3342 and t2 is C0:
    1. [1966] Set set [ 0/14 ] to LS1.
    2. [1967] Set set [ 0/15 ] to LS0.
    3. [1969] Set set [ 1/11 ] to ESC.
  10. [1716] If t1 is dtvcc and t2 is C0:
    1. [1717] Set set [ 1/0 ] to EXT1.
  11. [196] If t1 is C1 and t2 is one of: 4/5 (ISO-IR 40), 4/3 (ISO-IR 77), 4/3 followed by 4/0, or 4/7 (ISO-IR 105):
    1. [197] Set set [ 8/14 ] to SS2.
    2. [198] Set set [ 8/15 ] to SS3.
  12. [1999] If t1 is C1 and t2 is 4/3 (ISO-IR 77) or 4/3 followed by 4/0:
    1. [2001] Set set [ 9/0 ] to DCS.
    2. [2002] Set set [ 9/13 ] to OSC.
    3. [2003] Set set [ 9/14 ] to PM.
    4. [2004] Set set [ 9/15 ] to APC.
    5. [2007] If t2 is 4/3 followed by 4/0:
      1. [2005] Set set [ 9/8 ] to SOS.
      2. [2015] Set set [ 9/10 ] to SCI.
    6. [2006] Set set [ 9/12 ] to ST.
  13. [2016] If t1 is C1 and t2 is one of: 4/0 (ISO-IR 56), 4/1 (ISO-IR 73), 4/3 (ISO-IR 77), 4/3 followed by 4/0, or 4/8 (ISO-IR 107):
    1. [2025] Set set [ 9/11 ] to CSI.
  14. [1138] If t1 is C1 and t2 is 4/4:
    1. [1165] Set set [ 9/5 ] to P-MACRO.
  15. [1971] If t1 is gb8565 and t2 is C1:
    1. [1970] Set set [ 8/14 ] to SS2.
    2. [1972] Set set [ 8/15 ] to SS3.
    3. [2026] Set set [ 9/11 ] to CSI.
    4. [2008] Set set [ 9/14 ] to PM.
  16. [25] If t1 is vt and t2 is C1:
    1. [688] Set set [ 8/14 ] to LS1.
    2. [689] Set set [ 8/15 ] to LS0.
    3. [715] Set set [ 9/0 ] to DCS.
    4. [2027] Set set [ 9/11 ] to CSI.
  17. [1554] If t1 is videotex and t2 is geometric-c1:
    1. [1555] Set set [ 9/8 ] to SOS.
    2. [1556] Set set [ 9/12 ] to ST.
  18. [1016] If t1 is marc and t2 is C1:
    1. [1017] Set set [ 8/8 ] to SOS.
    2. [1020] Set set [ 8/9 ] to ST.
  19. [1557] If t1 is C1 and t2 is one of: 4/3 (ISO-IR 77) or 4/3 followed by 4/0:
    1. [1558] Set set [ 9/12 ] to ST.
  20. [716] Return set.

[179] The following combinations of type, t1, and t2 are used:

  • (C0, C0, bytes) where bytes is a byte sequence
  • (C0, gb8565, C0)
  • (C0, unknown-control, null)
  • (C0, dtvcc, C0)
  • (C0, isiri3342, CR)
  • (C1, C1, bytes) where bytes is a byte sequence
  • (C0, gb8565, C1)
  • (C1, vt, C1)
  • (C1, videotex, 2/0)
  • (C1, videotex, 2/1)
  • (C1, videotex, sound-control)
  • (C1, videotex, geometric-c1)
  • (C1, marc, C1)
  • (C1, unknown-control, null)
  • (C1, dtvcc, C1)
  • (C0, dtvcc, C2)
  • (C1, dtvcc, C3)

[19] The initial C0 set is the result of getting a C set with C0, C0, 4/7.

[37] The unknown C0 set is the result of getting a C set with C0, unknown-control, null.

[24] The empty C1 set is the result of getting a C set with C1, C1, 7/14.

[661] The unknown C1 set is the result of getting a C set with C1, unknown-control, null.


[45] A G set is 94 set, 96 set, 942 set, 962 set, or 943 set.

[578] A 94 set is a character set that has 1-byte range [ 2/1, 7/14 ].

[579] A 96 set is a character set that has 1-byte range [ 2/0, 7/15 ].

[580] A 942 set is a character set that has 2-byte range [ 2/1, 7/14 ].

[581] A 962 set is a character set that has 2-byte range [ 2/0, 7/15 ].

[582] A 943 set is a character set that has 3-byte range [ 2/1, 7/14 ].

[374] To determine whether is 96 size set, run these steps:

  1. [569] If set is unknown-96, return true.
  2. [570] Otherwise, if set is a 96 set, return true.
  3. [373] Otherwise, if set is a 962 set, return true.
  4. [571] Otherwise, return false.

[348] To determine character set set's byte length, run these steps:

  1. [350] If set is a 94 set or 96 set:
    1. [351] Return 1.
  2. [352] Otherwise, if set is a 942 set or 962 set:
    1. [353] Return 2.
  3. [360] Otherwise, if set is a 943 set:
    1. [361] Return 3.

[854] To get a G set with size, length, t1, and t2, run these steps:

  1. [855] If size is 94 and length is 1:
    1. [856] Let set be the result of getting a 1-byte set with 2/1, 7/14, t1, t2.
  2. [697] Otherwise, if size is 96 and length is 1:
    1. [857] Let set be the result of getting a 1-byte set with 2/0, 7/15, t1, t2.
  3. [858] Otherwise, if size is 94 and length is 2:
    1. [859] Let set be the result of getting a 2-byte set with 2/1, 7/14, t1, t2.
  4. [860] Otherwise, if size is 96 and length is 2:
    1. [861] Let set be the result of getting a 2-byte set with 2/0, 7/15, t1, t2.
  5. [862] Otherwise, if size is 94 and length is 3:
    1. [863] Let set be the result of getting a 3-byte set with 2/1, 7/14, t1, t2.
  6. [864] Return set.

[827] The following combinations of size, length, t1, and t2 are used:


[1095] A 128 set is a character set that has 1-byte range [ 0/0, 7/15 ].

[1183] A 256 set is a character set that has 1-byte range [ 0/0, 15/15 ].

[1176] A 2562 set is a character set that has 2-byte range [ 0/0, 15/15 ].

[1184] To get a 128 set with t1 and t2, run these steps:

  1. [1113] Let set be the result of getting a 1-byte set with 0/0, 7/15, t1, t2.
  2. [1115] If t1 is single and t2 is barcode:
    1. [1116] Set set [ 1/11 ] to ESC.
  3. [1114] Return set.

[1186] The following combinations of t1 and t2 are used:

[1268] To get a 256 set with t1 and t2, run these steps:

  1. [1269] Let set be the result of getting a 1-byte set with 0/0, 15/15, t1, t2.
  2. [1270] Return set.

[1271] The following combinations of t1 and t2 are used:

  • (unknown-byte, null)
  • (vts, transparent)
  • (captain, bc) where bc is a bit combination
  • (videotex, transparent)
  • (ct, extended-segment-data)

[1185] To get a 2562 set with t1 and t2, run these steps:

  1. [1182] Let set be the result of getting a 2-byte set with 0/0, 15/15, t1, t2.
  2. [1181] Return set.

[1187] The following combinations of t1 and t2 are used:

  • (sjis, null)
  • (sjis, 2000)
  • (gbk, null)
  • (big5, null)
  • (big5, hp)
  • (big5, hkscs)
  • (uhc, null)
  • (johab, null)
  • (unicode, 1.1)
  • (unicode, non-unicode)
  • (unicode, non-10646)

[1167] A CT right encoding name is one of the followings:

[1168] A CT 2-byte encoding name is one of the followings:

[1177] To get a CT character set with F and encoding name, run these steps:

  1. [1178] If F is 3/1 and encoding name is a CT right encoding name:
    1. [1188] If encoding name is iso8859-14:
      1. [1189] Return the result of getting a G set with 96, 1, 96, 5/15.
    2. [1190] Otherwise, if encoding name is iso8859-15:
      1. [1191] Return the result of getting a G set with 96, 1, 96, 6/2.
    3. [1194] Otherwise, if encoding name is mulelao-1:
      1. [1195] Return the result of getting a G set with 94, 1, mule-94, 3/1.
    4. [1196] Otherwise, if encoding name is iscii-dev:
      1. [1197] Return the result of getting a G set with 94, 1, mule-94, 3/5.
    5. [1199] Otherwise, if encoding name is omron_UDC_zh or omron_UDC_tw:
      1. [1200] Return the result of getting a G set with 94, 1, mule-94, 3/0.
    6. [1192] Otherwise:
      1. [1193] Return the result of getting a 128 set with ct, enoding name.
  2. [1179] Otherwise, if F is 3/2 and encoding name is a CT 2-byte encoding name:
    1. [1198] If encoding name is fujitsu.u90x03:
      1. [1201] Return the result of getting a G set with 94, 2, jef, null.
    2. [1202] Otherwise, if encoding name is DEC.CNS11643.1986-2:
      1. [1203] Return the result of getting a G set with 94, 2, cns, 2.
    3. [1204] Otherwise, if encoding name is DEC.DTSCS.1990-2:
      1. [1205] Return the result of getting a G set with 94, 2, cns, old14.
    4. [1206] Otherwise, if encoding name is big5-0 or BIG5-0:
      1. [1207] Return the result of getting a 2562 set with big5, null.
    5. [1208] Otherwise, if encoding name is big5hkscs-0:
      1. [1209] Return the result of getting a 2562 set with big5, hkscs.
    6. [1210] Otherwise, if encoding name is gbk-0:
      1. [1211] Return the result of getting a 2562 set with gbk, null.
  3. [1261] If F is 3/0 and encoding name is HP-BIG5:
    1. [1263] Return the result of getting a 2562 set with big5, hp.
  4. [1169] Otherwise:
    1. [1180] Return null.

[333] To modify character sets of state state for list features, run these steps:

  1. [342] For each feature in features:
    1. [739] Switch by feature:
      "fixed"
      1. [54] Set state's escape set [ 6/13 ] to character (deprecated, LS3R).
      2. [55] Set state's escape set [ 6/14 ] to LS2.
      3. [56] Set state's escape set [ 6/15 ] to LS3.
      4. [57] Set state's escape set [ 7/12 ] to LS3R.
      5. [60] Set state's escape set [ 7/13 ] to LS2R.
      6. [118] Set state's escape set [ 7/14 ] to LS1R.
      7. [49] Set state's escape set [ 6/7 ] to character (marc, esc, 6/7).
      8. [62] Set state's escape set [ 7/3 ] to character (marc, esc, 7/3).
      9. [123] Set state's escape set [ 7/11 ] to character (vt, esc, 7/11).
      10. [775] Set state's escape set [ 3/5 ] to character (vt, esc, 3/5).
      11. [776] Set state's escape set [ 3/6 ] to character (vt, esc, 3/6).
      12. [777] Set state's escape set [ 3/7 ] to character (vt, esc, 3/7).
      13. [686] Set state's escape set [ 3/12 ] to character (vt, esc, 3/12).
      14. [760] Set state's escape set [ 3/13 ] to character (vt, esc, 3/13).
      15. [761] Set state's escape set [ 3/14 ] to character (vt, esc, 3/14).
      16. [782] Set state's escape set [ 3/15 ] to character (vt, esc, 3/15).
      17. [764] Set state's escape set [ 3/10 ] to character (tektronix, esc, 3/10).
      18. [765] Set state's escape set [ 3/11 ] to character (tektronix, esc, 3/11).
      19. [766] Set state's escape set [ 3/0 ] to character (mule, esc, 3/0).
      20. [840] For each bc in [ 3/0, 7/14 ]:
        1. [842] Set bytes be bc.
        2. [841] Set state's 94 final set [ bytes ] to the result of getting a G set with 94, 1, null, bc.
        3. [846] Set state's 96 final set [ bytes ] to the result of getting a G set with 96, 1, null, bc.
        4. [878] Set state's 94n final set [ bytes ] to unassigned-94.
        5. [879] Set state's 96n final set [ bytes ] to unassigned-96.
        6. [880] Set state's 94n final RL set [ bytes ] to unassigned-94.
        7. [843] For each ibc in [ 2/0, 2/5 ]:
          1. [844] Set bytes be ibc followed by bc.
          2. [845] Set state's 94 final set [ bytes ] to the result of getting a G set with 94, 1, ibc, bc.
          3. [847] Set state's 96 final set [ bytes ] to the result of getting a G set with 96, 1, ibc, bc.
          4. [881] Set state's 94n final set [ bytes ] to unassigned-94.
          5. [882] Set state's 96n final set [ bytes ] to unassigned-96.
          6. [883] Set state's 94n final RL set [ bytes ] to unassigned-94.
      21. [274] For each bc in [ 4/0, 5/15 ]:
        1. [865] Set bytes be bc.
        2. [866] Set state's 94n final set [ bytes ] to the result of getting a G set with 94, 2, null, bc.
        3. [848] Set state's 96n final set [ bytes ] to the result of getting a G set with 96, 2, null, bc.
        4. [849] Set state's 94n final RL set [ bytes ] to unassigned-94.
        5. [850] For each ibc in [ 2/0, 2/5 ]:
          1. [867] Set bytes be ibc followed by bc.
          2. [868] Set state's 94n final set [ bytes ] to the result of getting a G set with 94, 2, null, bc.
          3. [851] Set state's 96n final set [ bytes ] to the result of getting a G set with 96, 2, null, bc.
          4. [852] Set state's 94n final RL set [ bytes ] to unassigned-94.
      22. [853] For each bc in [ 6/0, 6/15 ]:
        1. [869] Set bytes be bc.
        2. [870] Set state's 94n final set [ bytes ] to the result of getting a G set with 94, 3, null, bc.
        3. [871] Set state's 96n final set [ bytes ] to unassigned-96.
        4. [872] Set state's 94n final RL set [ bytes ] to unassigned-94.
        5. [873] For each ibc in [ 2/0, 2/5 ]:
          1. [874] Set bytes be ibc followed by bc.
          2. [875] Set state's 94n final set [ bytes ] to the result of getting a G set with 94, 3, null, bc.
          3. [876] Set state's 96n final set [ bytes ] to unassigned-96.
          4. [877] Set state's 94n final RL set [ bytes ] to unassigned-94.
      23. [920] For each F in 3/9, [ 3/12, 3/14 ], 2/2 followed by 3/1, 2/2 followed by 3/4, 2/5 followed by 3/0, 2/5 followed by 3/2, 2/5 followed by 3/4, 2/5 followed by 3/5, 2/5 followed by 3/6, 2/5 followed by 3/13, and 2/5 followed by 3/15:
        1. [921] Set state's 94 final set [ F ] to the result of getting a G set with 94, 1, vt, F.
      24. [915] For each F in [ 3/0, 3/2, 3/14 ]:
        1. [916] Set state's 96 final set [ F ] to the result of getting a G set with 96, 1, mule-96, F.
      25. [917] Set state's 96 final set [ 3/8 ] to the result of getting a G set with 96, 1, videotex, 3/8.
      26. [918] Set state's 96 final set [ 3/9 ] to the result of getting a G set with 96, 1, videotex, 3/9.
      27. [919] Set state's 96 final set [ 2/2 followed by 3/15 ] to the result of getting a G set with 94, 1, vt, 3/12.
      28. [898] For each F in [ 4/7, 4/13 ]:
        1. [897] Set state's 94n final set [ F ] to the result of getting a G set with 94, 2, cns, F - 0x47 + 1.
      29. [888] For each F in 3/4 and [ 3/12, 3/14 ]:
        1. [887] Set state's 94n final set [ F ] to the result of getting a G set with 94, 2, cns, F - 0x30 + 1.
      30. [886] For each I in [ 2/3, 2/4 ]:
        1. [889] For each F in [ 3/0, 3/15 ]:
          1. [890] Let p be (I - 0x20) × 0x10 + F - 0x30 + 1.
          2. [891] Set state's 94n final set [ F ] to the result of getting a G set with 94, 2, cns, p.
      31. [885] For each F in [ 3/0, 3/2 ]:
        1. [884] Set state's 96n final set [ F ] to the result of getting a G set with 96, 2, mule-962, F.
      32. [912] Set state's 94n final set [ 2/2 followed by 3/0 ] to the result of getting a G set with 94, 2, 942, 4/0.
      33. [913] Set state's 94n RL final set [ 2/2 followed by 3/0 ] to the result of getting a G set with 94, 2, dec, udc1978.
      34. [936] For each F in 6/2, 6/7, and 7/0:
        1. [935] Set state's 94 final set [ 1/11 followed by F ] to the result of getting a G set with 94, 1, marc, F.
      35. [937] Set state's 94 final set [ 1/11 followed by 7/3 ] to the result of getting a G set with 94, 1, 94, 4/2.
      36. [939] Set state's 94 final set [ 8/7 ] to the result of getting a G set with 94, 1, 94, 4/2.
      37. [1763] Set state's macro set [ bc ] to macro by each row of the following tables:
        bcmacro
        6/0macro "ESC 2/4 4/2 ESC 2/9 4/10 ESC 2/10 3/0 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/1macro "ESC 2/4 4/2 ESC 2/9 3/1 ESC 2/10 3/0 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/2macro "ESC 2/4 4/2 ESC 2/9 2/0 4/1 ESC 2/10 3/0 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/3macro "ESC 2/8 3/2 ESC 2/9 3/4 ESC 2/10 3/5 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/4macro "ESC 2/8 3/2 ESC 2/9 3/3 ESC 2/10 3/5 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/5macro "ESC 2/8 3/2 ESC 2/9 2/0 4/1 ESC 2/10 3/5 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/6macro "ESC 2/8 2/0 4/1 ESC 2/9 2/0 4/2 ESC 2/10 2/0 4/3 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/7macro "ESC 2/8 2/0 4/4 ESC 2/9 2/0 4/5 ESC 2/10 2/0 4/6 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/8macro "ESC 2/8 2/0 4/7 ESC 2/9 2/0 4/8 ESC 2/10 2/0 4/9 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/9macro "ESC 2/8 2/0 4/10 ESC 2/9 2/0 4/11 ESC 2/10 2/0 4/12 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/10macro "ESC 2/8 2/0 4/13 ESC 2/9 2/0 4/14 ESC 2/10 2/0 4/15 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/11macro "ESC 2/4 4/2 ESC 2/9 2/0 4/2 ESC 2/10 3/0 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/12macro "ESC 2/4 4/2 ESC 2/9 2/0 4/3 ESC 2/10 3/0 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/13macro "ESC 2/4 4/2 ESC 2/9 2/0 4/4 ESC 2/10 3/0 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/14macro "ESC 2/8 3/1 ESC 2/9 3/0 ESC 2/10 4/10 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
        6/15macro "ESC 2/8 4/10 ESC 2/9 3/2 ESC 2/10 2/0 4/1 ESC 2/11 2/0 7/0 LS0 ESC 7/13"
      "fallback"
      1. [740] Set state's fixed set [ 2/0 ] to SP.
      2. [741] Set state's fixed set [ 7/15 ] to DEL.
      3. [743] Set state's fixed set [ 10/0 ] to character (unknown-byte, null, 10/0).
      4. [1952] Set state's fixed set [ 15/15 ] to character (unknown-byte, null, 15/15).
      5. [1731] For each bc in 6/2, 6/3, 6/4, 6/11, 6/12, 6/15, 7/0, 7/2:
        1. [125] Set state's escape set [ bc ] to character (unknown-control, null, 1/11 followed by bc).
      6. [758] For each bc in [ 0/0, 1/15 ]:
        1. [759] Remove state's escape set [ bc ].
      7. [778] For each bc in [ 3/1, 3/4 ]:
        1. [779] Set state's escape set [ bc ] to character (unknown-control, null, bc).
      8. [780] Set state's escape set [ 3/8 ] to character (unknown-control, null, 3/8).
      9. [781] Set state's escape set [ 3/9 ] to character (unknown-control, null, 3/9).
      10. [922] For each F in [ 3/0, 3/8 ], 4/0, 4/3, 4/5, 4/7, 4/8, 4/11, 5/1, 5/5, 7/0, 7/10, 7/11, 7/13, 2/0 followed by 7/10, 2/0 followed by 7/11:
        1. [923] Set state's 94 final set [ F ] to the result of getting a G set with 94, 1, 94, F.
      11. [1701] For each F in 7/10, 7/11:
        1. [1702] Set state's 96 final set [ F ] to the result of getting a G set with 96, 1, 96, F.
      12. [894] For each F in 3/0, 3/2, 3/3, [ 3/5, 3/9 ], 3/11, 3/15, 4/2, 4/3, 4/5, 4/6:
        1. [896] Set state's 94n final set [ F ] to the result of getting a G set with 94, 2, 942, F.
      13. [895] Set state's 94n final set [ 3/1 ] to unassigned-94.
      14. [2128] Set state's 94n final set [ 3/10 ] to unassigned-94.
      15. [908] For each F in 3/1, 3/3, [ 4/0, 4/2 ]:
        1. [911] Set state's 94n RL final set [ F ] to unassigned-94.
      16. [940] Set state's 94 final set [ 8/6 ] to the result of getting a G set with 94, 1, vt, 8/6.
      17. [1683] Set state's 94n final set [ 4/2 ] to the result of getting a G set with 94, 2, 942, 4/2.
      18. [1684] Set state's 94n final set [ 4/2 followed by 4/0 ] to the result of getting a G set with 94, 2, 942, 4/2 followed by 4/0.
      19. [2277] For designate-IF and IRR-IF supported by ecma35lib:
        1. [2279] Set state's 94 final set [ designate-IF followed by IRR-IF ] to the result of getting a G set with 94, 1, 94, designate-IF followed by IRR-IF, if applicable.
        2. [2280] Set state's 96 final set [ designate-IF followed by IRR-IF ] to the result of getting a G set with 96, 1, 96, designate-IF followed by IRR-IF, if applicable.
        3. [2281] Set state's 94n final set [ designate-IF followed by IRR-IF ] to the result of getting a G set with 94, 2, 942, designate-IF followed by IRR-IF, if applicable.
        4. [2282] Set state's 96n final set [ designate-IF followed by IRR-IF ] to the result of getting a G set with 96, 2, 962, designate-IF followed by IRR-IF, if applicable.
      "iso2022"
      1. [1953] Set state's fixed set [ 2/0 ] to SP.
      2. [1954] Set state's fixed set [ 7/15 ] to DEL.
      3. [1955] Set state's fixed set [ 10/0 ] to character (unknown-byte, null, 10/0).
      4. [1956] Set state's fixed set [ 15/15 ] to character (unknown-byte, null, 15/15).
      5. [29] Set state's escape set [ 6/4 ] to CMD.
      6. [42] Set state's escape set [ 6/2 ] to character (esc, 6/2).
      7. [2121] Set state's escape set [ 6/3 ] to character (esc, 6/3).
      8. [1681] For each F in 4/0, 4/3, 4/5, 4/8, 4/11, 5/1, 5/5, 6/0, 7/0, 7/10, 7/11, 7/13, 2/0 followed by 7/10, 2/0 followed by 7/11:
        1. [1682] Set state's 94 final set [ F ] to the result of getting a G set with 94, 1, 94, F.
      9. [1699] For each F in 7/10, 7/11:
        1. [1700] Set state's 96 final set [ F ] to the result of getting a G set with 96, 1, 96, F.
      10. [2116] For each bc in 4/2, 4/3, 4/5, 4/6:
        1. [1685] Set state's 94n final set [ bc ] to the result of getting a G set with 94, 2, 942, bc.
      11. [1686] Set state's 94n final set [ 4/2 followed by 4/0 ] to the result of getting a G set with 94, 2, 942, 4/2 followed by 4/0.
      "cns"
      1. [892] For each F in [ 3/0, 3/3 ], [ 3/5, 3/11 ], and 3/15:
        1. [893] Set state's 94n final set [ F ] to the result of getting a G set with 94, 2, cns, F - 0x30 + 1.
      2. [2273] For each F in [ 3/0, 3/15 ]:
        1. [2274] Set state's 94n final set [ 2/1 followed by F ] to the result of getting a G set with 94, 2, cns, F - 0x30 + 1 + 0x10.
      3. [2275] For each F in [ 3/0, 3/15 ]:
        1. [2276] Set state's 94n final set [ 2/2 followed by F ] to the result of getting a G set with 94, 2, cns, F - 0x30 + 1 + 0x20.
      "mongolian7"
      1. [744] Set state's fixed set [ 2/0 ] to MSP.
      "mongolian8"
      1. [748] Set state's fixed set [ 2/0 ] to SP.
      2. [1957] Set state's fixed set [ 10/0 ] to MSP.
      "jisold"
      1. [2278] Set state's 94 final set [ 4/7 ] to the result of getting a G set with 94, 1, 94, 4/9.
      2. [977] Set state's 94 final set [ 4/8 ] to the result of getting a G set with 94, 1, 94, 4/10.
      "jisms"
      1. [1358] Set state's 94n final set [ 3/15 ] to the result of getting a G set with 94, 2, sjis2, ms.
      2. [1359] Set state's 94n final set [ 4/0 ] to the result of getting a G set with 94, 2, jisx0208, ms.
      3. [1360] Set state's 94n final set [ 4/2 ] to the result of getting a G set with 94, 2, jisx0208, ms.
      4. [1361] Set state's 94n final set [ 4/2 followed by 4/0 ] to the result of getting a G set with 94, 2, jisx0208, ms.
      "ks"
      1. [901] Set state's 94n final set [ 3/1 ] to the result of getting a G set with 94, 2, 942, 4/3.
      2. [2117] Set state's 94n final set [ 4/3 ] to the result of getting a G set with 94, 2, 942, 4/3.
      3. [2118] Set state's 94n final set [ 4/5 ] to the result of getting a G set with 94, 2, ksx1002, 1.
      4. [2119] Set state's 94n final set [ 4/6 ] to the result of getting a G set with 94, 2, ksx1002, 2.
      5. [2183] Set state's 94 final set [ 3/2 ] to the result of getting a G set with 94, 1, 94, 4/2.
      "ks1998"
      1. [2117] Set state's 94n final set [ 4/3 ] to the result of getting a G set with 94, 2, ksx1001, 1998.
      "ks2002"
      1. [2120] Set state's 94n final set [ 4/3 ] to the result of getting a G set with 94, 2, ksx1001, 2002.
      "isiri3342"
      1. [1958] Set state's fixed set [ 2/0 ] to character (isiri3342, left, SP).
      2. [1959] Set state's fixed set [ 7/15 ] to character (isiri3342, left, DEL).
      3. [1960] Set state's fixed set [ 10/0 ] to character (isiri3342, right, SP).
      4. [1961] Set state's fixed set [ 15/15 ] to character (isiri3342, right, DEL).
      "videotex"
      1. [52] Set state's escape set [ 6/11 ] to character (deprecated, LS1R).
      2. [53] Set state's escape set [ 6/12 ] to character (deprecated, LS2R).
      3. [43] Set state's escape set [ 7/0 ] to PCD.
      4. [974] Set state's 94 final set [ 4/0 ] to the result of getting a G set with 94, 1, videotex, 4/0.
      5. [928] For each F in [ 3/0, 3/8 ], 7/0:
        1. [929] Set state's 94 final set [ F ] to the result of getting a G set with 94, 1, arib, F.
      6. [904] For each F in [ 3/9, 3/11 ], 4/2:
        1. [903] Set state's 94n final set [ F ] to the result of getting a G set with 94, 2, arib, F.
      7. [1453] Set state's 94n final set [ 4/2 followed by 4/0 ] to the result of getting a G set with 94, 2, arib, 4/2.
      8. [1026] Set state's 96 final set [ 7/10 ] to the result of getting a G set with 96, 1, 96, 2/0 followed by 7/10.
      9. [1692] Set state's 96 final set [ 7/11 ] to the result of getting a G set with 96, 1, 96, 2/0 followed by 7/11.
      10. [1693] Set state's 94 final set [ 7/10 ] to the result of getting a G set with 96, 1, 96, 2/0 followed by 7/10.
      11. [1694] Set state's 94 final set [ 7/11 ] to the result of getting a G set with 96, 1, 96, 2/0 followed by 7/11.
      12. [1695] Set state's 94 final set [ 2/0 followed by 7/10 ] to the result of getting a G set with 96, 1, 96, 2/0 followed by 7/10.
      13. [1696] Set state's 94 final set [ 2/0 followed by 7/11 ] to the result of getting a G set with 96, 1, 96, 2/0 followed by 7/11.
      14. [1697] Set state's 94 final set [ 5/7 ] to the result of getting a G set with 96, 1, 96, 5/7.
      15. [1698] Set state's 94 final set [ 7/13 ] to the result of getting a G set with 96, 1, 96, 7/13.
      "marc"
      1. [44] Set state's escape set [ 6/2 ] to character (marc, esc, 6/2).
      2. [63] Set state's escape set [ 7/0 ] to character (marc, esc, 7/0).
      3. [930] For each F in [ 3/2, 3/4 ]:
        1. [931] Set state's 94 final set [ F ] to the result of getting a G set with 94, 1, marc, F.
      "vt"
      1. [126] For each bc in [ 3/1, 3/4 ], 3/8, 3/9, 6/4, 6/11, 6/12:
        1. [120] Set state's escape set [ bc ] to character (vt, esc, bc).
      2. [2122] Set state's escape set [ 6/3 ] to character (esc, 6/3).
      3. [924] For each F in [ 3/0, 3/8 ]:
        1. [925] Set state's 94 final set [ F ] to the result of getting a G set with 94, 1, vt, F.
      4. [970] Set state's 94 final set [ 4/3 ] to the result of getting a G set with 94, 1, vt, 3/5.
      5. [971] Set state's 94 final set [ 4/5 ] to the result of getting a G set with 94, 1, vt, 3/6.
      6. [972] Set state's 94 final set [ 4/8 ] to the result of getting a G set with 94, 1, vt, 3/7.
      7. [973] Set state's 94 final set [ 5/1 ] to the result of getting a G set with 94, 1, vt, 3/9.
      8. [124] Set state's 94 final set [ 4/11 ] to the result of getting a G set with 94, 1, vt, 4/11.
      9. [976] Set state's 94 final set [ 5/5 ] to the result of getting a G set with 94, 1, vt, 5/5.
      10. [2182] Set state's 94 final set [ 6/0 ] to the result of getting a G set with 94, 1, vt, 3/6.
      "vt52"
      1. [122] For each bc in 6/2, 6/3, 6/4, 6/11, 6/12, 6/15, 7/0, 7/2:
        1. [121] Set state's escape set [ bc ] to character (vt52, esc, bc).
      2. [942] Set state's 94 final set [ 8/6 ] to the result of getting a G set with 94, 1, vt52, 8/6.
      "vt100"
      1. [941] Set state's 94 final set [ 8/6 ] to the result of getting a G set with 94, 1, vt, 8/6.
      "vt105"
      1. [783] Set state's escape set [ 3/1 ] to character (vt105, esc, 3/1).
      2. [784] Set state's escape set [ 3/2 ] to character (vt105, esc, 3/2).
      "tektronix"
      1. [405] For each bc in [ 0/0, 1/15 ]:
        1. [757] Set state's escape set [ bc ] to character (tektronix, esc, bc).
      2. [762] Set state's escape set [ 3/8 ] to character (tektronix, esc, 3/8).
      3. [763] Set state's escape set [ 3/9 ] to character (tektronix, esc, 3/9).
      "escshift"
      1. [933] Set state's escape set [ 0/14 ] to character (deprecated, LS1).
      2. [934] Set state's escape set [ 0/15 ] to character (deprecated, LS0).
      "noesccl"
      1. [205] For each bc in [ 0/0, 1/15 ]:
        1. [228] Remove state's escape set [ bc ].
      "decea"
      1. [905] Set state's 94n final set [ 3/0 ] to the result of getting a G set with 94, 2, 942, 3/0.
      2. [906] Set state's 94n final set [ 3/1 ] to the result of getting a G set with 94, 2, 942, 4/0.
      3. [907] Set state's 94n final set [ 3/3 ] to the result of getting a G set with 94, 2, 942, 4/2.
      4. [909] For each F in 3/1, 3/3, 4/1, and 4/2:
        1. [910] Set state's 94n RL final set [ F ] to the result of getting a G set with 94, 2, 942, 3/0.
      5. [914] Set state's 94n RL final set [ 4/0 ] to the result of getting a G set with 94, 2, dec, udc1978.
      "mule"
      1. [767] Set state's escape set [ 3/1 ] to character (mule, esc, 3/1).
      2. [768] Set state's escape set [ 3/2 ] to character (mule, esc, 3/2).
      3. [769] Set state's escape set [ 3/3 ] to character (mule, esc, 3/3).
      4. [770] Set state's escape set [ 3/4 ] to character (mule, esc, 3/4).
      5. [926] For each F in [ 3/0, 3/5 ]:
        1. [927] Set state's 94 final set [ F ] to the result of getting a G set with 94, 1, mule-94, F.
      6. [900] For each F in [ 3/0, 3/3 ], [ 3/5, 3/8 ], and 3/15:
        1. [899] Set state's 94n final set [ F ] to the result of getting a G set with 94, 2, mule-942, F.
      7. [2127] Set state's 94n final set [ 3/10 ] to the result of getting a G set with 94, 3, mule-943, F.
      8. [2129] Set state's 96n final set [ 3/3 ] to the result of getting a G set with 96, 2, mule-962, 3/3.
      9. [2130] Set state's 96n final set [ 3/4 ] to the result of getting a G set with 96, 2, mule-962, 3/4.
      "mule2.3"
      1. [2126] Set state's 94 final set [ 3/1 ] to the result of getting a G set with 94, 1, tis620, GR.
      2. [2131] Set state's 96n final set [ 3/3 ] to the result of getting a G set with 96, 2, mule2.3, 3/3.
      3. [2132] Set state's 96n final set [ 3/4 ] to the result of getting a G set with 96, 2, mule2.3, 3/4.
      "cgreek"
      1. [2133] Set state's 96n final set [ 3/4 ] to the result of getting a G set with 96, 2, mule-962, cgreek.

Definitions

[14] This document depends on the Infra Standard.

[15] The terms for each, while, boolean, byte, byte sequence, length, code point, item, tuple, list, size, append, concatenation, extend, ordered map, entry, key, value, exists, remove an entry, and is empty are defined by the Infra Standard.


[572] A range range is a tuple of two integers (start, end), where range's startrange's end. It represents a set of all the integers i that satisfies range's startirange's end.

[573] A value i is in a range range if i is an item in the set represented by range.

switch

[16] A bit combination is a byte. A bit combination is represented as "X/Y", where X and Y are integers in [ 0, 15 ], which represents a byte X × 16 + Y.

[89] To append a bit combination bc to a byte sequence bytes, run these steps:

  1. [90] Replace bytes's content by bytes followed by bc.

[91] The empty byte sequence is a byte sequence whose length is 0.

Notes