Mercurial > vim
annotate src/ascii.h @ 24934:75bd12f3bfeb v8.2.3004
patch 8.2.3004: Vim9: error for missing colon given while skipping
Commit: https://github.com/vim/vim/commit/8ac681a280ffae14c30784a54587ad6cb640afbb
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 15 20:06:34 2021 +0200
patch 8.2.3004: Vim9: error for missing colon given while skipping
Problem: Vim9: error for missing colon given while skipping.
Solution: Do not give the error when skipping. (closes https://github.com/vim/vim/issues/8385)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 15 Jun 2021 20:15:03 +0200 |
parents | 6e3dc2d630c2 |
children | fb4c30606b4a |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
6901
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 */ | |
8 | |
9 /* | |
10 * Definitions of various common control characters. | |
11 * For EBCDIC we have to use different values. | |
12 */ | |
13 | |
14 #ifndef EBCDIC | |
15 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
16 // IF_EB(ASCII_constant, EBCDIC_constant) |
7 | 17 #define IF_EB(a, b) a |
18 | |
19 #define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a') | |
20 #define CharOrdLow(x) ((x) - 'a') | |
21 #define CharOrdUp(x) ((x) - 'A') | |
22 #define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a)) | |
23 | |
24 #define NUL '\000' | |
25 #define BELL '\007' | |
26 #define BS '\010' | |
27 #define TAB '\011' | |
28 #define NL '\012' | |
29 #define NL_STR (char_u *)"\012" | |
30 #define FF '\014' | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
31 #define CAR '\015' // CR is used by Mac OS X |
7 | 32 #define ESC '\033' |
33 #define ESC_STR (char_u *)"\033" | |
34 #define ESC_STR_nc "\033" | |
35 #define DEL 0x7f | |
36 #define DEL_STR (char_u *)"\177" | |
37 | |
38 #define POUND 0xA3 | |
39 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
40 #define Ctrl_chr(x) (TOUPPER_ASC(x) ^ 0x40) // '?' -> DEL, '@' -> ^@, etc. |
7 | 41 #define Meta(x) ((x) | 0x80) |
42 | |
43 #define CTRL_F_STR "\006" | |
44 #define CTRL_H_STR "\010" | |
45 #define CTRL_V_STR "\026" | |
46 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
47 #define Ctrl_AT 0 // @ |
7 | 48 #define Ctrl_A 1 |
49 #define Ctrl_B 2 | |
50 #define Ctrl_C 3 | |
51 #define Ctrl_D 4 | |
52 #define Ctrl_E 5 | |
53 #define Ctrl_F 6 | |
54 #define Ctrl_G 7 | |
55 #define Ctrl_H 8 | |
56 #define Ctrl_I 9 | |
57 #define Ctrl_J 10 | |
58 #define Ctrl_K 11 | |
59 #define Ctrl_L 12 | |
60 #define Ctrl_M 13 | |
61 #define Ctrl_N 14 | |
62 #define Ctrl_O 15 | |
63 #define Ctrl_P 16 | |
64 #define Ctrl_Q 17 | |
65 #define Ctrl_R 18 | |
66 #define Ctrl_S 19 | |
67 #define Ctrl_T 20 | |
68 #define Ctrl_U 21 | |
69 #define Ctrl_V 22 | |
70 #define Ctrl_W 23 | |
71 #define Ctrl_X 24 | |
72 #define Ctrl_Y 25 | |
73 #define Ctrl_Z 26 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
74 // CTRL- [ Left Square Bracket == ESC |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
75 #define Ctrl_BSL 28 // \ BackSLash |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
76 #define Ctrl_RSB 29 // ] Right Square Bracket |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
77 #define Ctrl_HAT 30 // ^ |
7 | 78 #define Ctrl__ 31 |
79 | |
80 #else | |
81 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
82 // EBCDIC |
7 | 83 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
84 // IF_EB(ASCII_constant, EBCDIC_constant) |
7 | 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 | |
3227 | 117 #define POUND 0xB1 |
7 | 118 |
119 #define CTRL_F_STR "\056" | |
120 #define CTRL_H_STR "\026" | |
121 #define CTRL_V_STR "\062" | |
122 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
123 #define Ctrl_AT 0x00 // @ |
7 | 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 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
150 // CTRL- [ Left Square Bracket == ESC |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
151 #define Ctrl_RSB 0x1D // ] Right Square Bracket |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
152 #define Ctrl_BSL 0x1C // \ BackSLash |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
153 #define Ctrl_HAT 0x1E // ^ |
7 | 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 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
165 #endif // defined EBCDIC |
7 | 166 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
167 // TODO: EBCDIC Code page dependent (here 1047) |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
168 #define CSI 0x9b // Control Sequence Introducer |
6901 | 169 #define CSI_STR "\233" |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
170 #define DCS 0x90 // Device Control String |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
171 #define OSC 0x9d // Operating System Command |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
10042
diff
changeset
|
172 #define STERM 0x9c // String Terminator |
6901 | 173 |
7 | 174 /* |
175 * Character that separates dir names in a path. | |
176 * For MS-DOS, WIN32 and OS/2 we use a backslash. A slash mostly works | |
177 * fine, but there are places where it doesn't (e.g. in a command name). | |
178 * For Acorn we use a dot. | |
179 */ | |
180 #ifdef BACKSLASH_IN_FILENAME | |
181 # define PATHSEP psepc | |
182 # define PATHSEPSTR pseps | |
183 #else | |
2823 | 184 # define PATHSEP '/' |
185 # define PATHSEPSTR "/" | |
7 | 186 #endif |