Skip to content

vtf iodata c1ctrl

srccircumflex edited this page Apr 24, 2023 · 5 revisions

↑ vtf-iodata

c1ctrl

The module contains the top-level types of the escaped sequence typing hierarchy (Fs, Fp, nF, and Fe); the gradations of Fe (CSI, SS3, DCS, OSC, APP); the wildcard classes ManualESC and UnknownESC; and typing interpretation recognizers.

Module contents

Constants

FeStruc: dict[str, Callable[ [str], bool] | None]

{
'DEFHMVWZ': None,
'NO': lambda other: isFinal(other[-1:], ((0x40, 0x7e), 0x20)),
'[': lambda other: isFinal(other[-1:], ((0x40, 0x7e),)),
'PX]^_': lambda other: isEscape27(other[-2:-1]) and other[-1:] == '\'
}

The structure of Fe sequences in the form: {Introducer Sequence: Query Final Character}

FsFpnFStruc: dict[str, tuple[str, ...]]

{
'  ': ('F', 'G', 'L', 'M', 'N'),
'#': ('3', '4', '5', '6', '8'),
'%': ('@', 'G'),
'()*+': ('A', '', 'C', '5', 'H', '7', 'K', 'Q', '9', 'R', 'f', 'y', 'Z', '4', '">', '%2', '%6', '%=', '=',
'`', 'E', '6', '0', '<', '>', '"4', '"?', '%0', '%5', '&4', '%3', '&5'),
'-./': ('A', '', 'F', 'H', 'L', 'M'),
'6789=>clmno|}~': ('',)
}

The structure of Fs Fp and nF sequences in the form: {Sequence of introducers: Sequence of possible parameterization}

NONE_SEQS = NoneSeqs()

Is returned internally by types if these are to be created over the class methods with new_* prefix and the passed string does not agree with the expected structure (only in APP, Fe and FsFpnF).

Functions

c1ctrl.isEscape27(__c) -> bool

Return whether __c is the escape character.

c1ctrl.isFe(seqs, _intro_only=False) -> bool

Check if seqs fits to the Fe structure. The escape character must not be prepended Check only the intro character if _intro_only is True.

c1ctrl.isFeIntro(seqs, has_esc=True) -> bool

Check if the intro character in seqs is a Fe sequence intro character. Check for a prefixed escape character if has_esc is True.

c1ctrl.isFeSeqs(seqs, has_esc=True) -> bool

Check if seqs fits to the Fe structure. Check for a prefixed escape character if has_esc is True.

c1ctrl.isFinal(char, finals) -> bool

Return whether the Unicode code point of char is in finals. Values in the iterable finals are explicitly specified as integers or as ranges ( tuple(incl. start, incl. end) ).

c1ctrl.isFsFpnF(seqs, _intro_only=False) -> bool

Check if seqs fits to the Fs, Fp, or nF structure. The escape character must not be prepended Check only the intro character if _intro_only is True.

c1ctrl.isFsFpnFIntro(seqs, has_esc=True) -> bool

Check if the intro character in seqs is a Fs, Fp, or nF sequence intro character. Check for a prefixed escape character if has_esc is True.

c1ctrl.isFsFpnFSeqs(seqs, has_esc=True) -> bool

Check if seqs fits to the Fs, Fp, or nF structure. Check for a prefixed escape character if has_esc is True.

Objects

Datatypes

class c1ctrl.Fe(EscSegment)

Fs (7-Bit) Escape Sequence

  • [IND] ESC D (0x84): Index
  • [NEL] ESC E (0x85): Next Line
  • [---] ESC F (0x86): To the lower left corner
  • [HTS] ESC H (0x88): Horizontal Tab Set [i] Windows / UNIX compatible
  • [RI] ESC M (0x8d): Reverse Index [i] Windows / UNIX compatible
  • [SS2] ESC N (0x8e): Single Shift Select of G2 Character Set (VT220) (Chr)
  • [SS3] ESC O (0x8f): Single Shift Select of G3 Character Set (VT220) (Chr)
  • [DCS] ESC P (0x90): Device Control String (Seq - t)
  • [SPA] ESC V (0x96): Start of Protected Area
  • [EPA] ESC W (0x97): End of Protected Area
  • [SOS] ESC X (0x98): Start of String (Seq - t) (APP)
  • [DECID] ESC Z (0x9a): Terminal ID Request
  • [CSI] ESC [ (0x9b): Control Sequence Introducer (Seq)
  • [ST] ESC (0x9c): String Terminator (t)
  • [OSC] ESC ] (0x9d): Operating System Command (Seq - t)
  • [PM] ESC ^ (0x9e): Private Message (Seq - t) (APP)
  • [APC] ESC _ (0x9f): Application Program Command (Seq - t) (APP)
Derivatives:
# Resources:
; xterm/C1-8-Bit-Control-Characters ; wikipedia/ANSI_escape_code/Fe_Escape_sequences ; microsoft/console-virtual-terminal-sequences/simple-cursor-positioning ; microsoft/console-virtual-terminal-sequences/tabs

__new__(__c) -> Fe

Create a new Fe type from the sequence __c (must be the escape-sequence without ESC prefix).

classmethod new_Fe(__c) -> Fe | NoneSeqs

Create a new Fe type from the sequence __c (must be the escape-sequence without ESC prefix). Check the sequence before if the sequence structure fits and return NoneSeqs in case of no match.

class c1ctrl.FsFpnF(EscSegment)

Fs-, Fp-, nF- Escape Sequence

Tell the Terminal to send C1 control characters as:
  • [S7C1T] ESC SP F : 7-Bit sequences <nF>
  • [S8C1T] ESC SP G : 8-Bit sequences <nF>

VT200 always accept 8-Bit sequences except when configured for VT100

Set ANSI conformance level to:
  • ESC SP L : level 1 <nF>
  • ESC SP M : level 2 <nF>
  • ESC SP N : level 3 <nF>
DEC Screen:
  • [DECDHL] ESC # 3 : double-height line, top half (VT100) <nF>
  • [DECDHL] ESC # 4 : double-height line, bottom half (VT100) <nF>
  • [DECSWL] ESC # 5 : single-width line (VT100) <nF>
  • [DECDWL] ESC # 6 : double-width line (VT100) <nF>
  • [DECALN] ESC # 8 : Screen Alignment Test (VT100) <nF>
Select Character Set:
  • ESC % @ : Default (ISO 8859-1) <nF>
  • ESC % G : UTF-8 <nF>
  • ESC ( Param : Designate G0 Character Set (VT100) <nF>
  • ESC ) Param : Designate G1 Character Set (VT100) <nF>
  • ESC * Param : Designate G2 Character Set (VT220) <nF>
  • ESC + Param : Designate G3 Character Set (VT220) <nF>
  • ESC - Param : Designate G1 Character Set (VT300) <nF>
  • ESC . Param : Designate G2 Character Set (VT300) <nF>
  • ESC / Param : Designate G3 Character Set (VT300) <nF>
  • [LS2] ESC n : Invoke the G2 Character Set as GL <Fs>
  • [LS3] ESC o : Invoke the G3 Character Set as GL <Fs>
  • [LS3R] ESC | : Invoke the G3 Character Set as GR <Fs>
  • [LS2R] ESC } : Invoke the G2 Character Set as GR <Fs>
  • [LS1R] ESC ~ : Invoke the G1 Character Set as GR (VT100) <Fs>
Index:
  • [DECBI] ESC 6 : Back Index (VT420) <Fp>
  • [DECFI] ESC 9 : Forward Index (VT420) <Fp>
Cursor:
  • [DECSC] ESC 7 : Save Cursor (VT100) <Fp> [i] Windows / UNIX compatible
  • [DECRC] ESC 8 : Restore Cursor (VT100) <Fp> [i] Windows / UNIX compatible
Keypad:
  • [DECKPAM] ESC = : Application Keypad <Fp> [i] Windows / UNIX compatible
  • [DECKPNM] ESC > : Normal Keypad (VT100) <Fp> [i] Windows / UNIX compatible
  • [RIS] ESC c : Full SGRReset (VT100) <Fs>
  • ESC l : Memory Lock. Lock mamory above the cursor. (HP) <Fs>
  • ESC m : Memory Unlock (HP) <Fs>
# Resources:
; xterm/Controls-beginning-with-ESC ; wikipedia/ANSI_escape_code/Fs_Escape_sequences ; wikipedia/ANSI_escape_code/Fp_Escape_sequences ; wikipedia/ANSI_escape_code/nF_Escape_sequences ; microsoft/console-virtual-terminal-sequences/simple-cursor-positioning ; microsoft/console-virtual-terminal-sequences/mode-changes

__new__(__c) -> FsFpnF

Create a new FsFpnF type from the sequence __c (must be the escape-sequence without ESC prefix).

classmethod new_FsFpnF(__c) -> FsFpnF | NoneSeqs

Create a new FsFpnF type from the sequence __c (must be the escape-sequence without ESC prefix). Check the sequence before if the sequence structure fits and return NoneSeqs in case of no match.

class c1ctrl.APP(Fe)

Application defined Sequences (terminated by ESC \ String Terminator (0x9c))

  • [SOS] ESC X Start of String (0x98)
  • [PM ] ESC ^ Private Message (0x9e)
  • [APC] ESC _ Application Program Command (0x9f)

__new__(__i, *params, esc_string='') -> APP

Create a new APP type from the intro character __i (can be 'X', '^' or '_'), the sequence parameters params and the escape-string esc_string.

classmethod new_app(__i, *params, esc_string='') -> APP | NoneSeqs

Create a new APP type from the intro character __i, the sequence parameters params and the escape-string esc_string. Check the sequence before if the sequence structure fits and return NoneSeqs in case of no match.

class c1ctrl.CSI(Fe)

Control Sequence Introducer (0x9b) ESC [ ...

__new__(*params, string='', outro='') -> CSI

Create a new CSI type from the sequence parameters params. The fields string and outro are optional and will be processed according to EscSegment.

classmethod new_csi(*params, string='', outro='') -> CSI

Identical to __new__().

class c1ctrl.DCS(Fe)

Device Control String (0x90) ESC P ... (terminated by ESC \ String Terminator (0x9c))

__new__(*params, esc_string='') -> DCS

Create a new DCS type from the sequence parameters params and the escape-string esc_string.

classmethod new_dcs(*params, esc_string='') -> DCS

Identical to __new__().

class c1ctrl.OSC(Fe)

Operating System Command (0x9d) ESC ] ... (terminated by ESC \ String Terminator (0x9c))

__new__(*params, esc_string='') -> OSC

Create a new OSC type from the sequence parameters params and the escape-string esc_string.

classmethod new_osc(*params, esc_string='') -> OSC

Identical to __new__().

class c1ctrl.SS3(Fe)

Single Shift Select of G3 Character Set (VT220) (0x8f) ESC O ...

__new__(*params, string='', outro='') -> SS3

Create a new SS3 type from the sequence parameters params. The fields string and outro are optional and will be processed according to EscSegment.

classmethod new_ss3(*params, string='', outro='') -> SS3

Identical to __new__().

class c1ctrl.ManualESC(EscSegment)

Type for manually entered escape sequence.

class c1ctrl.NoneSeqs(str)

Type for incorrect sequences. (identical to str())

__bool__() -> bool

Returns always False.

class c1ctrl.UnknownESC(EscSegment)

Type for unknown escape sequence.

Date: 07 Nov 2022
Version: 0.1
Author: Adrian Hoefflin [srccircumflex]
Doc-Generator: "pyiStructure-RSTGenerator" <prototype>
Clone this wiki locally