comparison src/digraph.c @ 18777:3a68dc2a1bc1 v8.1.2378

patch 8.1.2378: using old C style comments Commit: https://github.com/vim/vim/commit/5d18efecfd6c45d69f55268948a22cd0465bb955 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 1 21:11:22 2019 +0100 patch 8.1.2378: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate.
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Dec 2019 21:15:03 +0100
parents c90ca5b9fc0d
children d9a2e5dcfd9f
comparison
equal deleted inserted replaced
18776:90a6831d6cd7 18777:3a68dc2a1bc1
24 result_T result; 24 result_T result;
25 } digr_T; 25 } digr_T;
26 26
27 static void printdigraph(digr_T *dp, result_T *previous); 27 static void printdigraph(digr_T *dp, result_T *previous);
28 28
29 /* digraphs added by the user */ 29 // digraphs added by the user
30 static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL}; 30 static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
31 31
32 /* 32 /*
33 * Note: Characters marked with XX are not included literally, because some 33 * Note: Characters marked with XX are not included literally, because some
34 * compilers cannot handle them (Amiga SAS/C is the most picky one). 34 * compilers cannot handle them (Amiga SAS/C is the most picky one).
37 37
38 #ifdef __MINT__ 38 #ifdef __MINT__
39 /* 39 /*
40 * ATARI digraphs 40 * ATARI digraphs
41 */ 41 */
42 {{'C', ',', 128}, /* ~@ XX */ 42 {{'C', ',', 128}, // ~@ XX
43 {'u', '"', 129}, /*  */ 43 {'u', '"', 129}, // 
44 {'e', '\'', 130}, /* ‚ */ 44 {'e', '\'', 130}, // ‚
45 {'a', '^', 131}, /* ƒ */ 45 {'a', '^', 131}, // ƒ
46 {'a', '"', 132}, /* „ */ 46 {'a', '"', 132}, // „
47 {'a', '`', 133}, /* … */ 47 {'a', '`', 133}, // …
48 {'a', '@', 134}, /* † */ 48 {'a', '@', 134}, // †
49 {'c', ',', 135}, /* ~G XX */ 49 {'c', ',', 135}, // ~G XX
50 {'e', '^', 136}, /* ~H XX */ 50 {'e', '^', 136}, // ~H XX
51 {'e', '"', 137}, /* ‰ */ 51 {'e', '"', 137}, // ‰
52 {'e', '`', 138}, /* Š */ 52 {'e', '`', 138}, // Š
53 {'i', '"', 139}, /* ‹ */ 53 {'i', '"', 139}, // ‹
54 {'i', '^', 140}, /* Œ */ 54 {'i', '^', 140}, // Œ
55 {'i', '`', 141}, /*  */ 55 {'i', '`', 141}, // 
56 {'A', '"', 142}, /* Ž */ 56 {'A', '"', 142}, // Ž
57 {'A', '@', 143}, /*  */ 57 {'A', '@', 143}, // 
58 {'E', '\'', 144}, /*  */ 58 {'E', '\'', 144}, // 
59 {'a', 'e', 145}, /* ‘ */ 59 {'a', 'e', 145}, // ‘
60 {'A', 'E', 146}, /* ’ */ 60 {'A', 'E', 146}, // ’
61 {'o', '^', 147}, /* “ */ 61 {'o', '^', 147}, // “
62 {'o', '"', 148}, /* ” */ 62 {'o', '"', 148}, // ”
63 {'o', '`', 149}, /* • */ 63 {'o', '`', 149}, // •
64 {'u', '^', 150}, /* – */ 64 {'u', '^', 150}, // –
65 {'u', '`', 151}, /* — */ 65 {'u', '`', 151}, // —
66 {'y', '"', 152}, /* ˜ */ 66 {'y', '"', 152}, // ˜
67 {'O', '"', 153}, /* ™ */ 67 {'O', '"', 153}, // ™
68 {'U', '"', 154}, /* š */ 68 {'U', '"', 154}, // š
69 {'c', '|', 155}, /* › */ 69 {'c', '|', 155}, // ›
70 {'$', '$', 156}, /* œ */ 70 {'$', '$', 156}, // œ
71 {'Y', '-', 157}, /* ~] XX */ 71 {'Y', '-', 157}, // ~] XX
72 {'s', 's', 158}, /* ž */ 72 {'s', 's', 158}, // ž
73 {'f', 'f', 159}, /* Ÿ */ 73 {'f', 'f', 159}, // Ÿ
74 {'a', '\'', 160}, /*   */ 74 {'a', '\'', 160}, //  
75 {'i', '\'', 161}, /* ¡ */ 75 {'i', '\'', 161}, // ¡
76 {'o', '\'', 162}, /* ¢ */ 76 {'o', '\'', 162}, // ¢
77 {'u', '\'', 163}, /* £ */ 77 {'u', '\'', 163}, // £
78 {'n', '~', 164}, /* ¤ */ 78 {'n', '~', 164}, // ¤
79 {'N', '~', 165}, /* ¥ */ 79 {'N', '~', 165}, // ¥
80 {'a', 'a', 166}, /* ¦ */ 80 {'a', 'a', 166}, // ¦
81 {'o', 'o', 167}, /* § */ 81 {'o', 'o', 167}, // §
82 {'~', '?', 168}, /* ¨ */ 82 {'~', '?', 168}, // ¨
83 {'-', 'a', 169}, /* © */ 83 {'-', 'a', 169}, // ©
84 {'a', '-', 170}, /* ª */ 84 {'a', '-', 170}, // ª
85 {'1', '2', 171}, /* « */ 85 {'1', '2', 171}, // «
86 {'1', '4', 172}, /* ¬ */ 86 {'1', '4', 172}, // ¬
87 {'~', '!', 173}, /* ­ */ 87 {'~', '!', 173}, // ­
88 {'<', '<', 174}, /* ® */ 88 {'<', '<', 174}, // ®
89 {'>', '>', 175}, /* ¯ */ 89 {'>', '>', 175}, // ¯
90 {'j', 'u', 230}, /* æ */ 90 {'j', 'u', 230}, // æ
91 {'o', '/', 237}, /* í */ 91 {'o', '/', 237}, // í
92 {'+', '-', 241}, /* ñ */ 92 {'+', '-', 241}, // ñ
93 {'>', '=', 242}, /* ò */ 93 {'>', '=', 242}, // ò
94 {'<', '=', 243}, /* ó */ 94 {'<', '=', 243}, // ó
95 {':', '-', 246}, /* ö */ 95 {':', '-', 246}, // ö
96 {'~', '~', 247}, /* ÷ */ 96 {'~', '~', 247}, // ÷
97 {'~', 'o', 248}, /* ø */ 97 {'~', 'o', 248}, // ø
98 {'2', '2', 253}, /* ý */ 98 {'2', '2', 253}, // ý
99 {NUL, NUL, NUL} 99 {NUL, NUL, NUL}
100 }; 100 };
101 101
102 #else /* !__MINT__ */ 102 #else // !__MINT__
103 # ifdef HPUX_DIGRAPHS 103 # ifdef HPUX_DIGRAPHS
104 104
105 /* 105 /*
106 * different HPUX digraphs 106 * different HPUX digraphs
107 */ 107 */
108 {{'A', '`', 161}, /* ¡ */ 108 {{'A', '`', 161}, // ¡
109 {'A', '^', 162}, /* ¢ */ 109 {'A', '^', 162}, // ¢
110 {'E', '`', 163}, /* £ */ 110 {'E', '`', 163}, // £
111 {'E', '^', 164}, /* ¤ */ 111 {'E', '^', 164}, // ¤
112 {'E', '"', 165}, /* ¥ */ 112 {'E', '"', 165}, // ¥
113 {'I', '^', 166}, /* ¦ */ 113 {'I', '^', 166}, // ¦
114 {'I', '"', 167}, /* § */ 114 {'I', '"', 167}, // §
115 {'\'', '\'', 168}, /* ¨ */ 115 {'\'', '\'', 168}, // ¨
116 {'`', '`', 169}, /* © */ 116 {'`', '`', 169}, // ©
117 {'^', '^', 170}, /* ª */ 117 {'^', '^', 170}, // ª
118 {'"', '"', 171}, /* « */ 118 {'"', '"', 171}, // «
119 {'~', '~', 172}, /* ¬ */ 119 {'~', '~', 172}, // ¬
120 {'U', '`', 173}, /* ­ */ 120 {'U', '`', 173}, // ­
121 {'U', '^', 174}, /* ® */ 121 {'U', '^', 174}, // ®
122 {'L', '=', 175}, /* ¯ */ 122 {'L', '=', 175}, // ¯
123 {'~', '_', 176}, /* ° */ 123 {'~', '_', 176}, // °
124 {'Y', '\'', 177}, /* ± */ 124 {'Y', '\'', 177}, // ±
125 {'y', '\'', 178}, /* ² */ 125 {'y', '\'', 178}, // ²
126 {'~', 'o', 179}, /* ³ */ 126 {'~', 'o', 179}, // ³
127 {'C', ',', 180}, /* ´ */ 127 {'C', ',', 180}, // ´
128 {'c', ',', 181}, /* µ */ 128 {'c', ',', 181}, // µ
129 {'N', '~', 182}, /* ¶ */ 129 {'N', '~', 182}, // ¶
130 {'n', '~', 183}, /* · */ 130 {'n', '~', 183}, // ·
131 {'~', '!', 184}, /* ¸ */ 131 {'~', '!', 184}, // ¸
132 {'~', '?', 185}, /* ¹ */ 132 {'~', '?', 185}, // ¹
133 {'o', 'x', 186}, /* º */ 133 {'o', 'x', 186}, // º
134 {'L', '-', 187}, /* » */ 134 {'L', '-', 187}, // »
135 {'Y', '=', 188}, /* ¼ */ 135 {'Y', '=', 188}, // ¼
136 {'p', 'p', 189}, /* ½ */ 136 {'p', 'p', 189}, // ½
137 {'f', 'l', 190}, /* ¾ */ 137 {'f', 'l', 190}, // ¾
138 {'c', '|', 191}, /* ¿ */ 138 {'c', '|', 191}, // ¿
139 {'a', '^', 192}, /* À */ 139 {'a', '^', 192}, // À
140 {'e', '^', 193}, /* Á */ 140 {'e', '^', 193}, // Á
141 {'o', '^', 194}, /* Â */ 141 {'o', '^', 194}, // Â
142 {'u', '^', 195}, /* Ã */ 142 {'u', '^', 195}, // Ã
143 {'a', '\'', 196}, /* Ä */ 143 {'a', '\'', 196}, // Ä
144 {'e', '\'', 197}, /* Å */ 144 {'e', '\'', 197}, // Å
145 {'o', '\'', 198}, /* Æ */ 145 {'o', '\'', 198}, // Æ
146 {'u', '\'', 199}, /* Ç */ 146 {'u', '\'', 199}, // Ç
147 {'a', '`', 200}, /* È */ 147 {'a', '`', 200}, // È
148 {'e', '`', 201}, /* É */ 148 {'e', '`', 201}, // É
149 {'o', '`', 202}, /* Ê */ 149 {'o', '`', 202}, // Ê
150 {'u', '`', 203}, /* Ë */ 150 {'u', '`', 203}, // Ë
151 {'a', '"', 204}, /* Ì */ 151 {'a', '"', 204}, // Ì
152 {'e', '"', 205}, /* Í */ 152 {'e', '"', 205}, // Í
153 {'o', '"', 206}, /* Î */ 153 {'o', '"', 206}, // Î
154 {'u', '"', 207}, /* Ï */ 154 {'u', '"', 207}, // Ï
155 {'A', 'o', 208}, /* Ð */ 155 {'A', 'o', 208}, // Ð
156 {'i', '^', 209}, /* Ñ */ 156 {'i', '^', 209}, // Ñ
157 {'O', '/', 210}, /* Ò */ 157 {'O', '/', 210}, // Ò
158 {'A', 'E', 211}, /* Ó */ 158 {'A', 'E', 211}, // Ó
159 {'a', 'o', 212}, /* Ô */ 159 {'a', 'o', 212}, // Ô
160 {'i', '\'', 213}, /* Õ */ 160 {'i', '\'', 213}, // Õ
161 {'o', '/', 214}, /* Ö */ 161 {'o', '/', 214}, // Ö
162 {'a', 'e', 215}, /* × */ 162 {'a', 'e', 215}, // ×
163 {'A', '"', 216}, /* Ø */ 163 {'A', '"', 216}, // Ø
164 {'i', '`', 217}, /* Ù */ 164 {'i', '`', 217}, // Ù
165 {'O', '"', 218}, /* Ú */ 165 {'O', '"', 218}, // Ú
166 {'U', '"', 219}, /* Û */ 166 {'U', '"', 219}, // Û
167 {'E', '\'', 220}, /* Ü */ 167 {'E', '\'', 220}, // Ü
168 {'i', '"', 221}, /* Ý */ 168 {'i', '"', 221}, // Ý
169 {'s', 's', 222}, /* Þ */ 169 {'s', 's', 222}, // Þ
170 {'O', '^', 223}, /* ß */ 170 {'O', '^', 223}, // ß
171 {'A', '\'', 224}, /* à */ 171 {'A', '\'', 224}, // à
172 {'A', '~', 225}, /* á */ 172 {'A', '~', 225}, // á
173 {'a', '~', 226}, /* â */ 173 {'a', '~', 226}, // â
174 {'D', '-', 227}, /* ã */ 174 {'D', '-', 227}, // ã
175 {'d', '-', 228}, /* ä */ 175 {'d', '-', 228}, // ä
176 {'I', '\'', 229}, /* å */ 176 {'I', '\'', 229}, // å
177 {'I', '`', 230}, /* æ */ 177 {'I', '`', 230}, // æ
178 {'O', '\'', 231}, /* ç */ 178 {'O', '\'', 231}, // ç
179 {'O', '`', 232}, /* è */ 179 {'O', '`', 232}, // è
180 {'O', '~', 233}, /* é */ 180 {'O', '~', 233}, // é
181 {'o', '~', 234}, /* ê */ 181 {'o', '~', 234}, // ê
182 {'S', '~', 235}, /* ë */ 182 {'S', '~', 235}, // ë
183 {'s', '~', 236}, /* ì */ 183 {'s', '~', 236}, // ì
184 {'U', '\'', 237}, /* í */ 184 {'U', '\'', 237}, // í
185 {'Y', '"', 238}, /* î */ 185 {'Y', '"', 238}, // î
186 {'y', '"', 239}, /* ï */ 186 {'y', '"', 239}, // ï
187 {'p', '-', 240}, /* ð */ 187 {'p', '-', 240}, // ð
188 {'p', '~', 241}, /* ñ */ 188 {'p', '~', 241}, // ñ
189 {'~', '.', 242}, /* ò */ 189 {'~', '.', 242}, // ò
190 {'j', 'u', 243}, /* ó */ 190 {'j', 'u', 243}, // ó
191 {'P', 'p', 244}, /* ô */ 191 {'P', 'p', 244}, // ô
192 {'3', '4', 245}, /* õ */ 192 {'3', '4', 245}, // õ
193 {'-', '-', 246}, /* ö */ 193 {'-', '-', 246}, // ö
194 {'1', '4', 247}, /* ÷ */ 194 {'1', '4', 247}, // ÷
195 {'1', '2', 248}, /* ø */ 195 {'1', '2', 248}, // ø
196 {'a', '_', 249}, /* ù */ 196 {'a', '_', 249}, // ù
197 {'o', '_', 250}, /* ú */ 197 {'o', '_', 250}, // ú
198 {'<', '<', 251}, /* û */ 198 {'<', '<', 251}, // û
199 {'x', 'x', 252}, /* ü */ 199 {'x', 'x', 252}, // ü
200 {'>', '>', 253}, /* ý */ 200 {'>', '>', 253}, // ý
201 {'+', '-', 254}, /* þ */ 201 {'+', '-', 254}, // þ
202 {'n', 'u', 255}, /* x XX */ 202 {'n', 'u', 255}, // x XX
203 {NUL, NUL, NUL} 203 {NUL, NUL, NUL}
204 }; 204 };
205 205
206 # else /* !HPUX_DIGRAPHS */ 206 # else // !HPUX_DIGRAPHS
207 207
208 # ifdef EBCDIC 208 # ifdef EBCDIC
209 209
210 /* 210 /*
211 * EBCDIC - ISO digraphs 211 * EBCDIC - ISO digraphs
212 * TODO: EBCDIC Table is Code-Page 1047 212 * TODO: EBCDIC Table is Code-Page 1047
213 */ 213 */
214 {{'a', '^', 66}, /* â */ 214 {{'a', '^', 66}, // â
215 {'a', '"', 67}, /* ä */ 215 {'a', '"', 67}, // ä
216 {'a', '`', 68}, /* à */ 216 {'a', '`', 68}, // à
217 {'a', '\'', 69}, /* á */ 217 {'a', '\'', 69}, // á
218 {'a', '~', 70}, /* ã */ 218 {'a', '~', 70}, // ã
219 {'a', '@', 71}, /* å */ 219 {'a', '@', 71}, // å
220 {'a', 'a', 71}, /* å */ 220 {'a', 'a', 71}, // å
221 {'c', ',', 72}, /* ç */ 221 {'c', ',', 72}, // ç
222 {'n', '~', 73}, /* ñ */ 222 {'n', '~', 73}, // ñ
223 {'c', '|', 74}, /* ¢ */ 223 {'c', '|', 74}, // ¢
224 {'e', '\'', 81}, /* é */ 224 {'e', '\'', 81}, // é
225 {'e', '^', 82}, /* ê */ 225 {'e', '^', 82}, // ê
226 {'e', '"', 83}, /* ë */ 226 {'e', '"', 83}, // ë
227 {'e', '`', 84}, /* è */ 227 {'e', '`', 84}, // è
228 {'i', '\'', 85}, /* í */ 228 {'i', '\'', 85}, // í
229 {'i', '^', 86}, /* î */ 229 {'i', '^', 86}, // î
230 {'i', '"', 87}, /* ï */ 230 {'i', '"', 87}, // ï
231 {'i', '`', 88}, /* ì */ 231 {'i', '`', 88}, // ì
232 {'s', 's', 89}, /* ß */ 232 {'s', 's', 89}, // ß
233 {'A', '^', 98}, /* Â */ 233 {'A', '^', 98}, // Â
234 {'A', '"', 99}, /* Ä */ 234 {'A', '"', 99}, // Ä
235 {'A', '`', 100}, /* À */ 235 {'A', '`', 100}, // À
236 {'A', '\'', 101}, /* Á */ 236 {'A', '\'', 101}, // Á
237 {'A', '~', 102}, /* Ã */ 237 {'A', '~', 102}, // Ã
238 {'A', '@', 103}, /* Å */ 238 {'A', '@', 103}, // Å
239 {'A', 'A', 103}, /* Å */ 239 {'A', 'A', 103}, // Å
240 {'C', ',', 104}, /* Ç */ 240 {'C', ',', 104}, // Ç
241 {'N', '~', 105}, /* Ñ */ 241 {'N', '~', 105}, // Ñ
242 {'|', '|', 106}, /* ¦ */ 242 {'|', '|', 106}, // ¦
243 {'o', '/', 112}, /* ø */ 243 {'o', '/', 112}, // ø
244 {'E', '\'', 113}, /* É */ 244 {'E', '\'', 113}, // É
245 {'E', '^', 114}, /* Ê */ 245 {'E', '^', 114}, // Ê
246 {'E', '"', 115}, /* Ë */ 246 {'E', '"', 115}, // Ë
247 {'E', '`', 116}, /* È */ 247 {'E', '`', 116}, // È
248 {'I', '\'', 117}, /* Í */ 248 {'I', '\'', 117}, // Í
249 {'I', '^', 118}, /* Î */ 249 {'I', '^', 118}, // Î
250 {'I', '"', 119}, /* Ï */ 250 {'I', '"', 119}, // Ï
251 {'I', '`', 120}, /* Ì */ 251 {'I', '`', 120}, // Ì
252 {'O', '/', 128}, /* 0/ XX */ 252 {'O', '/', 128}, // 0/ XX
253 {'<', '<', 138}, /* « */ 253 {'<', '<', 138}, // «
254 {'>', '>', 139}, /* » */ 254 {'>', '>', 139}, // »
255 {'d', '-', 140}, /* ð */ 255 {'d', '-', 140}, // ð
256 {'y', '\'', 141}, /* ý */ 256 {'y', '\'', 141}, // ý
257 {'i', 'p', 142}, /* þ */ 257 {'i', 'p', 142}, // þ
258 {'+', '-', 143}, /* ± */ 258 {'+', '-', 143}, // ±
259 {'~', 'o', 144}, /* ° */ 259 {'~', 'o', 144}, // °
260 {'a', '-', 154}, /* ª */ 260 {'a', '-', 154}, // ª
261 {'o', '-', 155}, /* º */ 261 {'o', '-', 155}, // º
262 {'a', 'e', 156}, /* æ */ 262 {'a', 'e', 156}, // æ
263 {',', ',', 157}, /* , XX */ 263 {',', ',', 157}, // , XX
264 {'A', 'E', 158}, /* Æ */ 264 {'A', 'E', 158}, // Æ
265 {'o', 'x', 159}, /* ¤ - currency symbol in ISO 8859-1 */ 265 {'o', 'x', 159}, // ¤ - currency symbol in ISO 8859-1
266 {'e', '=', 159}, /* ¤ - euro symbol in ISO 8859-15 */ 266 {'e', '=', 159}, // ¤ - euro symbol in ISO 8859-15
267 {'E', 'u', 159}, /* ¤ - euro symbol in ISO 8859-15 */ 267 {'E', 'u', 159}, // ¤ - euro symbol in ISO 8859-15
268 {'j', 'u', 160}, /* µ */ 268 {'j', 'u', 160}, // µ
269 {'y', '"', 167}, /* x XX */ 269 {'y', '"', 167}, // x XX
270 {'~', '!', 170}, /* ¡ */ 270 {'~', '!', 170}, // ¡
271 {'~', '?', 171}, /* ¿ */ 271 {'~', '?', 171}, // ¿
272 {'D', '-', 172}, /* Ð */ 272 {'D', '-', 172}, // Ð
273 {'I', 'p', 174}, /* Þ */ 273 {'I', 'p', 174}, // Þ
274 {'r', 'O', 175}, /* ® */ 274 {'r', 'O', 175}, // ®
275 {'-', ',', 176}, /* ¬ */ 275 {'-', ',', 176}, // ¬
276 {'$', '$', 177}, /* £ */ 276 {'$', '$', 177}, // £
277 {'Y', '-', 178}, /* ¥ */ 277 {'Y', '-', 178}, // ¥
278 {'~', '.', 179}, /* · */ 278 {'~', '.', 179}, // ·
279 {'c', 'O', 180}, /* © */ 279 {'c', 'O', 180}, // ©
280 {'p', 'a', 181}, /* § */ 280 {'p', 'a', 181}, // §
281 {'p', 'p', 182}, /* ¶ */ 281 {'p', 'p', 182}, // ¶
282 {'1', '4', 183}, /* ¼ */ 282 {'1', '4', 183}, // ¼
283 {'1', '2', 184}, /* ½ */ 283 {'1', '2', 184}, // ½
284 {'3', '4', 185}, /* ¾ */ 284 {'3', '4', 185}, // ¾
285 {'Y', '\'', 186}, /* Ý */ 285 {'Y', '\'', 186}, // Ý
286 {'"', '"', 187}, /* ¨ */ 286 {'"', '"', 187}, // ¨
287 {'-', '=', 188}, /* ¯ */ 287 {'-', '=', 188}, // ¯
288 {'\'', '\'', 190}, /* ´ */ 288 {'\'', '\'', 190}, // ´
289 {'O', 'E', 191}, /* × - OE in ISO 8859-15 */ 289 {'O', 'E', 191}, // × - OE in ISO 8859-15
290 {'/', '\\', 191}, /* × - multiplication symbol in ISO 8859-1 */ 290 {'/', '\\', 191}, // × - multiplication symbol in ISO 8859-1
291 {'-', '-', 202}, /* ­ */ 291 {'-', '-', 202}, // ­
292 {'o', '^', 203}, /* ô */ 292 {'o', '^', 203}, // ô
293 {'o', '"', 204}, /* ö */ 293 {'o', '"', 204}, // ö
294 {'o', '`', 205}, /* ò */ 294 {'o', '`', 205}, // ò
295 {'o', '\'', 206}, /* ó */ 295 {'o', '\'', 206}, // ó
296 {'o', '~', 207}, /* õ */ 296 {'o', '~', 207}, // õ
297 {'1', '1', 218}, /* ¹ */ 297 {'1', '1', 218}, // ¹
298 {'u', '^', 219}, /* û */ 298 {'u', '^', 219}, // û
299 {'u', '"', 220}, /* ü */ 299 {'u', '"', 220}, // ü
300 {'u', '`', 221}, /* ù */ 300 {'u', '`', 221}, // ù
301 {'u', '\'', 222}, /* ú */ 301 {'u', '\'', 222}, // ú
302 {':', '-', 225}, /* ÷ - division symbol in ISO 8859-1 */ 302 {':', '-', 225}, // ÷ - division symbol in ISO 8859-1
303 {'o', 'e', 225}, /* ÷ - oe in ISO 8859-15 */ 303 {'o', 'e', 225}, // ÷ - oe in ISO 8859-15
304 {'2', '2', 234}, /* ² */ 304 {'2', '2', 234}, // ²
305 {'O', '^', 235}, /* Ô */ 305 {'O', '^', 235}, // Ô
306 {'O', '"', 236}, /* Ö */ 306 {'O', '"', 236}, // Ö
307 {'O', '`', 237}, /* Ò */ 307 {'O', '`', 237}, // Ò
308 {'O', '\'', 238}, /* Ó */ 308 {'O', '\'', 238}, // Ó
309 {'O', '~', 239}, /* Õ */ 309 {'O', '~', 239}, // Õ
310 {'3', '3', 250}, /* ³ */ 310 {'3', '3', 250}, // ³
311 {'U', '^', 251}, /* Û */ 311 {'U', '^', 251}, // Û
312 {'U', '"', 252}, /* Ü */ 312 {'U', '"', 252}, // Ü
313 {'U', '`', 253}, /* Ù */ 313 {'U', '`', 253}, // Ù
314 {'U', '\'', 254}, /* Ú */ 314 {'U', '\'', 254}, // Ú
315 {NUL, NUL, NUL} 315 {NUL, NUL, NUL}
316 }; 316 };
317 317
318 # else 318 # else
319 # ifdef OLD_DIGRAPHS 319 # ifdef OLD_DIGRAPHS
320 320
321 /* 321 /*
322 * digraphs compatible with Vim 5.x 322 * digraphs compatible with Vim 5.x
323 */ 323 */
324 {{'~', '!', 161}, /* ¡ */ 324 {{'~', '!', 161}, // ¡
325 {'c', '|', 162}, /* ¢ */ 325 {'c', '|', 162}, // ¢
326 {'$', '$', 163}, /* £ */ 326 {'$', '$', 163}, // £
327 {'o', 'x', 164}, /* ¤ - currency symbol in ISO 8859-1 */ 327 {'o', 'x', 164}, // ¤ - currency symbol in ISO 8859-1
328 {'e', '=', 164}, /* ¤ - euro symbol in ISO 8859-15 */ 328 {'e', '=', 164}, // ¤ - euro symbol in ISO 8859-15
329 {'Y', '-', 165}, /* ¥ */ 329 {'Y', '-', 165}, // ¥
330 {'|', '|', 166}, /* ¦ */ 330 {'|', '|', 166}, // ¦
331 {'p', 'a', 167}, /* § */ 331 {'p', 'a', 167}, // §
332 {'"', '"', 168}, /* ¨ */ 332 {'"', '"', 168}, // ¨
333 {'c', 'O', 169}, /* © */ 333 {'c', 'O', 169}, // ©
334 {'a', '-', 170}, /* ª */ 334 {'a', '-', 170}, // ª
335 {'<', '<', 171}, /* « */ 335 {'<', '<', 171}, // «
336 {'-', ',', 172}, /* ¬ */ 336 {'-', ',', 172}, // ¬
337 {'-', '-', 173}, /* ­ */ 337 {'-', '-', 173}, // ­
338 {'r', 'O', 174}, /* ® */ 338 {'r', 'O', 174}, // ®
339 {'-', '=', 175}, /* ¯ */ 339 {'-', '=', 175}, // ¯
340 {'~', 'o', 176}, /* ° */ 340 {'~', 'o', 176}, // °
341 {'+', '-', 177}, /* ± */ 341 {'+', '-', 177}, // ±
342 {'2', '2', 178}, /* ² */ 342 {'2', '2', 178}, // ²
343 {'3', '3', 179}, /* ³ */ 343 {'3', '3', 179}, // ³
344 {'\'', '\'', 180}, /* ´ */ 344 {'\'', '\'', 180}, // ´
345 {'j', 'u', 181}, /* µ */ 345 {'j', 'u', 181}, // µ
346 {'p', 'p', 182}, /* ¶ */ 346 {'p', 'p', 182}, // ¶
347 {'~', '.', 183}, /* · */ 347 {'~', '.', 183}, // ·
348 {',', ',', 184}, /* ¸ */ 348 {',', ',', 184}, // ¸
349 {'1', '1', 185}, /* ¹ */ 349 {'1', '1', 185}, // ¹
350 {'o', '-', 186}, /* º */ 350 {'o', '-', 186}, // º
351 {'>', '>', 187}, /* » */ 351 {'>', '>', 187}, // »
352 {'1', '4', 188}, /* ¼ */ 352 {'1', '4', 188}, // ¼
353 {'1', '2', 189}, /* ½ */ 353 {'1', '2', 189}, // ½
354 {'3', '4', 190}, /* ¾ */ 354 {'3', '4', 190}, // ¾
355 {'~', '?', 191}, /* ¿ */ 355 {'~', '?', 191}, // ¿
356 {'A', '`', 192}, /* À */ 356 {'A', '`', 192}, // À
357 {'A', '\'', 193}, /* Á */ 357 {'A', '\'', 193}, // Á
358 {'A', '^', 194}, /* Â */ 358 {'A', '^', 194}, // Â
359 {'A', '~', 195}, /* Ã */ 359 {'A', '~', 195}, // Ã
360 {'A', '"', 196}, /* Ä */ 360 {'A', '"', 196}, // Ä
361 {'A', '@', 197}, /* Å */ 361 {'A', '@', 197}, // Å
362 {'A', 'A', 197}, /* Å */ 362 {'A', 'A', 197}, // Å
363 {'A', 'E', 198}, /* Æ */ 363 {'A', 'E', 198}, // Æ
364 {'C', ',', 199}, /* Ç */ 364 {'C', ',', 199}, // Ç
365 {'E', '`', 200}, /* È */ 365 {'E', '`', 200}, // È
366 {'E', '\'', 201}, /* É */ 366 {'E', '\'', 201}, // É
367 {'E', '^', 202}, /* Ê */ 367 {'E', '^', 202}, // Ê
368 {'E', '"', 203}, /* Ë */ 368 {'E', '"', 203}, // Ë
369 {'I', '`', 204}, /* Ì */ 369 {'I', '`', 204}, // Ì
370 {'I', '\'', 205}, /* Í */ 370 {'I', '\'', 205}, // Í
371 {'I', '^', 206}, /* Î */ 371 {'I', '^', 206}, // Î
372 {'I', '"', 207}, /* Ï */ 372 {'I', '"', 207}, // Ï
373 {'D', '-', 208}, /* Ð */ 373 {'D', '-', 208}, // Ð
374 {'N', '~', 209}, /* Ñ */ 374 {'N', '~', 209}, // Ñ
375 {'O', '`', 210}, /* Ò */ 375 {'O', '`', 210}, // Ò
376 {'O', '\'', 211}, /* Ó */ 376 {'O', '\'', 211}, // Ó
377 {'O', '^', 212}, /* Ô */ 377 {'O', '^', 212}, // Ô
378 {'O', '~', 213}, /* Õ */ 378 {'O', '~', 213}, // Õ
379 {'O', '"', 214}, /* Ö */ 379 {'O', '"', 214}, // Ö
380 {'/', '\\', 215}, /* × - multiplication symbol in ISO 8859-1 */ 380 {'/', '\\', 215}, // × - multiplication symbol in ISO 8859-1
381 {'O', 'E', 215}, /* × - OE in ISO 8859-15 */ 381 {'O', 'E', 215}, // × - OE in ISO 8859-15
382 {'O', '/', 216}, /* Ø */ 382 {'O', '/', 216}, // Ø
383 {'U', '`', 217}, /* Ù */ 383 {'U', '`', 217}, // Ù
384 {'U', '\'', 218}, /* Ú */ 384 {'U', '\'', 218}, // Ú
385 {'U', '^', 219}, /* Û */ 385 {'U', '^', 219}, // Û
386 {'U', '"', 220}, /* Ü */ 386 {'U', '"', 220}, // Ü
387 {'Y', '\'', 221}, /* Ý */ 387 {'Y', '\'', 221}, // Ý
388 {'I', 'p', 222}, /* Þ */ 388 {'I', 'p', 222}, // Þ
389 {'s', 's', 223}, /* ß */ 389 {'s', 's', 223}, // ß
390 {'a', '`', 224}, /* à */ 390 {'a', '`', 224}, // à
391 {'a', '\'', 225}, /* á */ 391 {'a', '\'', 225}, // á
392 {'a', '^', 226}, /* â */ 392 {'a', '^', 226}, // â
393 {'a', '~', 227}, /* ã */ 393 {'a', '~', 227}, // ã
394 {'a', '"', 228}, /* ä */ 394 {'a', '"', 228}, // ä
395 {'a', '@', 229}, /* å */ 395 {'a', '@', 229}, // å
396 {'a', 'a', 229}, /* å */ 396 {'a', 'a', 229}, // å
397 {'a', 'e', 230}, /* æ */ 397 {'a', 'e', 230}, // æ
398 {'c', ',', 231}, /* ç */ 398 {'c', ',', 231}, // ç
399 {'e', '`', 232}, /* è */ 399 {'e', '`', 232}, // è
400 {'e', '\'', 233}, /* é */ 400 {'e', '\'', 233}, // é
401 {'e', '^', 234}, /* ê */ 401 {'e', '^', 234}, // ê
402 {'e', '"', 235}, /* ë */ 402 {'e', '"', 235}, // ë
403 {'i', '`', 236}, /* ì */ 403 {'i', '`', 236}, // ì
404 {'i', '\'', 237}, /* í */ 404 {'i', '\'', 237}, // í
405 {'i', '^', 238}, /* î */ 405 {'i', '^', 238}, // î
406 {'i', '"', 239}, /* ï */ 406 {'i', '"', 239}, // ï
407 {'d', '-', 240}, /* ð */ 407 {'d', '-', 240}, // ð
408 {'n', '~', 241}, /* ñ */ 408 {'n', '~', 241}, // ñ
409 {'o', '`', 242}, /* ò */ 409 {'o', '`', 242}, // ò
410 {'o', '\'', 243}, /* ó */ 410 {'o', '\'', 243}, // ó
411 {'o', '^', 244}, /* ô */ 411 {'o', '^', 244}, // ô
412 {'o', '~', 245}, /* õ */ 412 {'o', '~', 245}, // õ
413 {'o', '"', 246}, /* ö */ 413 {'o', '"', 246}, // ö
414 {':', '-', 247}, /* ÷ - division symbol in ISO 8859-1 */ 414 {':', '-', 247}, // ÷ - division symbol in ISO 8859-1
415 {'o', 'e', 247}, /* ÷ - oe in ISO 8859-15 */ 415 {'o', 'e', 247}, // ÷ - oe in ISO 8859-15
416 {'o', '/', 248}, /* ø */ 416 {'o', '/', 248}, // ø
417 {'u', '`', 249}, /* ù */ 417 {'u', '`', 249}, // ù
418 {'u', '\'', 250}, /* ú */ 418 {'u', '\'', 250}, // ú
419 {'u', '^', 251}, /* û */ 419 {'u', '^', 251}, // û
420 {'u', '"', 252}, /* ü */ 420 {'u', '"', 252}, // ü
421 {'y', '\'', 253}, /* ý */ 421 {'y', '\'', 253}, // ý
422 {'i', 'p', 254}, /* þ */ 422 {'i', 'p', 254}, // þ
423 {'y', '"', 255}, /* x XX */ 423 {'y', '"', 255}, // x XX
424 {NUL, NUL, NUL} 424 {NUL, NUL, NUL}
425 }; 425 };
426 # else /* OLD_DIGRAPHS */ 426 # else // OLD_DIGRAPHS
427 427
428 /* 428 /*
429 * digraphs for Unicode from RFC1345 429 * digraphs for Unicode from RFC1345
430 * (also work for ISO-8859-1 aka latin1) 430 * (also work for ISO-8859-1 aka latin1)
431 */ 431 */
432 { 432 {
433 {'N', 'U', 0x0a}, /* LF for NUL */ 433 {'N', 'U', 0x0a}, // LF for NUL
434 {'S', 'H', 0x01}, 434 {'S', 'H', 0x01},
435 {'S', 'X', 0x02}, 435 {'S', 'X', 0x02},
436 {'E', 'X', 0x03}, 436 {'E', 'X', 0x03},
437 {'E', 'T', 0x04}, 437 {'E', 'T', 0x04},
438 {'E', 'Q', 0x05}, 438 {'E', 'Q', 0x05},
1285 {')', 's', 0x208e}, 1285 {')', 's', 0x208e},
1286 #define DG_START_CURRENCY 0x20a4 1286 #define DG_START_CURRENCY 0x20a4
1287 {'L', 'i', 0x20a4}, 1287 {'L', 'i', 0x20a4},
1288 {'P', 't', 0x20a7}, 1288 {'P', 't', 0x20a7},
1289 {'W', '=', 0x20a9}, 1289 {'W', '=', 0x20a9},
1290 {'=', 'e', 0x20ac}, /* euro */ 1290 {'=', 'e', 0x20ac}, // euro
1291 {'E', 'u', 0x20ac}, /* euro */ 1291 {'E', 'u', 0x20ac}, // euro
1292 {'=', 'R', 0x20bd}, /* rouble */ 1292 {'=', 'R', 0x20bd}, // rouble
1293 {'=', 'P', 0x20bd}, /* rouble */ 1293 {'=', 'P', 0x20bd}, // rouble
1294 #define DG_START_OTHER1 0x2103 1294 #define DG_START_OTHER1 0x2103
1295 {'o', 'C', 0x2103}, 1295 {'o', 'C', 0x2103},
1296 {'c', 'o', 0x2105}, 1296 {'c', 'o', 0x2105},
1297 {'o', 'F', 0x2109}, 1297 {'o', 'F', 0x2109},
1298 {'N', '0', 0x2116}, 1298 {'N', '0', 0x2116},
1813 {'5', 'c', 0x3224}, 1813 {'5', 'c', 0x3224},
1814 {'6', 'c', 0x3225}, 1814 {'6', 'c', 0x3225},
1815 {'7', 'c', 0x3226}, 1815 {'7', 'c', 0x3226},
1816 {'8', 'c', 0x3227}, 1816 {'8', 'c', 0x3227},
1817 {'9', 'c', 0x3228}, 1817 {'9', 'c', 0x3228},
1818 /* code points 0xe000 - 0xefff excluded, they have no assigned 1818 // code points 0xe000 - 0xefff excluded, they have no assigned
1819 * characters, only used in proposals. */ 1819 // characters, only used in proposals.
1820 {'f', 'f', 0xfb00}, 1820 {'f', 'f', 0xfb00},
1821 {'f', 'i', 0xfb01}, 1821 {'f', 'i', 0xfb01},
1822 {'f', 'l', 0xfb02}, 1822 {'f', 'l', 0xfb02},
1823 {'f', 't', 0xfb05}, 1823 {'f', 't', 0xfb05},
1824 {'s', 't', 0xfb06}, 1824 {'s', 't', 0xfb06},
1825 1825
1826 {NUL, NUL, NUL} 1826 {NUL, NUL, NUL}
1827 }; 1827 };
1828 1828
1829 # endif /* OLD_DIGRAPHS */ 1829 # endif // OLD_DIGRAPHS
1830 # endif /* EBCDIC */ 1830 # endif // EBCDIC
1831 # endif /* !HPUX_DIGRAPHS */ 1831 # endif // !HPUX_DIGRAPHS
1832 #endif /* !__MINT__ */ 1832 #endif // !__MINT__
1833 1833
1834 /* 1834 /*
1835 * handle digraphs after typing a character 1835 * handle digraphs after typing a character
1836 */ 1836 */
1837 int 1837 int
1838 do_digraph(int c) 1838 do_digraph(int c)
1839 { 1839 {
1840 static int backspaced; /* character before K_BS */ 1840 static int backspaced; // character before K_BS
1841 static int lastchar; /* last typed character */ 1841 static int lastchar; // last typed character
1842 1842
1843 if (c == -1) /* init values */ 1843 if (c == -1) // init values
1844 { 1844 {
1845 backspaced = -1; 1845 backspaced = -1;
1846 } 1846 }
1847 else if (p_dg) 1847 else if (p_dg)
1848 { 1848 {
1919 * mode. 1919 * mode.
1920 * Returns composed character, or NUL when ESC was used. 1920 * Returns composed character, or NUL when ESC was used.
1921 */ 1921 */
1922 int 1922 int
1923 get_digraph( 1923 get_digraph(
1924 int cmdline) /* TRUE when called from the cmdline */ 1924 int cmdline) // TRUE when called from the cmdline
1925 { 1925 {
1926 int c, cc; 1926 int c, cc;
1927 1927
1928 ++no_mapping; 1928 ++no_mapping;
1929 ++allow_keys; 1929 ++allow_keys;
1930 c = plain_vgetc(); 1930 c = plain_vgetc();
1931 --no_mapping; 1931 --no_mapping;
1932 --allow_keys; 1932 --allow_keys;
1933 if (c != ESC) /* ESC cancels CTRL-K */ 1933 if (c != ESC) // ESC cancels CTRL-K
1934 { 1934 {
1935 if (IS_SPECIAL(c)) /* insert special key code */ 1935 if (IS_SPECIAL(c)) // insert special key code
1936 return c; 1936 return c;
1937 if (cmdline) 1937 if (cmdline)
1938 { 1938 {
1939 if (char2cells(c) == 1 1939 if (char2cells(c) == 1
1940 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) 1940 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
1950 ++no_mapping; 1950 ++no_mapping;
1951 ++allow_keys; 1951 ++allow_keys;
1952 cc = plain_vgetc(); 1952 cc = plain_vgetc();
1953 --no_mapping; 1953 --no_mapping;
1954 --allow_keys; 1954 --allow_keys;
1955 if (cc != ESC) /* ESC cancels CTRL-K */ 1955 if (cc != ESC) // ESC cancels CTRL-K
1956 return getdigraph(c, cc, TRUE); 1956 return getdigraph(c, cc, TRUE);
1957 } 1957 }
1958 return NUL; 1958 return NUL;
1959 } 1959 }
1960 1960
2027 (void)convert_setup(&vc, NULL, NULL); 2027 (void)convert_setup(&vc, NULL, NULL);
2028 } 2028 }
2029 } 2029 }
2030 #endif 2030 #endif
2031 2031
2032 /* Ignore multi-byte characters when not in multi-byte mode. */ 2032 // Ignore multi-byte characters when not in multi-byte mode.
2033 if (!has_mbyte && retval > 0xff) 2033 if (!has_mbyte && retval > 0xff)
2034 retval = 0; 2034 retval = 0;
2035 2035
2036 if (retval == 0) /* digraph deleted or not found */ 2036 if (retval == 0) // digraph deleted or not found
2037 { 2037 {
2038 if (char1 == ' ' && meta_char) /* <space> <char> --> meta-char */ 2038 if (char1 == ' ' && meta_char) // <space> <char> --> meta-char
2039 return (char2 | 0x80); 2039 return (char2 | 0x80);
2040 return char2; 2040 return char2;
2041 } 2041 }
2042 return retval; 2042 return retval;
2043 } 2043 }
2092 emsg(_(e_number_exp)); 2092 emsg(_(e_number_exp));
2093 return; 2093 return;
2094 } 2094 }
2095 n = getdigits(&str); 2095 n = getdigits(&str);
2096 2096
2097 /* If the digraph already exists, replace the result. */ 2097 // If the digraph already exists, replace the result.
2098 dp = (digr_T *)user_digraphs.ga_data; 2098 dp = (digr_T *)user_digraphs.ga_data;
2099 for (i = 0; i < user_digraphs.ga_len; ++i) 2099 for (i = 0; i < user_digraphs.ga_len; ++i)
2100 { 2100 {
2101 if ((int)dp->char1 == char1 && (int)dp->char2 == char2) 2101 if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2102 { 2102 {
2104 break; 2104 break;
2105 } 2105 }
2106 ++dp; 2106 ++dp;
2107 } 2107 }
2108 2108
2109 /* Add a new digraph to the table. */ 2109 // Add a new digraph to the table.
2110 if (i == user_digraphs.ga_len) 2110 if (i == user_digraphs.ga_len)
2111 { 2111 {
2112 if (ga_grow(&user_digraphs, 1) == OK) 2112 if (ga_grow(&user_digraphs, 1) == OK)
2113 { 2113 {
2114 dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len; 2114 dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
2145 for (i = 0; dp->char1 != NUL && !got_int; ++i) 2145 for (i = 0; dp->char1 != NUL && !got_int; ++i)
2146 { 2146 {
2147 #if defined(USE_UNICODE_DIGRAPHS) 2147 #if defined(USE_UNICODE_DIGRAPHS)
2148 digr_T tmp; 2148 digr_T tmp;
2149 2149
2150 /* May need to convert the result to 'encoding'. */ 2150 // May need to convert the result to 'encoding'.
2151 tmp.char1 = dp->char1; 2151 tmp.char1 = dp->char1;
2152 tmp.char2 = dp->char2; 2152 tmp.char2 = dp->char2;
2153 tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE); 2153 tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
2154 if (tmp.result != 0 && tmp.result != tmp.char2 2154 if (tmp.result != 0 && tmp.result != tmp.char2
2155 && (has_mbyte || tmp.result <= 255)) 2155 && (has_mbyte || tmp.result <= 255))
2174 #endif 2174 #endif
2175 printdigraph(dp, NULL); 2175 printdigraph(dp, NULL);
2176 ui_breakcheck(); 2176 ui_breakcheck();
2177 ++dp; 2177 ++dp;
2178 } 2178 }
2179 must_redraw = CLEAR; /* clear screen, because some digraphs may be 2179 must_redraw = CLEAR; // clear screen, because some digraphs may be
2180 wrong, in which case we messed up ScreenLines */ 2180 // wrong, in which case we messed up ScreenLines
2181 } 2181 }
2182 2182
2183 static struct dg_header_entry { 2183 static struct dg_header_entry {
2184 int dg_start; 2184 int dg_start;
2185 char *dg_header; 2185 char *dg_header;
2257 *p = NUL; 2257 *p = NUL;
2258 msg_outtrans(buf); 2258 msg_outtrans(buf);
2259 p = buf; 2259 p = buf;
2260 if (has_mbyte) 2260 if (has_mbyte)
2261 { 2261 {
2262 /* add a space to draw a composing char on */ 2262 // add a space to draw a composing char on
2263 if (enc_utf8 && utf_iscomposing(dp->result)) 2263 if (enc_utf8 && utf_iscomposing(dp->result))
2264 *p++ = ' '; 2264 *p++ = ' ';
2265 p += (*mb_char2bytes)(dp->result, p); 2265 p += (*mb_char2bytes)(dp->result, p);
2266 } 2266 }
2267 else 2267 else
2274 vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result); 2274 vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
2275 msg_outtrans(buf); 2275 msg_outtrans(buf);
2276 } 2276 }
2277 } 2277 }
2278 2278
2279 #endif /* FEAT_DIGRAPHS */ 2279 #endif // FEAT_DIGRAPHS
2280 2280
2281 #if defined(FEAT_KEYMAP) || defined(PROTO) 2281 #if defined(FEAT_KEYMAP) || defined(PROTO)
2282 2282
2283 /* structure used for b_kmap_ga.ga_data */ 2283 // structure used for b_kmap_ga.ga_data
2284 typedef struct 2284 typedef struct
2285 { 2285 {
2286 char_u *from; 2286 char_u *from;
2287 char_u *to; 2287 char_u *to;
2288 } kmap_T; 2288 } kmap_T;
2289 2289
2290 #define KMAP_MAXLEN 20 /* maximum length of "from" or "to" */ 2290 #define KMAP_MAXLEN 20 // maximum length of "from" or "to"
2291 2291
2292 static void keymap_unload(void); 2292 static void keymap_unload(void);
2293 2293
2294 /* 2294 /*
2295 * Set up key mapping tables for the 'keymap' option. 2295 * Set up key mapping tables for the 'keymap' option.
2302 { 2302 {
2303 curbuf->b_kmap_state &= ~KEYMAP_INIT; 2303 curbuf->b_kmap_state &= ~KEYMAP_INIT;
2304 2304
2305 if (*curbuf->b_p_keymap == NUL) 2305 if (*curbuf->b_p_keymap == NUL)
2306 { 2306 {
2307 /* Stop any active keymap and clear the table. Also remove 2307 // Stop any active keymap and clear the table. Also remove
2308 * b:keymap_name, as no keymap is active now. */ 2308 // b:keymap_name, as no keymap is active now.
2309 keymap_unload(); 2309 keymap_unload();
2310 do_cmdline_cmd((char_u *)"unlet! b:keymap_name"); 2310 do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
2311 } 2311 }
2312 else 2312 else
2313 { 2313 {
2314 char_u *buf; 2314 char_u *buf;
2315 size_t buflen; 2315 size_t buflen;
2316 2316
2317 /* Source the keymap file. It will contain a ":loadkeymap" command 2317 // Source the keymap file. It will contain a ":loadkeymap" command
2318 * which will call ex_loadkeymap() below. */ 2318 // which will call ex_loadkeymap() below.
2319 buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14; 2319 buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14;
2320 buf = alloc(buflen); 2320 buf = alloc(buflen);
2321 if (buf == NULL) 2321 if (buf == NULL)
2322 return e_outofmem; 2322 return e_outofmem;
2323 2323
2324 /* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */ 2324 // try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath'
2325 vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim", 2325 vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
2326 curbuf->b_p_keymap, p_enc); 2326 curbuf->b_p_keymap, p_enc);
2327 if (source_runtime(buf, 0) == FAIL) 2327 if (source_runtime(buf, 0) == FAIL)
2328 { 2328 {
2329 /* try finding "keymap/'keymap'.vim" in 'runtimepath' */ 2329 // try finding "keymap/'keymap'.vim" in 'runtimepath'
2330 vim_snprintf((char *)buf, buflen, "keymap/%s.vim", 2330 vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
2331 curbuf->b_p_keymap); 2331 curbuf->b_p_keymap);
2332 if (source_runtime(buf, 0) == FAIL) 2332 if (source_runtime(buf, 0) == FAIL)
2333 { 2333 {
2334 vim_free(buf); 2334 vim_free(buf);
2349 { 2349 {
2350 char_u *line; 2350 char_u *line;
2351 char_u *p; 2351 char_u *p;
2352 char_u *s; 2352 char_u *s;
2353 kmap_T *kp; 2353 kmap_T *kp;
2354 #define KMAP_LLEN 200 /* max length of "to" and "from" together */ 2354 #define KMAP_LLEN 200 // max length of "to" and "from" together
2355 char_u buf[KMAP_LLEN + 11]; 2355 char_u buf[KMAP_LLEN + 11];
2356 int i; 2356 int i;
2357 char_u *save_cpo = p_cpo; 2357 char_u *save_cpo = p_cpo;
2358 2358
2359 if (!getline_equal(eap->getline, eap->cookie, getsourceline)) 2359 if (!getline_equal(eap->getline, eap->cookie, getsourceline))
2368 keymap_unload(); 2368 keymap_unload();
2369 2369
2370 curbuf->b_kmap_state = 0; 2370 curbuf->b_kmap_state = 0;
2371 ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20); 2371 ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
2372 2372
2373 /* Set 'cpoptions' to "C" to avoid line continuation. */ 2373 // Set 'cpoptions' to "C" to avoid line continuation.
2374 p_cpo = (char_u *)"C"; 2374 p_cpo = (char_u *)"C";
2375 2375
2376 /* 2376 /*
2377 * Get each line of the sourced file, break at the end. 2377 * Get each line of the sourced file, break at the end.
2378 */ 2378 */
2436 kmap_T *kp; 2436 kmap_T *kp;
2437 2437
2438 if (!(curbuf->b_kmap_state & KEYMAP_LOADED)) 2438 if (!(curbuf->b_kmap_state & KEYMAP_LOADED))
2439 return; 2439 return;
2440 2440
2441 /* Set 'cpoptions' to "C" to avoid line continuation. */ 2441 // Set 'cpoptions' to "C" to avoid line continuation.
2442 p_cpo = (char_u *)"C"; 2442 p_cpo = (char_u *)"C";
2443 2443
2444 /* clear the ":lmap"s */ 2444 // clear the ":lmap"s
2445 kp = (kmap_T *)curbuf->b_kmap_ga.ga_data; 2445 kp = (kmap_T *)curbuf->b_kmap_ga.ga_data;
2446 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) 2446 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2447 { 2447 {
2448 vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from); 2448 vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
2449 (void)do_map(1, buf, LANGMAP, FALSE); 2449 (void)do_map(1, buf, LANGMAP, FALSE);
2467 { 2467 {
2468 vim_free(kp[i].from); 2468 vim_free(kp[i].from);
2469 vim_free(kp[i].to); 2469 vim_free(kp[i].to);
2470 } 2470 }
2471 } 2471 }
2472 #endif /* FEAT_KEYMAP */ 2472 #endif // FEAT_KEYMAP