Mercurial > vim
comparison src/ascii.h @ 27490:fb4c30606b4a v8.2.4273
patch 8.2.4273: the EBCDIC support is outdated
Commit: https://github.com/vim/vim/commit/424bcae1fb0f69e0aef5e0cf84fd771cf34a0fb7
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 31 14:59:41 2022 +0000
patch 8.2.4273: the EBCDIC support is outdated
Problem: The EBCDIC support is outdated.
Solution: Remove the EBCDIC support.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 31 Jan 2022 16:00:09 +0100 |
parents | 6e3dc2d630c2 |
children |
comparison
equal
deleted
inserted
replaced
27489:9f00e1edb43c | 27490:fb4c30606b4a |
---|---|
6 * Do ":help credits" in Vim to see a list of people who contributed. | 6 * Do ":help credits" in Vim to see a list of people who contributed. |
7 */ | 7 */ |
8 | 8 |
9 /* | 9 /* |
10 * Definitions of various common control characters. | 10 * Definitions of various common control characters. |
11 * For EBCDIC we have to use different values. | |
12 */ | 11 */ |
13 | |
14 #ifndef EBCDIC | |
15 | |
16 // IF_EB(ASCII_constant, EBCDIC_constant) | |
17 #define IF_EB(a, b) a | |
18 | 12 |
19 #define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a') | 13 #define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a') |
20 #define CharOrdLow(x) ((x) - 'a') | 14 #define CharOrdLow(x) ((x) - 'a') |
21 #define CharOrdUp(x) ((x) - 'A') | 15 #define CharOrdUp(x) ((x) - 'A') |
22 #define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a)) | 16 #define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a)) |
75 #define Ctrl_BSL 28 // \ BackSLash | 69 #define Ctrl_BSL 28 // \ BackSLash |
76 #define Ctrl_RSB 29 // ] Right Square Bracket | 70 #define Ctrl_RSB 29 // ] Right Square Bracket |
77 #define Ctrl_HAT 30 // ^ | 71 #define Ctrl_HAT 30 // ^ |
78 #define Ctrl__ 31 | 72 #define Ctrl__ 31 |
79 | 73 |
80 #else | |
81 | |
82 // EBCDIC | |
83 | |
84 // IF_EB(ASCII_constant, EBCDIC_constant) | |
85 #define IF_EB(a, b) b | |
86 | |
87 /* | |
88 * Finding the position in the alphabet is not straightforward in EBCDIC. | |
89 * There are gaps in the code table. | |
90 * 'a' + 1 == 'b', but: 'i' + 7 == 'j' and 'r' + 8 == 's' | |
91 */ | |
92 #define CharOrd__(c) ((c) < ('j' - 'a') ? (c) : ((c) < ('s' - 'a') ? (c) - 7 : (c) - 7 - 8)) | |
93 #define CharOrdLow(x) (CharOrd__((x) - 'a')) | |
94 #define CharOrdUp(x) (CharOrd__((x) - 'A')) | |
95 #define CharOrd(x) (isupper(x) ? CharOrdUp(x) : CharOrdLow(x)) | |
96 | |
97 #define EBCDIC_CHAR_ADD_(x) ((x) < 0?'a':(x)>25?'z':"abcdefghijklmnopqrstuvwxyz"[x]) | |
98 #define EBCDIC_CHAR_ADD(c,s) (isupper(c) ? toupper(EBCDIC_CHAR_ADD_(CharOrdUp(c)+(s))) : EBCDIC_CHAR_ADD_(CharOrdLow(c)+(s))) | |
99 | |
100 #define R13_(c) ("abcdefghijklmnopqrstuvwxyz"[((c) + 13) % 26]) | |
101 #define ROT13(c, a) (isupper(c) ? toupper(R13_(CharOrdUp(c))) : R13_(CharOrdLow(c))) | |
102 | |
103 #define NUL '\000' | |
104 #define BELL '\x2f' | |
105 #define BS '\x16' | |
106 #define TAB '\x05' | |
107 #define NL '\x15' | |
108 #define NL_STR (char_u *)"\x15" | |
109 #define FF '\x0C' | |
110 #define CAR '\x0D' | |
111 #define ESC '\x27' | |
112 #define ESC_STR (char_u *)"\x27" | |
113 #define ESC_STR_nc "\x27" | |
114 #define DEL 0x07 | |
115 #define DEL_STR (char_u *)"\007" | |
116 | |
117 #define POUND 0xB1 | |
118 | |
119 #define CTRL_F_STR "\056" | |
120 #define CTRL_H_STR "\026" | |
121 #define CTRL_V_STR "\062" | |
122 | |
123 #define Ctrl_AT 0x00 // @ | |
124 #define Ctrl_A 0x01 | |
125 #define Ctrl_B 0x02 | |
126 #define Ctrl_C 0x03 | |
127 #define Ctrl_D 0x37 | |
128 #define Ctrl_E 0x2D | |
129 #define Ctrl_F 0x2E | |
130 #define Ctrl_G 0x2F | |
131 #define Ctrl_H 0x16 | |
132 #define Ctrl_I 0x05 | |
133 #define Ctrl_J 0x15 | |
134 #define Ctrl_K 0x0B | |
135 #define Ctrl_L 0x0C | |
136 #define Ctrl_M 0x0D | |
137 #define Ctrl_N 0x0E | |
138 #define Ctrl_O 0x0F | |
139 #define Ctrl_P 0x10 | |
140 #define Ctrl_Q 0x11 | |
141 #define Ctrl_R 0x12 | |
142 #define Ctrl_S 0x13 | |
143 #define Ctrl_T 0x3C | |
144 #define Ctrl_U 0x3D | |
145 #define Ctrl_V 0x32 | |
146 #define Ctrl_W 0x26 | |
147 #define Ctrl_X 0x18 | |
148 #define Ctrl_Y 0x19 | |
149 #define Ctrl_Z 0x3F | |
150 // CTRL- [ Left Square Bracket == ESC | |
151 #define Ctrl_RSB 0x1D // ] Right Square Bracket | |
152 #define Ctrl_BSL 0x1C // \ BackSLash | |
153 #define Ctrl_HAT 0x1E // ^ | |
154 #define Ctrl__ 0x1F | |
155 | |
156 #define Ctrl_chr(x) (CtrlTable[(x)]) | |
157 extern char CtrlTable[]; | |
158 | |
159 #define CtrlChar(x) ((x < ' ') ? CtrlCharTable[(x)] : 0) | |
160 extern char CtrlCharTable[]; | |
161 | |
162 #define MetaChar(x) ((x < ' ') ? MetaCharTable[(x)] : 0) | |
163 extern char MetaCharTable[]; | |
164 | |
165 #endif // defined EBCDIC | |
166 | |
167 // TODO: EBCDIC Code page dependent (here 1047) | |
168 #define CSI 0x9b // Control Sequence Introducer | 74 #define CSI 0x9b // Control Sequence Introducer |
169 #define CSI_STR "\233" | 75 #define CSI_STR "\233" |
170 #define DCS 0x90 // Device Control String | 76 #define DCS 0x90 // Device Control String |
171 #define OSC 0x9d // Operating System Command | 77 #define OSC 0x9d // Operating System Command |
172 #define STERM 0x9c // String Terminator | 78 #define STERM 0x9c // String Terminator |