1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
//! Independent Control Functions.
//!
//! These control functions are represented in 7-bit codes by 2-character escape sequences of the form `ESC Fs`, where
//! `ESC` is represented by bit combination `01/11` and `Fs` is represented by a bit combination from `06/00` to
//! `07/14`.
//!
//! ## Usage
//!
//! You can use the independent control functions inside normal strings, format them with the `format!()` macro, or
//! print them with the `print!()` and `println!()` macros.
//!
//! For example, to disable manual input:
//!
//! ```
//! use ansi_control_codes::independent_control_functions::DMI;
//! println!("{}", DMI);
//! ```
//!
//! ## Overview of the Independent Control Functions
//!
//! | Row Number | Column `06` | Column `07` |
//! | ---------: | :---------: | :---------: |
//! | `00` | [`DMI`] | -- |
//! | `01` | [`INT`] | -- |
//! | `02` | [`EMI`] | -- |
//! | `03` | [`RIS`] | -- |
//! | `04` | [`CMD`] | -- |
//! | `05` | -- | -- |
//! | `06` | -- | -- |
//! | `07` | -- | -- |
//! | `08` | -- | -- |
//! | `09` | -- | -- |
//! | `10` | -- | -- |
//! | `11` | -- | -- |
//! | `12` | -- | [`LS3R`] |
//! | `13` | -- | [`LS2R`] |
//! | `14` | [`LS2`] | [`LS1R`] |
//! | `15` | [`LS3`] | -- |
//!
//! ## Note
//!
//! `ESC Fs` sequences are registered in the ISO International Register of Coded Character Sets to be Used with Escape
//! Sequences, which is maintained by the Registration Authority for ISO 2375.
use crate::ControlFunction;
macro_rules! independent {
($xx:literal/$yy:literal) => {
ControlFunction::new_independent_control_function(ascii!($xx / $yy))
};
}
/// Coding Method Delimiter.
///
/// `CMD` is used as the delimiter of a string of data coded according to Standard ECMA-35, and to switch to a general
/// level of control.
///
/// The use of `CMD` is not mandatory if the higher level protocol defines means of delimiting the string, for instance,
/// by specifying the length of the string.
pub const CMD: ControlFunction = independent!(06 / 04);
/// Disable Manual Input
///
/// `DMI` causes the manual input facilities of a device to be disabled.
pub const DMI: ControlFunction = independent!(06 / 00);
/// Enable Manual Input.
///
/// `EMI` is used to enable the manual input facilities of a device.
pub const EMI: ControlFunction = independent!(06 / 02);
/// Interrupt.
///
/// `INT` is used to indicate to the receiving device that the current process is to be interrupted and an agreed
/// procedure is to be initiated. This control function is applicable to either direction of transmission.
pub const INT: ControlFunction = independent!(06 / 01);
/// Locking-Shift One Right.
///
/// `LS1R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
/// stream to be changed.
///
/// The use of `LS1R` is defined in Standard [ECMA-35][ecma-35].
///
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
pub const LS1R: ControlFunction = independent!(07 / 14);
/// Locking-Shift Two.
///
/// `LS2` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
/// stream to be changed.
///
/// The use of `LS2` is defined in Standard [ECMA-35][ecma-35].
///
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
pub const LS2: ControlFunction = independent!(06 / 14);
/// Locking-Shift Two Right.
///
/// `LS2R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
/// stream to be changed.
///
/// The use of `LS2R` is defined in Standard [ECMA-35][ecma-35].
///
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
pub const LS2R: ControlFunction = independent!(07 / 13);
/// Locking-Shift Three.
///
/// `LS3` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
/// stream to be changed.
///
/// The use of `LS3` is defined in Standard [ECMA-35][ecma-35].
///
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
pub const LS3: ControlFunction = independent!(06 / 15);
/// Locking-Shift Three Right.
///
/// `LS3R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
/// stream to be changed.
///
/// The use of `LS3R` is defined in Standard [ECMA-35][ecma-35].
///
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
pub const LS3R: ControlFunction = independent!(07 / 12);
/// Reset to Initial State.
///
/// `RIS` causes a device to be reset to its initial state, i.e. the state it has after it is made operational. This
/// may imply, if applicable: clear tabulation stops, remove qualified areas, reset graphic rendition, put all character
/// positions into the erased state, move the active presentation position to the first position of the first line in
/// the presentation component, move the active data position to the first character position of the first line in the
/// data component, set the modes into the reset state, etc..
pub const RIS: ControlFunction = independent!(06 / 03);