Add helper macros.

This commit is contained in:
CismonX 2021-02-22 03:05:27 +08:00
parent 15749035f4
commit 0263439e1f
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
1 changed files with 54 additions and 19 deletions

View File

@ -28,40 +28,75 @@
#define CTLSEQS_VERSION_ID 0x000100
#define CTLSEQS_VERSION_STRING "0.1.0"
/* C0 Control Functions */
#define CTLSEQS_NUL "\x00" // Null
#define CTLSEQS_SOH "\x01" // Start of Heading
#define CTLSEQS_STX "\x02" // Start of Text
#define CTLSEQS_ETX "\x03" // End of Text
#define CTLSEQS_EOT "\x04" // End of Transmission
#define CTLSEQS_ENQ "\x05" // Enquiry
#define CTLSEQS_ACK "\x06" // Acknowledge
#define CTLSEQS_BEL "\x07" // Bell
#define CTLSEQS_BS "\x08" // Backspace
#define CTLSEQS_HT "\x09" // Horizontal Tab
#define CTLSEQS_LF "\x0a" // Line Feed
#define CTLSEQS_VT "\x0b" // Vertical Tab
#define CTLSEQS_FF "\x0c" // Form Feed or New Page
#define CTLSEQS_CR "\x0d" // Carriage Return
#define CTLSEQS_SO "\x0e" // Shift Out
#define CTLSEQS_SI "\x0f" // Shift In
#define CTLSEQS_DLE "\x10" // Data Link Escape
#define CTLSEQS_DC1 "\x11" // Device Control 1
#define CTLSEQS_DC2 "\x12" // Device Control 2
#define CTLSEQS_DC3 "\x13" // Device Control 3
#define CTLSEQS_DC4 "\x14" // Device Control 4
#define CTLSEQS_NAK "\x15" // Negative Acknowledgement
#define CTLSEQS_SYN "\x16" // Synchronous Idle
#define CTLSEQS_ETB "\x17" // End of Transmission Block
#define CTLSEQS_CAN "\x18" // Cancel
#define CTLSEQS_EM "\x19" // End of Medium
#define CTLSEQS_SUB "\x1a" // Substitute
#define CTLSEQS_ESC "\x1b" // Escape
#define CTLSEQS_FS "\x1c" // File Separator
#define CTLSEQS_GS "\x1d" // Group Separator
#define CTLSEQS_RS "\x1e" // Record Separator
#define CTLSEQS_US "\x1f" // Unit Separator
#define CTLSEQS_SP "\x20" // Space
#define CTLSEQS_DEL "\x7f" // Delete
/* C0(7-bit) Control Characters */
/* C1 Control Functions (2-character 7-bit representation) */
#define CTLSEQS_BPH CTLSEQS_ESC "B" // Break Permitted Here
#define CTLSEQS_NBH CTLSEQS_ESC "C" // No Break Here
#define CTLSEQS_IND CTLSEQS_ESC "D" // Index
#define CTLSEQS_NEL CTLSEQS_ESC "E" // Next Line
#define CTLSEQS_HTS CTLSEQS_ESC "H" // Tab Set
#define CTLSEQS_SSA CTLSEQS_ESC "F" // Start of Selected Area
#define CTLSEQS_ESA CTLSEQS_ESC "G" // End of Selected Area
#define CTLSEQS_HTS CTLSEQS_ESC "H" // Character Tabulation Set
#define CTLSEQS_VTS CTLSEQS_ESC "J" // Line Tabulation Set
#define CTLSEQS_PLD CTLSEQS_ESC "K" // Partial Line Forward
#define CTLSEQS_PLU CTLSEQS_ESC "L" // Partial Line Backward
#define CTLSEQS_RI CTLSEQS_ESC "M" // Reverse Index
#define CTLSEQS_SS2 CTLSEQS_ESC "N" // Single Shift Select of G2 Character Set
#define CTLSEQS_SS3 CTLSEQS_ESC "O" // Single Shift Select of G3 Character Set
#define CTLSEQS_SS2 CTLSEQS_ESC "N" // Single Shift 2
#define CTLSEQS_SS3 CTLSEQS_ESC "O" // Single Shift 3
#define CTLSEQS_DCS CTLSEQS_ESC "P" // Device Control String
#define CYLSEQS_PU1 CTLSEQS_ESC "Q" // Private Use 1
#define CYLSEQS_PU2 CTLSEQS_ESC "R" // Private Use 2
#define CYLSEQS_STS CTLSEQS_ESC "S" // Set Transmit State
#define CTLSEQS_CCH CTLSEQS_ESC "T" // Cancel Character
#define CTLSEQS_MW CTLSEQS_ESC "U" // Message Waiting
#define CTLSEQS_SPA CTLSEQS_ESC "V" // Start of Guarded Area
#define CTLSEQS_EPA CTLSEQS_ESC "W" // End of Guarded Area
#define CTLSEQS_SOS CTLSEQS_ESC "X" // Start of String
#define CTLSEQS_HTJ CTLSEQS_ESC "Y" // Character Tabulation with Justification
#define CYLSEQS_SCI CTLSEQS_ESC "Z" // Single Character Introducer
#define CTLSEQS_CSI CTLSEQS_ESC "[" // Control Sequence Introducer
#define CTLSEQS_ST CTLSEQS_ESC "\\" // String Terminator
#define CTLSEQS_OSC CTLSEQS_ESC "]" // Operating System Command
#define CTLSEQS_PM CTLSEQS_ESC "^" // Privacy Message
#define CTLSEQS_APC CTLSEQS_ESC "_" // Application Program Command
/* Single Character Functions */
#define CTLSEQS_ENQ() "\x05" // Return Terminal Status
#define CTLSEQS_BEL() "\x07" // Bell
#define CTLSEQS_BS() "\x08" // Backspace
#define CTLSEQS_TAB() "\x09" // Horizontal Tab
#define CTLSEQS_LF() "\x0a" // Line Feed or New Line
#define CTLSEQS_VT() "\x0b" // Vertical Tab
#define CTLSEQS_FF() "\x0c" // Form Feed or New Page
#define CTLSEQS_CR() "\x0d" // Carriage Return
#define CTLSEQS_SO() "\x0e" // Switch to Alternate Character Set
#define CTLSEQS_SI() "\x0f" // Switch to Standard Character Set
#define CTLSEQS_SP() "\x20" // Space
/* Controls beginning with ESC */
#define CTLSEQS_S7C1T() CTLSEQS_ESC " F" // 7-bit controls
@ -94,7 +129,7 @@
// Request Termcap/Terminfo String
#define CTLSEQS_XTGETTCAP(s) CTLSEQS_DCS "+q" s CTLSEQS_ST
/* Functions using CSI */
/* Control Sequences */
// Insert $n (Blank) Character(s)
#define CTLSEQS_ICH(n) CTLSEQS_CSI n "@"