/** * @file charset.h * @brief Control characters whose code points differ between ASCII and * EBCDIC. * * Printable characters and `\n`, `\t`, `\b`, `\r`, `\a` are spelled as C * character constants everywhere in zash, so the compiler maps them to the * build's character set. C has no spelling for ESC, DEL or "control-X", * so those are defined here, once per character set. * * The ASCII values are exact. The EBCDIC values are the IBM-1047 control * codes, each one checked against the code page (iconv name `IBM-1047`), * and the EBCDIC build has been run on a z/OS terminal. */ #ifndef ZASH_CHARSET_H #define ZASH_CHARSET_H #if 'A' == 0x41 /** @brief True when the program is built for ASCII. */ #define ZASH_ASCII 1 enum { CH_ESC = 0x1b, /**< Escape: starts terminal control sequences. */ CH_DEL = 0x7f, /**< Delete: what most terminals send for Backspace. */ CH_CTRL_A = 0x01, CH_CTRL_B = 0x02, CH_CTRL_C = 0x03, CH_CTRL_D = 0x04, CH_CTRL_E = 0x05, CH_CTRL_F = 0x06, CH_CTRL_G = 0x07, CH_CTRL_H = 0x08, CH_CTRL_K = 0x0b, CH_CTRL_L = 0x0c, CH_CTRL_N = 0x0e, CH_CTRL_P = 0x10, CH_CTRL_R = 0x12, CH_CTRL_T = 0x14, CH_CTRL_U = 0x15, CH_CTRL_V = 0x16, CH_CTRL_W = 0x17, CH_CTRL_X = 0x18, CH_CTRL_Y = 0x19, CH_CTRL_Z = 0x1a, }; #else /* EBCDIC (IBM-1047) */ /** * @brief True when the program is built for ASCII. */ #define ZASH_ASCII 0 enum { CH_ESC = 0x27, CH_DEL = 0x07, CH_CTRL_A = 0x01, /**< SOH */ CH_CTRL_B = 0x02, /**< STX */ CH_CTRL_C = 0x03, /**< ETX */ CH_CTRL_D = 0x37, /**< EOT */ CH_CTRL_E = 0x2d, /**< ENQ */ CH_CTRL_F = 0x2e, /**< ACK */ CH_CTRL_G = 0x2f, /**< BEL */ CH_CTRL_H = 0x16, /**< BS */ CH_CTRL_K = 0x0b, /**< VT */ CH_CTRL_L = 0x0c, /**< FF */ CH_CTRL_N = 0x0e, /**< SO */ CH_CTRL_P = 0x10, /**< DLE */ CH_CTRL_R = 0x12, /**< DC2 */ CH_CTRL_T = 0x3c, /**< DC4 */ CH_CTRL_U = 0x3d, /**< NAK */ CH_CTRL_V = 0x32, /**< SYN */ CH_CTRL_W = 0x26, /**< ETB */ CH_CTRL_X = 0x18, /**< CAN */ CH_CTRL_Y = 0x19, /**< EM */ CH_CTRL_Z = 0x3f, /**< SUB */ }; #endif #endif