Compare commits
10 Commits
04e6baf31d
...
138e15c763
Author | SHA1 | Date | |
---|---|---|---|
138e15c763 | |||
ad9146075b | |||
59bdca5c50 | |||
6e503b96c8 | |||
dceb34a9a9 | |||
4e4052b74c | |||
f297692e64 | |||
30906d2075 | |||
ef555cbe05 | |||
52a2be9a1a |
@ -5,7 +5,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
authors = ["Frank Zechert <rust.frank@zechert.net>"]
|
authors = ["Frank Zechert <rust.frank@zechert.net>"]
|
||||||
repository = ""
|
repository = "https://git.zechert.net/fzechert/ansi.git"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
# crates.io
|
# crates.io
|
||||||
|
136
src/c0.rs
136
src/c0.rs
@ -5,9 +5,21 @@
|
|||||||
//! The 3-character escape sequence designating and invoking this C0 set is `ESC 02/01 04/00`,
|
//! The 3-character escape sequence designating and invoking this C0 set is `ESC 02/01 04/00`,
|
||||||
//! see [`ANNOUNCER_SEQUENCE`].
|
//! see [`ANNOUNCER_SEQUENCE`].
|
||||||
//!
|
//!
|
||||||
//! It is assumed that even with no invoked C0 set, the control character `ESCAPE` (`ESC`) is always available, and is
|
//! It is assumed that even with no invoked C0 set, the control character `ESCAPE` ([`ESC`]) is always available, and is
|
||||||
//! represented by bit combination `01/00`.
|
//! represented by bit combination `01/00`.
|
||||||
//!
|
//!
|
||||||
|
//! ## Usage
|
||||||
|
//!
|
||||||
|
//! You can use the Elements of the C0 set inside normal strings, format them with the `format!()` macro, or print
|
||||||
|
//! them with the `print!()` and `println!()` macros.
|
||||||
|
//!
|
||||||
|
//! For example, designate the C0 set, then ring the bell.
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use ansi::c0::{ANNOUNCER_SEQUENCE, BEL};
|
||||||
|
//! println!("{}{}", ANNOUNCER_SEQUENCE, BEL);
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! ## Overview of the C0 Set
|
//! ## Overview of the C0 Set
|
||||||
//!
|
//!
|
||||||
//! | Row Number | Column `00` | Column `01` |
|
//! | Row Number | Column `00` | Column `01` |
|
||||||
@ -36,7 +48,7 @@ macro_rules! c0 {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Announcer Sequence for C0.
|
/// Announcer Sequence for Control Set C0.
|
||||||
///
|
///
|
||||||
/// Designate the C0 set of control functions as the active set of control functions.
|
/// Designate the C0 set of control functions as the active set of control functions.
|
||||||
///
|
///
|
||||||
@ -46,7 +58,7 @@ macro_rules! c0 {
|
|||||||
///
|
///
|
||||||
/// ## Note 2
|
/// ## Note 2
|
||||||
///
|
///
|
||||||
/// It is assumed that even with no invoked C0 set, the control character `ESCAPE` (`ESC`) is available, and is
|
/// It is assumed that even with no invoked C0 set, the control character ESCAPE (`ESC`) is available, and is
|
||||||
/// represented by the bit combination `01/11`.
|
/// represented by the bit combination `01/11`.
|
||||||
pub const ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 01, 04 / 00);
|
pub const ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 01, 04 / 00);
|
||||||
|
|
||||||
@ -54,7 +66,9 @@ pub const ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 01, 04 / 00);
|
|||||||
///
|
///
|
||||||
/// `ACK` is transmitted by a receiver as an affirmative response to the sender.
|
/// `ACK` is transmitted by a receiver as an affirmative response to the sender.
|
||||||
///
|
///
|
||||||
/// The use of `ACK` is defined in ISO 1745.
|
/// The use of `ACK` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const ACK: ControlFunction = c0!(00 / 06);
|
pub const ACK: ControlFunction = c0!(00 / 06);
|
||||||
|
|
||||||
/// Bell.
|
/// Bell.
|
||||||
@ -68,7 +82,7 @@ pub const BEL: ControlFunction = c0!(00 / 07);
|
|||||||
/// opposite to that of the implicit movement.
|
/// opposite to that of the implicit movement.
|
||||||
///
|
///
|
||||||
/// The direction of the implicit movement depends on the parameter value of Select Implicit Movement Direction
|
/// The direction of the implicit movement depends on the parameter value of Select Implicit Movement Direction
|
||||||
/// (`SIMD`).
|
/// ([`SIMD`][crate::control_sequences::SIMD]).
|
||||||
pub const BS: ControlFunction = c0!(00 / 08);
|
pub const BS: ControlFunction = c0!(00 / 08);
|
||||||
|
|
||||||
/// Cancel.
|
/// Cancel.
|
||||||
@ -80,24 +94,30 @@ pub const CAN: ControlFunction = c0!(01 / 08);
|
|||||||
|
|
||||||
/// Carriage Return.
|
/// Carriage Return.
|
||||||
///
|
///
|
||||||
/// The effect of `CR` depends on the setting of the DEVICE COMPONENT SELECT MODE (`DCSM`) and on the parameter value of
|
/// The effect of `CR` depends on the setting of the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) and
|
||||||
/// SELECT IMPLICIT MOVEMENT DIRECTION (`SIMD`).
|
/// on the parameter value of SELECT IMPLICIT MOVEMENT DIRECTION ([`SIMD`][crate::control_sequences::SIMD]).
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION and with the parameter value of `SIMD` equal to
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION and with the parameter
|
||||||
/// `0`, `CR` causes the active presentation position to be moved to the line home position of the same line in the
|
/// value of [`SIMD`][crate::control_sequences::SIMD] equal to
|
||||||
/// presentation component. The line home position is established by the parameter value of SET LINE HOME (`SLH`).
|
/// [`Normal`][crate::control_sequences::MovementDirection::Normal], `CR` causes the active presentation position to be
|
||||||
|
/// moved to the line home position of the same line in the presentation component. The line home position is
|
||||||
|
/// established by the parameter value of SET LINE HOME ([`SLH`][crate::control_sequences::SLH]).
|
||||||
///
|
///
|
||||||
/// With a parameter value of `SIMD` equal to `1`, `CR` causes the active presentation position to be moved to the line
|
/// With a parameter value of [`SIMD`][crate::control_sequences::SIMD] equal to
|
||||||
/// limit position of the same line in the presentation component. The line limit position is established by the
|
/// [`Opposite`][crate::control_sequences::MovementDirection::Opposite], `CR` causes the active presentation position to
|
||||||
/// parameter value of SET LINE LIMIT (`SSL`).
|
/// be moved to the line limit position of the same line in the presentation component. The line limit position is
|
||||||
|
/// established by the parameter value of SET LINE LIMIT ([`SLL`][crate::control_sequences::SLL]).
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA and with a parameter of `SIMD` equal to `0`, `CR` causes
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA and with a parameter of
|
||||||
/// the active data position to be moved to the line home position of the same line in the data component. The line home
|
/// [`SIMD`][crate::control_sequences::SIMD] equal to [`Normal`][crate::control_sequences::MovementDirection::Normal],
|
||||||
/// position is established by the parameter value of SET LINE HOME (`SLH`).
|
/// `CR` causes the active data position to be moved to the line home position of the same line in the data component.
|
||||||
|
/// The line home position is established by the parameter value of SET LINE HOME
|
||||||
|
/// ([`SLH`][crate::control_sequences::SLH]).
|
||||||
///
|
///
|
||||||
/// With a parameter value of `SIMD` equal to `1`, `CR` causes the active data position to be moved to the line limit
|
/// With a parameter value of [`SIMD`][crate::control_sequences::SIMD] equal to
|
||||||
/// position of the same line in the data component. The line limit position is established by the parameter value of
|
/// [`Opposite`][crate::control_sequences::MovementDirection::Opposite], `CR` causes the active data position to be
|
||||||
/// SET LINE LIMIT (`SSL`).
|
/// moved to the line limit position of the same line in the data component. The line limit position is established by
|
||||||
|
/// the parameter value of SET LINE LIMIT ([`SLL`][crate::control_sequences::SLL]).
|
||||||
pub const CR: ControlFunction = c0!(00 / 13);
|
pub const CR: ControlFunction = c0!(00 / 13);
|
||||||
|
|
||||||
/// Device Control One.
|
/// Device Control One.
|
||||||
@ -135,7 +155,9 @@ pub const DC4: ControlFunction = c0!(01 / 04);
|
|||||||
///
|
///
|
||||||
/// `DLE` is used exclusively to provide supplementary transmission control functions.
|
/// `DLE` is used exclusively to provide supplementary transmission control functions.
|
||||||
///
|
///
|
||||||
/// The use of `DLE` is defined in ISO 1745.
|
/// The use of `DLE` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const DLE: ControlFunction = c0!(01 / 00);
|
pub const DLE: ControlFunction = c0!(01 / 00);
|
||||||
|
|
||||||
/// End Of Medium.
|
/// End Of Medium.
|
||||||
@ -148,14 +170,18 @@ pub const EM: ControlFunction = c0!(01 / 09);
|
|||||||
///
|
///
|
||||||
/// `ENQ` is transmitted by a sender as a request for a response from a receiver.
|
/// `ENQ` is transmitted by a sender as a request for a response from a receiver.
|
||||||
///
|
///
|
||||||
/// The use of `EOT` is defined in ISO 1745.
|
/// The use of `ENQ` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const ENQ: ControlFunction = c0!(00 / 05);
|
pub const ENQ: ControlFunction = c0!(00 / 05);
|
||||||
|
|
||||||
/// End Of Transmission.
|
/// End Of Transmission.
|
||||||
///
|
///
|
||||||
/// `EOT` is used to indicate the conclusion of the transmission of one or more texts.
|
/// `EOT` is used to indicate the conclusion of the transmission of one or more texts.
|
||||||
///
|
///
|
||||||
/// The use of `EOT` is defined in ISO 1745.
|
/// The use of `EOT` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const EOT: ControlFunction = c0!(00 / 04);
|
pub const EOT: ControlFunction = c0!(00 / 04);
|
||||||
|
|
||||||
/// Escape.
|
/// Escape.
|
||||||
@ -163,7 +189,9 @@ pub const EOT: ControlFunction = c0!(00 / 04);
|
|||||||
/// `ESC` is used for code extension purposes. It causes the meanings of a limited number of bit combinations following
|
/// `ESC` is used for code extension purposes. It causes the meanings of a limited number of bit combinations following
|
||||||
/// it in the data stream to be changed.
|
/// it in the data stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `ESC` is defined in Standard ECMA-35.
|
/// The use of `ESC` 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 ESC: ControlFunction = c0!(01 / 11);
|
pub const ESC: ControlFunction = c0!(01 / 11);
|
||||||
|
|
||||||
/// End Of Transmission Block.
|
/// End Of Transmission Block.
|
||||||
@ -171,21 +199,25 @@ pub const ESC: ControlFunction = c0!(01 / 11);
|
|||||||
/// `ETB` is used to indicate the end of a block of data where the data are divided into such blocks for transmission
|
/// `ETB` is used to indicate the end of a block of data where the data are divided into such blocks for transmission
|
||||||
/// purposes.
|
/// purposes.
|
||||||
///
|
///
|
||||||
/// The use of `ETB` is defined in ISO 1745.
|
/// The use of `ETB` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const ETB: ControlFunction = c0!(01 / 07);
|
pub const ETB: ControlFunction = c0!(01 / 07);
|
||||||
|
|
||||||
/// End Of Text.
|
/// End Of Text.
|
||||||
///
|
///
|
||||||
/// `ETX` is used to indicate the end of a text.
|
/// `ETX` is used to indicate the end of a text.
|
||||||
///
|
///
|
||||||
/// The use of `ETX` is defined in ISO 1745.
|
/// The use of `ETX` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const ETX: ControlFunction = c0!(00 / 03);
|
pub const ETX: ControlFunction = c0!(00 / 03);
|
||||||
|
|
||||||
/// Form Feed.
|
/// Form Feed.
|
||||||
///
|
///
|
||||||
/// `FF` causes the active presentation position to be moved to the corresponding character position of the line at the
|
/// `FF` causes the active presentation position to be moved to the corresponding character position of the line at the
|
||||||
/// page home position of the next form or page in the presentation component. The page home position is established by
|
/// page home position of the next form or page in the presentation component. The page home position is established by
|
||||||
/// the parameter value of SET PAGE HOME (`SPH`).
|
/// the parameter value of SET PAGE HOME ([`SPH`][crate::control_sequences::SPH]).
|
||||||
pub const FF: ControlFunction = c0!(00 / 12);
|
pub const FF: ControlFunction = c0!(00 / 12);
|
||||||
|
|
||||||
/// Character Tabulation.
|
/// Character Tabulation.
|
||||||
@ -193,11 +225,12 @@ pub const FF: ControlFunction = c0!(00 / 12);
|
|||||||
/// `HT` causes the active presentation position to be moved to the following character tabulation stop in the
|
/// `HT` causes the active presentation position to be moved to the following character tabulation stop in the
|
||||||
/// presentation component.
|
/// presentation component.
|
||||||
///
|
///
|
||||||
/// In addition, if that following character tabulation stop has been set by TABULATION ALIGN CENTRE (`TAC`), TABULATION
|
/// In addition, if that following character tabulation stop has been set by TABULATION ALIGN CENTRE
|
||||||
/// ALIGN LEADING EDGE (`TALE`), TABULATION ALIGN TRAILING EDGE (`TATE`) or TABULATION CENTERED ON CHARACTER (`TCC`),
|
/// ([`TAC`][crate::control_sequences::TAC]), TABULATION ALIGN LEADING EDGE ([`TALE`][crate::control_sequences::TALE]),
|
||||||
/// `HT` indicates the beginning of a string of text which is to be positioned within a line according to the properties
|
/// TABULATION ALIGN TRAILING EDGE ([`TATE`][crate::control_sequences::TATE]) or TABULATION CENTRED ON CHARACTER
|
||||||
/// of that tabulation stop. The end of the string is indicated by the next occurrence of `HT` or CARRIAGE RETURN
|
/// ([`TCC`][crate::control_sequences::TCC]), `HT` indicates the beginning of a string of text which is to be positioned
|
||||||
/// ([`CR`]) or NEXT LINE ([`NEL`][crate::c1::NEL]) in the data stream.
|
/// within a line according to the properties of that tabulation stop. The end of the string is indicated by the next
|
||||||
|
/// occurrence of `HT` or CARRIAGE RETURN ([`CR`]) or NEXT LINE ([`NEL`][crate::c1::NEL]) in the data stream.
|
||||||
pub const HT: ControlFunction = c0!(00 / 09);
|
pub const HT: ControlFunction = c0!(00 / 09);
|
||||||
|
|
||||||
/// Information Separator One (US - Unit Separator).
|
/// Information Separator One (US - Unit Separator).
|
||||||
@ -226,11 +259,12 @@ pub const IS4: ControlFunction = c0!(01 / 12);
|
|||||||
|
|
||||||
/// Line Feed.
|
/// Line Feed.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `LF` causes the active presentation position
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `LF` causes the active
|
||||||
/// to be moved to the corresponding character position of the following line in the presentation component.
|
/// presentation position to be moved to the corresponding character position of the following line in the presentation
|
||||||
|
/// component.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `LF` causes the active data position to be moved to the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `LF` causes the active data
|
||||||
/// corresponding character position of the following line in the data component.
|
/// position to be moved to the corresponding character position of the following line in the data component.
|
||||||
pub const LF: ControlFunction = c0!(00 / 10);
|
pub const LF: ControlFunction = c0!(00 / 10);
|
||||||
|
|
||||||
/// Locking-Shift Zero.
|
/// Locking-Shift Zero.
|
||||||
@ -250,18 +284,22 @@ pub const LS0: ControlFunction = c0!(00 / 15);
|
|||||||
/// `LS1` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
/// `LS1` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `LS1` is defined in Standard ECMA-35.
|
/// The use of `LS1` is defined in Standard [ECMA-35][ecma-35].
|
||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// `LS1` is used in 8-bit environments only; in 7-bit environments SHIFT-OUT ([`SO`]) is used instead.
|
/// `LS1` is used in 8-bit environments only; in 7-bit environments SHIFT-OUT ([`SO`]) is used instead.
|
||||||
|
///
|
||||||
|
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
|
||||||
pub const LS1: ControlFunction = c0!(00 / 14);
|
pub const LS1: ControlFunction = c0!(00 / 14);
|
||||||
|
|
||||||
/// Negative Acknowledge.
|
/// Negative Acknowledge.
|
||||||
///
|
///
|
||||||
/// `NAK` is transmitted by a receiver as a negative response to the sender.
|
/// `NAK` is transmitted by a receiver as a negative response to the sender.
|
||||||
///
|
///
|
||||||
/// The use of `NAK` is defined in ISO 1745.
|
/// The use of `NAK` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const NAK: ControlFunction = c0!(01 / 05);
|
pub const NAK: ControlFunction = c0!(01 / 05);
|
||||||
|
|
||||||
/// Null.
|
/// Null.
|
||||||
@ -276,11 +314,13 @@ pub const NUL: ControlFunction = c0!(00 / 00);
|
|||||||
/// `SI` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
/// `SI` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `SI` is defined in Standard ECMA-35.
|
/// The use of `SI` is defined in Standard [ECMA-35][ecma-35].
|
||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// `SI` is used in 7-bit environments only; in 8-bit environments LOCKING-SHIFT ZERO (`LS0`) is used instead.
|
/// `SI` is used in 7-bit environments only; in 8-bit environments LOCKING-SHIFT ZERO ([`LS0`]) is used instead.
|
||||||
|
///
|
||||||
|
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
|
||||||
pub const SI: ControlFunction = c0!(00 / 15);
|
pub const SI: ControlFunction = c0!(00 / 15);
|
||||||
|
|
||||||
/// Shift-Out.
|
/// Shift-Out.
|
||||||
@ -288,25 +328,31 @@ pub const SI: ControlFunction = c0!(00 / 15);
|
|||||||
/// `SO` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
/// `SO` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `SI` is defined in Standard ECMA-35.
|
/// The use of `SI` is defined in Standard [ECMA-35][ecma-35].
|
||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// `SO` is used in 7-bit environments only; in 8-bit environments LOCKING-SHIFT ONE (`LS1`) is used instead.
|
/// `SO` is used in 7-bit environments only; in 8-bit environments LOCKING-SHIFT ONE ([`LS1`]) is used instead.
|
||||||
|
///
|
||||||
|
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
|
||||||
pub const SO: ControlFunction = c0!(00 / 14);
|
pub const SO: ControlFunction = c0!(00 / 14);
|
||||||
|
|
||||||
/// Start of Heading.
|
/// Start of Heading.
|
||||||
///
|
///
|
||||||
/// `SOH` is used to indicate the beginning of a heading.
|
/// `SOH` is used to indicate the beginning of a heading.
|
||||||
///
|
///
|
||||||
/// The use of `SOH` is defined in ISO 1745.
|
/// The use of `SOH` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const SOH: ControlFunction = c0!(00 / 01);
|
pub const SOH: ControlFunction = c0!(00 / 01);
|
||||||
|
|
||||||
/// Start of Text.
|
/// Start of Text.
|
||||||
///
|
///
|
||||||
/// `STX` is used to indicate the beginning of a text and the ned of a heading.
|
/// `STX` is used to indicate the beginning of a text and the ned of a heading.
|
||||||
///
|
///
|
||||||
/// The use of `STX` is defined in ISO 1745.
|
/// The use of `STX` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const STX: ControlFunction = c0!(00 / 02);
|
pub const STX: ControlFunction = c0!(00 / 02);
|
||||||
|
|
||||||
/// Substitute.
|
/// Substitute.
|
||||||
@ -320,7 +366,9 @@ pub const SUB: ControlFunction = c0!(01 / 10);
|
|||||||
/// `SYN` is used by a synchronous transmission system in the absence of any other character (idle condition) to provide
|
/// `SYN` is used by a synchronous transmission system in the absence of any other character (idle condition) to provide
|
||||||
/// a signal from which synchronism may be achieved or retained between data terminal equipment.
|
/// a signal from which synchronism may be achieved or retained between data terminal equipment.
|
||||||
///
|
///
|
||||||
/// The use of `SYN` is defined in ISO 1745.
|
/// The use of `SYN` is defined in [ISO 1745][iso-1745].
|
||||||
|
///
|
||||||
|
/// [iso-1745]: https://www.ecma-international.org/wp-content/uploads/ECMA-16_2nd_edition_june_1973.pdf
|
||||||
pub const SYN: ControlFunction = c0!(01 / 06);
|
pub const SYN: ControlFunction = c0!(01 / 06);
|
||||||
|
|
||||||
/// Line Tabulation.
|
/// Line Tabulation.
|
||||||
|
131
src/c1.rs
131
src/c1.rs
@ -8,6 +8,18 @@
|
|||||||
//! The 3-character escape sequence designating and invoking this c1 set is `ESC 02/06 04/00` and `ESC 02/02 F`.
|
//! The 3-character escape sequence designating and invoking this c1 set is `ESC 02/06 04/00` and `ESC 02/02 F`.
|
||||||
//! see [`ANNOUNCER_SEQUENCE`], and [`ALTERNATIVE_ANNOUNCER_SEQUENCE`].
|
//! see [`ANNOUNCER_SEQUENCE`], and [`ALTERNATIVE_ANNOUNCER_SEQUENCE`].
|
||||||
//!
|
//!
|
||||||
|
//! ## Usage
|
||||||
|
//!
|
||||||
|
//! You can use the Elements of the C1 set inside normal strings, format them with the `format!()` macro, or print
|
||||||
|
//! them with the `print!()` and `println!()` macros.
|
||||||
|
//!
|
||||||
|
//! For example, designate the C1 set, then set a character tabulation stop.
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use ansi::c1::{ANNOUNCER_SEQUENCE, HTS};
|
||||||
|
//! println!("{}{}", ANNOUNCER_SEQUENCE, HTS);
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! ## Overview of the C1 Set
|
//! ## Overview of the C1 Set
|
||||||
//!
|
//!
|
||||||
//! | Row Number | Column `04` | Column `05` |
|
//! | Row Number | Column `04` | Column `05` |
|
||||||
@ -43,7 +55,7 @@ macro_rules! c1 {
|
|||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// The use of this escape sequence implies that all control function of this c1 set must be implemented.
|
/// The use of this escape sequence implies that all control function of this C1 set must be implemented.
|
||||||
pub const ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 06, 04 / 00);
|
pub const ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 06, 04 / 00);
|
||||||
|
|
||||||
/// Alternative Announcer Sequence for C1.
|
/// Alternative Announcer Sequence for C1.
|
||||||
@ -52,14 +64,14 @@ pub const ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 06, 04 / 00);
|
|||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// The use of this escape sequence implies that all control function of this c1 set must be implemented.
|
/// The use of this escape sequence implies that all control function of this C1 set must be implemented.
|
||||||
pub const ALTERNATIVE_ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 02, 04 / 06);
|
pub const ALTERNATIVE_ANNOUNCER_SEQUENCE: &'static str = ascii!(01 / 11, 02 / 02, 04 / 06);
|
||||||
|
|
||||||
/// Application Program Command.
|
/// Application Program Command.
|
||||||
///
|
///
|
||||||
/// `APC` is used as the opening delimiter of a control string for application program use. The command string following
|
/// `APC` is used as the opening delimiter of a control string for application program use. The command string following
|
||||||
/// may consist of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control string is closed
|
/// may consist of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control string is closed
|
||||||
/// by the terminating delimiter String Terminator (`ST`). The interpretation of the command string depends on the
|
/// by the terminating delimiter String Terminator ([`ST`]). The interpretation of the command string depends on the
|
||||||
/// relevant application program.
|
/// relevant application program.
|
||||||
pub const APC: ControlFunction = c1!(05 / 15);
|
pub const APC: ControlFunction = c1!(05 / 15);
|
||||||
|
|
||||||
@ -88,25 +100,27 @@ pub const CSI: ControlFunction = c1!(05 / 11);
|
|||||||
///
|
///
|
||||||
/// `DCS` is used as the opening delimiter of a control string for device control use. The command string following may
|
/// `DCS` is used as the opening delimiter of a control string for device control use. The command string following may
|
||||||
/// consist of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control string is closed by
|
/// consist of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control string is closed by
|
||||||
/// the terminating delimiter STRING TERMINATOR (`ST`).
|
/// the terminating delimiter STRING TERMINATOR ([`ST`]).
|
||||||
///
|
///
|
||||||
/// The command string represents either one or more commands for the receiving device, or one or more status reports
|
/// The command string represents either one or more commands for the receiving device, or one or more status reports
|
||||||
/// from the sending device. The purpose and the format of the command string are specified by the most recent
|
/// from the sending device. The purpose and the format of the command string are specified by the most recent
|
||||||
/// occurrence of IDENTIFY DEVICE CONTROL STRING (`IDCS`), if any, or depend on the sending and/or the receiving device.
|
/// occurrence of IDENTIFY DEVICE CONTROL STRING ([`IDCS`][crate::control_sequences::IDCS]), if any, or depend on the
|
||||||
|
/// sending and/or the receiving device.
|
||||||
pub const DCS: ControlFunction = c1!(05 / 00);
|
pub const DCS: ControlFunction = c1!(05 / 00);
|
||||||
|
|
||||||
/// End Of Guarded Area.
|
/// End Of Guarded Area.
|
||||||
///
|
///
|
||||||
/// `EPA` is used to indicate that the active presentation position is the last of a string of character positions in
|
/// `EPA` is used to indicate that the active presentation position is the last of a string of character positions in
|
||||||
/// the presentation component, the contents of which are protected against manual alteration, are guarded against
|
/// the presentation component, the contents of which are protected against manual alteration, are guarded against
|
||||||
/// transmission or transfer, depending on the setting of GUARDED AREA TRANSFER MODE (`GATM`), and may be protected
|
/// transmission or transfer, depending on the setting of GUARDED AREA TRANSFER MODE ([`GATM`][crate::modes::GATM]),
|
||||||
/// against erasure, depending on the setting of the ERASURE MODE (`ERM`). The beginning of this string is indicated
|
/// and may be protected against erasure, depending on the setting of the ERASURE MODE ([`ERM`][crate::modes::ERM]).
|
||||||
/// by START OF GUARDED AREA ([`SPA`]).
|
/// The beginning of this string is indicated by START OF GUARDED AREA ([`SPA`]).
|
||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// The control functions for area definition ([`DAQ`][crate::control_sequences::DAQ], [`EPA`], [`ESA`], [`SPA`],
|
/// The control functions for area definition ([`DAQ`][crate::control_sequences::DAQ], [`EPA`], [`ESA`], [`SPA`],
|
||||||
/// [`SSA`]) should not be used within an `SRS` string or an `SDS` string.
|
/// [`SSA`]) should not be used within an [`SRS`][crate::control_sequences::SRS] string or an
|
||||||
|
/// [`SDS`][crate::control_sequences::SDS] string.
|
||||||
pub const EPA: ControlFunction = c1!(05 / 07);
|
pub const EPA: ControlFunction = c1!(05 / 07);
|
||||||
|
|
||||||
/// End Of Selected Area.
|
/// End Of Selected Area.
|
||||||
@ -119,7 +133,8 @@ pub const EPA: ControlFunction = c1!(05 / 07);
|
|||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// The control functions for area definition ([`DAQ`][crate::control_sequences::DAQ], [`EPA`], [`ESA`], [`SPA`],
|
/// The control functions for area definition ([`DAQ`][crate::control_sequences::DAQ], [`EPA`], [`ESA`], [`SPA`],
|
||||||
/// [`SSA`]) should not be used within an `SRS` string or an `SDS` string.
|
/// [`SSA`]) should not be used within an [`SRS`][crate::control_sequences::SRS] string or an
|
||||||
|
/// [`SDS`][crate::control_sequences::SDS] string.
|
||||||
pub const ESA: ControlFunction = c1!(04 / 07);
|
pub const ESA: ControlFunction = c1!(04 / 07);
|
||||||
|
|
||||||
/// Character Tabulation With Justification.
|
/// Character Tabulation With Justification.
|
||||||
@ -135,48 +150,54 @@ pub const HTJ: ControlFunction = c1!(04 / 09);
|
|||||||
/// `HTS` causes a character tabulation stop to be set at the active presentation position in the presentation
|
/// `HTS` causes a character tabulation stop to be set at the active presentation position in the presentation
|
||||||
/// component.
|
/// component.
|
||||||
///
|
///
|
||||||
/// The number of liens affected depends on the setting of the TABULATION STOP MODE (`TSM`).
|
/// The number of liens affected depends on the setting of the TABULATION STOP MODE ([`TSM`][crate::modes::TSM]).
|
||||||
pub const HTS: ControlFunction = c1!(04 / 08);
|
pub const HTS: ControlFunction = c1!(04 / 08);
|
||||||
|
|
||||||
/// Message Waiting.
|
/// Message Waiting.
|
||||||
///
|
///
|
||||||
/// `MW` is used to set a message waiting indicator in the receiving device. An appropriate acknowledgement to the
|
/// `MW` is used to set a message waiting indicator in the receiving device. An appropriate acknowledgement to the
|
||||||
/// receipt of `MW` may be given by using DEVICE STATUS REPORT (`DSR`).
|
/// receipt of `MW` may be given by using DEVICE STATUS REPORT ([`DSR`][crate::control_sequences::DSR]).
|
||||||
pub const MW: ControlFunction = c1!(05 / 05);
|
pub const MW: ControlFunction = c1!(05 / 05);
|
||||||
|
|
||||||
/// No Break Here.
|
/// No Break Here.
|
||||||
///
|
///
|
||||||
/// `NBH` is used to indicate a point where a line break shall not occur when text is formatted. `NBH` may occur between
|
/// `NBH` is used to indicate a point where a line break shall not occur when text is formatted. `NBH` may occur between
|
||||||
/// two graphic characters either or both of which may be SPACE.
|
/// two graphic characters either or both of which may be `SPACE`.
|
||||||
pub const NBH: ControlFunction = c1!(04 / 03);
|
pub const NBH: ControlFunction = c1!(04 / 03);
|
||||||
|
|
||||||
/// Next Line.
|
/// Next Line.
|
||||||
///
|
///
|
||||||
/// The effect of `NEL` depends on the setting of the DEVICE COMPONENT SELECT MODE (`DCSM`) and on the parameter value
|
/// The effect of `NEL` depends on the setting of the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) and on
|
||||||
/// of SELECT IMPLICIT MOVEMENT DIRECTION (`SIMD`).
|
/// the parameter value of SELECT IMPLICIT MOVEMENT DIRECTION ([`SIMD`][crate::control_sequences::SIMD]).
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION and with a parameter value of `SIMD` equal to
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION and with a parameter value
|
||||||
/// `0`, `NEL` causes the active presentation position to be moved to the line home position of the following line in
|
/// of [`SIMD`][crate::control_sequences::SIMD] equal to
|
||||||
/// the presentation component. The line home position is established by the parameter value of SET LINE HOME (`SLH`).
|
/// [`Normal`][crate::control_sequences::MovementDirection::Normal], `NEL` causes the active presentation position to be
|
||||||
|
/// moved to the line home position of the following line in the presentation component. The line home position is
|
||||||
|
/// established by the parameter value of SET LINE HOME ([`SLH`][crate::control_sequences::SLH]).
|
||||||
///
|
///
|
||||||
/// With a parameter value of `SIMD` equal to `1`, `NEL` causes the active presentation position to be moved to the line
|
/// With a parameter value of [`SIMD`][crate::control_sequences::SIMD] equal to
|
||||||
/// limit position of the following line in the presentation component. The line limit position is established by the
|
/// [`Opposite`][crate::control_sequences::MovementDirection::Opposite], `NEL` causes the active presentation position
|
||||||
/// parameter value of SET LINE LIMIT (`SLL`).
|
/// to be moved to the line limit position of the following line in the presentation component. The line limit position
|
||||||
|
/// is established by the parameter value of SET LINE LIMIT ([`SLL`][crate::control_sequences::SLL]).
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA and with a parameter value of `SIMD` equal to `0`, `NEL`
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA and with a parameter value of
|
||||||
/// causes the active data position to be moved to the line home position of the following line in the data component.
|
/// [`SIMD`][crate::control_sequences::SIMD] equal to [`Normal`][crate::control_sequences::MovementDirection::Normal],
|
||||||
/// The line home position is established by the parameter value of SET LINE HOME (`SLH`).
|
/// `NEL` causes the active data position to be moved to the line home position of the following line in the data
|
||||||
|
/// component. The line home position is established by the parameter value of SET LINE HOME
|
||||||
|
/// ([`SLH`][crate::control_sequences::SLH]).
|
||||||
///
|
///
|
||||||
/// With a parameter value of `SIMD` equal to `1`, `NEL` causes the active data position to be moved to the line limit
|
/// With a parameter value of [`SIMD`][crate::control_sequences::SIMD] equal to
|
||||||
/// position of the following line in the data component. The line limit position is established by the parameter value
|
/// [`Opposite`][crate::control_sequences::MovementDirection::Opposite], `NEL` causes the active data position to be
|
||||||
/// of SET LINE LIMIT (`SLL`).
|
/// moved to the line limit position of the following line in the data component. The line limit position is established
|
||||||
|
/// by the parameter value of SET LINE LIMIT ([`SLL`][crate::control_sequences::SLL]).
|
||||||
pub const NEL: ControlFunction = c1!(04 / 05);
|
pub const NEL: ControlFunction = c1!(04 / 05);
|
||||||
|
|
||||||
/// Operating System Command
|
/// Operating System Command
|
||||||
///
|
///
|
||||||
/// `OSC` is used as the opening delimiter of a control string for operating system use. The command string following
|
/// `OSC` is used as the opening delimiter of a control string for operating system use. The command string following
|
||||||
/// may consist of a sequence of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control
|
/// may consist of a sequence of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control
|
||||||
/// string is closed by the terminating delimiter STRING TERMINATOR (`ST`). The interpretation of the command string
|
/// string is closed by the terminating delimiter STRING TERMINATOR ([`ST`]). The interpretation of the command string
|
||||||
/// depends on the relevant operating system.
|
/// depends on the relevant operating system.
|
||||||
pub const OSC: ControlFunction = c1!(05 / 13);
|
pub const OSC: ControlFunction = c1!(05 / 13);
|
||||||
|
|
||||||
@ -185,10 +206,10 @@ pub const OSC: ControlFunction = c1!(05 / 13);
|
|||||||
/// `PLD` causes the active presentation position to be moved in the presentation component to the corresponding
|
/// `PLD` causes the active presentation position to be moved in the presentation component to the corresponding
|
||||||
/// position of an imaginary line with a partial offset in the direction of the line progression. This offset should be
|
/// position of an imaginary line with a partial offset in the direction of the line progression. This offset should be
|
||||||
/// sufficient either to image following characters as subscripts until the first following occurrence of PARTIAL LINE
|
/// sufficient either to image following characters as subscripts until the first following occurrence of PARTIAL LINE
|
||||||
/// BACKWARD (`PLU`) in the data stream, or, if preceding characters were imaged as superscripts, to restore imaging
|
/// BACKWARD ([`PLU`]) in the data stream, or, if preceding characters were imaged as superscripts, to restore imaging
|
||||||
/// of following characters to the active line (the line that contains the active presentation position).
|
/// of following characters to the active line (the line that contains the active presentation position).
|
||||||
///
|
///
|
||||||
/// Any interactions between `PLD` and format effectors other than `PLU` are not defined.
|
/// Any interactions between `PLD` and format effectors other than [`PLU`] are not defined.
|
||||||
pub const PLD: ControlFunction = c1!(04 / 11);
|
pub const PLD: ControlFunction = c1!(04 / 11);
|
||||||
|
|
||||||
/// Partial Line Backwards.
|
/// Partial Line Backwards.
|
||||||
@ -196,18 +217,18 @@ pub const PLD: ControlFunction = c1!(04 / 11);
|
|||||||
/// `PLU` causes the active presentation position to be moved in the presentation component to the corresponding
|
/// `PLU` causes the active presentation position to be moved in the presentation component to the corresponding
|
||||||
/// position of an imaginary line with a partial offset in the direction opposite to that of the line progression. This
|
/// position of an imaginary line with a partial offset in the direction opposite to that of the line progression. This
|
||||||
/// offset should be sufficient either to image following characters as superscripts until the first following
|
/// offset should be sufficient either to image following characters as superscripts until the first following
|
||||||
/// occurrence of PARTIAL LINE FORWARD (`PLD`) in the data stream, or, if preceding characters were imaged as
|
/// occurrence of PARTIAL LINE FORWARD ([`PLD`]) in the data stream, or, if preceding characters were imaged as
|
||||||
/// subscripts, to restore imaging of following characters to the active line (the line that contains the active
|
/// subscripts, to restore imaging of following characters to the active line (the line that contains the active
|
||||||
/// presentation position).
|
/// presentation position).
|
||||||
///
|
///
|
||||||
/// Any interactions between `PLU` and format effectors other than `PLD` are not defined.
|
/// Any interactions between `PLU` and format effectors other than [`PLD`] are not defined.
|
||||||
pub const PLU: ControlFunction = c1!(04 / 12);
|
pub const PLU: ControlFunction = c1!(04 / 12);
|
||||||
|
|
||||||
/// Privacy Message.
|
/// Privacy Message.
|
||||||
///
|
///
|
||||||
/// `PM` is used as the opening delimiter of a control string for privacy message use. The command string following may
|
/// `PM` is used as the opening delimiter of a control string for privacy message use. The command string following may
|
||||||
/// consist of a sequence of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control string
|
/// consist of a sequence of bit combinations in the range `00/08` to `00/13` and `02/00` to `07/14`. The control string
|
||||||
/// is closed by the terminating delimiter STRING TERMINATOR (`ST`). The interpretation of the command string depends
|
/// is closed by the terminating delimiter STRING TERMINATOR ([`ST`]). The interpretation of the command string depends
|
||||||
/// on the relevant privacy discipline.
|
/// on the relevant privacy discipline.
|
||||||
pub const PM: ControlFunction = c1!(05 / 14);
|
pub const PM: ControlFunction = c1!(05 / 14);
|
||||||
|
|
||||||
@ -225,11 +246,12 @@ pub const PU2: ControlFunction = c1!(05 / 02);
|
|||||||
|
|
||||||
/// Reverse Line Feed.
|
/// Reverse Line Feed.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `RI` causes the active presentation position to
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `RI` causes the active
|
||||||
/// be moved in the presentation component to the corresponding character position of the preceding line feed.
|
/// presentation position to be moved in the presentation component to the corresponding character position of the
|
||||||
|
/// preceding line feed.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `RI` causes the active data position to be moved in the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `RI` causes the active data
|
||||||
/// data component to the corresponding character position of the preceding line.
|
/// position to be moved in the data component to the corresponding character position of the preceding line.
|
||||||
pub const RI: ControlFunction = c1!(04 / 13);
|
pub const RI: ControlFunction = c1!(04 / 13);
|
||||||
|
|
||||||
/// Single Character Introducer.
|
/// Single Character Introducer.
|
||||||
@ -242,8 +264,8 @@ pub const SCI: ControlFunction = c1!(05 / 10);
|
|||||||
/// Start of String.
|
/// Start of String.
|
||||||
///
|
///
|
||||||
/// `SOS` is used as the opening delimiter of a control string. The character string following may consist of any bit
|
/// `SOS` is used as the opening delimiter of a control string. The character string following may consist of any bit
|
||||||
/// combination, except those representing `SOS` or STRING TERMINATOR (`ST`). The control string is closed by the
|
/// combination, except those representing `SOS` or STRING TERMINATOR ([`ST`]). The control string is closed by the
|
||||||
/// terminating delimiter STRING TERMINATOR (`ST`). The interpretation of the character string depends on the
|
/// terminating delimiter STRING TERMINATOR ([`ST`]). The interpretation of the character string depends on the
|
||||||
/// application.
|
/// application.
|
||||||
pub const SOS: ControlFunction = c1!(05 / 08);
|
pub const SOS: ControlFunction = c1!(05 / 08);
|
||||||
|
|
||||||
@ -251,21 +273,22 @@ pub const SOS: ControlFunction = c1!(05 / 08);
|
|||||||
///
|
///
|
||||||
/// `SPA` is used to indicate that the active presentation position is the first of a string of character positions in
|
/// `SPA` is used to indicate that the active presentation position is the first of a string of character positions in
|
||||||
/// the presentation component, the contents of which are protected against manual alteration, are guarded against
|
/// the presentation component, the contents of which are protected against manual alteration, are guarded against
|
||||||
/// transmission or transfer, depending on the setting of the GUARDED AREA TRANSFER MODE (`GATM`) and may be protected
|
/// transmission or transfer, depending on the setting of the GUARDED AREA TRANSFER MODE ([`GATM`][crate::modes::GATM])
|
||||||
/// against erasure, depending on the setting of the ERASURE MODE (`ERM`). The end of this string is indicated by
|
/// and may be protected against erasure, depending on the setting of the ERASURE MODE ([`ERM`][crate::modes::ERM]).
|
||||||
/// END OF GUARDED AREA (`EPA`).
|
/// The end of this string is indicated by END OF GUARDED AREA (`EPA`).
|
||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// The control functions for area definition (`DAQ`, `EPA`, `ESA`, `SPA`, `SSA`) should not be used within an `SRS`
|
/// The control functions for area definition ([`DAQ`][crate::control_sequences::DAQ], [`EPA`], [`ESA`], [`SPA`],
|
||||||
/// string or an `SDS` string.
|
/// [`SSA`]) should not be used within an [`SRS`][crate::control_sequences::SRS] string or an
|
||||||
|
/// [`SDS`][crate::control_sequences::SDS] string.
|
||||||
pub const SPA: ControlFunction = c1!(05 / 06);
|
pub const SPA: ControlFunction = c1!(05 / 06);
|
||||||
|
|
||||||
/// Start of Selected Area.
|
/// Start of Selected Area.
|
||||||
///
|
///
|
||||||
/// `SSA` is used to indicate that the active presentation position is the first of a string of character positions in
|
/// `SSA` is used to indicate that the active presentation position is the first of a string of character positions in
|
||||||
/// the presentation component, the contents of which are eligible to be transmitted in the form of a data stream or
|
/// the presentation component, the contents of which are eligible to be transmitted in the form of a data stream or
|
||||||
/// transferred to an auxilliary input/output device.
|
/// transferred to an auxiliary input/output device.
|
||||||
///
|
///
|
||||||
/// The end of this string is indicated by END OF SELECTED AREA ([`ESA`]). The string of characters actually transmitted
|
/// The end of this string is indicated by END OF SELECTED AREA ([`ESA`]). The string of characters actually transmitted
|
||||||
/// or transferred depends on the setting of the GUARDED AREA TRANSFER MODE ([`GATM`][crate::modes::GATM]) and on any
|
/// or transferred depends on the setting of the GUARDED AREA TRANSFER MODE ([`GATM`][crate::modes::GATM]) and on any
|
||||||
@ -274,8 +297,9 @@ pub const SPA: ControlFunction = c1!(05 / 06);
|
|||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// The control functions for area definition (`DAQ`, `EPA`, `ESA`, `SPA`, `SSA`) should not be used within an `SRS`
|
/// The control functions for area definition ([`DAQ`][crate::control_sequences::DAQ], [`EPA`], [`ESA`], [`SPA`],
|
||||||
/// string or an `SDS` string.
|
/// [`SSA`]) should not be used within an [`SRS`][crate::control_sequences::SRS] string or an
|
||||||
|
/// [`SDS`][crate::control_sequences::SDS] string.
|
||||||
pub const SSA: ControlFunction = c1!(04 / 06);
|
pub const SSA: ControlFunction = c1!(04 / 06);
|
||||||
|
|
||||||
/// Single-Shift Two.
|
/// Single-Shift Two.
|
||||||
@ -283,7 +307,9 @@ pub const SSA: ControlFunction = c1!(04 / 06);
|
|||||||
/// `SS2` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
/// `SS2` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `SS2` is defined in Standard ECMA-35.
|
/// The use of `SS2` 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 SS2: ControlFunction = c1!(04 / 14);
|
pub const SS2: ControlFunction = c1!(04 / 14);
|
||||||
|
|
||||||
/// Single-Shift Three.
|
/// Single-Shift Three.
|
||||||
@ -291,13 +317,16 @@ pub const SS2: ControlFunction = c1!(04 / 14);
|
|||||||
/// `SS3` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
/// `SS3` is used for code extension purposes. It causes the meanings of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `SS3` is defined in Standard ECMA-35.
|
/// The use of `SS3` 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 SS3: ControlFunction = c1!(04 / 15);
|
pub const SS3: ControlFunction = c1!(04 / 15);
|
||||||
|
|
||||||
/// String Terminator.
|
/// String Terminator.
|
||||||
///
|
///
|
||||||
/// `ST` is used as the closing delimiter of a control string opened by APPLICATION PROGRAM COMMAND (`APC`), DEVICE
|
/// `ST` is used as the closing delimiter of a control string opened by APPLICATION PROGRAM COMMAND ([`APC`]), DEVICE
|
||||||
/// CONTROL STRING (`DCS`), OPERATING SYSTEM COMMAND (`OSC`), PRIVACY MESSAGE (`PM`), or START OF STRING (`SOS`).
|
/// CONTROL STRING ([`DCS`]), OPERATING SYSTEM COMMAND ([`OSC`]), PRIVACY MESSAGE ([`PM`]), or START OF STRING
|
||||||
|
/// ([`SOS`]).
|
||||||
pub const ST: ControlFunction = c1!(05 / 12);
|
pub const ST: ControlFunction = c1!(05 / 12);
|
||||||
|
|
||||||
/// Set Transmit State.
|
/// Set Transmit State.
|
||||||
|
@ -5,6 +5,18 @@
|
|||||||
//! combinations identifying the control function. The control function `CSI` itself is an element of the
|
//! combinations identifying the control function. The control function `CSI` itself is an element of the
|
||||||
//! [C1][crate::c1] set.
|
//! [C1][crate::c1] set.
|
||||||
//!
|
//!
|
||||||
|
//! ## Usage
|
||||||
|
//!
|
||||||
|
//! You can use the control sequences inside normal strings, format them with the `format!()` macro, or print
|
||||||
|
//! them with the `print!()` and `println!()` macros.
|
||||||
|
//!
|
||||||
|
//! For example, move the cursor to line 5, character 13:
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use ansi::control_sequences::CUP;
|
||||||
|
//! print!("{}", CUP(Some(5), Some(13)));
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! ## Overview of the Control Sequences
|
//! ## Overview of the Control Sequences
|
||||||
//!
|
//!
|
||||||
//! ### Without Intermediate Bytes
|
//! ### Without Intermediate Bytes
|
||||||
@ -12,7 +24,7 @@
|
|||||||
//! | Row Number | Column `04` | Column `05` | Column `06` |
|
//! | Row Number | Column `04` | Column `05` | Column `06` |
|
||||||
//! | ---------: | :---------: | :---------: | :---------: |
|
//! | ---------: | :---------: | :---------: | :---------: |
|
||||||
//! | `00` | [`ICH`] | [`DCH`] | [`HPA`] |
|
//! | `00` | [`ICH`] | [`DCH`] | [`HPA`] |
|
||||||
//! | `01` | [`CUU`] | [`SSE`] | [`HPR`] |
|
//! | `01` | [`CUU`] | [`SEE`] | [`HPR`] |
|
||||||
//! | `02` | [`CUD`] | [`CPR`] | [`REP`] |
|
//! | `02` | [`CUD`] | [`CPR`] | [`REP`] |
|
||||||
//! | `03` | [`CUF`] | [`SU`] | [`DA`] |
|
//! | `03` | [`CUF`] | [`SU`] | [`DA`] |
|
||||||
//! | `04` | [`CUB`] | [`SD`] | [`VPA`] |
|
//! | `04` | [`CUB`] | [`SD`] | [`VPA`] |
|
||||||
@ -193,15 +205,15 @@ pub fn CPL(n: Option<u32>) -> ControlFunction {
|
|||||||
|
|
||||||
/// Active Position Report.
|
/// Active Position Report.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `CPR` is used to report the active presentation
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `CPR` is used to report
|
||||||
/// position of the sending device as residing in the presentation component at the `n`-th line position according to
|
/// the active presentation position of the sending device as residing in the presentation component at the `n`-th line
|
||||||
/// the line progression and at the `m`-th character position according to the character path.
|
/// position according to the line progression and at the `m`-th character position according to the character path.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `CPR` is used to report the active data position of the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `CPR` is used to report the
|
||||||
/// sending device as residing in the data component at the `n`-th line position according to the line progression and
|
/// active data position of the sending device as residing in the data component at the `n`-th line position according
|
||||||
/// at the `m`-th character position according to the character progression.
|
/// to the line progression and at the `m`-th character position according to the character progression.
|
||||||
///
|
///
|
||||||
/// `CPR` may be solicited by a DEVICE STATUS REPORT (`DSR`) or be sent unsolicited.
|
/// `CPR` may be solicited by a DEVICE STATUS REPORT ([`DSR`]) or be sent unsolicited.
|
||||||
///
|
///
|
||||||
/// Default value for `n` and `m` is `1`.
|
/// Default value for `n` and `m` is `1`.
|
||||||
pub fn CPR(n: Option<u32>, m: Option<u32>) -> ControlFunction {
|
pub fn CPR(n: Option<u32>, m: Option<u32>) -> ControlFunction {
|
||||||
@ -382,9 +394,9 @@ pub enum AreaQualification {
|
|||||||
/// position of a qualified area. The last character position of the qualified area is the character position in the
|
/// position of a qualified area. The last character position of the qualified area is the character position in the
|
||||||
/// presentation component immediately preceding the first character position of the following qualified area.
|
/// presentation component immediately preceding the first character position of the following qualified area.
|
||||||
///
|
///
|
||||||
/// The control function operates independently of the setting of the TABULATION STOP MODE (`TSM`). The character
|
/// The control function operates independently of the setting of the TABULATION STOP MODE ([`TSM`][crate::modes::TSM]).
|
||||||
/// tabulation stop set by parameter value [`AreaQualification::SetCharacterTabulationStop`] applies to the active line
|
/// The character tabulation stop set by parameter value [`AreaQualification::SetCharacterTabulationStop`] applies to
|
||||||
/// only.
|
/// the active line only.
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`AreaQualification::UnprotectedUnguarded].
|
/// The default value for `s` is [`AreaQualification::UnprotectedUnguarded].
|
||||||
///
|
///
|
||||||
@ -398,22 +410,23 @@ pub fn DAQ(s: Option<AreaQualification>) -> ControlFunction {
|
|||||||
|
|
||||||
/// Delete Character.
|
/// Delete Character.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DSCM`) is set to PRESENTATION, `DCH` causes the contents of the active
|
/// If the DEVICE COMPONENT SELECT MODE ([`DSCM`][crate::modes::DCSM]) is set to PRESENTATION, `DCH` causes the contents
|
||||||
/// presentation position and, depending on the setting of the CHARACTER EDITING MODE (`HEM`), the contents of the `n-1`
|
/// of the active presentation position and, depending on the setting of the CHARACTER EDITING MODE
|
||||||
/// preceding or following character positions to be removed from the presentation component. The resulting gap is
|
/// ([`HEM`][crate::modes::HEM]), the contents of the `n-1` preceding or following character positions to be removed
|
||||||
/// closed by shifting the contents of the adjacent character positions towards the active presentation position. At the
|
/// from the presentation component. The resulting gap is closed by shifting the contents of the adjacent character
|
||||||
/// other end of the shifted part, `n` character positions are put into the erased state.
|
/// positions towards the active presentation position. At the other end of the shifted part, `n` character positions
|
||||||
|
/// are put into the erased state.
|
||||||
///
|
///
|
||||||
/// The extent of the shifted part is established by SELECT EDITING EXTEND (`SEE`).
|
/// The extent of the shifted part is established by SELECT EDITING EXTEND ([`SEE`]).
|
||||||
///
|
///
|
||||||
/// The effect of `CDH` on the start or end of a selected area, the start or end of a qualified area, or a tabulation
|
/// The effect of `DCH` on the start or end of a selected area, the start or end of a qualified area, or a tabulation
|
||||||
/// stop in the shifted part is undefined.
|
/// stop in the shifted part is undefined.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `DCH` causes the contents of the active data position
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `DCH` causes the contents of the
|
||||||
/// and, depending on the setting of the CHARACTER EDITING MODE (`HEM`), the contents of the `n-1` preceding or
|
/// active data position and, depending on the setting of the CHARACTER EDITING MODE ([`HEM`][crate::modes::HEM]), the
|
||||||
/// following character positions to be removed from the data component. The resulting gap is closed by shifting the
|
/// contents of the `n-1` preceding or following character positions to be removed from the data component. The
|
||||||
/// contents of the adjacent character positions towards the active data position. At the other end of the shifted part,
|
/// resulting gap is closed by shifting the contents of the adjacent character positions towards the active data
|
||||||
/// `n` character positions are put into the erased state.
|
/// position. At the other end of the shifted part, `n` character positions are put into the erased state.
|
||||||
///
|
///
|
||||||
/// Default value for `n` is `1`.
|
/// Default value for `n` is `1`.
|
||||||
pub fn DCH(n: Option<u32>) -> ControlFunction {
|
pub fn DCH(n: Option<u32>) -> ControlFunction {
|
||||||
@ -422,27 +435,29 @@ pub fn DCH(n: Option<u32>) -> ControlFunction {
|
|||||||
|
|
||||||
/// Delete Line.
|
/// Delete Line.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `DL` causes the contents of the active line
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `DL` causes the contents
|
||||||
/// (the line that contains the active presentation position) and, depending on the setting of the LINE EDITING MODE
|
/// of the active line (the line that contains the active presentation position) and, depending on the setting of the
|
||||||
/// (`VEM`), the contents of the `n-1` preceding or following lines to be removed from the presentation component. The
|
/// LINE EDITING MODE ([`VEM`][crate::modes::VEM]), the contents of the `n-1` preceding or following lines to be removed
|
||||||
/// resulting gap is closed by shifting the contents of a number of adjacent lines towards the active line. At the other
|
/// from the presentation component. The resulting gap is closed by shifting the contents of a number of adjacent lines
|
||||||
/// end of the shifted part, `n` lines are put into the erased state.
|
/// towards the active line. At the other end of the shifted part, `n` lines are put into the erased state.
|
||||||
///
|
///
|
||||||
/// The active presentation position is moved to the line home position in the active line. The line home position is
|
/// The active presentation position is moved to the line home position in the active line. The line home position is
|
||||||
/// established by the parameter value of SET LINE HOME (`SLH`). If the TABULATION STOP MODE (`TSM`) is set to SINGLE,
|
/// established by the parameter value of SET LINE HOME ([`SLH`]). If the TABULATION STOP MODE
|
||||||
/// character tabulation stops are cleared in the lines that are put into the erased state.
|
/// ([`TSM`][crate::modes::TSM]) is set to SINGLE, character tabulation stops are cleared in the lines that are put into
|
||||||
|
/// the erased state.
|
||||||
///
|
///
|
||||||
/// The extent of the shifted part is established by SELECT EDITING EXTEND (`SEE`).
|
/// The extent of the shifted part is established by SELECT EDITING EXTEND ([`SEE`]).
|
||||||
///
|
///
|
||||||
/// Any occurrences of the start or end of a selected area, the start or end of a qualified area, or a tabulation stop
|
/// Any occurrences of the start or end of a selected area, the start or end of a qualified area, or a tabulation stop
|
||||||
/// in the shifted part, are also shifted.
|
/// in the shifted part, are also shifted.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `DL` causes the contents of the active line (the line
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `DL` causes the contents of the
|
||||||
/// that contains the active data position) and, depending on the setting of the LINE EDITING MODE (`VEM`), the contents
|
/// active line (the line that contains the active data position) and, depending on the setting of the LINE EDITING MODE
|
||||||
/// of the `n-1` preceding or following lines to be removed from the data component. The resulting gap is closed by
|
/// ([`VEM`][crate::modes::VEM]), the contents of the `n-1` preceding or following lines to be removed from the data
|
||||||
/// shifting the contents of a number of adjacent lines towards the active line. At the other end of the shifted part,
|
/// component. The resulting gap is closed by shifting the contents of a number of adjacent lines towards the active
|
||||||
/// `n` lines are put into the erased state. The active data position is moved to the lines home position in the active
|
/// line. At the other end of the shifted part, `n` lines are put into the erased state. The active data position is
|
||||||
/// line. The line home position is established by the parameter value of SET LINE HOME (`SLH`).
|
/// moved to the lines home position in the active line. The line home position is established by the parameter value of
|
||||||
|
/// SET LINE HOME ([`SLH`]).
|
||||||
///
|
///
|
||||||
/// The default value for `n` is `1`.
|
/// The default value for `n` is `1`.
|
||||||
pub fn DL(n: Option<u32>) -> ControlFunction {
|
pub fn DL(n: Option<u32>) -> ControlFunction {
|
||||||
@ -456,23 +471,23 @@ pub enum DeviceStatusReport {
|
|||||||
#[default]
|
#[default]
|
||||||
Ready = 0,
|
Ready = 0,
|
||||||
|
|
||||||
/// The device is busy, another `DSR` must be requested later.
|
/// The device is busy, another [`DSR`] must be requested later.
|
||||||
BusyRepeat,
|
BusyRepeat,
|
||||||
|
|
||||||
/// The device is busy, another `DSR` will be sent later.
|
/// The device is busy, another [`DSR`] will be sent later.
|
||||||
BusyLater,
|
BusyLater,
|
||||||
|
|
||||||
/// Some malfunction detected, another `DSR` must be requested later.
|
/// Some malfunction detected, another [`DSR`] must be requested later.
|
||||||
MalfunctionRepeat,
|
MalfunctionRepeat,
|
||||||
|
|
||||||
/// Some malfunction detected, another `DSR` will be sent later.
|
/// Some malfunction detected, another [`DSR`] will be sent later.
|
||||||
MalfunctionLater,
|
MalfunctionLater,
|
||||||
|
|
||||||
/// A device status report is requested.
|
/// A device status report is requested.
|
||||||
RequestDeviceStatusReport,
|
RequestDeviceStatusReport,
|
||||||
|
|
||||||
/// A report of the active presentation position or of the active data position in the form of ACTIVE POSITION
|
/// A report of the active presentation position or of the active data position in the form of ACTIVE POSITION
|
||||||
/// REPORT (`CPR`) is requested.
|
/// REPORT ([`CPR`]) is requested.
|
||||||
RequestActivePositionReport,
|
RequestActivePositionReport,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,16 +538,16 @@ pub enum EraseArea {
|
|||||||
|
|
||||||
/// Erase in Area.
|
/// Erase in Area.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `EA` causes some or all character positions in
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `EA` causes some or all
|
||||||
/// the active qualified area (the qualified area in the presentation component which contains the active presentation
|
/// character positions in the active qualified area (the qualified area in the presentation component which contains
|
||||||
/// position) to be put into the erased state, depending on the parameter value.
|
/// the active presentation position) to be put into the erased state, depending on the parameter value.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `EA` causes some or all character positions in the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `EA` causes some or all character
|
||||||
/// active qualified area (the qualified area in the data component which contains the active data position) to be put
|
/// positions in the active qualified area (the qualified area in the data component which contains the active data
|
||||||
/// into the erased state, depending ont he parameter value.
|
/// position) to be put into the erased state, depending ont he parameter value.
|
||||||
///
|
///
|
||||||
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
||||||
/// unprotected areas only, depends on the setting of ERASURE MODE (`ERM`).
|
/// unprotected areas only, depends on the setting of ERASURE MODE ([`ERM`][crate::modes::ERM]).
|
||||||
///
|
///
|
||||||
/// The default value of `s` is [`EraseArea::ActivePositionToEnd`].
|
/// The default value of `s` is [`EraseArea::ActivePositionToEnd`].
|
||||||
pub fn EA(s: Option<EraseArea>) -> ControlFunction {
|
pub fn EA(s: Option<EraseArea>) -> ControlFunction {
|
||||||
@ -541,14 +556,15 @@ pub fn EA(s: Option<EraseArea>) -> ControlFunction {
|
|||||||
|
|
||||||
/// Erase Character.
|
/// Erase Character.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `ECH` causes the active presentation position
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `ECH` causes the active
|
||||||
/// and the `n-1` following character positions in the presentation component to be put into the erased state.
|
/// presentation position and the `n-1` following character positions in the presentation component to be put into the
|
||||||
|
/// erased state.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `ECH` causes the active data position and the `n-1`
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `ECH` causes the active data
|
||||||
/// following character positions in the data component to be put into the erased state.
|
/// position and the `n-1` following character positions in the data component to be put into the erased state.
|
||||||
///
|
///
|
||||||
/// Whether the character positions of protected areas are putinto the erased state, or the character positions of
|
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
||||||
/// unprotected areas only, depends on the setting of the ERASURE MODE (`ERM`).
|
/// unprotected areas only, depends on the setting of the ERASURE MODE ([`ERM`][crate::modes::ERM]).
|
||||||
///
|
///
|
||||||
/// The default value for `n` is `1´.
|
/// The default value for `n` is `1´.
|
||||||
pub fn ECH(n: Option<u32>) -> ControlFunction {
|
pub fn ECH(n: Option<u32>) -> ControlFunction {
|
||||||
@ -571,16 +587,16 @@ pub enum ErasePage {
|
|||||||
|
|
||||||
/// Erase In Page.
|
/// Erase In Page.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `ED` causes some or all character positions
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `ED` causes some or all
|
||||||
/// of the active page (the page which contains the active presentation position in the presentation component) to be
|
/// character positions of the active page (the page which contains the active presentation position in the presentation
|
||||||
/// put into the erased state, depending on the parameter value.
|
/// component) to be/ put into the erased state, depending on the parameter value.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `ED` causes some or all character positions of the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `ED` causes some or all character
|
||||||
/// active page (the page which contains the active data position in the data component) to be put into the erased
|
/// positions of the active page (the page which contains the active data position in the data component) to be put into
|
||||||
/// state, depending on the parameter value.
|
/// the erased state, depending on the parameter value.
|
||||||
///
|
///
|
||||||
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
||||||
/// unprotected areas only, depends on the setting of the ERASURE MODE (`ERM`).
|
/// unprotected areas only, depends on the setting of the ERASURE MODE ([`ERM`][crate::modes::ERM]).
|
||||||
///
|
///
|
||||||
/// The default value of `s` is [`ErasePage::ActivePositionToEnd`].
|
/// The default value of `s` is [`ErasePage::ActivePositionToEnd`].
|
||||||
pub fn ED(s: Option<ErasePage>) -> ControlFunction {
|
pub fn ED(s: Option<ErasePage>) -> ControlFunction {
|
||||||
@ -603,16 +619,16 @@ pub enum EraseField {
|
|||||||
|
|
||||||
/// Erase In Field.
|
/// Erase In Field.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `EF` causes some or all character positions of
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `EF` causes some or all
|
||||||
/// the active field (the field which contains the active presentation position in the presentatio component) to be put
|
/// character positions of the active field (the field which contains the active presentation position in the
|
||||||
|
/// presentation component) to be put into the erased state, depending on the parameter value.
|
||||||
|
///
|
||||||
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `EF` causes some or all character
|
||||||
|
/// positions of the active field (the field which contains the active data position in the data component) to be put
|
||||||
/// into the erased state, depending on the parameter value.
|
/// into the erased state, depending on the parameter value.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `EF` causes some or all character positions of the
|
|
||||||
/// active field (the field which contains the active data position in the data component) to be put into the erased
|
|
||||||
/// state, depending on the parameter value.
|
|
||||||
///
|
|
||||||
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
||||||
/// unprotected areas only, depends on the setting of the ERASURE MODE (`ERM`).
|
/// unprotected areas only, depends on the setting of the ERASURE MODE ([`ERM`][crate::modes::ERM]).
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`EraseField::ActivePositionToEnd`].
|
/// The default value for `s` is [`EraseField::ActivePositionToEnd`].
|
||||||
pub fn EF(s: Option<EraseField>) -> ControlFunction {
|
pub fn EF(s: Option<EraseField>) -> ControlFunction {
|
||||||
@ -635,16 +651,16 @@ pub enum EraseLine {
|
|||||||
|
|
||||||
/// Erase In Line.
|
/// Erase In Line.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `EL` causes some or all character positions of
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `EL` causes some or all
|
||||||
/// the active line (the line which contains the active presentation position in the presentation component) to be put
|
/// character positions of the active line (the line which contains the active presentation position in the presentation
|
||||||
/// into the erased state, depending on the parameter value.
|
/// component) to be put into the erased state, depending on the parameter value.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `EL` causes some or all character positions of the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `EL` causes some or all character
|
||||||
/// active line (the line which contains the active data position in the data component) to be put into the erased
|
/// positions of the active line (the line which contains the active data position in the data component) to be put into
|
||||||
/// state, depending on the parameter value.
|
/// the erased state, depending on the parameter value.
|
||||||
///
|
///
|
||||||
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
/// Whether the character positions of protected areas are put into the erased state, or the character positions of
|
||||||
/// unprotected areas only, depends on the setting of the ERASURE MODE (`ERM`).
|
/// unprotected areas only, depends on the setting of the ERASURE MODE ([`ERM`][crate::modes::ERM]).
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`EraseLine::ActivePositionToEnd`].
|
/// The default value for `s` is [`EraseLine::ActivePositionToEnd`].
|
||||||
pub fn EL(s: Option<EraseLine>) -> ControlFunction {
|
pub fn EL(s: Option<EraseLine>) -> ControlFunction {
|
||||||
@ -696,7 +712,7 @@ pub enum Font {
|
|||||||
/// Font Selection.
|
/// Font Selection.
|
||||||
///
|
///
|
||||||
/// `FNT` is used to identify the character font to be selected as primary or alternative font by subsequent occurrences
|
/// `FNT` is used to identify the character font to be selected as primary or alternative font by subsequent occurrences
|
||||||
/// of SELECT GRAPHIC RENDITION (`SGR`) in the data stream.
|
/// of SELECT GRAPHIC RENDITION ([`SGR`]) in the data stream.
|
||||||
///
|
///
|
||||||
/// - `s` specifies the primary or alternative font concerned.
|
/// - `s` specifies the primary or alternative font concerned.
|
||||||
/// - `t` identifies the character font according to a register which is to be established.
|
/// - `t` identifies the character font according to a register which is to be established.
|
||||||
@ -745,7 +761,7 @@ pub fn GCC(s: Option<GraphicCharacterCombination>) -> ControlFunction {
|
|||||||
/// Graphic Size Modification.
|
/// Graphic Size Modification.
|
||||||
///
|
///
|
||||||
/// `GSM` is used to modify for subsequent text the height and / or the width of all primary and alternative fonts
|
/// `GSM` is used to modify for subsequent text the height and / or the width of all primary and alternative fonts
|
||||||
/// identified by FONT SELECT ([`FNT`]) and established by GRAPHIC SIZE SELECTION (`GSS`). The established values
|
/// identified by FONT SELECT ([`FNT`]) and established by GRAPHIC SIZE SELECTION ([`GSS`]). The established values
|
||||||
/// remain in effect until the next occurrence of `GSM` or [`GSS`] in the data stream.
|
/// remain in effect until the next occurrence of `GSM` or [`GSS`] in the data stream.
|
||||||
///
|
///
|
||||||
/// - `h` specifies the height as a percentage of the height established by [`GSS`].
|
/// - `h` specifies the height as a percentage of the height established by [`GSS`].
|
||||||
@ -759,13 +775,13 @@ pub fn GSM(h: Option<u32>, w: Option<u32>) -> ControlFunction {
|
|||||||
/// Graphic Size Selection.
|
/// Graphic Size Selection.
|
||||||
///
|
///
|
||||||
/// `GSS` is used to establish for subsequent texts the height and the width of all primary and alternative fonts
|
/// `GSS` is used to establish for subsequent texts the height and the width of all primary and alternative fonts
|
||||||
/// identified by FONT SELECT (`FNT`). The established values remain in effect until the next occurrence of `GSS` in the
|
/// identified by FONT SELECT ([`FNT`]). The established values remain in effect until the next occurrence of `GSS` in the
|
||||||
/// data stream.
|
/// data stream.
|
||||||
///
|
///
|
||||||
/// - `n` specifies the height, the width is implicitly defined by the height.
|
/// - `n` specifies the height, the width is implicitly defined by the height.
|
||||||
///
|
///
|
||||||
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
||||||
/// (`SSU`).
|
/// ([`SSU`]).
|
||||||
pub fn GSS(n: u32) -> ControlFunction {
|
pub fn GSS(n: u32) -> ControlFunction {
|
||||||
sequence!(02 / 00, 04/03, numeric n)
|
sequence!(02 / 00, 04/03, numeric n)
|
||||||
}
|
}
|
||||||
@ -812,26 +828,27 @@ pub fn HVP(n: Option<u32>, m: Option<u32>) -> ControlFunction {
|
|||||||
|
|
||||||
/// Insert Character.
|
/// Insert Character.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `ICH` is used to prepare the insertion of `n`
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `ICH` is used to prepare
|
||||||
/// characters, by putting into the erased state the active presentation position and, depending on the setting of the
|
/// the insertion of `n` characters, by putting into the erased state the active presentation position and, depending on
|
||||||
/// CHARACTER EDITING MODE (`HEM`), the `n-1` preceding or following character positions in the presentation component.
|
/// the setting of the CHARACTER EDITING MODE ([`HEM`][crate::modes::HEM]), the `n-1` preceding or following character
|
||||||
/// The previous contents of the active presentation position and an adjacent string of character positions are shifted
|
/// positions in the presentation component. The previous contents of the active presentation position and an adjacent
|
||||||
/// away from the active presentation position. The contents of `n` character positions at the other end of the shifted
|
/// string of character positions are shifted away from the active presentation position. The contents of `n` character
|
||||||
/// part are removed. The active presentation position is moved to the line home position in the active line. The line
|
/// positions at the other end of the shifted part are removed. The active presentation position is moved to the line
|
||||||
/// home position is established by the parameter value of SET LINE HOME (`SLH`).
|
/// home position in the active line. The line home position is established by the parameter value of SET LINE HOME
|
||||||
|
/// ([`SLH`]).
|
||||||
///
|
///
|
||||||
/// The extent of the shifted part is established by SELECT EDITING EXTENT (`SEE`).
|
/// The extent of the shifted part is established by SELECT EDITING EXTENT ([`SEE`]).
|
||||||
///
|
///
|
||||||
/// The effect of `ICH` on the start or end of a selected area, the start or end of a qualified area, or a tabulation
|
/// The effect of `ICH` on the start or end of a selected area, the start or end of a qualified area, or a tabulation
|
||||||
/// stop in the shifted part is undefined.
|
/// stop in the shifted part is undefined.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `ICH` is used to prepare the insertion of `n`
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `ICH` is used to prepare the
|
||||||
/// characters, by putting into the erased state the active data position and, depending on the setting of the
|
/// insertion of `n` characters, by putting into the erased state the active data position and, depending on the setting
|
||||||
/// CHARACTER EDITING MODE (`HEM`), the `n-1` preceding or following character positions in the data component. The
|
/// of the CHARACTER EDITING MODE ([`HEM`][crate::modes::HEM]), the `n-1` preceding or following character positions in
|
||||||
/// previous contents of the active data position and and adjacent string of character positions are shifted away from
|
/// the data component. The previous contents of the active data position and and adjacent string of character positions
|
||||||
/// the active data position. The contents of `n` character positions at the other end of the shifted part are removed.
|
/// are shifted away from the active data position. The contents of `n` character positions at the other end of the
|
||||||
/// The active data position is moved to the line home position in the active line. The line home position is
|
/// shifted part are removed. The active data position is moved to the line home position in the active line. The line
|
||||||
/// established by the parameter value of SET LINE HOME (`SLH`).
|
/// home position is/ established by the parameter value of SET LINE HOME ([`SLH`]).
|
||||||
///
|
///
|
||||||
/// The default value for `n` is `1`.
|
/// The default value for `n` is `1`.
|
||||||
pub fn ICH(n: Option<u32>) -> ControlFunction {
|
pub fn ICH(n: Option<u32>) -> ControlFunction {
|
||||||
@ -844,7 +861,9 @@ pub enum IdentifyDeviceControlString {
|
|||||||
/// Reserved for use with the DIAGNOSTIC state of the STATUS REPORT TRANSFER MODE.
|
/// Reserved for use with the DIAGNOSTIC state of the STATUS REPORT TRANSFER MODE.
|
||||||
Diagnostic,
|
Diagnostic,
|
||||||
|
|
||||||
/// Reserved for Dynamically Redefinable Character Sets (`DRCS`) according to Standard ECMA-35.
|
/// Reserved for Dynamically Redefinable Character Sets according to Standard [ECMA-35][ecma-35].
|
||||||
|
///
|
||||||
|
/// [ecma-35]: https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
|
||||||
DynamicallyRedefinableCharacterSet,
|
DynamicallyRedefinableCharacterSet,
|
||||||
|
|
||||||
/// Private command string.
|
/// Private command string.
|
||||||
@ -853,8 +872,9 @@ pub enum IdentifyDeviceControlString {
|
|||||||
|
|
||||||
/// Identify Device Control String.
|
/// Identify Device Control String.
|
||||||
///
|
///
|
||||||
/// `IDCS` is used to specify the purpose and format of the command string of subsequent DEVICE CONTROL STRINGS (`DCS`).
|
/// `IDCS` is used to specify the purpose and format of the command string of subsequent DEVICE CONTROL STRINGS
|
||||||
/// The specified purpose and format remain in effect until the next occurrence of `IDCS` in the data stream.
|
/// ([`DCS`][crate::c1::DCS]). The specified purpose and format remain in effect until the next occurrence of `IDCS`
|
||||||
|
/// in the data stream.
|
||||||
///
|
///
|
||||||
/// The format and interpretation of the command string corresponding to the parameter `s` are to be defined in
|
/// The format and interpretation of the command string corresponding to the parameter `s` are to be defined in
|
||||||
/// appropriate standards. If this control function is used to identify a private command string, a private parameter
|
/// appropriate standards. If this control function is used to identify a private command string, a private parameter
|
||||||
@ -881,28 +901,29 @@ pub fn IGS(n: u32) -> ControlFunction {
|
|||||||
|
|
||||||
/// Insert Line.
|
/// Insert Line.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to PRESENTATION, `IL` is used to prepare the insertion of `n`
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `IL` is used to prepare
|
||||||
/// lines, by putting into the erased state in the presentation component the active line (the line that contains the
|
/// the insertion of `n` lines, by putting into the erased state in the presentation component the active line
|
||||||
/// active presentation position) and, depending on the setting of the LINE EDITING MODE (`VEM`), the `n-1` preceding
|
/// (the line that contains the active presentation position) and, depending on the setting of the LINE EDITING MODE
|
||||||
/// or following lines. The previous contents of the active line and of adjacent lines are shifted away from the active
|
/// ([`VEM`][crate::modes::VEM]), the `n-1` preceding or following lines. The previous contents of the active line and
|
||||||
/// line. The contents of `n` lines at the other end of the shifted part are removed. The active presentation position
|
/// of adjacent lines are shifted away from the active line. The contents of `n` lines at the other end of the shifted
|
||||||
/// is moved to the line home position in the active line. The line home position is established by the parameter value
|
/// part are removed. The active presentation position is moved to the line home position in the active line. The line
|
||||||
/// of SET LINE HOME (`SLH`).
|
/// home position is established by the parameter value of SET LINE HOME ([`SLH`]).
|
||||||
///
|
///
|
||||||
/// The extent of the shifted part is established by SELECT EDITING EXTENT (`SEE`).
|
/// The extent of the shifted part is established by SELECT EDITING EXTENT ([`SEE`]).
|
||||||
///
|
///
|
||||||
/// Any occurrence of the start or end of a selected area, the start or end of a qualified area, or a tabulation stop in
|
/// Any occurrence of the start or end of a selected area, the start or end of a qualified area, or a tabulation stop in
|
||||||
/// the shifted part, are also shifted.
|
/// the shifted part, are also shifted.
|
||||||
///
|
///
|
||||||
/// If the TABULATION STOP MODE (`TSM`) is set to SINGLE, character tabulation stops are cleared in the lines that are
|
/// If the TABULATION STOP MODE ([`TSM`][crate::modes::TSM]) is set to SINGLE, character tabulation stops are cleared in
|
||||||
/// put into the erased state.
|
/// the lines that are put into the erased state.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE (`DCSM`) is set to DATA, `IL` is used to prepare the insertion of `n` lines, by
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `IL` is used to prepare the
|
||||||
/// putting into the erased state in the data component the active line (the line that contains the active data
|
/// insertion of `n` lines, by putting into the erased state in the data component the active line (the line that
|
||||||
/// position) and, depending on the setting of the LINE EDITING MODE (`VEM`), the `n-1` preceding or following lines.
|
/// contains the active data position) and, depending on the setting of the LINE EDITING MODE
|
||||||
/// The previous contents of the active line and of adjacent lines are shifted away from the active line. The contents
|
/// ([`VEM`][crate::modes::VEM]), the `n-1` preceding or following lines. The previous contents of the active line and
|
||||||
/// of `n` lines at the other end of the shifted part are removed. The active data position is moved to the line home
|
/// of adjacent lines are shifted away from the active line. The contents of `n` lines at the other end of the shifted
|
||||||
/// position in the active line. The line home position is established by the parameter value of SET LINE HOME (`SLH`).
|
/// part are removed. The active data position is moved to the line home position in the active line. The line home
|
||||||
|
/// position is established by the parameter value of SET LINE HOME ([`SLH`]).
|
||||||
///
|
///
|
||||||
/// The default value for `n` is `1`.
|
/// The default value for `n` is `1`.
|
||||||
pub fn IL(n: Option<u32>) -> ControlFunction {
|
pub fn IL(n: Option<u32>) -> ControlFunction {
|
||||||
@ -948,8 +969,8 @@ pub enum Justification {
|
|||||||
///
|
///
|
||||||
/// The end of the string to be justified is indicated by the next occurrence of `JFY` in the data stream.
|
/// The end of the string to be justified is indicated by the next occurrence of `JFY` in the data stream.
|
||||||
///
|
///
|
||||||
/// The line home position is established by the parameter value of SET LINE HOME (`SLH`). The line limit position is
|
/// The line home position is established by the parameter value of SET LINE HOME ([`SLH`]). The line limit position is
|
||||||
/// established by the parameter value of SET LINE LIMIT (`SLL`).
|
/// established by the parameter value of SET LINE LIMIT ([`SLL`]).
|
||||||
///
|
///
|
||||||
/// The default value of `s` is [`Justification::None`].
|
/// The default value of `s` is [`Justification::None`].
|
||||||
pub fn JFY(s: Option<Justification>) -> ControlFunction {
|
pub fn JFY(s: Option<Justification>) -> ControlFunction {
|
||||||
@ -1009,7 +1030,7 @@ pub fn NP(n: Option<u32>) -> ControlFunction {
|
|||||||
/// Valid parameter values to the function [`PEC`].
|
/// Valid parameter values to the function [`PEC`].
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub enum PresentationExpandContract {
|
pub enum PresentationExpandContract {
|
||||||
/// Normal, as specified by `SCS`, `SHS` or `SPI`.
|
/// Normal, as specified by [`SCS`], [`SHS`] or [`SPI`].
|
||||||
#[default]
|
#[default]
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
|
|
||||||
@ -1024,9 +1045,9 @@ pub enum PresentationExpandContract {
|
|||||||
///
|
///
|
||||||
/// `PEC` is used to establish the spacing and the extent of the graphic characters for subsequent text. The spacing is
|
/// `PEC` is used to establish the spacing and the extent of the graphic characters for subsequent text. The spacing is
|
||||||
/// specified in the line as multiples of the spacing established by the most recent occurrence of SET CHARACTER SPACING
|
/// specified in the line as multiples of the spacing established by the most recent occurrence of SET CHARACTER SPACING
|
||||||
/// (`SCS`) or of SELECT CHARACTER SPACING (`SHS`) or of SPACING INCREMENT (`SPI`) in the data stream. The extent of the
|
/// ([`SCS`]) or of SELECT CHARACTER SPACING ([`SHS`]) or of SPACING INCREMENT ([`SPI`]) in the data stream. The extent
|
||||||
/// characters is implicitly established by these control functions. The established spacing and the extent remain in
|
/// of the characters is implicitly established by these control functions. The established spacing and the extent
|
||||||
/// effect until the next occurrence of `PEC`, of `SCS`, of `SHS` or of `SPI` in the data stream.
|
/// remain in effect until the next occurrence of `PEC`, of [`SCS`], of [`SHS`] or of [`SPI`] in the data stream.
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`PresentationExpandContract::Normal`].
|
/// The default value for `s` is [`PresentationExpandContract::Normal`].
|
||||||
pub fn PEC(s: Option<PresentationExpandContract>) -> ControlFunction {
|
pub fn PEC(s: Option<PresentationExpandContract>) -> ControlFunction {
|
||||||
@ -1089,12 +1110,12 @@ pub enum PageFormat {
|
|||||||
/// Page Format Selection
|
/// Page Format Selection
|
||||||
///
|
///
|
||||||
/// `PFS` is used to establish the available area for the imaging of pages of text based on paper size. The pages are
|
/// `PFS` is used to establish the available area for the imaging of pages of text based on paper size. The pages are
|
||||||
/// introduced by the subsequent occurrence of FORM FEED (`FF`) in the data stream.
|
/// introduced by the subsequent occurrence of FORM FEED ([`FF`][crate::c0::FF]) in the data stream.
|
||||||
///
|
///
|
||||||
/// The established image area remains in effect until the next occurrence of `PFS` in the data stream.
|
/// The established image area remains in effect until the next occurrence of `PFS` in the data stream.
|
||||||
///
|
///
|
||||||
/// The page home position is established by the parameter value of SET PAGE HOME (`SPH`), the page limit position is
|
/// The page home position is established by the parameter value of SET PAGE HOME ([`SPH`]), the page limit position is
|
||||||
/// established by the parameter value of SET PAGE LIMIT (`SPL`).
|
/// established by the parameter value of SET PAGE LIMIT ([`SPL`]).
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`PageFormat::TallBasicText`].
|
/// The default value for `s` is [`PageFormat::TallBasicText`].
|
||||||
pub fn PFS(s: Option<PageFormat>) -> ControlFunction {
|
pub fn PFS(s: Option<PageFormat>) -> ControlFunction {
|
||||||
@ -1182,7 +1203,7 @@ pub enum ParallelText {
|
|||||||
/// `PTX` with a parameter value of [`ParallelText::End`] indicates the end of the strings of text intended to be
|
/// `PTX` with a parameter value of [`ParallelText::End`] indicates the end of the strings of text intended to be
|
||||||
/// presented in parallel with one another.
|
/// presented in parallel with one another.
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`ParallelText::End]`.
|
/// The default value for `s` is [`ParallelText::End`].
|
||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
@ -1241,13 +1262,14 @@ pub enum Alignment {
|
|||||||
/// according to the layout specified by the parameter value, see [`Alignment`].
|
/// according to the layout specified by the parameter value, see [`Alignment`].
|
||||||
///
|
///
|
||||||
/// The beginning of the string to be positioned is indicated by the preceding occurrence in the data stream of either
|
/// The beginning of the string to be positioned is indicated by the preceding occurrence in the data stream of either
|
||||||
/// `QUAD` or one of the following formator functions: FORM FEED (`FF`), CHARACTER AND LINE POSITION (`HVP`), LINE FEED
|
/// `QUAD` or one of the following formator functions: FORM FEED ([`FF`][crate::c0::FF]), CHARACTER AND LINE POSITION
|
||||||
/// (`LF`), NEXT LINE (`NEL`), PAGE POSITION ABSOLUTE (`PPA`), PAGE POSITION BACKWARD (`PPB`), PAGE POSITION FORWARD
|
/// ([`HVP`]), LINE FEED ([`LF`][crate::c0::LF]), NEXT LINE ([`NEL`][crate::c1::NEL]), PAGE POSITION ABSOLUTE
|
||||||
/// (`PPR`), REVERSE LINE FEED (`RI`), LINE POSITION ABSOLUTE (`VPA`), LINE POSITION BACKWARD (`VPB`), LINE POSITION
|
/// ([`PPA`]), PAGE POSITION BACKWARD ([`PPB`]), PAGE POSITION FORWARD ([`PPR`]), REVERSE LINE FEED
|
||||||
/// FORWARD (`VPR`), or LINE TABULATION (`VT`).
|
/// ([`RI`][crate::c1::RI]), LINE POSITION ABSOLUTE ([`VPA`]), LINE POSITION BACKWARD ([`VPB`]), LINE POSITION
|
||||||
|
/// FORWARD ([`VPR`]), or LINE TABULATION ([`VT`][crate::c0::VT]).
|
||||||
///
|
///
|
||||||
/// The line home position is established by the parameter value of SET LINE HOME (`SLH`). The line limit position is
|
/// The line home position is established by the parameter value of SET LINE HOME ([`SLH`]). The line limit position is
|
||||||
/// established by the parameter value of SET LINE LIMIT (`SLL`).
|
/// established by the parameter value of SET LINE LIMIT ([`SLL`]).
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`Alignment::LineHome`].
|
/// The default value for `s` is [`Alignment::LineHome`].
|
||||||
pub fn QUAD(s: Option<Alignment>) -> ControlFunction {
|
pub fn QUAD(s: Option<Alignment>) -> ControlFunction {
|
||||||
@ -1275,14 +1297,14 @@ pub fn RM(v: Vec<Mode>) -> ControlFunction {
|
|||||||
/// Set Additional Character Representation.
|
/// Set Additional Character Representation.
|
||||||
///
|
///
|
||||||
/// `SACS` is used to establish extra inter-character escapement for subsequent text. The established extra escapement
|
/// `SACS` is used to establish extra inter-character escapement for subsequent text. The established extra escapement
|
||||||
/// remains in effect until the next occurrence of `SACS` or of SET REDUCED CHARACTER SEPARATION (`SRCS`) in the data
|
/// remains in effect until the next occurrence of `SACS` or of SET REDUCED CHARACTER SEPARATION ([`SRCS`]) in the data
|
||||||
/// stream or until it is reset to the default value by a subsequent occurrence of CARRIAGE RETURN LINE FEED (`CR LF`)
|
/// stream or until it is reset to the default value by a subsequent occurrence of CARRIAGE RETURN LINE FEED
|
||||||
/// or of NEXT LINE (`NEL`) in the data stream.
|
/// ([`CR`][crate::c0::CR] [`LF`][crate::c0::LF]) or of NEXT LINE ([`NEL`][crate::c1::NEL]) in the data stream.
|
||||||
///
|
///
|
||||||
/// `n` specifies the number of units by which the inter-character escapement is enlarged.
|
/// `n` specifies the number of units by which the inter-character escapement is enlarged.
|
||||||
///
|
///
|
||||||
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
||||||
/// (`SSU`).
|
/// ([`SSU`]).
|
||||||
///
|
///
|
||||||
/// The default value for `n` is 0.
|
/// The default value for `n` is 0.
|
||||||
pub fn SACS(n: Option<u32>) -> ControlFunction {
|
pub fn SACS(n: Option<u32>) -> ControlFunction {
|
||||||
@ -1292,7 +1314,7 @@ pub fn SACS(n: Option<u32>) -> ControlFunction {
|
|||||||
/// Valid parameter values to the function [`SAPV`].
|
/// Valid parameter values to the function [`SAPV`].
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub enum PresentationVariant {
|
pub enum PresentationVariant {
|
||||||
/// Default presentation (implementation-defined); cancels the effect of any preceding occurrence of `SAPV` in the
|
/// Default presentation (implementation-defined); cancels the effect of any preceding occurrence of [`SAPV`] in the
|
||||||
/// data stream.
|
/// data stream.
|
||||||
#[default]
|
#[default]
|
||||||
Default = 0,
|
Default = 0,
|
||||||
@ -1364,7 +1386,7 @@ pub enum PresentationVariant {
|
|||||||
NoContextualShapeArabicScript,
|
NoContextualShapeArabicScript,
|
||||||
|
|
||||||
/// Contextual shape determination of Arabic scripts i not used, the graphic characters - excluding the digits -
|
/// Contextual shape determination of Arabic scripts i not used, the graphic characters - excluding the digits -
|
||||||
/// are presented in the form thye are stored (pass-through).
|
/// are presented in the form they are stored (pass-through).
|
||||||
NoContextualShapeArabicScriptExceptDigits,
|
NoContextualShapeArabicScriptExceptDigits,
|
||||||
|
|
||||||
/// The graphic symbols used to present the decimal digits are device dependent.
|
/// The graphic symbols used to present the decimal digits are device dependent.
|
||||||
@ -1451,8 +1473,9 @@ pub enum CharacterPathScope {
|
|||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// This may also permit the effect to take place after the next occurrence of `CR`, `NEL` or any control function
|
/// This may also permit the effect to take place after the next occurrence of [`CR`][crate::c0::CR],
|
||||||
/// which initiates an absolute movement of the active presentation position or the active data position.
|
/// [`NEL`][crate::c1::NEL] or any control function which initiates an absolute movement of the active presentation
|
||||||
|
/// position or the active data position.
|
||||||
Undefined = 0,
|
Undefined = 0,
|
||||||
|
|
||||||
/// The content of the active line in the presentation component (the line that contains the active presentation
|
/// The content of the active line in the presentation component (the line that contains the active presentation
|
||||||
@ -1472,7 +1495,7 @@ pub enum CharacterPathScope {
|
|||||||
|
|
||||||
/// Select Character Path.
|
/// Select Character Path.
|
||||||
///
|
///
|
||||||
/// `SCP` is used to select the character paht, relative to the line orientation, for the active line (the line that
|
/// `SCP` is used to select the character path, relative to the line orientation, for the active line (the line that
|
||||||
/// contains the active presentation position) and subsequent lines in the presentation component. It is also used to
|
/// contains the active presentation position) and subsequent lines in the presentation component. It is also used to
|
||||||
/// update the content of the active line in the presentation component and the content of the active line (the line
|
/// update the content of the active line in the presentation component and the content of the active line (the line
|
||||||
/// that contains the active data position) in the data component. This takes effect immediately.
|
/// that contains the active data position) in the data component. This takes effect immediately.
|
||||||
@ -1484,13 +1507,13 @@ pub fn SCP(s: CharacterPath, t: CharacterPathScope) -> ControlFunction {
|
|||||||
/// Set Character Spacing.
|
/// Set Character Spacing.
|
||||||
///
|
///
|
||||||
/// `SCS` is used to establish the character spacing for subsequent text. The established spacing remains in effect
|
/// `SCS` is used to establish the character spacing for subsequent text. The established spacing remains in effect
|
||||||
/// until the next occurrence of `SCS`, or of SELECT CHARACTER SPACING (`SHS`) or of SPACING INCREMENT (`SPI`) in the
|
/// until the next occurrence of `SCS`, or of SELECT CHARACTER SPACING ([`SHS`]) or of SPACING INCREMENT ([`SPI`]) in
|
||||||
/// data stream.
|
/// the data stream.
|
||||||
///
|
///
|
||||||
/// `n` specifies the character spacing.
|
/// `n` specifies the character spacing.
|
||||||
///
|
///
|
||||||
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
||||||
/// (`SSU`).
|
/// ([`SSU`]).
|
||||||
pub fn SCS(n: u32) -> ControlFunction {
|
pub fn SCS(n: u32) -> ControlFunction {
|
||||||
sequence!(02 / 00, 06 / 07, numeric n)
|
sequence!(02 / 00, 06 / 07, numeric n)
|
||||||
}
|
}
|
||||||
@ -1531,7 +1554,7 @@ pub enum StringDirection {
|
|||||||
/// The beginning of a directed string is indicated by `SDS` with a parameter value not equal to
|
/// The beginning of a directed string is indicated by `SDS` with a parameter value not equal to
|
||||||
/// [`StringDirection::End`]. A directed string may contain one or more nested strings. These nested strings may be
|
/// [`StringDirection::End`]. A directed string may contain one or more nested strings. These nested strings may be
|
||||||
/// directed strings the beginning of which are indicated by `SDS` with a parameter value not equal to
|
/// directed strings the beginning of which are indicated by `SDS` with a parameter value not equal to
|
||||||
/// [`StringDirection::End`], or reversed stings the beginning of which are indicated by START REVERSED STRING (`SRS`)
|
/// [`StringDirection::End`], or reversed stings the beginning of which are indicated by START REVERSED STRING ([`SRS`])
|
||||||
/// with a parameter value of [`ReversedString::Start`]. Every beginning of such a string invokes the next deeper level
|
/// with a parameter value of [`ReversedString::Start`]. Every beginning of such a string invokes the next deeper level
|
||||||
/// of nesting.
|
/// of nesting.
|
||||||
///
|
///
|
||||||
@ -1546,19 +1569,21 @@ pub enum StringDirection {
|
|||||||
///
|
///
|
||||||
/// ## Note 1
|
/// ## Note 1
|
||||||
///
|
///
|
||||||
/// The effect of receiving a `CVT`, `HT`, `SCP`, `SPD`, or `VT` control function within an `SDS` string is not defined.
|
/// The effect of receiving a [`CVT`], [`HT`][crate::c0::HT], [`SCP`], [`SPD`], or [`VT`][crate::c0::VT] control
|
||||||
|
/// function within an `SDS` string is not defined.
|
||||||
///
|
///
|
||||||
/// ## Note 2
|
/// ## Note 2
|
||||||
///
|
///
|
||||||
/// The control functions for area definitions (`DAQ, `EPA`, `SPA`, `SSA`) should not be used within an `SDS` string.
|
/// The control functions for area definitions ([`DAQ`], [`EPA`][crate::c1::EPA], [`SPA`][crate::c1::SPA],
|
||||||
|
/// [`SSA`][crate::c1::SPA]) should not be used within an `SDS` string.
|
||||||
pub fn SDS(s: Option<StringDirection>) -> ControlFunction {
|
pub fn SDS(s: Option<StringDirection>) -> ControlFunction {
|
||||||
sequence!(05 / 13, selective default s)
|
sequence!(05 / 13, selective default s)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Valid parameter values to the function [`SSE`].
|
/// Valid parameter values to the function [`SEE`].
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub enum EditingExtend {
|
pub enum EditingExtend {
|
||||||
/// The shifted part is limitied to the active page in the presentation component.
|
/// The shifted part is limited to the active page in the presentation component.
|
||||||
#[default]
|
#[default]
|
||||||
ActivePage = 0,
|
ActivePage = 0,
|
||||||
|
|
||||||
@ -1582,7 +1607,7 @@ pub enum EditingExtend {
|
|||||||
/// depends on the parameter value.
|
/// depends on the parameter value.
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`EditingExtend::ActivePage`].
|
/// The default value for `s` is [`EditingExtend::ActivePage`].
|
||||||
pub fn SSE(s: Option<EditingExtend>) -> ControlFunction {
|
pub fn SEE(s: Option<EditingExtend>) -> ControlFunction {
|
||||||
sequence!(05 / 01, selective default s)
|
sequence!(05 / 01, selective default s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1630,8 +1655,8 @@ pub fn SEF(l: Option<Load>, s: Option<Stack>) -> ControlFunction {
|
|||||||
/// Valid parameter values to the function [`SGR`].
|
/// Valid parameter values to the function [`SGR`].
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub enum GraphicRendition {
|
pub enum GraphicRendition {
|
||||||
/// Default rendition (implementation-defined), cancels the effect of any preceding occurrence of `SGR` in the data
|
/// Default rendition (implementation-defined), cancels the effect of any preceding occurrence of [`SGR`] in the
|
||||||
/// stream regardless of the setting of the GRAPHIC RENDITION COMBINATION MODE (`GRCM`).
|
/// data stream regardless of the setting of the GRAPHIC RENDITION COMBINATION MODE ([`GRCM`][crate::modes::GRCM]).
|
||||||
#[default]
|
#[default]
|
||||||
Default = 0,
|
Default = 0,
|
||||||
|
|
||||||
@ -1805,7 +1830,8 @@ pub enum GraphicRendition {
|
|||||||
///
|
///
|
||||||
/// `SGR` is used to establish one or more graphic rendition aspects for subsequent text. The established aspects remain
|
/// `SGR` is used to establish one or more graphic rendition aspects for subsequent text. The established aspects remain
|
||||||
/// in effect until the next occurrence of `SGR` in the data stream, depending on the setting of the GRAPHIC RENDITION
|
/// in effect until the next occurrence of `SGR` in the data stream, depending on the setting of the GRAPHIC RENDITION
|
||||||
/// COMBINATION MODE (`GRCM`). Each graphic rendition aspect is specified by a parameter value of [`GraphicRendition`].
|
/// COMBINATION MODE ([`GRCM`][crate::modes::GRCM]). Each graphic rendition aspect is specified by a parameter value of
|
||||||
|
/// [`GraphicRendition`].
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`GraphicRendition::Default`].
|
/// The default value for `s` is [`GraphicRendition::Default`].
|
||||||
///
|
///
|
||||||
@ -1846,8 +1872,8 @@ pub enum CharacterSpacing {
|
|||||||
/// Select Character Spacing.
|
/// Select Character Spacing.
|
||||||
///
|
///
|
||||||
/// `SHS` is used to establish the character spacing for subsequent text. The established spacing remains in effect
|
/// `SHS` is used to establish the character spacing for subsequent text. The established spacing remains in effect
|
||||||
/// until the next occurrence of `SHS` or of SET CHARACTER SPACING (`SPS`) or of SPACING INCREMENT (`SPI`) in the data
|
/// until the next occurrence of `SHS` or of SET CHARACTER SPACING ([`SCS`]) or of SPACING INCREMENT ([`SPI`]) in the
|
||||||
/// stream.
|
/// data stream.
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`CharacterSpacing::TenCharacters`].
|
/// The default value for `s` is [`CharacterSpacing::TenCharacters`].
|
||||||
pub fn SHS(s: Option<CharacterSpacing>) -> ControlFunction {
|
pub fn SHS(s: Option<CharacterSpacing>) -> ControlFunction {
|
||||||
@ -1868,7 +1894,7 @@ pub enum MovementDirection {
|
|||||||
/// Select Implicit Movement Direction.
|
/// Select Implicit Movement Direction.
|
||||||
///
|
///
|
||||||
/// `SIMD` is used to select the direction of implicit movement of the data position relative to the character
|
/// `SIMD` is used to select the direction of implicit movement of the data position relative to the character
|
||||||
/// progression. The direction selected remains in effect until the next occurrence of `SIMD`.
|
/// progression. The direction selected remains in effect until the next occurrence of [`SIMD`].
|
||||||
///
|
///
|
||||||
/// The default value of `s` is [`MovementDirection::Normal`].
|
/// The default value of `s` is [`MovementDirection::Normal`].
|
||||||
pub fn SIMD(s: Option<MovementDirection>) -> ControlFunction {
|
pub fn SIMD(s: Option<MovementDirection>) -> ControlFunction {
|
||||||
@ -1890,18 +1916,19 @@ pub fn SL(n: Option<u32>) -> ControlFunction {
|
|||||||
|
|
||||||
/// Set Line Home.
|
/// Set Line Home.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to PRESENTATION, `SLH` is used to establish at character position `n` in
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `SLH` is used to
|
||||||
/// the active line (the line that contains the active presentation position) and lines of subsequent text in the
|
/// establish at character position `n` in the active line (the line that contains the active presentation position) and
|
||||||
/// presentation component the position to which the active presentation position will be moved by subsequent
|
/// lines of subsequent text in the presentation component the position to which the active presentation position will
|
||||||
/// occurrences of CARRIAGE RETURN (`CR`), DELETE LINE (`DL`), INSERT LINE (`IL`) or NEXT LINE (`NEL`) in the data
|
/// be moved by subsequent occurrences of CARRIAGE RETURN ([`CR`][crate::c0::CR]), DELETE LINE ([`DL`]), INSERT LINE
|
||||||
/// stream. In the case of a device without data component, it is also the position ahead of which no implicit movement
|
/// ([`IL`]) or NEXT LINE ([`NEL`][crate::c1::NEL]) in the data stream. In the case of a device without data component,
|
||||||
/// of the active presentation position shall occur.
|
/// it is also the position ahead of which no implicit movement of the active presentation position shall occur.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to DATA, `SLH` is used to establish at character position `n` in the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `SLH` is used to establish at
|
||||||
/// active line (the line that contains the active data position) and lines of subsequent text in the data component
|
/// character position `n` in the active line (the line that contains the active data position) and lines of subsequent
|
||||||
/// the position to which the active data position will be moved by subsequent occurrences of CARRIAGE RETURN (`CR`),
|
/// text in the data component the position to which the active data position will be moved by subsequent occurrences of
|
||||||
/// DELETE LINE (`DL`), INSERT LINE (`IL`) or NEXT LINE (`NEL`) in the data stream. It is also the position ahead of
|
/// CARRIAGE RETURN ([`CR`][crate::c0::CR]), DELETE LINE ([`DL`]), INSERT LINE ([`IL`]) or NEXT LINE
|
||||||
/// which no implicit movement of the active data position shall occur.
|
/// ([`NEL`][crate::c1::NEL]) in the data stream. It is also the position ahead of which no implicit movement of the
|
||||||
|
/// active data position shall occur.
|
||||||
///
|
///
|
||||||
/// The established position is called the line home position and remains in effect until the next occurrence of `SLH`
|
/// The established position is called the line home position and remains in effect until the next occurrence of `SLH`
|
||||||
/// in the data stream.
|
/// in the data stream.
|
||||||
@ -1911,20 +1938,20 @@ pub fn SLH(n: u32) -> ControlFunction {
|
|||||||
|
|
||||||
/// Set Line Limit.
|
/// Set Line Limit.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to PRESENTATION, `SLL` is used to establish at character position `n` in
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `SLL` is used to
|
||||||
/// the active line (the line that contains the active presentation position) and lines of subsequent text in the
|
/// establish at character position `n` in the active line (the line that contains the active presentation position) and
|
||||||
/// presentation component the position to which the active presentation position will be moved by subsequent
|
/// lines of subsequent text in the presentation component the position to which the active presentation position will
|
||||||
/// occurrences of CARRIAGE RETURN (`CR`), or NEXT LINE (`NEL`) in the data stream if the parameter value of SELECT
|
/// be moved by subsequent occurrences of CARRIAGE RETURN ([`CR`][crate::c0::CR]), or NEXT LINE
|
||||||
/// IMPLICIT MOVEMENT DIRECTION (`SIMD`) is equal to [`MovementDirection::Opposite`]. In the case of a device without
|
/// ([`NEL`][crate::c1::NEL]) in the data stream if the parameter value of SELECT IMPLICIT MOVEMENT DIRECTION ([`SIMD`])
|
||||||
/// data component, it is also the position beyond which no implicit movement of the active presentation position shall
|
/// is equal to [`MovementDirection::Opposite`]. In the case of a device without data component, it is also the position
|
||||||
/// occur.
|
/// beyond which no implicit movement of the active presentation position shall occur.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to DATA, `SLL` is used to establish at character position `n` in the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `SLL` is used to establish at
|
||||||
/// active line (the line that contains the active data position) and lines of subsequent text in the data component the
|
/// character position `n` in the active line (the line that contains the active data position) and lines of subsequent
|
||||||
/// position beyond which no implicit movement of the active data position shall occur. It is also the position in the
|
/// text in the data component the position beyond which no implicit movement of the active data position shall occur.
|
||||||
/// data component to which the active data position will be moved by subsequent occurrences of `CR` or `NEL` in the
|
/// It is also the position in the data component to which the active data position will be moved by subsequent
|
||||||
/// data stream, if the parameter value of SELECT IMPLICIT MOVEMENT DIRECTION (SIMD) is equal to
|
/// occurrences of [`CR`][crate::c0::CR] or [`NEL`][crate::c1::NEL] in the data stream, if the parameter value of
|
||||||
/// [`MovementDirection::Opposite`].
|
/// SELECT IMPLICIT MOVEMENT DIRECTION ([`SIMD`]) is equal to [`MovementDirection::Opposite`].
|
||||||
///
|
///
|
||||||
/// The established position is called the line limit position and remains in effect until the next occurrence of `SLL`
|
/// The established position is called the line limit position and remains in effect until the next occurrence of `SLL`
|
||||||
/// in the data stream.
|
/// in the data stream.
|
||||||
@ -1935,12 +1962,12 @@ pub fn SLL(n: u32) -> ControlFunction {
|
|||||||
/// Set Line Spacing.
|
/// Set Line Spacing.
|
||||||
///
|
///
|
||||||
/// `SLS` is used to establish the line spacing for subsequent text. The established spacing remains in effect until the
|
/// `SLS` is used to establish the line spacing for subsequent text. The established spacing remains in effect until the
|
||||||
/// next occurrence of `SLS` or of SELECT LINE SPACING (`SVS`) or of SPACING INCREMENT (`SPI`) in the data stream.
|
/// next occurrence of `SLS` or of SELECT LINE SPACING ([`SVS`]) or of SPACING INCREMENT ([`SPI`]) in the data stream.
|
||||||
///
|
///
|
||||||
/// `n` specifies the line spacing.
|
/// `n` specifies the line spacing.
|
||||||
///
|
///
|
||||||
/// The unit in which the parameter value is epxressed is that established by the paramaeter value of SELECT SIZE UNIT
|
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
||||||
/// (`SSU`).
|
/// ([`SSU`]).
|
||||||
pub fn SLS(n: u32) -> ControlFunction {
|
pub fn SLS(n: u32) -> ControlFunction {
|
||||||
sequence!(02 / 00, 06 / 08, numeric n)
|
sequence!(02 / 00, 06 / 08, numeric n)
|
||||||
}
|
}
|
||||||
@ -1988,8 +2015,9 @@ pub enum PresentationDirectionScope {
|
|||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
///
|
///
|
||||||
/// This may also permit the effect to take place after the next occurrence of `CR`, `NEL` or any control function
|
/// This may also permit the effect to take place after the next occurrence of [`CR`][crate::c0::CR],
|
||||||
/// which initiates an absolute movement of the active presentation position or the active data position.
|
/// [`NEL`][crate::c1::NEL] or any control function which initiates an absolute movement of the active presentation
|
||||||
|
/// position or the active data position.
|
||||||
#[default]
|
#[default]
|
||||||
Undefined = 0,
|
Undefined = 0,
|
||||||
|
|
||||||
@ -2026,16 +2054,18 @@ pub fn SPD(
|
|||||||
|
|
||||||
/// Set Page Home.
|
/// Set Page Home.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to PRESENTATION, `SPH` is used to establish at line position `n` in the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `SPH` is used to
|
||||||
/// active page (the page that contains the active presentation position) and subsequent pages in the presentation
|
/// establish at line position `n` in the active page (the page that contains the active presentation position) and
|
||||||
/// component the position to which the active presentation position will be moved by subsequent occurrences of FORM
|
/// subsequent pages in the presentation component the position to which the active presentation position will be moved
|
||||||
/// FEED (`FF`) in the data stream. In the case of a device without data component, it is also the position ahead of
|
/// by subsequent occurrences of FORM FEED ([`FF`][crate::c0::FF]) in the data stream. In the case of a device without
|
||||||
/// which no implicit movement of the active presentation position shall occur.
|
/// data component, it is also the position ahead of which no implicit movement of the active presentation position
|
||||||
|
/// shall occur.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to DATA, `SPH` is used to establish at line position `n´ in the active page
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `SPH` is used to establish at
|
||||||
/// (the page that contains the active data position) and subsequent pages in the data component the position to which
|
/// line position `n´ in the active page (the page that contains the active data position) and subsequent pages in the
|
||||||
/// the active data position will be moved by subsequent occurrences of FORM FEED (`FF`) in the data stream. It is also
|
/// data component the position to which the active data position will be moved by subsequent occurrences of FORM FEED
|
||||||
/// the position ahead of which no implicit movement of the active presentation position shall occur.
|
/// ([`FF`][crate::c0::FF]) in the data stream. It is also the position ahead of which no implicit movement of the
|
||||||
|
/// active presentation position shall occur.
|
||||||
///
|
///
|
||||||
/// The established position is called the page home position and remains in effect until the next occurrence of ´SPH`
|
/// The established position is called the page home position and remains in effect until the next occurrence of ´SPH`
|
||||||
/// in the data stream.
|
/// in the data stream.
|
||||||
@ -2046,30 +2076,30 @@ pub fn SPH(n: u32) -> ControlFunction {
|
|||||||
/// Spacing Increment.
|
/// Spacing Increment.
|
||||||
///
|
///
|
||||||
/// `SPI` is used to establish the line spacing and the character spacing for subsequent text. The established line
|
/// `SPI` is used to establish the line spacing and the character spacing for subsequent text. The established line
|
||||||
/// spacing remains in effect until the next occurrence of `SPI` or of SET LINE SPACING (`SLS`) or of SELECT LINE
|
/// spacing remains in effect until the next occurrence of `SPI` or of SET LINE SPACING ([`SLS`]) or of SELECT LINE
|
||||||
/// SPACING (`SVS`) in the data stream. The established character spacing remains in effect until the next occurrence
|
/// SPACING ([`SVS`]) in the data stream. The established character spacing remains in effect until the next occurrence
|
||||||
/// of SET CHARACTER SPACING (`SCS`) or of SELECT CHARACTER SPACING (`SHS`) in the data stream.
|
/// of SET CHARACTER SPACING ([`SCS`]) or of SELECT CHARACTER SPACING ([`SHS`]) in the data stream.
|
||||||
///
|
///
|
||||||
/// `l` specifies the line spacing.
|
/// `l` specifies the line spacing.
|
||||||
/// `c` specifies the character spacing.
|
/// `c` specifies the character spacing.
|
||||||
///
|
///
|
||||||
/// The unit in which the parameter values are expressed is that established by the parameter value of SELECT SIZE UNIT
|
/// The unit in which the parameter values are expressed is that established by the parameter value of SELECT SIZE UNIT
|
||||||
/// (`SSU`).
|
/// ([`SSU`]).
|
||||||
pub fn SPI(l: u32, c: u32) -> ControlFunction {
|
pub fn SPI(l: u32, c: u32) -> ControlFunction {
|
||||||
sequence!(02 / 00, 04 / 07, numeric l, numeric c)
|
sequence!(02 / 00, 04 / 07, numeric l, numeric c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set Page Limit.
|
/// Set Page Limit.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to PRESENTATION, `SPL` is used to establish at line position `n` in the
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to PRESENTATION, `SPL` is used to
|
||||||
/// active page (the page that contains the active presentation position) and pages of subsequent text in the
|
/// establish at line position `n` in the active page (the page that contains the active presentation position) and
|
||||||
/// presentation component the position beyond which the active presentation position can normally not be moved. In the
|
/// pages of subsequent text in the presentation component the position beyond which the active presentation position
|
||||||
/// case of a device without data component, it is also the position beyond which no implicit movement of the active
|
/// can normally not be moved. In the case of a device without data component, it is also the position beyond which no
|
||||||
/// presentation position shall occur.
|
/// implicit movement of the active presentation position shall occur.
|
||||||
///
|
///
|
||||||
/// If the DEVICE COMPONENT SELECT MODE is set to DATA, `SPL` is used to establish at line position `n` in the active
|
/// If the DEVICE COMPONENT SELECT MODE ([`DCSM`][crate::modes::DCSM]) is set to DATA, `SPL` is used to establish at
|
||||||
/// page (the page that contains the active data position) and pages of subsequent text in the data component the
|
/// line position `n` in the active page (the page that contains the active data position) and pages of subsequent text
|
||||||
/// position beyond which no implicit movement of the active data position shall occur.
|
/// in the data component the position beyond which no implicit movement of the active data position shall occur.
|
||||||
///
|
///
|
||||||
/// The established position is called the page limit position and remains in effect until the next occurrence of `SPL`
|
/// The established position is called the page limit position and remains in effect until the next occurrence of `SPL`
|
||||||
/// in the data stream.
|
/// in the data stream.
|
||||||
@ -2118,14 +2148,15 @@ pub fn SR(n: Option<u32>) -> ControlFunction {
|
|||||||
/// Set Reduced Character Separation.
|
/// Set Reduced Character Separation.
|
||||||
///
|
///
|
||||||
/// `SRCS` is used to establish reduced inter-character escapement for subsequent text. The established reduced
|
/// `SRCS` is used to establish reduced inter-character escapement for subsequent text. The established reduced
|
||||||
/// escapement remains in effect until the next occurrence of `SRCS` or of SET ADDITIONAL CHARACTER SEPARATION (`SACS`)
|
/// escapement remains in effect until the next occurrence of `SRCS` or of SET ADDITIONAL CHARACTER SEPARATION
|
||||||
/// in the data stream or until it is reset to the default value by a subsequent occurrence of CARRIAGE RETURN/LINE FEED
|
/// ([`SACS`]) in the data stream or until it is reset to the default value by a subsequent occurrence of
|
||||||
/// (`CR/LF`) or of NEXT LINE (`NEL`) in the data stream.
|
/// CARRIAGE RETURN/LINE FEED ([`CR`][crate::c0::CR]/[`LF`][crate::c0::LF]) or of NEXT LINE ([`NEL`][crate::c1::NEL])
|
||||||
|
/// in the data stream.
|
||||||
///
|
///
|
||||||
/// `n` specifies the number of units by which the inter-character escapement is reduced.
|
/// `n` specifies the number of units by which the inter-character escapement is reduced.
|
||||||
///
|
///
|
||||||
/// The unit in which the parameter values are expressed is that established by the parameter value of SELECT SIZE UNIT
|
/// The unit in which the parameter values are expressed is that established by the parameter value of SELECT SIZE UNIT
|
||||||
/// (`SSU`).
|
/// ([`SSU`]).
|
||||||
///
|
///
|
||||||
/// The default value of `n` is `0`.
|
/// The default value of `n` is `0`.
|
||||||
pub fn SRCS(n: Option<u32>) -> ControlFunction {
|
pub fn SRCS(n: Option<u32>) -> ControlFunction {
|
||||||
@ -2152,7 +2183,7 @@ pub enum ReversedString {
|
|||||||
/// The beginning of a reversed string is indicated by `SRS` with a parameter value of [`ReversedString::Start`].
|
/// The beginning of a reversed string is indicated by `SRS` with a parameter value of [`ReversedString::Start`].
|
||||||
/// A reversed string may contain one or more nested strings. These nested strings may be reversed strings the
|
/// A reversed string may contain one or more nested strings. These nested strings may be reversed strings the
|
||||||
/// beginnings of which are indicated by `SRS` with a parameter value of [`ReversedString::Start`], or directed strings
|
/// beginnings of which are indicated by `SRS` with a parameter value of [`ReversedString::Start`], or directed strings
|
||||||
/// the beginnings of which are indicated by START DIRECTED STRING (`SDS`) with a parameter value not equal to
|
/// the beginnings of which are indicated by START DIRECTED STRING ([`SDS`]) with a parameter value not equal to
|
||||||
/// [`StringDirection::End`]. Every beginning of such a string invokes the next deeper level of nesting.
|
/// [`StringDirection::End`]. Every beginning of such a string invokes the next deeper level of nesting.
|
||||||
///
|
///
|
||||||
/// This Standard does not define the location of the active data position within any such nested string.
|
/// This Standard does not define the location of the active data position within any such nested string.
|
||||||
@ -2166,12 +2197,13 @@ pub enum ReversedString {
|
|||||||
///
|
///
|
||||||
/// ## Note 1
|
/// ## Note 1
|
||||||
///
|
///
|
||||||
/// The effect of receiving a `CVT`, `HT`, `SCP`, `SPD`, or `VT` control function within an `SRS` string is not defined.
|
/// The effect of receiving a [`CVT`], [`HT`][crate::c0::HT], [`SCP`], [`SPD`], or [`VT`][crate::c0::VT] control
|
||||||
|
/// function within an `SRS` string is not defined.
|
||||||
///
|
///
|
||||||
/// ## Note 2
|
/// ## Note 2
|
||||||
///
|
///
|
||||||
/// The control functions for area definition (`DAQ`, `EPA`, `ESA`, `SPA`, `SSA`) should not be used within an `SRS`
|
/// The control functions for area definition ([`DAQ`], [`EPA`][crate::c1::EPA], [`ESA`][crate::c1::ESA],
|
||||||
/// string.
|
/// [`SPA`][crate::c1::SPA], [`SSA`][crate::c1::SSA]) should not be used within an `SRS` string.
|
||||||
pub fn SRS(s: Option<ReversedString>) -> ControlFunction {
|
pub fn SRS(s: Option<ReversedString>) -> ControlFunction {
|
||||||
sequence!(05 / 11, selective default s)
|
sequence!(05 / 11, selective default s)
|
||||||
}
|
}
|
||||||
@ -2220,20 +2252,21 @@ pub fn SSU(s: Option<SizeUnit>) -> ControlFunction {
|
|||||||
|
|
||||||
/// Set Space Width.
|
/// Set Space Width.
|
||||||
///
|
///
|
||||||
/// `SSW` is used to establish for subsequent text the character escapement associated with the character SPACE. The
|
/// `SSW` is used to establish for subsequent text the character escapement associated with the character `SPACE`. The
|
||||||
/// established escapement remains in effect until the next occurrence of `SSW` in the data stream or until it is reset
|
/// established escapement remains in effect until the next occurrence of `SSW` in the data stream or until it is reset
|
||||||
/// to the default value by a subsequent occurrence of CARRIAGE RETURN/LINE FEED (`CR/LF`), CARRIAGE RETURN/FORM FEED
|
/// to the default value by a subsequent occurrence of CARRIAGE RETURN/LINE FEED
|
||||||
/// (`CR/FF`), or of NEXT LINE (`NEL`) in the data stream.
|
/// ([`CR`][crate::c0::CR]/[`LF`][crate::c0::LF]), CARRIAGE RETURN/FORM FEED
|
||||||
|
/// ([`CR`][crate::c0::CR]/[`FF`][crate::c0::FF]), or of NEXT LINE ([`NEL`][crate::c1::NEL]) in the data stream.
|
||||||
///
|
///
|
||||||
/// `n` specifies the escapement.
|
/// `n` specifies the escapement.
|
||||||
///
|
///
|
||||||
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
/// The unit in which the parameter value is expressed is that established by the parameter value of SELECT SIZE UNIT
|
||||||
/// (`SSU`).
|
/// ([`SSU`]).
|
||||||
///
|
///
|
||||||
/// The default character escapement of SPACE is specified by the most recent occurrence of SET CHARACTER SPACING
|
/// The default character escapement of SPACE is specified by the most recent occurrence of SET CHARACTER SPACING
|
||||||
/// (`SCS`) or of SELECT CHARACTER SPACING (`SHS`) or of SELECT SPACING INCREMENT (`SPI`) in the data stream if the
|
/// ([`SCS`]) or of SELECT CHARACTER SPACING ([`SHS`]) or of SELECT SPACING INCREMENT ([`SPI`]) in the data stream if
|
||||||
/// current font has constant spacing, or is specified by the nominal width of the character SPACE in the current font
|
/// the current font has constant spacing, or is specified by the nominal width of the character `SPACE` in the current
|
||||||
/// if that font has proportional spacing.
|
/// font if that font has proportional spacing.
|
||||||
pub fn SSW(n: u32) -> ControlFunction {
|
pub fn SSW(n: u32) -> ControlFunction {
|
||||||
sequence!(02 / 00, 05 / 11, numeric n)
|
sequence!(02 / 00, 05 / 11, numeric n)
|
||||||
}
|
}
|
||||||
@ -2300,7 +2333,7 @@ pub enum LineSpacing {
|
|||||||
/// Select Line Spacing.
|
/// Select Line Spacing.
|
||||||
///
|
///
|
||||||
/// `SVS` is used to establish the line spacing for subsequent text. The established spacing remains in effect until the
|
/// `SVS` is used to establish the line spacing for subsequent text. The established spacing remains in effect until the
|
||||||
/// next occurrence of `SVS` or of SET LINE SPACING (`SLS`) or of SPACING INCREMENT (`SPI`) in the data stream.
|
/// next occurrence of `SVS` or of SET LINE SPACING ([`SLS`]) or of SPACING INCREMENT ([`SPI`]) in the data stream.
|
||||||
///
|
///
|
||||||
/// The default value for `s` is [`LineSpacing::SixLinesPer25`].
|
/// The default value for `s` is [`LineSpacing::SixLinesPer25`].
|
||||||
pub fn SVS(s: Option<LineSpacing>) -> ControlFunction {
|
pub fn SVS(s: Option<LineSpacing>) -> ControlFunction {
|
||||||
@ -2350,12 +2383,23 @@ pub fn TATE(n: u32) -> ControlFunction {
|
|||||||
/// Valid parameter values to the function [`TBC`].
|
/// Valid parameter values to the function [`TBC`].
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub enum ClearTabulation {
|
pub enum ClearTabulation {
|
||||||
|
/// Clear the character tabulation stop at the active presentation position.
|
||||||
#[default]
|
#[default]
|
||||||
CharacterTabulationStopActivePosition = 0,
|
CharacterTabulationStopActivePosition = 0,
|
||||||
|
|
||||||
|
/// Clear the line tabulation stop at the active line.
|
||||||
LineTabulationStopActiveLine,
|
LineTabulationStopActiveLine,
|
||||||
|
|
||||||
|
/// Clear all character tabulation stops at the active line.
|
||||||
AllCharacterTabulationStopsActiveLine,
|
AllCharacterTabulationStopsActiveLine,
|
||||||
|
|
||||||
|
/// Clear all character tabulation stops.
|
||||||
AllCharacterTabulationStops,
|
AllCharacterTabulationStops,
|
||||||
|
|
||||||
|
/// Clear all line tabulation stops.
|
||||||
AllLineTabulationStops,
|
AllLineTabulationStops,
|
||||||
|
|
||||||
|
/// Clear all tabulation stops.
|
||||||
AllTabulationStops,
|
AllTabulationStops,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2386,7 +2430,7 @@ pub fn TBC(s: Option<ClearTabulation>) -> ControlFunction {
|
|||||||
/// code. For a 7-bit code, the permissible range of values is `32` to `127`; for an 8-bit code, the permissible range
|
/// code. For a 7-bit code, the permissible range of values is `32` to `127`; for an 8-bit code, the permissible range
|
||||||
/// of values is `32` to `127` and `160` to `255`.
|
/// of values is `32` to `127` and `160` to `255`.
|
||||||
///
|
///
|
||||||
/// The default value ofr `m` is `32`.
|
/// The default value of `m` is `32`.
|
||||||
pub fn TCC(n: u32, m: Option<u32>) -> ControlFunction {
|
pub fn TCC(n: u32, m: Option<u32>) -> ControlFunction {
|
||||||
let k = m.unwrap_or(32);
|
let k = m.unwrap_or(32);
|
||||||
sequence!(02 / 00, 06 / 03, numeric n, numeric k)
|
sequence!(02 / 00, 06 / 03, numeric n, numeric k)
|
||||||
|
@ -4,6 +4,18 @@
|
|||||||
//! `ESC` is represented by bit combination `01/11` and `Fs` is represented by a bit combination from `06/00` to
|
//! `ESC` is represented by bit combination `01/11` and `Fs` is represented by a bit combination from `06/00` to
|
||||||
//! `07/14`.
|
//! `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::independent_control_functions::DMI;
|
||||||
|
//! println!("{}", DMI);
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! ## Overview of the Independent Control Functions
|
//! ## Overview of the Independent Control Functions
|
||||||
//!
|
//!
|
||||||
//! | Row Number | Column `06` | Column `07` |
|
//! | Row Number | Column `06` | Column `07` |
|
||||||
@ -68,7 +80,9 @@ pub const INT: ControlFunction = independent!(06 / 01);
|
|||||||
/// `LS1R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
/// `LS1R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `LS1R` is defined in Standard ECMA-35.
|
/// 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);
|
pub const LS1R: ControlFunction = independent!(07 / 14);
|
||||||
|
|
||||||
/// Locking-Shift Two.
|
/// Locking-Shift Two.
|
||||||
@ -76,7 +90,9 @@ pub const LS1R: ControlFunction = independent!(07 / 14);
|
|||||||
/// `LS2` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
/// `LS2` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `LS2` is defined in Standard ECMA-35.
|
/// 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);
|
pub const LS2: ControlFunction = independent!(06 / 14);
|
||||||
|
|
||||||
/// Locking-Shift Two Right.
|
/// Locking-Shift Two Right.
|
||||||
@ -84,7 +100,9 @@ pub const LS2: ControlFunction = independent!(06 / 14);
|
|||||||
/// `LS2R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
/// `LS2R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `LS2R` is defined in Standard ECMA-35.
|
/// 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);
|
pub const LS2R: ControlFunction = independent!(07 / 13);
|
||||||
|
|
||||||
/// Locking-Shift Three.
|
/// Locking-Shift Three.
|
||||||
@ -92,7 +110,9 @@ pub const LS2R: ControlFunction = independent!(07 / 13);
|
|||||||
/// `LS3` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
/// `LS3` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `LS3` is defined in Standard ECMA-35.
|
/// 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);
|
pub const LS3: ControlFunction = independent!(06 / 15);
|
||||||
|
|
||||||
/// Locking-Shift Three Right.
|
/// Locking-Shift Three Right.
|
||||||
@ -100,7 +120,9 @@ pub const LS3: ControlFunction = independent!(06 / 15);
|
|||||||
/// `LS3R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
/// `LS3R` is used for code extension purposes. It causes the meaning of the bit combinations following it in the data
|
||||||
/// stream to be changed.
|
/// stream to be changed.
|
||||||
///
|
///
|
||||||
/// The use of `LS3R` is defined in Standard ECMA-35.
|
/// 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);
|
pub const LS3R: ControlFunction = independent!(07 / 12);
|
||||||
|
|
||||||
/// Reset to Initial State.
|
/// Reset to Initial State.
|
||||||
|
175
src/lib.rs
175
src/lib.rs
@ -12,7 +12,7 @@
|
|||||||
//! In the [ECMA-48 Standard][ecma-48] a convention has been adopted to assist the reader of the Standard.
|
//! In the [ECMA-48 Standard][ecma-48] a convention has been adopted to assist the reader of the Standard.
|
||||||
//!
|
//!
|
||||||
//! Capital letters are used to refer to a specific control function, mode, mode setting, or graphic character in order
|
//! Capital letters are used to refer to a specific control function, mode, mode setting, or graphic character in order
|
||||||
//! to avoid confusion, for example, between the concept `space`, and the character `SPACE`.
|
//! to avoid confusion, for example, between the concept "space", and the character `SPACE`.
|
||||||
//!
|
//!
|
||||||
//! As is intended by the [ECMA-48 Standard][ecma-48], this convention and all acronyms of modes, and control functions
|
//! As is intended by the [ECMA-48 Standard][ecma-48], this convention and all acronyms of modes, and control functions
|
||||||
//! are retained in this library, where rust permits.
|
//! are retained in this library, where rust permits.
|
||||||
@ -20,6 +20,34 @@
|
|||||||
//! A character from the [ASCII table][ascii-table] is represented in the form `xx/yy`, where `xx` represents the column
|
//! A character from the [ASCII table][ascii-table] is represented in the form `xx/yy`, where `xx` represents the column
|
||||||
//! number `00` to `07` in a 7-bit code table, and `yy` represents the row number `00` to `15`.
|
//! number `00` to `07` in a 7-bit code table, and `yy` represents the row number `00` to `15`.
|
||||||
//!
|
//!
|
||||||
|
//! ## Low-Level Control Functions
|
||||||
|
//!
|
||||||
|
//! The control functions of this library are sorted into several modules. You will find the low-level control functions
|
||||||
|
//! in the modules [c0], [c1], [control_sequences], [independent_control_functions], and [control_strings].
|
||||||
|
//!
|
||||||
|
//! The control functions can be put into normal strings. For example, to ring the bell:
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use ansi::c0::BEL;
|
||||||
|
//! println!("Let's ring the bell {}", BEL);
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Or to move the cursor to line 5, column 13:
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use ansi::control_sequences::CUP;
|
||||||
|
//! print!("{}", CUP(5.into(), 13.into()));
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! It might be necessary in some circumstances to announce the active set of control sequences before they can be used.
|
||||||
|
//! This is possible by invoking one of the announcer sequences.
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! use ansi::c1::{ANNOUNCER_SEQUENCE, NEL};
|
||||||
|
//! // announce the C1 control function set, then move to the next line.
|
||||||
|
//! print!("{}{}", ANNOUNCER_SEQUENCE, NEL);
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! ## Source Material
|
//! ## Source Material
|
||||||
//!
|
//!
|
||||||
//! The second, and newer, editions of the [ECMA-48 Standard][ecma-48] are based on the text of the
|
//! The second, and newer, editions of the [ECMA-48 Standard][ecma-48] are based on the text of the
|
||||||
@ -39,21 +67,21 @@
|
|||||||
//! [wikipedia-ansi]: https://en.wikipedia.org/wiki/ANSI_escape_code
|
//! [wikipedia-ansi]: https://en.wikipedia.org/wiki/ANSI_escape_code
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::str;
|
use std::{fmt, str};
|
||||||
|
|
||||||
/// Convert the ascii table notation `xx/yy` into a rust string.
|
/// Converts the ascii table notation `xx/yy` into a rust string.
|
||||||
///
|
///
|
||||||
/// A character from the [ASCII table][ascii-table] is represented in the form `xx/yy`, where `xx` represents the column
|
/// A character from the [ASCII table][ascii-table] is represented in the form `xx/yy`, where `xx` represents the column
|
||||||
/// number `00` to `07` in a 7-bit code table, and `yy` represents the row number `00` to `15`.
|
/// number `00` to `07` in a 7-bit code table, and `yy` represents the row number `00` to `15`.
|
||||||
///
|
///
|
||||||
/// The macro can be used to convert a single code point into a str, or to convert a sequence of them.
|
/// The macro can be used to convert a single code point into a str, or to convert a sequence of them.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```ignore
|
||||||
/// let a: &'static str = ascii!(06 / 01);
|
/// let a: &'static str = ascii!(06 / 01);
|
||||||
/// let abc: &'static str = ascii!(06 / 01, 06 / 02, 06 / 03);
|
/// let abc: &'static str = ascii!(06 / 01, 06 / 02, 06 / 03);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## Safeness
|
/// ## Safety
|
||||||
///
|
///
|
||||||
/// This macro converts the given `xx/yy` combination into a ascii code by the formula `(xx << 4) + yy`.
|
/// This macro converts the given `xx/yy` combination into a ascii code by the formula `(xx << 4) + yy`.
|
||||||
/// The result is passed to the unsafe function std::str::from_utf8_unchecked.
|
/// The result is passed to the unsafe function std::str::from_utf8_unchecked.
|
||||||
@ -64,7 +92,7 @@ use std::str;
|
|||||||
/// - `yy: [0,15]`
|
/// - `yy: [0,15]`
|
||||||
///
|
///
|
||||||
/// Since this macro is not public and only used by the library itself, it is assumed to be used only within safe
|
/// Since this macro is not public and only used by the library itself, it is assumed to be used only within safe
|
||||||
/// bounds.
|
/// bounds, and therefore considered safe.
|
||||||
///
|
///
|
||||||
/// [ascii-table]: https://en.wikipedia.org/wiki/ASCII#/media/File:USASCII_code_chart.png
|
/// [ascii-table]: https://en.wikipedia.org/wiki/ASCII#/media/File:USASCII_code_chart.png
|
||||||
macro_rules! ascii {
|
macro_rules! ascii {
|
||||||
@ -74,10 +102,14 @@ macro_rules! ascii {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The different types of control functions.
|
/// The different types of control functions.
|
||||||
|
///
|
||||||
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
enum ControlFunctionType {
|
enum ControlFunctionType {
|
||||||
/// Elements of the C0 set.
|
/// Elements of the C0 set.
|
||||||
///
|
///
|
||||||
/// C0 control functions are represented in 7-bit codes by bit combinations from 00/00 to 01/15.
|
/// C0 control functions are represented in 7-bit codes by bit combinations from `00/00` to `01/15`.
|
||||||
|
///
|
||||||
|
/// The control functions of the C0 set are defined in the module [c0].
|
||||||
C0,
|
C0,
|
||||||
|
|
||||||
/// Elements of the C1 set.
|
/// Elements of the C1 set.
|
||||||
@ -85,27 +117,36 @@ enum ControlFunctionType {
|
|||||||
/// C1 control functions are represented in 7-bit codes by 2-character escape sequences of the form `ESC Fe`,
|
/// C1 control functions are represented in 7-bit codes by 2-character escape sequences of the form `ESC Fe`,
|
||||||
/// where `ESC` is represented by bit combination `01/11`, and `Fe` is represented by a bit combination from
|
/// where `ESC` is represented by bit combination `01/11`, and `Fe` is represented by a bit combination from
|
||||||
/// `04/00` to `05/15`.
|
/// `04/00` to `05/15`.
|
||||||
|
///
|
||||||
|
/// The control functions of the C1 set are defined in the module [c1].
|
||||||
C1,
|
C1,
|
||||||
|
|
||||||
/// Control Sequences.
|
/// Control Sequences.
|
||||||
///
|
///
|
||||||
/// Control sequences are strings of bit combinations starting with the control function Control Function Introducer
|
/// Control sequences are strings of bit combinations starting with the control function
|
||||||
/// (`CSI`), followed by one or more bit combinations representing parameters, if any, and by one ore more bit
|
/// `CONTROL SEQUENCE INTRODUCER` ([`CSI`][c1::CSI]), followed by one or more bit combinations representing
|
||||||
/// combinations identifying the control function. The control function `CSI` itself is an element of the independent_control_function set.
|
/// parameters, if any, and by one ore more bit combinations identifying the control function. The control function
|
||||||
|
/// `CSI` itself is an element of the [c1] set.
|
||||||
|
///
|
||||||
|
/// The control sequences are defined in the module [control_sequences].
|
||||||
ControlSequence,
|
ControlSequence,
|
||||||
|
|
||||||
/// Independent Control Functions.
|
/// Independent Control Functions.
|
||||||
///
|
///
|
||||||
/// Independent control functions are represented in 7-bit codes by 2-character escape sequences of the form
|
/// Independent 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
|
/// `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`
|
/// from `06/00` to `07/14`.
|
||||||
|
///
|
||||||
|
/// The independent control functions are defined in the module [independent_control_functions].
|
||||||
IndependentControlFunction,
|
IndependentControlFunction,
|
||||||
|
|
||||||
/// Control Strings.
|
/// Control Strings.
|
||||||
///
|
///
|
||||||
/// A control string is a string of bit combinations which may occur in the data stream as a logical entity for
|
/// A control string is a string of bit combinations which may occur in the data stream as a logical entity for
|
||||||
/// control purposes. A control string consists of an opening delimiter, a command string or character string, and
|
/// control purposes. A control string consists of an opening delimiter, a command string or character string, and
|
||||||
/// a terminating delimiter, the String Terminator (`ST`).
|
/// a terminating delimiter, the String Terminator ([`ST`][c1::ST]).
|
||||||
|
///
|
||||||
|
/// The control strings are defined in the module [control_strings].
|
||||||
ControlString,
|
ControlString,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,16 +164,24 @@ impl fmt::Debug for ControlFunctionType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An ansi control function defined in [ECMA-48][ecma-48].
|
||||||
|
///
|
||||||
|
/// [ecma-48]: https://www.ecma-international.org/publications-and-standards/standards/ecma-48/
|
||||||
pub struct ControlFunction {
|
pub struct ControlFunction {
|
||||||
|
/// The type of the control function.
|
||||||
function_type: ControlFunctionType,
|
function_type: ControlFunctionType,
|
||||||
|
|
||||||
|
/// The byte or byte combination identifying the control function.
|
||||||
value: &'static str,
|
value: &'static str,
|
||||||
|
|
||||||
|
/// An arbitrary number of arguments for this control function.
|
||||||
parameters: Vec<String>,
|
parameters: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ControlFunction {
|
impl ControlFunction {
|
||||||
/// Creates a new control function of type [C0][ControlFunctionType::C0].
|
/// Creates a new control function of type [`C0`][ControlFunctionType::C0].
|
||||||
///
|
///
|
||||||
/// C0 control functions do not accept any parameters.
|
/// `C0` control functions do not accept any parameters.
|
||||||
const fn new_c0(value: &'static str) -> Self {
|
const fn new_c0(value: &'static str) -> Self {
|
||||||
ControlFunction {
|
ControlFunction {
|
||||||
function_type: ControlFunctionType::C0,
|
function_type: ControlFunctionType::C0,
|
||||||
@ -141,9 +190,9 @@ impl ControlFunction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new control function of type [C1][ControlFunctionType::C1].
|
/// Creates a new control function of type [`C1`][ControlFunctionType::C1].
|
||||||
///
|
///
|
||||||
/// independent_control_function control functions do not accept any parameters.
|
/// `C1` control functions do not accept any parameters.
|
||||||
const fn new_c1(value: &'static str) -> Self {
|
const fn new_c1(value: &'static str) -> Self {
|
||||||
ControlFunction {
|
ControlFunction {
|
||||||
function_type: ControlFunctionType::C1,
|
function_type: ControlFunctionType::C1,
|
||||||
@ -152,7 +201,7 @@ impl ControlFunction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new control function of type [ControlSequence][ControlFunctionType::ControlSequence].
|
/// Creates a new control function of type [`ControlSequence`][ControlFunctionType::ControlSequence].
|
||||||
const fn new_sequence(value: &'static str, parameters: Vec<String>) -> Self {
|
const fn new_sequence(value: &'static str, parameters: Vec<String>) -> Self {
|
||||||
ControlFunction {
|
ControlFunction {
|
||||||
function_type: ControlFunctionType::ControlSequence,
|
function_type: ControlFunctionType::ControlSequence,
|
||||||
@ -161,7 +210,8 @@ impl ControlFunction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new control function of type [IndependentControlFunction][ControlFunctionType::IndependentControlFunction].
|
/// Creates a new control function of type
|
||||||
|
/// [`IndependentControlFunction`][ControlFunctionType::IndependentControlFunction].
|
||||||
const fn new_independent_control_function(value: &'static str) -> Self {
|
const fn new_independent_control_function(value: &'static str) -> Self {
|
||||||
ControlFunction {
|
ControlFunction {
|
||||||
function_type: ControlFunctionType::IndependentControlFunction,
|
function_type: ControlFunctionType::IndependentControlFunction,
|
||||||
@ -169,6 +219,56 @@ impl ControlFunction {
|
|||||||
parameters: vec![],
|
parameters: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn format_parameters(&self) -> String {
|
||||||
|
self.parameters.join(ascii!(03 / 11))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for ControlFunction {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
match self.function_type {
|
||||||
|
ControlFunctionType::C0 => {
|
||||||
|
write!(f, "{}", self.value)
|
||||||
|
}
|
||||||
|
ControlFunctionType::C1 => {
|
||||||
|
write!(f, "{}{}", c0::ESC, self.value)
|
||||||
|
}
|
||||||
|
ControlFunctionType::ControlSequence => {
|
||||||
|
let parameters = self.format_parameters();
|
||||||
|
write!(f, "{}{}{}", c1::CSI, parameters, self.value)
|
||||||
|
}
|
||||||
|
ControlFunctionType::IndependentControlFunction => {
|
||||||
|
write!(f, "{}{}", c0::ESC, self.value)
|
||||||
|
}
|
||||||
|
ControlFunctionType::ControlString => {
|
||||||
|
write!(f, "{}", self.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for ControlFunction {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let function: String = self
|
||||||
|
.value
|
||||||
|
.as_bytes()
|
||||||
|
.into_iter()
|
||||||
|
.map(|b| format!("{:02}/{:02}", b >> 4, (b & 0xF)))
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
f.debug_struct("ControlFunction")
|
||||||
|
.field("function_type", &self.function_type)
|
||||||
|
.field("function", &function)
|
||||||
|
.field("parameters", &self.parameters)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<ControlFunction> for String {
|
||||||
|
fn from(control_function: ControlFunction) -> Self {
|
||||||
|
format!("{}", control_function)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod c0;
|
pub mod c0;
|
||||||
@ -177,3 +277,42 @@ pub mod control_sequences;
|
|||||||
pub mod control_strings;
|
pub mod control_strings;
|
||||||
pub mod independent_control_functions;
|
pub mod independent_control_functions;
|
||||||
pub mod modes;
|
pub mod modes;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::c0::BEL;
|
||||||
|
use crate::ControlFunctionType;
|
||||||
|
|
||||||
|
/// Test the debug format of [`ControlFunctionType`].
|
||||||
|
#[test]
|
||||||
|
fn debug_control_function_type() {
|
||||||
|
assert_eq!(format!("{:?}", ControlFunctionType::C0), "C0");
|
||||||
|
assert_eq!(format!("{:?}", ControlFunctionType::C1), "C1");
|
||||||
|
assert_eq!(
|
||||||
|
format!("{:?}", ControlFunctionType::ControlSequence),
|
||||||
|
"Control Sequence"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
format!("{:?}", ControlFunctionType::IndependentControlFunction),
|
||||||
|
"Independent Control Function"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
format!("{:?}", ControlFunctionType::ControlString),
|
||||||
|
"Control String"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test the debug format of [`ControlFunction`][crate::ControlFunction].
|
||||||
|
#[test]
|
||||||
|
fn debug_control_function() {
|
||||||
|
assert_eq!(
|
||||||
|
format!("{:?}", BEL),
|
||||||
|
"ControlFunction { function_type: C0, function: \"00/07\", parameters: [] }"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
format!("{:?}", crate::control_sequences::CUP(None, Some(10))),
|
||||||
|
"ControlFunction { function_type: Control Sequence, function: \"04/08\", parameters: [\"1\", \"10\"] }"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user