blob: 31d7f3788fb49d62748380103de3550b9423fb38 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001/* vi:set ts=8 sts=4 sw=4:
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 * See README.txt for an overview of the Vim source code.
8 */
9
10/*
11 * digraph.c: code for digraphs
12 */
13
14#include "vim.h"
15
16#if defined(FEAT_DIGRAPHS) || defined(PROTO)
17
18#ifdef FEAT_MBYTE
19typedef int result_T;
20#else
21typedef char_u result_T;
22#endif
23
24typedef struct digraph
25{
26 char_u char1;
27 char_u char2;
28 result_T result;
29} digr_T;
30
31static int getexactdigraph __ARGS((int, int, int));
32static void printdigraph __ARGS((digr_T *));
33
34/* digraphs added by the user */
35static garray_T user_digraphs = {0, 0, sizeof(digr_T), 10, NULL};
36
37/*
38 * Note: Characters marked with XX are not included literally, because some
39 * compilers cannot handle them (Amiga SAS/C is the most picky one).
40 */
41#if defined(MSDOS) || defined(OS2)
42 /*
43 * MSDOS digraphs.
44 */
45digr_T digraphdefault[] =
46 {{'C', ',', 128}, /* ~@ XX */
47 {'u', '"', 129}, /*  */
48 {'e', '\'', 130}, /* ‚ */
49 {'a', '^', 131}, /* ƒ */
50 {'a', '"', 132}, /* „ */
51 {'a', '`', 133}, /* … */
52 {'a', '@', 134}, /* † */
53 {'c', ',', 135}, /* ~G XX */
54 {'e', '^', 136}, /* ~H XX */
55 {'e', '"', 137}, /* ‰ */
56 {'e', '`', 138}, /* Š */
57 {'i', '"', 139}, /* ‹ */
58 {'i', '^', 140}, /* Œ */
59 {'i', '`', 141}, /*  */
60 {'A', '"', 142}, /* ~N XX */
61 {'A', '@', 143}, /*  */
62 {'E', '\'', 144}, /*  */
63 {'a', 'e', 145}, /* ‘ */
64 {'A', 'E', 146}, /* ’ */
65 {'o', '^', 147}, /* “ */
66 {'o', '"', 148}, /* ” */
67 {'o', '`', 149}, /* • */
68 {'u', '^', 150}, /* – */
69 {'u', '`', 151}, /* — */
70 {'y', '"', 152}, /* ˜ */
71 {'O', '"', 153}, /* ™ */
72 {'U', '"', 154}, /* š */
73 {'c', '|', 155}, /* › */
74 {'$', '$', 156}, /* œ */
75 {'Y', '-', 157}, /* ~] XX */
76 {'P', 't', 158}, /* ž */
77 {'f', 'f', 159}, /* Ÿ */
78 {'a', '\'', 160}, /*   */
79 {'i', '\'', 161}, /* ¡ */
80 {'o', '\'', 162}, /* ¢ */
81 {'u', '\'', 163}, /* x XX */
82 {'n', '~', 164}, /* ¤ */
83 {'N', '~', 165}, /* ¥ */
84 {'a', 'a', 166}, /* ¦ */
85 {'o', 'o', 167}, /* § */
86 {'~', '?', 168}, /* ¨ */
87 {'-', 'a', 169}, /* © */
88 {'a', '-', 170}, /* ª */
89 {'1', '2', 171}, /* « */
90 {'1', '4', 172}, /* ¬ */
91 {'~', '!', 173}, /* ­ */
92 {'<', '<', 174}, /* ® */
93 {'>', '>', 175}, /* ¯ */
94
95 {'s', 's', 225}, /* á */
96 {'j', 'u', 230}, /* æ */
97 {'o', '/', 237}, /* í */
98 {'+', '-', 241}, /* ñ */
99 {'>', '=', 242}, /* ò */
100 {'<', '=', 243}, /* ó */
101 {':', '-', 246}, /* ö */
102 {'~', '~', 247}, /* ÷ */
103 {'~', 'o', 248}, /* ø */
104 {'2', '2', 253}, /* ý */
105 {NUL, NUL, NUL}
106 };
107
108#else /* !MSDOS && !OS2 */
109# ifdef __MINT__
110
111 /*
112 * ATARI digraphs
113 */
114digr_T digraphdefault[] =
115 {{'C', ',', 128}, /* ~@ XX */
116 {'u', '"', 129}, /*  */
117 {'e', '\'', 130}, /* ‚ */
118 {'a', '^', 131}, /* ƒ */
119 {'a', '"', 132}, /* „ */
120 {'a', '`', 133}, /* … */
121 {'a', '@', 134}, /* † */
122 {'c', ',', 135}, /* ~G XX */
123 {'e', '^', 136}, /* ~H XX */
124 {'e', '"', 137}, /* ‰ */
125 {'e', '`', 138}, /* Š */
126 {'i', '"', 139}, /* ‹ */
127 {'i', '^', 140}, /* Œ */
128 {'i', '`', 141}, /*  */
129 {'A', '"', 142}, /* Ž */
130 {'A', '@', 143}, /*  */
131 {'E', '\'', 144}, /*  */
132 {'a', 'e', 145}, /* ‘ */
133 {'A', 'E', 146}, /* ’ */
134 {'o', '^', 147}, /* “ */
135 {'o', '"', 148}, /* ” */
136 {'o', '`', 149}, /* • */
137 {'u', '^', 150}, /* – */
138 {'u', '`', 151}, /* — */
139 {'y', '"', 152}, /* ˜ */
140 {'O', '"', 153}, /* ™ */
141 {'U', '"', 154}, /* š */
142 {'c', '|', 155}, /* › */
143 {'$', '$', 156}, /* œ */
144 {'Y', '-', 157}, /* ~] XX */
145 {'s', 's', 158}, /* ž */
146 {'f', 'f', 159}, /* Ÿ */
147 {'a', '\'', 160}, /*   */
148 {'i', '\'', 161}, /* ¡ */
149 {'o', '\'', 162}, /* ¢ */
150 {'u', '\'', 163}, /* £ */
151 {'n', '~', 164}, /* ¤ */
152 {'N', '~', 165}, /* ¥ */
153 {'a', 'a', 166}, /* ¦ */
154 {'o', 'o', 167}, /* § */
155 {'~', '?', 168}, /* ¨ */
156 {'-', 'a', 169}, /* © */
157 {'a', '-', 170}, /* ª */
158 {'1', '2', 171}, /* « */
159 {'1', '4', 172}, /* ¬ */
160 {'~', '!', 173}, /* ­ */
161 {'<', '<', 174}, /* ® */
162 {'>', '>', 175}, /* ¯ */
163 {'j', 'u', 230}, /* æ */
164 {'o', '/', 237}, /* í */
165 {'+', '-', 241}, /* ñ */
166 {'>', '=', 242}, /* ò */
167 {'<', '=', 243}, /* ó */
168 {':', '-', 246}, /* ö */
169 {'~', '~', 247}, /* ÷ */
170 {'~', 'o', 248}, /* ø */
171 {'2', '2', 253}, /* ý */
172 {NUL, NUL, NUL}
173 };
174
175# else /* !__MINT__ */
176# ifdef HPUX_DIGRAPHS
177
178 /*
179 * different HPUX digraphs
180 */
181digr_T digraphdefault[] =
182 {{'A', '`', 161}, /* ¡ */
183 {'A', '^', 162}, /* ¢ */
184 {'E', '`', 163}, /* £ */
185 {'E', '^', 164}, /* ¤ */
186 {'E', '"', 165}, /* ¥ */
187 {'I', '^', 166}, /* ¦ */
188 {'I', '"', 167}, /* § */
189 {'\'', '\'', 168}, /* ¨ */
190 {'`', '`', 169}, /* © */
191 {'^', '^', 170}, /* ª */
192 {'"', '"', 171}, /* « */
193 {'~', '~', 172}, /* ¬ */
194 {'U', '`', 173}, /* ­ */
195 {'U', '^', 174}, /* ® */
196 {'L', '=', 175}, /* ¯ */
197 {'~', '_', 176}, /* ° */
198 {'Y', '\'', 177}, /* ± */
199 {'y', '\'', 178}, /* ² */
200 {'~', 'o', 179}, /* ³ */
201 {'C', ',', 180}, /* ´ */
202 {'c', ',', 181}, /* µ */
203 {'N', '~', 182}, /* ¶ */
204 {'n', '~', 183}, /* · */
205 {'~', '!', 184}, /* ¸ */
206 {'~', '?', 185}, /* ¹ */
207 {'o', 'x', 186}, /* º */
208 {'L', '-', 187}, /* » */
209 {'Y', '=', 188}, /* ¼ */
210 {'p', 'p', 189}, /* ½ */
211 {'f', 'l', 190}, /* ¾ */
212 {'c', '|', 191}, /* ¿ */
213 {'a', '^', 192}, /* À */
214 {'e', '^', 193}, /* Á */
215 {'o', '^', 194}, /* Â */
216 {'u', '^', 195}, /* Ã */
217 {'a', '\'', 196}, /* Ä */
218 {'e', '\'', 197}, /* Å */
219 {'o', '\'', 198}, /* Æ */
220 {'u', '\'', 199}, /* Ç */
221 {'a', '`', 200}, /* È */
222 {'e', '`', 201}, /* É */
223 {'o', '`', 202}, /* Ê */
224 {'u', '`', 203}, /* Ë */
225 {'a', '"', 204}, /* Ì */
226 {'e', '"', 205}, /* Í */
227 {'o', '"', 206}, /* Î */
228 {'u', '"', 207}, /* Ï */
229 {'A', 'o', 208}, /* Ð */
230 {'i', '^', 209}, /* Ñ */
231 {'O', '/', 210}, /* Ò */
232 {'A', 'E', 211}, /* Ó */
233 {'a', 'o', 212}, /* Ô */
234 {'i', '\'', 213}, /* Õ */
235 {'o', '/', 214}, /* Ö */
236 {'a', 'e', 215}, /* × */
237 {'A', '"', 216}, /* Ø */
238 {'i', '`', 217}, /* Ù */
239 {'O', '"', 218}, /* Ú */
240 {'U', '"', 219}, /* Û */
241 {'E', '\'', 220}, /* Ü */
242 {'i', '"', 221}, /* Ý */
243 {'s', 's', 222}, /* Þ */
244 {'O', '^', 223}, /* ß */
245 {'A', '\'', 224}, /* à */
246 {'A', '~', 225}, /* á */
247 {'a', '~', 226}, /* â */
248 {'D', '-', 227}, /* ã */
249 {'d', '-', 228}, /* ä */
250 {'I', '\'', 229}, /* å */
251 {'I', '`', 230}, /* æ */
252 {'O', '\'', 231}, /* ç */
253 {'O', '`', 232}, /* è */
254 {'O', '~', 233}, /* é */
255 {'o', '~', 234}, /* ê */
256 {'S', '~', 235}, /* ë */
257 {'s', '~', 236}, /* ì */
258 {'U', '\'', 237}, /* í */
259 {'Y', '"', 238}, /* î */
260 {'y', '"', 239}, /* ï */
261 {'p', '-', 240}, /* ð */
262 {'p', '~', 241}, /* ñ */
263 {'~', '.', 242}, /* ò */
264 {'j', 'u', 243}, /* ó */
265 {'P', 'p', 244}, /* ô */
266 {'3', '4', 245}, /* õ */
267 {'-', '-', 246}, /* ö */
268 {'1', '4', 247}, /* ÷ */
269 {'1', '2', 248}, /* ø */
270 {'a', '_', 249}, /* ù */
271 {'o', '_', 250}, /* ú */
272 {'<', '<', 251}, /* û */
273 {'x', 'x', 252}, /* ü */
274 {'>', '>', 253}, /* ý */
275 {'+', '-', 254}, /* þ */
276 {'n', 'u', 255}, /* x XX */
277 {NUL, NUL, NUL}
278 };
279
280# else /* !HPUX_DIGRAPHS */
281
282# ifdef EBCDIC
283
284 /*
285 * EBCDIC - ISO digraphs
286 * TODO: EBCDIC Table is Code-Page 1047
287 */
288digr_T digraphdefault[] =
289 {{'a', '^', 66}, /* â */
290 {'a', '"', 67}, /* ä */
291 {'a', '`', 68}, /* à */
292 {'a', '\'', 69}, /* á */
293 {'a', '~', 70}, /* ã */
294 {'a', '@', 71}, /* å */
295 {'a', 'a', 71}, /* å */
296 {'c', ',', 72}, /* ç */
297 {'n', '~', 73}, /* ñ */
298 {'c', '|', 74}, /* ¢ */
299 {'e', '\'', 81}, /* é */
300 {'e', '^', 82}, /* ê */
301 {'e', '"', 83}, /* ë */
302 {'e', '`', 84}, /* è */
303 {'i', '\'', 85}, /* í */
304 {'i', '^', 86}, /* î */
305 {'i', '"', 87}, /* ï */
306 {'i', '`', 88}, /* ì */
307 {'s', 's', 89}, /* ß */
308 {'A', '^', 98}, /* Â */
309 {'A', '"', 99}, /* Ä */
310 {'A', '`', 100}, /* À */
311 {'A', '\'', 101}, /* Á */
312 {'A', '~', 102}, /* Ã */
313 {'A', '@', 103}, /* Å */
314 {'A', 'A', 103}, /* Å */
315 {'C', ',', 104}, /* Ç */
316 {'N', '~', 105}, /* Ñ */
317 {'|', '|', 106}, /* ¦ */
318 {'o', '/', 112}, /* ø */
319 {'E', '\'', 113}, /* É */
320 {'E', '^', 114}, /* Ê */
321 {'E', '"', 115}, /* Ë */
322 {'E', '`', 116}, /* È */
323 {'I', '\'', 117}, /* Í */
324 {'I', '^', 118}, /* Î */
325 {'I', '"', 119}, /* Ï */
326 {'I', '`', 120}, /* Ì */
327 {'O', '/', 128}, /* 0/ XX */
328 {'<', '<', 138}, /* « */
329 {'>', '>', 139}, /* » */
330 {'d', '-', 140}, /* ð */
331 {'y', '\'', 141}, /* ý */
332 {'i', 'p', 142}, /* þ */
333 {'+', '-', 143}, /* ± */
334 {'~', 'o', 144}, /* ° */
335 {'a', '-', 154}, /* ª */
336 {'o', '-', 155}, /* º */
337 {'a', 'e', 156}, /* æ */
338 {',', ',', 157}, /* , XX */
339 {'A', 'E', 158}, /* Æ */
340 {'o', 'x', 159}, /* ¤ - currency symbol in ISO 8859-1 */
341 {'e', '=', 159}, /* ¤ - euro symbol in ISO 8859-15 */
342 {'j', 'u', 160}, /* µ */
343 {'y', '"', 167}, /* x XX */
344 {'~', '!', 170}, /* ¡ */
345 {'~', '?', 171}, /* ¿ */
346 {'D', '-', 172}, /* Ð */
347 {'I', 'p', 174}, /* Þ */
348 {'r', 'O', 175}, /* ® */
349 {'-', ',', 176}, /* ¬ */
350 {'$', '$', 177}, /* £ */
351 {'Y', '-', 178}, /* ¥ */
352 {'~', '.', 179}, /* · */
353 {'c', 'O', 180}, /* © */
354 {'p', 'a', 181}, /* § */
355 {'p', 'p', 182}, /* ¶ */
356 {'1', '4', 183}, /* ¼ */
357 {'1', '2', 184}, /* ½ */
358 {'3', '4', 185}, /* ¾ */
359 {'Y', '\'', 186}, /* Ý */
360 {'"', '"', 187}, /* ¨ */
361 {'-', '=', 188}, /* ¯ */
362 {'\'', '\'', 190}, /* ´ */
363 {'O', 'E', 191}, /* × - OE in ISO 8859-15 */
364 {'/', '\\', 191}, /* × - multiplication symbol in ISO 8859-1 */
365 {'-', '-', 202}, /* ­ */
366 {'o', '^', 203}, /* ô */
367 {'o', '"', 204}, /* ö */
368 {'o', '`', 205}, /* ò */
369 {'o', '\'', 206}, /* ó */
370 {'o', '~', 207}, /* õ */
371 {'1', '1', 218}, /* ¹ */
372 {'u', '^', 219}, /* û */
373 {'u', '"', 220}, /* ü */
374 {'u', '`', 221}, /* ù */
375 {'u', '\'', 222}, /* ú */
376 {':', '-', 225}, /* ÷ - division symbol in ISO 8859-1 */
377 {'o', 'e', 225}, /* ÷ - oe in ISO 8859-15 */
378 {'2', '2', 234}, /* ² */
379 {'O', '^', 235}, /* Ô */
380 {'O', '"', 236}, /* Ö */
381 {'O', '`', 237}, /* Ò */
382 {'O', '\'', 238}, /* Ó */
383 {'O', '~', 239}, /* Õ */
384 {'3', '3', 250}, /* ³ */
385 {'U', '^', 251}, /* Û */
386 {'U', '"', 252}, /* Ü */
387 {'U', '`', 253}, /* Ù */
388 {'U', '\'', 254}, /* Ú */
389 {NUL, NUL, NUL}
390 };
391
392# else
393# if defined(MACOS) && !defined(FEAT_MBYTE)
394
395 /*
396 * Macintosh digraphs
397 */
398digr_T digraphdefault[] =
399 {{'a', 't', 64}, /* @ */
400 {'A', '"', 128}, /* ~@ XX */
401 {'A', 'o', 129}, /* Å */
402 {'C', ',', 130}, /* Ç */
403 {'E', '\'', 131}, /* É */
404 {'N', '~', 132}, /* Ñ */
405 {'O', '"', 133}, /* Ö */
406 {'U', '"', 134}, /* Ü */
407 {'a', '\'', 135}, /* ~G XX */
408 {'a', '`', 136}, /* ~H XX */
409 {'a', '^', 137}, /* â */
410 {'a', '"', 138}, /* ä */
411 {'a', '~', 139}, /* ã */
412 {'a', 'o', 140}, /* å */
413 {'c', ',', 141}, /* ç */
414 {'e', '\'', 142}, /* é */
415 {'e', '`', 143}, /* è */
416 {'e', '^', 144}, /* ê */
417 {'e', '"', 145}, /* ë */
418 {'i', '\'', 146}, /* í */
419 {'i', '`', 147}, /* ì */
420 {'i', '^', 148}, /* î */
421 {'i', '"', 149}, /* ï */
422 {'n', '~', 150}, /* ñ */
423 {'o', '\'', 151}, /* ó */
424 {'o', '`', 152}, /* ò */
425 {'o', '^', 153}, /* ô */
426 {'o', '"', 154}, /* ö */
427 {'o', '~', 155}, /* o */
428 {'u', '\'', 156}, /* ú */
429 {'u', '`', 157}, /* ~] XX */
430 {'u', '^', 158}, /* û */
431 {'u', '"', 159}, /* ü */
432 {'+', '_', 160}, /* Ý */
433 {'~', 'o', 161}, /* ° */
434 {'c', '|', 162}, /* ¢ */
435 {'$', '$', 163}, /* £ */
436 {'p', 'a', 164}, /* § */
437 {'.', '.', 165}, /* * */
438 {'P', 'P', 166}, /* ¶ */
439 {'s', 's', 167}, /* ß */
440 {'r', 'O', 168}, /* ® */
441 {'c', 'O', 169}, /* © */
442 {'T', 'M', 170}, /*  */
443 {'=', '/', 173}, /* ‚ */
444 {'A', 'E', 174}, /* Æ */
445 {'O', '/', 175}, /* Ø */
446 {'0', '0', 176}, /* ƒ */
447 {'+', '-', 177}, /* ± */
448 {'<', '=', 178}, /* ¾ */
449 {'>', '=', 179}, /* „ */
450 {'Y', '-', 180}, /* ¥ */
451 {'j', 'u', 181}, /* µ */
452 {'m', 'u', 181}, /* µ */
453 {'d', 'd', 182}, /*  */
454 {'S', 'S', 183}, /* … */
455 {'S', 'I', 183}, /* … */
456 {'P', 'I', 184}, /* ½ */
457 {'p', 'i', 185}, /* ¼ */
458 {'I', 'I', 186}, /* † */
459 {'a', '-', 187}, /* » */
460 {'o', '-', 188}, /* º */
461 {'O', 'M', 189}, /* ½ */
462 {'a', 'e', 190}, /* æ */
463 {'o', '/', 191}, /* ø */
464 {'~', '?', 192}, /* ¿ */
465 {'~', '!', 193}, /* ¡ */
466 {'-', ',', 194}, /* ¬ */
467 {'v', '-', 195}, /* ~H XX */
468 {'f', '-', 196}, /* Ÿ */
469 {'~', '~', 197}, /* ‰ */
470 {'D', 'E', 198}, /*  */
471 {'<', '<', 199}, /* « */
472 {'>', '>', 200}, /* » */
473 {'.', ':', 201}, /* Š */
474 {'A', '`', 203}, /* À */
475 {'A', '~', 204}, /* Ã */
476 {'O', '~', 205}, /* Õ */
477 {'O', 'E', 206}, /* ‘ */
478 {'o', 'e', 207}, /* ¦ */
479 {'-', '.', 208}, /* - */
480 {'-', '-', 209}, /* - */
481 {'`', '`', 210}, /* " */
482 {'\'', '\'', 211}, /* " */
483 {'`', ' ', 212}, /* ' */
484 {'\'', ' ', 213}, /* ' */
485 {'-', ':', 214}, /* ÷ */
486 {'D', 'I', 215}, /* × */
487 {'y', ':', 216}, /* ÿ */
488 {'Y', ':', 217}, /*  */
489 {'/', '/', 218}, /* Ž */
490 {'E', '=', 219}, /* ¤ Euro System >=8.5 */
491 {'o', 'x', 219}, /* ¤ Currency System <=8.1*/
492 {'<', ' ', 220}, /* Ð */
493 {'>', ' ', 221}, /* ð */
494 {'f', 'i', 222}, /* Þ */
495 {'f', 'l', 223}, /* þ */
496 {'+', '+', 224}, /* ý */
497 {'~', '.', 225}, /* · */
498 {',', ' ', 226}, /* ’ */
499 {',', ',', 227}, /* “ */
500 {'%', '.', 228}, /* ” */
501 {'%', '0', 228}, /* ” */
502 {'A', '^', 229}, /* Â */
503 {'E', '^', 230}, /* Ê */
504 {'A', '\'', 231}, /* Á */
505 {'E', '"', 232}, /* Ë */
506 {'E', '`', 233}, /* È */
507 {'I', '\'', 234}, /* Í */
508 {'I', '^', 235}, /* Î */
509 {'I', '"', 236}, /* Ï */
510 {'I', '`', 237}, /* Ì */
511 {'O', '\'', 238}, /* Ó */
512 {'O', '^', 239}, /* Ô */
513 {'A', 'P', 240}, /* • */
514 {'O', '`', 241}, /* Ò */
515 {'U', '\'', 242}, /* Ú */
516 {'U', '^', 243}, /* Û */
517 {'U', '`', 244}, /* Ù */
518 {'i', '.', 245}, /* ž */
519 {NUL, NUL, NUL}
520 };
521
522# else /* !MACOS */
523
524# ifdef OLD_DIGRAPHS
525
526 /*
527 * digraphs compatible with Vim 5.x
528 */
529digr_T digraphdefault[] =
530 {{'~', '!', 161}, /* ¡ */
531 {'c', '|', 162}, /* ¢ */
532 {'$', '$', 163}, /* £ */
533 {'o', 'x', 164}, /* ¤ - currency symbol in ISO 8859-1 */
534 {'e', '=', 164}, /* ¤ - euro symbol in ISO 8859-15 */
535 {'Y', '-', 165}, /* ¥ */
536 {'|', '|', 166}, /* ¦ */
537 {'p', 'a', 167}, /* § */
538 {'"', '"', 168}, /* ¨ */
539 {'c', 'O', 169}, /* © */
540 {'a', '-', 170}, /* ª */
541 {'<', '<', 171}, /* « */
542 {'-', ',', 172}, /* ¬ */
543 {'-', '-', 173}, /* ­ */
544 {'r', 'O', 174}, /* ® */
545 {'-', '=', 175}, /* ¯ */
546 {'~', 'o', 176}, /* ° */
547 {'+', '-', 177}, /* ± */
548 {'2', '2', 178}, /* ² */
549 {'3', '3', 179}, /* ³ */
550 {'\'', '\'', 180}, /* ´ */
551 {'j', 'u', 181}, /* µ */
552 {'p', 'p', 182}, /* ¶ */
553 {'~', '.', 183}, /* · */
554 {',', ',', 184}, /* ¸ */
555 {'1', '1', 185}, /* ¹ */
556 {'o', '-', 186}, /* º */
557 {'>', '>', 187}, /* » */
558 {'1', '4', 188}, /* ¼ */
559 {'1', '2', 189}, /* ½ */
560 {'3', '4', 190}, /* ¾ */
561 {'~', '?', 191}, /* ¿ */
562 {'A', '`', 192}, /* À */
563 {'A', '\'', 193}, /* Á */
564 {'A', '^', 194}, /* Â */
565 {'A', '~', 195}, /* Ã */
566 {'A', '"', 196}, /* Ä */
567 {'A', '@', 197}, /* Å */
568 {'A', 'A', 197}, /* Å */
569 {'A', 'E', 198}, /* Æ */
570 {'C', ',', 199}, /* Ç */
571 {'E', '`', 200}, /* È */
572 {'E', '\'', 201}, /* É */
573 {'E', '^', 202}, /* Ê */
574 {'E', '"', 203}, /* Ë */
575 {'I', '`', 204}, /* Ì */
576 {'I', '\'', 205}, /* Í */
577 {'I', '^', 206}, /* Î */
578 {'I', '"', 207}, /* Ï */
579 {'D', '-', 208}, /* Ð */
580 {'N', '~', 209}, /* Ñ */
581 {'O', '`', 210}, /* Ò */
582 {'O', '\'', 211}, /* Ó */
583 {'O', '^', 212}, /* Ô */
584 {'O', '~', 213}, /* Õ */
585 {'O', '"', 214}, /* Ö */
586 {'/', '\\', 215}, /* × - multiplication symbol in ISO 8859-1 */
587 {'O', 'E', 215}, /* × - OE in ISO 8859-15 */
588 {'O', '/', 216}, /* Ø */
589 {'U', '`', 217}, /* Ù */
590 {'U', '\'', 218}, /* Ú */
591 {'U', '^', 219}, /* Û */
592 {'U', '"', 220}, /* Ü */
593 {'Y', '\'', 221}, /* Ý */
594 {'I', 'p', 222}, /* Þ */
595 {'s', 's', 223}, /* ß */
596 {'a', '`', 224}, /* à */
597 {'a', '\'', 225}, /* á */
598 {'a', '^', 226}, /* â */
599 {'a', '~', 227}, /* ã */
600 {'a', '"', 228}, /* ä */
601 {'a', '@', 229}, /* å */
602 {'a', 'a', 229}, /* å */
603 {'a', 'e', 230}, /* æ */
604 {'c', ',', 231}, /* ç */
605 {'e', '`', 232}, /* è */
606 {'e', '\'', 233}, /* é */
607 {'e', '^', 234}, /* ê */
608 {'e', '"', 235}, /* ë */
609 {'i', '`', 236}, /* ì */
610 {'i', '\'', 237}, /* í */
611 {'i', '^', 238}, /* î */
612 {'i', '"', 239}, /* ï */
613 {'d', '-', 240}, /* ð */
614 {'n', '~', 241}, /* ñ */
615 {'o', '`', 242}, /* ò */
616 {'o', '\'', 243}, /* ó */
617 {'o', '^', 244}, /* ô */
618 {'o', '~', 245}, /* õ */
619 {'o', '"', 246}, /* ö */
620 {':', '-', 247}, /* ÷ - division symbol in ISO 8859-1 */
621 {'o', 'e', 247}, /* ÷ - oe in ISO 8859-15 */
622 {'o', '/', 248}, /* ø */
623 {'u', '`', 249}, /* ù */
624 {'u', '\'', 250}, /* ú */
625 {'u', '^', 251}, /* û */
626 {'u', '"', 252}, /* ü */
627 {'y', '\'', 253}, /* ý */
628 {'i', 'p', 254}, /* þ */
629 {'y', '"', 255}, /* x XX */
630 {NUL, NUL, NUL}
631 };
632# else /* OLD_DIGRAPHS */
633
634 /*
635 * digraphs for Unicode from RFC1345
636 * (also work for ISO-8859-1 aka latin1)
637 */
638digr_T digraphdefault[] =
639 {
640 {'N', 'U', 0x0a}, /* LF for NUL */
641 {'S', 'H', 0x01},
642 {'S', 'X', 0x02},
643 {'E', 'X', 0x03},
644 {'E', 'T', 0x04},
645 {'E', 'Q', 0x05},
646 {'A', 'K', 0x06},
647 {'B', 'L', 0x07},
648 {'B', 'S', 0x08},
649 {'H', 'T', 0x09},
650 {'L', 'F', 0x0a},
651 {'V', 'T', 0x0b},
652 {'F', 'F', 0x0c},
653 {'C', 'R', 0x0d},
654 {'S', 'O', 0x0e},
655 {'S', 'I', 0x0f},
656 {'D', 'L', 0x10},
657 {'D', '1', 0x11},
658 {'D', '2', 0x12},
659 {'D', '3', 0x13},
660 {'D', '4', 0x14},
661 {'N', 'K', 0x15},
662 {'S', 'Y', 0x16},
663 {'E', 'B', 0x17},
664 {'C', 'N', 0x18},
665 {'E', 'M', 0x19},
666 {'S', 'B', 0x1a},
667 {'E', 'C', 0x1b},
668 {'F', 'S', 0x1c},
669 {'G', 'S', 0x1d},
670 {'R', 'S', 0x1e},
671 {'U', 'S', 0x1f},
672 {'S', 'P', 0x20},
673 {'N', 'b', 0x23},
674 {'D', 'O', 0x24},
675 {'A', 't', 0x40},
676 {'<', '(', 0x5b},
677 {'/', '/', 0x5c},
678 {')', '>', 0x5d},
679 {'\'', '>', 0x5e},
680 {'\'', '!', 0x60},
681 {'(', '!', 0x7b},
682 {'!', '!', 0x7c},
683 {'!', ')', 0x7d},
684 {'\'', '?', 0x7e},
685 {'D', 'T', 0x7f},
686 {'P', 'A', 0x80},
687 {'H', 'O', 0x81},
688 {'B', 'H', 0x82},
689 {'N', 'H', 0x83},
690 {'I', 'N', 0x84},
691 {'N', 'L', 0x85},
692 {'S', 'A', 0x86},
693 {'E', 'S', 0x87},
694 {'H', 'S', 0x88},
695 {'H', 'J', 0x89},
696 {'V', 'S', 0x8a},
697 {'P', 'D', 0x8b},
698 {'P', 'U', 0x8c},
699 {'R', 'I', 0x8d},
700 {'S', '2', 0x8e},
701 {'S', '3', 0x8f},
702 {'D', 'C', 0x90},
703 {'P', '1', 0x91},
704 {'P', '2', 0x92},
705 {'T', 'S', 0x93},
706 {'C', 'C', 0x94},
707 {'M', 'W', 0x95},
708 {'S', 'G', 0x96},
709 {'E', 'G', 0x97},
710 {'S', 'S', 0x98},
711 {'G', 'C', 0x99},
712 {'S', 'C', 0x9a},
713 {'C', 'I', 0x9b},
714 {'S', 'T', 0x9c},
715 {'O', 'C', 0x9d},
716 {'P', 'M', 0x9e},
717 {'A', 'C', 0x9f},
718 {'N', 'S', 0xa0},
719 {'!', 'I', 0xa1},
720 {'C', 't', 0xa2},
721 {'P', 'd', 0xa3},
722 {'C', 'u', 0xa4},
723 {'Y', 'e', 0xa5},
724 {'B', 'B', 0xa6},
725 {'S', 'E', 0xa7},
726 {'\'', ':', 0xa8},
727 {'C', 'o', 0xa9},
728 {'-', 'a', 0xaa},
729 {'<', '<', 0xab},
730 {'N', 'O', 0xac},
731 {'-', '-', 0xad},
732 {'R', 'g', 0xae},
733 {'\'', 'm', 0xaf},
734 {'D', 'G', 0xb0},
735 {'+', '-', 0xb1},
736 {'2', 'S', 0xb2},
737 {'3', 'S', 0xb3},
738 {'\'', '\'', 0xb4},
739 {'M', 'y', 0xb5},
740 {'P', 'I', 0xb6},
741 {'.', 'M', 0xb7},
742 {'\'', ',', 0xb8},
743 {'1', 'S', 0xb9},
744 {'-', 'o', 0xba},
745 {'>', '>', 0xbb},
746 {'1', '4', 0xbc},
747 {'1', '2', 0xbd},
748 {'3', '4', 0xbe},
749 {'?', 'I', 0xbf},
750 {'A', '!', 0xc0},
751 {'A', '\'', 0xc1},
752 {'A', '>', 0xc2},
753 {'A', '?', 0xc3},
754 {'A', ':', 0xc4},
755 {'A', 'A', 0xc5},
756 {'A', 'E', 0xc6},
757 {'C', ',', 0xc7},
758 {'E', '!', 0xc8},
759 {'E', '\'', 0xc9},
760 {'E', '>', 0xca},
761 {'E', ':', 0xcb},
762 {'I', '!', 0xcc},
763 {'I', '\'', 0xcd},
764 {'I', '>', 0xce},
765 {'I', ':', 0xcf},
766 {'D', '-', 0xd0},
767 {'N', '?', 0xd1},
768 {'O', '!', 0xd2},
769 {'O', '\'', 0xd3},
770 {'O', '>', 0xd4},
771 {'O', '?', 0xd5},
772 {'O', ':', 0xd6},
773 {'*', 'X', 0xd7},
774 {'O', '/', 0xd8},
775 {'U', '!', 0xd9},
776 {'U', '\'', 0xda},
777 {'U', '>', 0xdb},
778 {'U', ':', 0xdc},
779 {'Y', '\'', 0xdd},
780 {'T', 'H', 0xde},
781 {'s', 's', 0xdf},
782 {'a', '!', 0xe0},
783 {'a', '\'', 0xe1},
784 {'a', '>', 0xe2},
785 {'a', '?', 0xe3},
786 {'a', ':', 0xe4},
787 {'a', 'a', 0xe5},
788 {'a', 'e', 0xe6},
789 {'c', ',', 0xe7},
790 {'e', '!', 0xe8},
791 {'e', '\'', 0xe9},
792 {'e', '>', 0xea},
793 {'e', ':', 0xeb},
794 {'i', '!', 0xec},
795 {'i', '\'', 0xed},
796 {'i', '>', 0xee},
797 {'i', ':', 0xef},
798 {'d', '-', 0xf0},
799 {'n', '?', 0xf1},
800 {'o', '!', 0xf2},
801 {'o', '\'', 0xf3},
802 {'o', '>', 0xf4},
803 {'o', '?', 0xf5},
804 {'o', ':', 0xf6},
805 {'-', ':', 0xf7},
806 {'o', '/', 0xf8},
807 {'u', '!', 0xf9},
808 {'u', '\'', 0xfa},
809 {'u', '>', 0xfb},
810 {'u', ':', 0xfc},
811 {'y', '\'', 0xfd},
812 {'t', 'h', 0xfe},
813 {'y', ':', 0xff},
814
815# ifdef FEAT_MBYTE
816# define USE_UNICODE_DIGRAPHS
817
818 {'A', '-', 0x0100},
819 {'a', '-', 0x0101},
820 {'A', '(', 0x0102},
821 {'a', '(', 0x0103},
822 {'A', ';', 0x0104},
823 {'a', ';', 0x0105},
824 {'C', '\'', 0x0106},
825 {'c', '\'', 0x0107},
826 {'C', '>', 0x0108},
827 {'c', '>', 0x0109},
828 {'C', '.', 0x010a},
829 {'c', '.', 0x010b},
830 {'C', '<', 0x010c},
831 {'c', '<', 0x010d},
832 {'D', '<', 0x010e},
833 {'d', '<', 0x010f},
834 {'D', '/', 0x0110},
835 {'d', '/', 0x0111},
836 {'E', '-', 0x0112},
837 {'e', '-', 0x0113},
838 {'E', '(', 0x0114},
839 {'e', '(', 0x0115},
840 {'E', '.', 0x0116},
841 {'e', '.', 0x0117},
842 {'E', ';', 0x0118},
843 {'e', ';', 0x0119},
844 {'E', '<', 0x011a},
845 {'e', '<', 0x011b},
846 {'G', '>', 0x011c},
847 {'g', '>', 0x011d},
848 {'G', '(', 0x011e},
849 {'g', '(', 0x011f},
850 {'G', '.', 0x0120},
851 {'g', '.', 0x0121},
852 {'G', ',', 0x0122},
853 {'g', ',', 0x0123},
854 {'H', '>', 0x0124},
855 {'h', '>', 0x0125},
856 {'H', '/', 0x0126},
857 {'h', '/', 0x0127},
858 {'I', '?', 0x0128},
859 {'i', '?', 0x0129},
860 {'I', '-', 0x012a},
861 {'i', '-', 0x012b},
862 {'I', '(', 0x012c},
863 {'i', '(', 0x012d},
864 {'I', ';', 0x012e},
865 {'i', ';', 0x012f},
866 {'I', '.', 0x0130},
867 {'i', '.', 0x0131},
868 {'I', 'J', 0x0132},
869 {'i', 'j', 0x0133},
870 {'J', '>', 0x0134},
871 {'j', '>', 0x0135},
872 {'K', ',', 0x0136},
873 {'k', ',', 0x0137},
874 {'k', 'k', 0x0138},
875 {'L', '\'', 0x0139},
876 {'l', '\'', 0x013a},
877 {'L', ',', 0x013b},
878 {'l', ',', 0x013c},
879 {'L', '<', 0x013d},
880 {'l', '<', 0x013e},
881 {'L', '.', 0x013f},
882 {'l', '.', 0x0140},
883 {'L', '/', 0x0141},
884 {'l', '/', 0x0142},
885 {'N', '\'', 0x0143},
886 {'n', '\'', 0x0144},
887 {'N', ',', 0x0145},
888 {'n', ',', 0x0146},
889 {'N', '<', 0x0147},
890 {'n', '<', 0x0148},
891 {'\'', 'n', 0x0149},
892 {'N', 'G', 0x014a},
893 {'n', 'g', 0x014b},
894 {'O', '-', 0x014c},
895 {'o', '-', 0x014d},
896 {'O', '(', 0x014e},
897 {'o', '(', 0x014f},
898 {'O', '"', 0x0150},
899 {'o', '"', 0x0151},
900 {'O', 'E', 0x0152},
901 {'o', 'e', 0x0153},
902 {'R', '\'', 0x0154},
903 {'r', '\'', 0x0155},
904 {'R', ',', 0x0156},
905 {'r', ',', 0x0157},
906 {'R', '<', 0x0158},
907 {'r', '<', 0x0159},
908 {'S', '\'', 0x015a},
909 {'s', '\'', 0x015b},
910 {'S', '>', 0x015c},
911 {'s', '>', 0x015d},
912 {'S', ',', 0x015e},
913 {'s', ',', 0x015f},
914 {'S', '<', 0x0160},
915 {'s', '<', 0x0161},
916 {'T', ',', 0x0162},
917 {'t', ',', 0x0163},
918 {'T', '<', 0x0164},
919 {'t', '<', 0x0165},
920 {'T', '/', 0x0166},
921 {'t', '/', 0x0167},
922 {'U', '?', 0x0168},
923 {'u', '?', 0x0169},
924 {'U', '-', 0x016a},
925 {'u', '-', 0x016b},
926 {'U', '(', 0x016c},
927 {'u', '(', 0x016d},
928 {'U', '0', 0x016e},
929 {'u', '0', 0x016f},
930 {'U', '"', 0x0170},
931 {'u', '"', 0x0171},
932 {'U', ';', 0x0172},
933 {'u', ';', 0x0173},
934 {'W', '>', 0x0174},
935 {'w', '>', 0x0175},
936 {'Y', '>', 0x0176},
937 {'y', '>', 0x0177},
938 {'Y', ':', 0x0178},
939 {'Z', '\'', 0x0179},
940 {'z', '\'', 0x017a},
941 {'Z', '.', 0x017b},
942 {'z', '.', 0x017c},
943 {'Z', '<', 0x017d},
944 {'z', '<', 0x017e},
945 {'O', '9', 0x01a0},
946 {'o', '9', 0x01a1},
947 {'O', 'I', 0x01a2},
948 {'o', 'i', 0x01a3},
949 {'y', 'r', 0x01a6},
950 {'U', '9', 0x01af},
951 {'u', '9', 0x01b0},
952 {'Z', '/', 0x01b5},
953 {'z', '/', 0x01b6},
954 {'E', 'D', 0x01b7},
955 {'A', '<', 0x01cd},
956 {'a', '<', 0x01ce},
957 {'I', '<', 0x01cf},
958 {'i', '<', 0x01d0},
959 {'O', '<', 0x01d1},
960 {'o', '<', 0x01d2},
961 {'U', '<', 0x01d3},
962 {'u', '<', 0x01d4},
963 {'A', '1', 0x01de},
964 {'a', '1', 0x01df},
965 {'A', '7', 0x01e0},
966 {'a', '7', 0x01e1},
967 {'A', '3', 0x01e2},
968 {'a', '3', 0x01e3},
969 {'G', '/', 0x01e4},
970 {'g', '/', 0x01e5},
971 {'G', '<', 0x01e6},
972 {'g', '<', 0x01e7},
973 {'K', '<', 0x01e8},
974 {'k', '<', 0x01e9},
975 {'O', ';', 0x01ea},
976 {'o', ';', 0x01eb},
977 {'O', '1', 0x01ec},
978 {'o', '1', 0x01ed},
979 {'E', 'Z', 0x01ee},
980 {'e', 'z', 0x01ef},
981 {'j', '<', 0x01f0},
982 {'G', '\'', 0x01f4},
983 {'g', '\'', 0x01f5},
984 {';', 'S', 0x02bf},
985 {'\'', '<', 0x02c7},
986 {'\'', '(', 0x02d8},
987 {'\'', '.', 0x02d9},
988 {'\'', '0', 0x02da},
989 {'\'', ';', 0x02db},
990 {'\'', '"', 0x02dd},
991 {'A', '%', 0x0386},
992 {'E', '%', 0x0388},
993 {'Y', '%', 0x0389},
994 {'I', '%', 0x038a},
995 {'O', '%', 0x038c},
996 {'U', '%', 0x038e},
997 {'W', '%', 0x038f},
998 {'i', '3', 0x0390},
999 {'A', '*', 0x0391},
1000 {'B', '*', 0x0392},
1001 {'G', '*', 0x0393},
1002 {'D', '*', 0x0394},
1003 {'E', '*', 0x0395},
1004 {'Z', '*', 0x0396},
1005 {'Y', '*', 0x0397},
1006 {'H', '*', 0x0398},
1007 {'I', '*', 0x0399},
1008 {'K', '*', 0x039a},
1009 {'L', '*', 0x039b},
1010 {'M', '*', 0x039c},
1011 {'N', '*', 0x039d},
1012 {'C', '*', 0x039e},
1013 {'O', '*', 0x039f},
1014 {'P', '*', 0x03a0},
1015 {'R', '*', 0x03a1},
1016 {'S', '*', 0x03a3},
1017 {'T', '*', 0x03a4},
1018 {'U', '*', 0x03a5},
1019 {'F', '*', 0x03a6},
1020 {'X', '*', 0x03a7},
1021 {'Q', '*', 0x03a8},
1022 {'W', '*', 0x03a9},
1023 {'J', '*', 0x03aa},
1024 {'V', '*', 0x03ab},
1025 {'a', '%', 0x03ac},
1026 {'e', '%', 0x03ad},
1027 {'y', '%', 0x03ae},
1028 {'i', '%', 0x03af},
1029 {'u', '3', 0x03b0},
1030 {'a', '*', 0x03b1},
1031 {'b', '*', 0x03b2},
1032 {'g', '*', 0x03b3},
1033 {'d', '*', 0x03b4},
1034 {'e', '*', 0x03b5},
1035 {'z', '*', 0x03b6},
1036 {'y', '*', 0x03b7},
1037 {'h', '*', 0x03b8},
1038 {'i', '*', 0x03b9},
1039 {'k', '*', 0x03ba},
1040 {'l', '*', 0x03bb},
1041 {'m', '*', 0x03bc},
1042 {'n', '*', 0x03bd},
1043 {'c', '*', 0x03be},
1044 {'o', '*', 0x03bf},
1045 {'p', '*', 0x03c0},
1046 {'r', '*', 0x03c1},
1047 {'*', 's', 0x03c2},
1048 {'s', '*', 0x03c3},
1049 {'t', '*', 0x03c4},
1050 {'u', '*', 0x03c5},
1051 {'f', '*', 0x03c6},
1052 {'x', '*', 0x03c7},
1053 {'q', '*', 0x03c8},
1054 {'w', '*', 0x03c9},
1055 {'j', '*', 0x03ca},
1056 {'v', '*', 0x03cb},
1057 {'o', '%', 0x03cc},
1058 {'u', '%', 0x03cd},
1059 {'w', '%', 0x03ce},
1060 {'\'', 'G', 0x03d8},
1061 {',', 'G', 0x03d9},
1062 {'T', '3', 0x03da},
1063 {'t', '3', 0x03db},
1064 {'M', '3', 0x03dc},
1065 {'m', '3', 0x03dd},
1066 {'K', '3', 0x03de},
1067 {'k', '3', 0x03df},
1068 {'P', '3', 0x03e0},
1069 {'p', '3', 0x03e1},
1070 {'\'', '%', 0x03f4},
1071 {'j', '3', 0x03f5},
1072 {'I', 'O', 0x0401},
1073 {'D', '%', 0x0402},
1074 {'G', '%', 0x0403},
1075 {'I', 'E', 0x0404},
1076 {'D', 'S', 0x0405},
1077 {'I', 'I', 0x0406},
1078 {'Y', 'I', 0x0407},
1079 {'J', '%', 0x0408},
1080 {'L', 'J', 0x0409},
1081 {'N', 'J', 0x040a},
1082 {'T', 's', 0x040b},
1083 {'K', 'J', 0x040c},
1084 {'V', '%', 0x040e},
1085 {'D', 'Z', 0x040f},
1086 {'A', '=', 0x0410},
1087 {'B', '=', 0x0411},
1088 {'V', '=', 0x0412},
1089 {'G', '=', 0x0413},
1090 {'D', '=', 0x0414},
1091 {'E', '=', 0x0415},
1092 {'Z', '%', 0x0416},
1093 {'Z', '=', 0x0417},
1094 {'I', '=', 0x0418},
1095 {'J', '=', 0x0419},
1096 {'K', '=', 0x041a},
1097 {'L', '=', 0x041b},
1098 {'M', '=', 0x041c},
1099 {'N', '=', 0x041d},
1100 {'O', '=', 0x041e},
1101 {'P', '=', 0x041f},
1102 {'R', '=', 0x0420},
1103 {'S', '=', 0x0421},
1104 {'T', '=', 0x0422},
1105 {'U', '=', 0x0423},
1106 {'F', '=', 0x0424},
1107 {'H', '=', 0x0425},
1108 {'C', '=', 0x0426},
1109 {'C', '%', 0x0427},
1110 {'S', '%', 0x0428},
1111 {'S', 'c', 0x0429},
1112 {'=', '"', 0x042a},
1113 {'Y', '=', 0x042b},
1114 {'%', '"', 0x042c},
1115 {'J', 'E', 0x042d},
1116 {'J', 'U', 0x042e},
1117 {'J', 'A', 0x042f},
1118 {'a', '=', 0x0430},
1119 {'b', '=', 0x0431},
1120 {'v', '=', 0x0432},
1121 {'g', '=', 0x0433},
1122 {'d', '=', 0x0434},
1123 {'e', '=', 0x0435},
1124 {'z', '%', 0x0436},
1125 {'z', '=', 0x0437},
1126 {'i', '=', 0x0438},
1127 {'j', '=', 0x0439},
1128 {'k', '=', 0x043a},
1129 {'l', '=', 0x043b},
1130 {'m', '=', 0x043c},
1131 {'n', '=', 0x043d},
1132 {'o', '=', 0x043e},
1133 {'p', '=', 0x043f},
1134 {'r', '=', 0x0440},
1135 {'s', '=', 0x0441},
1136 {'t', '=', 0x0442},
1137 {'u', '=', 0x0443},
1138 {'f', '=', 0x0444},
1139 {'h', '=', 0x0445},
1140 {'c', '=', 0x0446},
1141 {'c', '%', 0x0447},
1142 {'s', '%', 0x0448},
1143 {'s', 'c', 0x0449},
1144 {'=', '\'', 0x044a},
1145 {'y', '=', 0x044b},
1146 {'%', '\'', 0x044c},
1147 {'j', 'e', 0x044d},
1148 {'j', 'u', 0x044e},
1149 {'j', 'a', 0x044f},
1150 {'i', 'o', 0x0451},
1151 {'d', '%', 0x0452},
1152 {'g', '%', 0x0453},
1153 {'i', 'e', 0x0454},
1154 {'d', 's', 0x0455},
1155 {'i', 'i', 0x0456},
1156 {'y', 'i', 0x0457},
1157 {'j', '%', 0x0458},
1158 {'l', 'j', 0x0459},
1159 {'n', 'j', 0x045a},
1160 {'t', 's', 0x045b},
1161 {'k', 'j', 0x045c},
1162 {'v', '%', 0x045e},
1163 {'d', 'z', 0x045f},
1164 {'Y', '3', 0x0462},
1165 {'y', '3', 0x0463},
1166 {'O', '3', 0x046a},
1167 {'o', '3', 0x046b},
1168 {'F', '3', 0x0472},
1169 {'f', '3', 0x0473},
1170 {'V', '3', 0x0474},
1171 {'v', '3', 0x0475},
1172 {'C', '3', 0x0480},
1173 {'c', '3', 0x0481},
1174 {'G', '3', 0x0490},
1175 {'g', '3', 0x0491},
1176 {'A', '+', 0x05d0},
1177 {'B', '+', 0x05d1},
1178 {'G', '+', 0x05d2},
1179 {'D', '+', 0x05d3},
1180 {'H', '+', 0x05d4},
1181 {'W', '+', 0x05d5},
1182 {'Z', '+', 0x05d6},
1183 {'X', '+', 0x05d7},
1184 {'T', 'j', 0x05d8},
1185 {'J', '+', 0x05d9},
1186 {'K', '%', 0x05da},
1187 {'K', '+', 0x05db},
1188 {'L', '+', 0x05dc},
1189 {'M', '%', 0x05dd},
1190 {'M', '+', 0x05de},
1191 {'N', '%', 0x05df},
1192 {'N', '+', 0x05e0},
1193 {'S', '+', 0x05e1},
1194 {'E', '+', 0x05e2},
1195 {'P', '%', 0x05e3},
1196 {'P', '+', 0x05e4},
1197 {'Z', 'j', 0x05e5},
1198 {'Z', 'J', 0x05e6},
1199 {'Q', '+', 0x05e7},
1200 {'R', '+', 0x05e8},
1201 {'S', 'h', 0x05e9},
1202 {'T', '+', 0x05ea},
1203 {',', '+', 0x060c},
1204 {';', '+', 0x061b},
1205 {'?', '+', 0x061f},
1206 {'H', '\'', 0x0621},
1207 {'a', 'M', 0x0622},
1208 {'a', 'H', 0x0623},
1209 {'w', 'H', 0x0624},
1210 {'a', 'h', 0x0625},
1211 {'y', 'H', 0x0626},
1212 {'a', '+', 0x0627},
1213 {'b', '+', 0x0628},
1214 {'t', 'm', 0x0629},
1215 {'t', '+', 0x062a},
1216 {'t', 'k', 0x062b},
1217 {'g', '+', 0x062c},
1218 {'h', 'k', 0x062d},
1219 {'x', '+', 0x062e},
1220 {'d', '+', 0x062f},
1221 {'d', 'k', 0x0630},
1222 {'r', '+', 0x0631},
1223 {'z', '+', 0x0632},
1224 {'s', '+', 0x0633},
1225 {'s', 'n', 0x0634},
1226 {'c', '+', 0x0635},
1227 {'d', 'd', 0x0636},
1228 {'t', 'j', 0x0637},
1229 {'z', 'H', 0x0638},
1230 {'e', '+', 0x0639},
1231 {'i', '+', 0x063a},
1232 {'+', '+', 0x0640},
1233 {'f', '+', 0x0641},
1234 {'q', '+', 0x0642},
1235 {'k', '+', 0x0643},
1236 {'l', '+', 0x0644},
1237 {'m', '+', 0x0645},
1238 {'n', '+', 0x0646},
1239 {'h', '+', 0x0647},
1240 {'w', '+', 0x0648},
1241 {'j', '+', 0x0649},
1242 {'y', '+', 0x064a},
1243 {':', '+', 0x064b},
1244 {'"', '+', 0x064c},
1245 {'=', '+', 0x064d},
1246 {'/', '+', 0x064e},
1247 {'\'', '+', 0x064f},
1248 {'1', '+', 0x0650},
1249 {'3', '+', 0x0651},
1250 {'0', '+', 0x0652},
1251 {'a', 'S', 0x0670},
1252 {'p', '+', 0x067e},
1253 {'v', '+', 0x06a4},
1254 {'g', 'f', 0x06af},
1255 {'0', 'a', 0x06f0},
1256 {'1', 'a', 0x06f1},
1257 {'2', 'a', 0x06f2},
1258 {'3', 'a', 0x06f3},
1259 {'4', 'a', 0x06f4},
1260 {'5', 'a', 0x06f5},
1261 {'6', 'a', 0x06f6},
1262 {'7', 'a', 0x06f7},
1263 {'8', 'a', 0x06f8},
1264 {'9', 'a', 0x06f9},
1265 {'B', '.', 0x1e02},
1266 {'b', '.', 0x1e03},
1267 {'B', '_', 0x1e06},
1268 {'b', '_', 0x1e07},
1269 {'D', '.', 0x1e0a},
1270 {'d', '.', 0x1e0b},
1271 {'D', '_', 0x1e0e},
1272 {'d', '_', 0x1e0f},
1273 {'D', ',', 0x1e10},
1274 {'d', ',', 0x1e11},
1275 {'F', '.', 0x1e1e},
1276 {'f', '.', 0x1e1f},
1277 {'G', '-', 0x1e20},
1278 {'g', '-', 0x1e21},
1279 {'H', '.', 0x1e22},
1280 {'h', '.', 0x1e23},
1281 {'H', ':', 0x1e26},
1282 {'h', ':', 0x1e27},
1283 {'H', ',', 0x1e28},
1284 {'h', ',', 0x1e29},
1285 {'K', '\'', 0x1e30},
1286 {'k', '\'', 0x1e31},
1287 {'K', '_', 0x1e34},
1288 {'k', '_', 0x1e35},
1289 {'L', '_', 0x1e3a},
1290 {'l', '_', 0x1e3b},
1291 {'M', '\'', 0x1e3e},
1292 {'m', '\'', 0x1e3f},
1293 {'M', '.', 0x1e40},
1294 {'m', '.', 0x1e41},
1295 {'N', '.', 0x1e44},
1296 {'n', '.', 0x1e45},
1297 {'N', '_', 0x1e48},
1298 {'n', '_', 0x1e49},
1299 {'P', '\'', 0x1e54},
1300 {'p', '\'', 0x1e55},
1301 {'P', '.', 0x1e56},
1302 {'p', '.', 0x1e57},
1303 {'R', '.', 0x1e58},
1304 {'r', '.', 0x1e59},
1305 {'R', '_', 0x1e5e},
1306 {'r', '_', 0x1e5f},
1307 {'S', '.', 0x1e60},
1308 {'s', '.', 0x1e61},
1309 {'T', '.', 0x1e6a},
1310 {'t', '.', 0x1e6b},
1311 {'T', '_', 0x1e6e},
1312 {'t', '_', 0x1e6f},
1313 {'V', '?', 0x1e7c},
1314 {'v', '?', 0x1e7d},
1315 {'W', '!', 0x1e80},
1316 {'w', '!', 0x1e81},
1317 {'W', '\'', 0x1e82},
1318 {'w', '\'', 0x1e83},
1319 {'W', ':', 0x1e84},
1320 {'w', ':', 0x1e85},
1321 {'W', '.', 0x1e86},
1322 {'w', '.', 0x1e87},
1323 {'X', '.', 0x1e8a},
1324 {'x', '.', 0x1e8b},
1325 {'X', ':', 0x1e8c},
1326 {'x', ':', 0x1e8d},
1327 {'Y', '.', 0x1e8e},
1328 {'y', '.', 0x1e8f},
1329 {'Z', '>', 0x1e90},
1330 {'z', '>', 0x1e91},
1331 {'Z', '_', 0x1e94},
1332 {'z', '_', 0x1e95},
1333 {'h', '_', 0x1e96},
1334 {'t', ':', 0x1e97},
1335 {'w', '0', 0x1e98},
1336 {'y', '0', 0x1e99},
1337 {'A', '2', 0x1ea2},
1338 {'a', '2', 0x1ea3},
1339 {'E', '2', 0x1eba},
1340 {'e', '2', 0x1ebb},
1341 {'E', '?', 0x1ebc},
1342 {'e', '?', 0x1ebd},
1343 {'I', '2', 0x1ec8},
1344 {'i', '2', 0x1ec9},
1345 {'O', '2', 0x1ece},
1346 {'o', '2', 0x1ecf},
1347 {'U', '2', 0x1ee6},
1348 {'u', '2', 0x1ee7},
1349 {'Y', '!', 0x1ef2},
1350 {'y', '!', 0x1ef3},
1351 {'Y', '2', 0x1ef6},
1352 {'y', '2', 0x1ef7},
1353 {'Y', '?', 0x1ef8},
1354 {'y', '?', 0x1ef9},
1355 {';', '\'', 0x1f00},
1356 {',', '\'', 0x1f01},
1357 {';', '!', 0x1f02},
1358 {',', '!', 0x1f03},
1359 {'?', ';', 0x1f04},
1360 {'?', ',', 0x1f05},
1361 {'!', ':', 0x1f06},
1362 {'?', ':', 0x1f07},
1363 {'1', 'N', 0x2002},
1364 {'1', 'M', 0x2003},
1365 {'3', 'M', 0x2004},
1366 {'4', 'M', 0x2005},
1367 {'6', 'M', 0x2006},
1368 {'1', 'T', 0x2009},
1369 {'1', 'H', 0x200a},
1370 {'-', '1', 0x2010},
1371 {'-', 'N', 0x2013},
1372 {'-', 'M', 0x2014},
1373 {'-', '3', 0x2015},
1374 {'!', '2', 0x2016},
1375 {'=', '2', 0x2017},
1376 {'\'', '6', 0x2018},
1377 {'\'', '9', 0x2019},
1378 {'.', '9', 0x201a},
1379 {'9', '\'', 0x201b},
1380 {'"', '6', 0x201c},
1381 {'"', '9', 0x201d},
1382 {':', '9', 0x201e},
1383 {'9', '"', 0x201f},
1384 {'/', '-', 0x2020},
1385 {'/', '=', 0x2021},
1386 {'.', '.', 0x2025},
1387 {'%', '0', 0x2030},
1388 {'1', '\'', 0x2032},
1389 {'2', '\'', 0x2033},
1390 {'3', '\'', 0x2034},
1391 {'1', '"', 0x2035},
1392 {'2', '"', 0x2036},
1393 {'3', '"', 0x2037},
1394 {'C', 'a', 0x2038},
1395 {'<', '1', 0x2039},
1396 {'>', '1', 0x203a},
1397 {':', 'X', 0x203b},
1398 {'\'', '-', 0x203e},
1399 {'/', 'f', 0x2044},
1400 {'0', 'S', 0x2070},
1401 {'4', 'S', 0x2074},
1402 {'5', 'S', 0x2075},
1403 {'6', 'S', 0x2076},
1404 {'7', 'S', 0x2077},
1405 {'8', 'S', 0x2078},
1406 {'9', 'S', 0x2079},
1407 {'+', 'S', 0x207a},
1408 {'-', 'S', 0x207b},
1409 {'=', 'S', 0x207c},
1410 {'(', 'S', 0x207d},
1411 {')', 'S', 0x207e},
1412 {'n', 'S', 0x207f},
1413 {'0', 's', 0x2080},
1414 {'1', 's', 0x2081},
1415 {'2', 's', 0x2082},
1416 {'3', 's', 0x2083},
1417 {'4', 's', 0x2084},
1418 {'5', 's', 0x2085},
1419 {'6', 's', 0x2086},
1420 {'7', 's', 0x2087},
1421 {'8', 's', 0x2088},
1422 {'9', 's', 0x2089},
1423 {'+', 's', 0x208a},
1424 {'-', 's', 0x208b},
1425 {'=', 's', 0x208c},
1426 {'(', 's', 0x208d},
1427 {')', 's', 0x208e},
1428 {'L', 'i', 0x20a4},
1429 {'P', 't', 0x20a7},
1430 {'W', '=', 0x20a9},
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001431 {'=', 'e', 0x20ac}, /* euro */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001432 {'o', 'C', 0x2103},
1433 {'c', 'o', 0x2105},
1434 {'o', 'F', 0x2109},
1435 {'N', '0', 0x2116},
1436 {'P', 'O', 0x2117},
1437 {'R', 'x', 0x211e},
1438 {'S', 'M', 0x2120},
1439 {'T', 'M', 0x2122},
1440 {'O', 'm', 0x2126},
1441 {'A', 'O', 0x212b},
1442 {'1', '3', 0x2153},
1443 {'2', '3', 0x2154},
1444 {'1', '5', 0x2155},
1445 {'2', '5', 0x2156},
1446 {'3', '5', 0x2157},
1447 {'4', '5', 0x2158},
1448 {'1', '6', 0x2159},
1449 {'5', '6', 0x215a},
1450 {'1', '8', 0x215b},
1451 {'3', '8', 0x215c},
1452 {'5', '8', 0x215d},
1453 {'7', '8', 0x215e},
1454 {'1', 'R', 0x2160},
1455 {'2', 'R', 0x2161},
1456 {'3', 'R', 0x2162},
1457 {'4', 'R', 0x2163},
1458 {'5', 'R', 0x2164},
1459 {'6', 'R', 0x2165},
1460 {'7', 'R', 0x2166},
1461 {'8', 'R', 0x2167},
1462 {'9', 'R', 0x2168},
1463 {'a', 'R', 0x2169},
1464 {'b', 'R', 0x216a},
1465 {'c', 'R', 0x216b},
1466 {'1', 'r', 0x2170},
1467 {'2', 'r', 0x2171},
1468 {'3', 'r', 0x2172},
1469 {'4', 'r', 0x2173},
1470 {'5', 'r', 0x2174},
1471 {'6', 'r', 0x2175},
1472 {'7', 'r', 0x2176},
1473 {'8', 'r', 0x2177},
1474 {'9', 'r', 0x2178},
1475 {'a', 'r', 0x2179},
1476 {'b', 'r', 0x217a},
1477 {'c', 'r', 0x217b},
1478 {'<', '-', 0x2190},
1479 {'-', '!', 0x2191},
1480 {'-', '>', 0x2192},
1481 {'-', 'v', 0x2193},
1482 {'<', '>', 0x2194},
1483 {'U', 'D', 0x2195},
1484 {'<', '=', 0x21d0},
1485 {'=', '>', 0x21d2},
1486 {'=', '=', 0x21d4},
1487 {'F', 'A', 0x2200},
1488 {'d', 'P', 0x2202},
1489 {'T', 'E', 0x2203},
1490 {'/', '0', 0x2205},
1491 {'D', 'E', 0x2206},
1492 {'N', 'B', 0x2207},
1493 {'(', '-', 0x2208},
1494 {'-', ')', 0x220b},
1495 {'*', 'P', 0x220f},
1496 {'+', 'Z', 0x2211},
1497 {'-', '2', 0x2212},
1498 {'-', '+', 0x2213},
1499 {'*', '-', 0x2217},
1500 {'O', 'b', 0x2218},
1501 {'S', 'b', 0x2219},
1502 {'R', 'T', 0x221a},
1503 {'0', '(', 0x221d},
1504 {'0', '0', 0x221e},
1505 {'-', 'L', 0x221f},
1506 {'-', 'V', 0x2220},
1507 {'P', 'P', 0x2225},
1508 {'A', 'N', 0x2227},
1509 {'O', 'R', 0x2228},
1510 {'(', 'U', 0x2229},
1511 {')', 'U', 0x222a},
1512 {'I', 'n', 0x222b},
1513 {'D', 'I', 0x222c},
1514 {'I', 'o', 0x222e},
1515 {'.', ':', 0x2234},
1516 {':', '.', 0x2235},
1517 {':', 'R', 0x2236},
1518 {':', ':', 0x2237},
1519 {'?', '1', 0x223c},
1520 {'C', 'G', 0x223e},
1521 {'?', '-', 0x2243},
1522 {'?', '=', 0x2245},
1523 {'?', '2', 0x2248},
1524 {'=', '?', 0x224c},
1525 {'H', 'I', 0x2253},
1526 {'!', '=', 0x2260},
1527 {'=', '3', 0x2261},
1528 {'=', '<', 0x2264},
1529 {'>', '=', 0x2265},
1530 {'<', '*', 0x226a},
1531 {'*', '>', 0x226b},
1532 {'!', '<', 0x226e},
1533 {'!', '>', 0x226f},
1534 {'(', 'C', 0x2282},
1535 {')', 'C', 0x2283},
1536 {'(', '_', 0x2286},
1537 {')', '_', 0x2287},
1538 {'0', '.', 0x2299},
1539 {'0', '2', 0x229a},
1540 {'-', 'T', 0x22a5},
1541 {'.', 'P', 0x22c5},
1542 {':', '3', 0x22ee},
1543 {'.', '3', 0x22ef},
1544 {'E', 'h', 0x2302},
1545 {'<', '7', 0x2308},
1546 {'>', '7', 0x2309},
1547 {'7', '<', 0x230a},
1548 {'7', '>', 0x230b},
1549 {'N', 'I', 0x2310},
1550 {'(', 'A', 0x2312},
1551 {'T', 'R', 0x2315},
1552 {'I', 'u', 0x2320},
1553 {'I', 'l', 0x2321},
1554 {'<', '/', 0x2329},
1555 {'/', '>', 0x232a},
1556 {'V', 's', 0x2423},
1557 {'1', 'h', 0x2440},
1558 {'3', 'h', 0x2441},
1559 {'2', 'h', 0x2442},
1560 {'4', 'h', 0x2443},
1561 {'1', 'j', 0x2446},
1562 {'2', 'j', 0x2447},
1563 {'3', 'j', 0x2448},
1564 {'4', 'j', 0x2449},
1565 {'1', '.', 0x2488},
1566 {'2', '.', 0x2489},
1567 {'3', '.', 0x248a},
1568 {'4', '.', 0x248b},
1569 {'5', '.', 0x248c},
1570 {'6', '.', 0x248d},
1571 {'7', '.', 0x248e},
1572 {'8', '.', 0x248f},
1573 {'9', '.', 0x2490},
1574 {'h', 'h', 0x2500},
1575 {'H', 'H', 0x2501},
1576 {'v', 'v', 0x2502},
1577 {'V', 'V', 0x2503},
1578 {'3', '-', 0x2504},
1579 {'3', '_', 0x2505},
1580 {'3', '!', 0x2506},
1581 {'3', '/', 0x2507},
1582 {'4', '-', 0x2508},
1583 {'4', '_', 0x2509},
1584 {'4', '!', 0x250a},
1585 {'4', '/', 0x250b},
1586 {'d', 'r', 0x250c},
1587 {'d', 'R', 0x250d},
1588 {'D', 'r', 0x250e},
1589 {'D', 'R', 0x250f},
1590 {'d', 'l', 0x2510},
1591 {'d', 'L', 0x2511},
1592 {'D', 'l', 0x2512},
1593 {'L', 'D', 0x2513},
1594 {'u', 'r', 0x2514},
1595 {'u', 'R', 0x2515},
1596 {'U', 'r', 0x2516},
1597 {'U', 'R', 0x2517},
1598 {'u', 'l', 0x2518},
1599 {'u', 'L', 0x2519},
1600 {'U', 'l', 0x251a},
1601 {'U', 'L', 0x251b},
1602 {'v', 'r', 0x251c},
1603 {'v', 'R', 0x251d},
1604 {'V', 'r', 0x2520},
1605 {'V', 'R', 0x2523},
1606 {'v', 'l', 0x2524},
1607 {'v', 'L', 0x2525},
1608 {'V', 'l', 0x2528},
1609 {'V', 'L', 0x252b},
1610 {'d', 'h', 0x252c},
1611 {'d', 'H', 0x252f},
1612 {'D', 'h', 0x2530},
1613 {'D', 'H', 0x2533},
1614 {'u', 'h', 0x2534},
1615 {'u', 'H', 0x2537},
1616 {'U', 'h', 0x2538},
1617 {'U', 'H', 0x253b},
1618 {'v', 'h', 0x253c},
1619 {'v', 'H', 0x253f},
1620 {'V', 'h', 0x2542},
1621 {'V', 'H', 0x254b},
1622 {'F', 'D', 0x2571},
1623 {'B', 'D', 0x2572},
1624 {'T', 'B', 0x2580},
1625 {'L', 'B', 0x2584},
1626 {'F', 'B', 0x2588},
1627 {'l', 'B', 0x258c},
1628 {'R', 'B', 0x2590},
1629 {'.', 'S', 0x2591},
1630 {':', 'S', 0x2592},
1631 {'?', 'S', 0x2593},
1632 {'f', 'S', 0x25a0},
1633 {'O', 'S', 0x25a1},
1634 {'R', 'O', 0x25a2},
1635 {'R', 'r', 0x25a3},
1636 {'R', 'F', 0x25a4},
1637 {'R', 'Y', 0x25a5},
1638 {'R', 'H', 0x25a6},
1639 {'R', 'Z', 0x25a7},
1640 {'R', 'K', 0x25a8},
1641 {'R', 'X', 0x25a9},
1642 {'s', 'B', 0x25aa},
1643 {'S', 'R', 0x25ac},
1644 {'O', 'r', 0x25ad},
1645 {'U', 'T', 0x25b2},
1646 {'u', 'T', 0x25b3},
1647 {'P', 'R', 0x25b6},
1648 {'T', 'r', 0x25b7},
1649 {'D', 't', 0x25bc},
1650 {'d', 'T', 0x25bd},
1651 {'P', 'L', 0x25c0},
1652 {'T', 'l', 0x25c1},
1653 {'D', 'b', 0x25c6},
1654 {'D', 'w', 0x25c7},
1655 {'L', 'Z', 0x25ca},
1656 {'0', 'm', 0x25cb},
1657 {'0', 'o', 0x25ce},
1658 {'0', 'M', 0x25cf},
1659 {'0', 'L', 0x25d0},
1660 {'0', 'R', 0x25d1},
1661 {'S', 'n', 0x25d8},
1662 {'I', 'c', 0x25d9},
1663 {'F', 'd', 0x25e2},
1664 {'B', 'd', 0x25e3},
1665 {'*', '2', 0x2605},
1666 {'*', '1', 0x2606},
1667 {'<', 'H', 0x261c},
1668 {'>', 'H', 0x261e},
1669 {'0', 'u', 0x263a},
1670 {'0', 'U', 0x263b},
1671 {'S', 'U', 0x263c},
1672 {'F', 'm', 0x2640},
1673 {'M', 'l', 0x2642},
1674 {'c', 'S', 0x2660},
1675 {'c', 'H', 0x2661},
1676 {'c', 'D', 0x2662},
1677 {'c', 'C', 0x2663},
1678 {'M', 'd', 0x2669},
1679 {'M', '8', 0x266a},
1680 {'M', '2', 0x266b},
1681 {'M', 'b', 0x266d},
1682 {'M', 'x', 0x266e},
1683 {'M', 'X', 0x266f},
1684 {'O', 'K', 0x2713},
1685 {'X', 'X', 0x2717},
1686 {'-', 'X', 0x2720},
1687 {'I', 'S', 0x3000},
1688 {',', '_', 0x3001},
1689 {'.', '_', 0x3002},
1690 {'+', '"', 0x3003},
1691 {'+', '_', 0x3004},
1692 {'*', '_', 0x3005},
1693 {';', '_', 0x3006},
1694 {'0', '_', 0x3007},
1695 {'<', '+', 0x300a},
1696 {'>', '+', 0x300b},
1697 {'<', '\'', 0x300c},
1698 {'>', '\'', 0x300d},
1699 {'<', '"', 0x300e},
1700 {'>', '"', 0x300f},
1701 {'(', '"', 0x3010},
1702 {')', '"', 0x3011},
1703 {'=', 'T', 0x3012},
1704 {'=', '_', 0x3013},
1705 {'(', '\'', 0x3014},
1706 {')', '\'', 0x3015},
1707 {'(', 'I', 0x3016},
1708 {')', 'I', 0x3017},
1709 {'-', '?', 0x301c},
1710 {'A', '5', 0x3041},
1711 {'a', '5', 0x3042},
1712 {'I', '5', 0x3043},
1713 {'i', '5', 0x3044},
1714 {'U', '5', 0x3045},
1715 {'u', '5', 0x3046},
1716 {'E', '5', 0x3047},
1717 {'e', '5', 0x3048},
1718 {'O', '5', 0x3049},
1719 {'o', '5', 0x304a},
1720 {'k', 'a', 0x304b},
1721 {'g', 'a', 0x304c},
1722 {'k', 'i', 0x304d},
1723 {'g', 'i', 0x304e},
1724 {'k', 'u', 0x304f},
1725 {'g', 'u', 0x3050},
1726 {'k', 'e', 0x3051},
1727 {'g', 'e', 0x3052},
1728 {'k', 'o', 0x3053},
1729 {'g', 'o', 0x3054},
1730 {'s', 'a', 0x3055},
1731 {'z', 'a', 0x3056},
1732 {'s', 'i', 0x3057},
1733 {'z', 'i', 0x3058},
1734 {'s', 'u', 0x3059},
1735 {'z', 'u', 0x305a},
1736 {'s', 'e', 0x305b},
1737 {'z', 'e', 0x305c},
1738 {'s', 'o', 0x305d},
1739 {'z', 'o', 0x305e},
1740 {'t', 'a', 0x305f},
1741 {'d', 'a', 0x3060},
1742 {'t', 'i', 0x3061},
1743 {'d', 'i', 0x3062},
1744 {'t', 'U', 0x3063},
1745 {'t', 'u', 0x3064},
1746 {'d', 'u', 0x3065},
1747 {'t', 'e', 0x3066},
1748 {'d', 'e', 0x3067},
1749 {'t', 'o', 0x3068},
1750 {'d', 'o', 0x3069},
1751 {'n', 'a', 0x306a},
1752 {'n', 'i', 0x306b},
1753 {'n', 'u', 0x306c},
1754 {'n', 'e', 0x306d},
1755 {'n', 'o', 0x306e},
1756 {'h', 'a', 0x306f},
1757 {'b', 'a', 0x3070},
1758 {'p', 'a', 0x3071},
1759 {'h', 'i', 0x3072},
1760 {'b', 'i', 0x3073},
1761 {'p', 'i', 0x3074},
1762 {'h', 'u', 0x3075},
1763 {'b', 'u', 0x3076},
1764 {'p', 'u', 0x3077},
1765 {'h', 'e', 0x3078},
1766 {'b', 'e', 0x3079},
1767 {'p', 'e', 0x307a},
1768 {'h', 'o', 0x307b},
1769 {'b', 'o', 0x307c},
1770 {'p', 'o', 0x307d},
1771 {'m', 'a', 0x307e},
1772 {'m', 'i', 0x307f},
1773 {'m', 'u', 0x3080},
1774 {'m', 'e', 0x3081},
1775 {'m', 'o', 0x3082},
1776 {'y', 'A', 0x3083},
1777 {'y', 'a', 0x3084},
1778 {'y', 'U', 0x3085},
1779 {'y', 'u', 0x3086},
1780 {'y', 'O', 0x3087},
1781 {'y', 'o', 0x3088},
1782 {'r', 'a', 0x3089},
1783 {'r', 'i', 0x308a},
1784 {'r', 'u', 0x308b},
1785 {'r', 'e', 0x308c},
1786 {'r', 'o', 0x308d},
1787 {'w', 'A', 0x308e},
1788 {'w', 'a', 0x308f},
1789 {'w', 'i', 0x3090},
1790 {'w', 'e', 0x3091},
1791 {'w', 'o', 0x3092},
1792 {'n', '5', 0x3093},
1793 {'v', 'u', 0x3094},
1794 {'"', '5', 0x309b},
1795 {'0', '5', 0x309c},
1796 {'*', '5', 0x309d},
1797 {'+', '5', 0x309e},
1798 {'a', '6', 0x30a1},
1799 {'A', '6', 0x30a2},
1800 {'i', '6', 0x30a3},
1801 {'I', '6', 0x30a4},
1802 {'u', '6', 0x30a5},
1803 {'U', '6', 0x30a6},
1804 {'e', '6', 0x30a7},
1805 {'E', '6', 0x30a8},
1806 {'o', '6', 0x30a9},
1807 {'O', '6', 0x30aa},
1808 {'K', 'a', 0x30ab},
1809 {'G', 'a', 0x30ac},
1810 {'K', 'i', 0x30ad},
1811 {'G', 'i', 0x30ae},
1812 {'K', 'u', 0x30af},
1813 {'G', 'u', 0x30b0},
1814 {'K', 'e', 0x30b1},
1815 {'G', 'e', 0x30b2},
1816 {'K', 'o', 0x30b3},
1817 {'G', 'o', 0x30b4},
1818 {'S', 'a', 0x30b5},
1819 {'Z', 'a', 0x30b6},
1820 {'S', 'i', 0x30b7},
1821 {'Z', 'i', 0x30b8},
1822 {'S', 'u', 0x30b9},
1823 {'Z', 'u', 0x30ba},
1824 {'S', 'e', 0x30bb},
1825 {'Z', 'e', 0x30bc},
1826 {'S', 'o', 0x30bd},
1827 {'Z', 'o', 0x30be},
1828 {'T', 'a', 0x30bf},
1829 {'D', 'a', 0x30c0},
1830 {'T', 'i', 0x30c1},
1831 {'D', 'i', 0x30c2},
1832 {'T', 'U', 0x30c3},
1833 {'T', 'u', 0x30c4},
1834 {'D', 'u', 0x30c5},
1835 {'T', 'e', 0x30c6},
1836 {'D', 'e', 0x30c7},
1837 {'T', 'o', 0x30c8},
1838 {'D', 'o', 0x30c9},
1839 {'N', 'a', 0x30ca},
1840 {'N', 'i', 0x30cb},
1841 {'N', 'u', 0x30cc},
1842 {'N', 'e', 0x30cd},
1843 {'N', 'o', 0x30ce},
1844 {'H', 'a', 0x30cf},
1845 {'B', 'a', 0x30d0},
1846 {'P', 'a', 0x30d1},
1847 {'H', 'i', 0x30d2},
1848 {'B', 'i', 0x30d3},
1849 {'P', 'i', 0x30d4},
1850 {'H', 'u', 0x30d5},
1851 {'B', 'u', 0x30d6},
1852 {'P', 'u', 0x30d7},
1853 {'H', 'e', 0x30d8},
1854 {'B', 'e', 0x30d9},
1855 {'P', 'e', 0x30da},
1856 {'H', 'o', 0x30db},
1857 {'B', 'o', 0x30dc},
1858 {'P', 'o', 0x30dd},
1859 {'M', 'a', 0x30de},
1860 {'M', 'i', 0x30df},
1861 {'M', 'u', 0x30e0},
1862 {'M', 'e', 0x30e1},
1863 {'M', 'o', 0x30e2},
1864 {'Y', 'A', 0x30e3},
1865 {'Y', 'a', 0x30e4},
1866 {'Y', 'U', 0x30e5},
1867 {'Y', 'u', 0x30e6},
1868 {'Y', 'O', 0x30e7},
1869 {'Y', 'o', 0x30e8},
1870 {'R', 'a', 0x30e9},
1871 {'R', 'i', 0x30ea},
1872 {'R', 'u', 0x30eb},
1873 {'R', 'e', 0x30ec},
1874 {'R', 'o', 0x30ed},
1875 {'W', 'A', 0x30ee},
1876 {'W', 'a', 0x30ef},
1877 {'W', 'i', 0x30f0},
1878 {'W', 'e', 0x30f1},
1879 {'W', 'o', 0x30f2},
1880 {'N', '6', 0x30f3},
1881 {'V', 'u', 0x30f4},
1882 {'K', 'A', 0x30f5},
1883 {'K', 'E', 0x30f6},
1884 {'V', 'a', 0x30f7},
1885 {'V', 'i', 0x30f8},
1886 {'V', 'e', 0x30f9},
1887 {'V', 'o', 0x30fa},
1888 {'.', '6', 0x30fb},
1889 {'-', '6', 0x30fc},
1890 {'*', '6', 0x30fd},
1891 {'+', '6', 0x30fe},
1892 {'b', '4', 0x3105},
1893 {'p', '4', 0x3106},
1894 {'m', '4', 0x3107},
1895 {'f', '4', 0x3108},
1896 {'d', '4', 0x3109},
1897 {'t', '4', 0x310a},
1898 {'n', '4', 0x310b},
1899 {'l', '4', 0x310c},
1900 {'g', '4', 0x310d},
1901 {'k', '4', 0x310e},
1902 {'h', '4', 0x310f},
1903 {'j', '4', 0x3110},
1904 {'q', '4', 0x3111},
1905 {'x', '4', 0x3112},
1906 {'z', 'h', 0x3113},
1907 {'c', 'h', 0x3114},
1908 {'s', 'h', 0x3115},
1909 {'r', '4', 0x3116},
1910 {'z', '4', 0x3117},
1911 {'c', '4', 0x3118},
1912 {'s', '4', 0x3119},
1913 {'a', '4', 0x311a},
1914 {'o', '4', 0x311b},
1915 {'e', '4', 0x311c},
1916 {'a', 'i', 0x311e},
1917 {'e', 'i', 0x311f},
1918 {'a', 'u', 0x3120},
1919 {'o', 'u', 0x3121},
1920 {'a', 'n', 0x3122},
1921 {'e', 'n', 0x3123},
1922 {'a', 'N', 0x3124},
1923 {'e', 'N', 0x3125},
1924 {'e', 'r', 0x3126},
1925 {'i', '4', 0x3127},
1926 {'u', '4', 0x3128},
1927 {'i', 'u', 0x3129},
1928 {'v', '4', 0x312a},
1929 {'n', 'G', 0x312b},
1930 {'g', 'n', 0x312c},
1931 {'1', 'c', 0x3220},
1932 {'2', 'c', 0x3221},
1933 {'3', 'c', 0x3222},
1934 {'4', 'c', 0x3223},
1935 {'5', 'c', 0x3224},
1936 {'6', 'c', 0x3225},
1937 {'7', 'c', 0x3226},
1938 {'8', 'c', 0x3227},
1939 {'9', 'c', 0x3228},
1940 {' ', ' ', 0xe000},
1941 {'/', 'c', 0xe001},
1942 {'U', 'A', 0xe002},
1943 {'U', 'B', 0xe003},
1944 {'"', '3', 0xe004},
1945 {'"', '1', 0xe005},
1946 {'"', '!', 0xe006},
1947 {'"', '\'', 0xe007},
1948 {'"', '>', 0xe008},
1949 {'"', '?', 0xe009},
1950 {'"', '-', 0xe00a},
1951 {'"', '(', 0xe00b},
1952 {'"', '.', 0xe00c},
1953 {'"', ':', 0xe00d},
1954 {'"', '0', 0xe00e},
1955 {'"', '"', 0xe00f},
1956 {'"', '<', 0xe010},
1957 {'"', ',', 0xe011},
1958 {'"', ';', 0xe012},
1959 {'"', '_', 0xe013},
1960 {'"', '=', 0xe014},
1961 {'"', '/', 0xe015},
1962 {'"', 'i', 0xe016},
1963 {'"', 'd', 0xe017},
1964 {'"', 'p', 0xe018},
1965 {';', ';', 0xe019},
1966 {',', ',', 0xe01a},
1967 {'b', '3', 0xe01b},
1968 {'C', 'i', 0xe01c},
1969 {'f', '(', 0xe01d},
1970 {'e', 'd', 0xe01e},
1971 {'a', 'm', 0xe01f},
1972 {'p', 'm', 0xe020},
1973 {'F', 'l', 0xe023},
1974 {'G', 'F', 0xe024},
1975 {'>', 'V', 0xe025},
1976 {'!', '*', 0xe026},
1977 {'?', '*', 0xe027},
1978 {'J', '<', 0xe028},
1979 {'f', 'f', 0xfb00},
1980 {'f', 'i', 0xfb01},
1981 {'f', 'l', 0xfb02},
1982 {'f', 't', 0xfb05},
1983 {'s', 't', 0xfb06},
1984# endif /* FEAT_MBYTE */
1985 {NUL, NUL, NUL}
1986 };
1987
1988# endif /* OLD_DIGRAPHS */
1989
1990# endif /* Macintosh */
1991# endif /* EBCDIC */
1992# endif /* !HPUX_DIGRAPHS */
1993# endif /* !__MINT__ */
1994#endif /* !MSDOS && !OS2 */
1995
1996/*
1997 * handle digraphs after typing a character
1998 */
1999 int
2000do_digraph(c)
2001 int c;
2002{
2003 static int backspaced; /* character before K_BS */
2004 static int lastchar; /* last typed character */
2005
2006 if (c == -1) /* init values */
2007 {
2008 backspaced = -1;
2009 }
2010 else if (p_dg)
2011 {
2012 if (backspaced >= 0)
2013 c = getdigraph(backspaced, c, FALSE);
2014 backspaced = -1;
2015 if ((c == K_BS || c == Ctrl_H) && lastchar >= 0)
2016 backspaced = lastchar;
2017 }
2018 lastchar = c;
2019 return c;
2020}
2021
2022/*
2023 * Get a digraph. Used after typing CTRL-K on the command line or in normal
2024 * mode.
2025 * Returns composed character, or NUL when ESC was used.
2026 */
2027 int
2028get_digraph(cmdline)
2029 int cmdline; /* TRUE when called from the cmdline */
2030{
2031 int c, cc;
2032
2033 ++no_mapping;
2034 ++allow_keys;
2035 c = safe_vgetc();
2036 --no_mapping;
2037 --allow_keys;
2038 if (c != ESC) /* ESC cancels CTRL-K */
2039 {
2040 if (IS_SPECIAL(c)) /* insert special key code */
2041 return c;
2042 if (cmdline)
2043 {
2044 if (char2cells(c) == 1
2045#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
2046 && cmdline_star == 0
2047#endif
2048 )
2049 putcmdline(c, TRUE);
2050 }
2051#ifdef FEAT_CMDL_INFO
2052 else
2053 add_to_showcmd(c);
2054#endif
2055 ++no_mapping;
2056 ++allow_keys;
2057 cc = safe_vgetc();
2058 --no_mapping;
2059 --allow_keys;
2060 if (cc != ESC) /* ESC cancels CTRL-K */
2061 return getdigraph(c, cc, TRUE);
2062 }
2063 return NUL;
2064}
2065
2066/*
2067 * Lookup the pair "char1", "char2" in the digraph tables.
2068 * If no match, return "char2".
2069 * If "meta" is TRUE and "char1" is a space, return "char2" | 0x80.
2070 */
2071 static int
2072getexactdigraph(char1, char2, meta)
2073 int char1;
2074 int char2;
2075 int meta;
2076{
2077 int i;
2078 int retval = 0;
2079 digr_T *dp;
2080
2081 if (IS_SPECIAL(char1) || IS_SPECIAL(char2))
2082 return char2;
2083
2084 /*
2085 * Search user digraphs first.
2086 */
2087 dp = (digr_T *)user_digraphs.ga_data;
2088 for (i = 0; i < user_digraphs.ga_len; ++i)
2089 {
2090 if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2091 {
2092 retval = dp->result;
2093 break;
2094 }
2095 ++dp;
2096 }
2097
2098 /*
2099 * Search default digraphs.
2100 */
2101 if (retval == 0)
2102 {
2103 dp = digraphdefault;
2104 for (i = 0; dp->char1 != 0; ++i)
2105 {
2106 if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2107 {
2108 retval = dp->result;
2109 break;
2110 }
2111 ++dp;
2112 }
2113 }
2114#ifdef FEAT_MBYTE
2115# ifdef USE_UNICODE_DIGRAPHS
2116 if (retval != 0 && !enc_utf8)
2117 {
2118 char_u buf[6], *to;
2119 vimconv_T vc;
2120
2121 /*
2122 * Convert the Unicode digraph to 'encoding'.
2123 */
2124 i = utf_char2bytes(retval, buf);
2125 retval = 0;
2126 vc.vc_type = CONV_NONE;
2127 if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK)
2128 {
2129 vc.vc_fail = TRUE;
2130 to = string_convert(&vc, buf, &i);
2131 if (to != NULL)
2132 {
2133 retval = (*mb_ptr2char)(to);
2134 vim_free(to);
2135 }
2136 (void)convert_setup(&vc, NULL, NULL);
2137 }
2138 }
2139# endif
2140
2141 /* Ignore multi-byte characters when not in multi-byte mode. */
2142 if (!has_mbyte && retval > 0xff)
2143 retval = 0;
2144#endif
2145
2146 if (retval == 0) /* digraph deleted or not found */
2147 {
2148 if (char1 == ' ' && meta) /* <space> <char> --> meta-char */
2149 return (char2 | 0x80);
2150 return char2;
2151 }
2152 return retval;
2153}
2154
2155/*
2156 * Get digraph.
2157 * Allow for both char1-char2 and char2-char1
2158 */
2159 int
2160getdigraph(char1, char2, meta)
2161 int char1;
2162 int char2;
2163 int meta;
2164{
2165 int retval;
2166
2167 if (((retval = getexactdigraph(char1, char2, meta)) == char2)
2168 && (char1 != char2)
2169 && ((retval = getexactdigraph(char2, char1, meta)) == char1))
2170 return char2;
2171 return retval;
2172}
2173
2174/*
2175 * Add the digraphs in the argument to the digraph table.
2176 * format: {c1}{c2} char {c1}{c2} char ...
2177 */
2178 void
2179putdigraph(str)
2180 char_u *str;
2181{
2182 int char1, char2, n;
2183 int i;
2184 digr_T *dp;
2185
2186 while (*str != NUL)
2187 {
2188 str = skipwhite(str);
2189 if (*str == NUL)
2190 return;
2191 char1 = *str++;
2192 char2 = *str++;
2193 if (char2 == 0)
2194 {
2195 EMSG(_(e_invarg));
2196 return;
2197 }
2198 if (char1 == ESC || char2 == ESC)
2199 {
2200 EMSG(_("E104: Escape not allowed in digraph"));
2201 return;
2202 }
2203 str = skipwhite(str);
2204 if (!VIM_ISDIGIT(*str))
2205 {
2206 EMSG(_(e_number_exp));
2207 return;
2208 }
2209 n = getdigits(&str);
2210
2211 /* If the digraph already exists, replace the result. */
2212 dp = (digr_T *)user_digraphs.ga_data;
2213 for (i = 0; i < user_digraphs.ga_len; ++i)
2214 {
2215 if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2216 {
2217 dp->result = n;
2218 break;
2219 }
2220 ++dp;
2221 }
2222
2223 /* Add a new digraph to the table. */
2224 if (i == user_digraphs.ga_len)
2225 {
2226 if (ga_grow(&user_digraphs, 1) == OK)
2227 {
2228 dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
2229 dp->char1 = char1;
2230 dp->char2 = char2;
2231 dp->result = n;
2232 ++user_digraphs.ga_len;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002233 }
2234 }
2235 }
2236}
2237
2238 void
2239listdigraphs()
2240{
2241 int i;
2242 digr_T *dp;
2243
2244 msg_putchar('\n');
2245
2246 dp = digraphdefault;
2247 for (i = 0; dp->char1 != NUL && !got_int; ++i)
2248 {
2249#if defined(USE_UNICODE_DIGRAPHS) && defined(FEAT_MBYTE)
2250 digr_T tmp;
2251
2252 /* May need to convert the result to 'encoding'. */
2253 tmp.char1 = dp->char1;
2254 tmp.char2 = dp->char2;
2255 tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
2256 if (tmp.result != 0 && tmp.result != tmp.char2
2257 && (has_mbyte || tmp.result <= 255))
2258 printdigraph(&tmp);
2259#else
2260
2261 if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
2262# ifdef FEAT_MBYTE
2263 && (has_mbyte || dp->result <= 255)
2264# endif
2265 )
2266 printdigraph(dp);
2267#endif
2268 ++dp;
2269 ui_breakcheck();
2270 }
2271
2272 dp = (digr_T *)user_digraphs.ga_data;
2273 for (i = 0; i < user_digraphs.ga_len && !got_int; ++i)
2274 {
2275 printdigraph(dp);
2276 ui_breakcheck();
2277 ++dp;
2278 }
2279 must_redraw = CLEAR; /* clear screen, because some digraphs may be
2280 wrong, in which case we messed up ScreenLines */
2281}
2282
2283 static void
2284printdigraph(dp)
2285 digr_T *dp;
2286{
2287 char_u buf[30];
2288 char_u *p;
2289
2290 int list_width;
2291
2292 if ((dy_flags & DY_UHEX)
2293#ifdef FEAT_MBYTE
2294 || has_mbyte
2295#endif
2296 )
2297 list_width = 13;
2298 else
2299 list_width = 11;
2300
2301 if (dp->result != 0)
2302 {
2303 if (msg_col > Columns - list_width)
2304 msg_putchar('\n');
2305 if (msg_col)
2306 while (msg_col % list_width != 0)
2307 msg_putchar(' ');
2308
2309 p = buf;
2310 *p++ = dp->char1;
2311 *p++ = dp->char2;
2312 *p++ = ' ';
2313#ifdef FEAT_MBYTE
2314 if (has_mbyte)
2315 {
2316 /* add a space to draw a composing char on */
2317 if (enc_utf8 && utf_iscomposing(dp->result))
2318 *p++ = ' ';
2319 p += (*mb_char2bytes)(dp->result, p);
2320 }
2321 else
2322#endif
2323 *p++ = dp->result;
2324 if (char2cells(dp->result) == 1)
2325 *p++ = ' ';
2326 sprintf((char *)p, " %3d", dp->result);
2327 msg_outtrans(buf);
2328 }
2329}
2330
2331#endif /* FEAT_DIGRAPHS */
2332
2333#if defined(FEAT_KEYMAP) || defined(PROTO)
2334
2335/* structure used for b_kmap_ga.ga_data */
2336typedef struct
2337{
2338 char_u *from;
2339 char_u *to;
2340} kmap_T;
2341
2342#define KMAP_MAXLEN 20 /* maximum length of "from" or "to" */
2343
2344static void keymap_unload __ARGS((void));
2345
2346/*
2347 * Set up key mapping tables for the 'keymap' option
2348 */
2349 char_u *
2350keymap_init()
2351{
2352 curbuf->b_kmap_state &= ~KEYMAP_INIT;
2353
2354 if (*curbuf->b_p_keymap == NUL)
2355 {
2356 /* Stop any active keymap and clear the table. */
2357 keymap_unload();
2358 }
2359 else
2360 {
2361 char_u *buf;
2362
2363 /* Source the keymap file. It will contain a ":loadkeymap" command
2364 * which will call ex_loadkeymap() below. */
2365 buf = alloc((unsigned)(STRLEN(curbuf->b_p_keymap)
2366# ifdef FEAT_MBYTE
2367 + STRLEN(p_enc)
2368# endif
2369 + 14));
2370 if (buf == NULL)
2371 return e_outofmem;
2372
2373# ifdef FEAT_MBYTE
2374 /* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
2375 sprintf((char *)buf, "keymap/%s_%s.vim", curbuf->b_p_keymap, p_enc);
2376 if (cmd_runtime(buf, FALSE) == FAIL)
2377# endif
2378 {
2379 /* try finding "keymap/'keymap'.vim" in 'runtimepath' */
2380 sprintf((char *)buf, "keymap/%s.vim", curbuf->b_p_keymap);
2381 if (cmd_runtime(buf, FALSE) == FAIL)
2382 {
2383 vim_free(buf);
2384 return (char_u *)N_("E544: Keymap file not found");
2385 }
2386 }
2387 vim_free(buf);
2388 }
2389
2390 return NULL;
2391}
2392
2393/*
2394 * ":loadkeymap" command: load the following lines as the keymap.
2395 */
2396 void
2397ex_loadkeymap(eap)
2398 exarg_T *eap;
2399{
2400 char_u *line;
2401 char_u *p;
2402 char_u *s;
2403 kmap_T *kp;
2404#define KMAP_LLEN 200 /* max length of "to" and "from" together */
2405 char_u buf[KMAP_LLEN + 11];
2406 int i;
2407 char_u *save_cpo = p_cpo;
2408
2409 if (!getline_equal(eap->getline, eap->cookie, getsourceline))
2410 {
2411 EMSG(_("E105: Using :loadkeymap not in a sourced file"));
2412 return;
2413 }
2414
2415 /*
2416 * Stop any active keymap and clear the table.
2417 */
2418 keymap_unload();
2419
2420 curbuf->b_kmap_state = 0;
2421 ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
2422
2423 /* Set 'cpoptions' to "C" to avoid line continuation. */
2424 p_cpo = (char_u *)"C";
2425
2426 /*
2427 * Get each line of the sourced file, break at the end.
2428 */
2429 for (;;)
2430 {
2431 line = eap->getline(0, eap->cookie, 0);
2432 if (line == NULL)
2433 break;
2434
2435 p = skipwhite(line);
2436 if (*p != '"' && *p != NUL && ga_grow(&curbuf->b_kmap_ga, 1) == OK)
2437 {
2438 kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len;
2439 s = skiptowhite(p);
2440 kp->from = vim_strnsave(p, (int)(s - p));
2441 p = skipwhite(s);
2442 s = skiptowhite(p);
2443 kp->to = vim_strnsave(p, (int)(s - p));
2444
2445 if (kp->from == NULL || kp->to == NULL
2446 || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN)
2447 {
2448 vim_free(kp->from);
2449 vim_free(kp->to);
2450 }
2451 else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002452 ++curbuf->b_kmap_ga.ga_len;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002453 }
2454 vim_free(line);
2455 }
2456
2457 /*
2458 * setup ":lnoremap" to map the keys
2459 */
2460 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2461 {
2462 sprintf((char *)buf, "<buffer> %s %s",
2463 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from,
2464 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to);
2465 (void)do_map(2, buf, LANGMAP, FALSE);
2466 }
2467
2468 p_cpo = save_cpo;
2469
2470 curbuf->b_kmap_state |= KEYMAP_LOADED;
2471#ifdef FEAT_WINDOWS
2472 status_redraw_curbuf();
2473#endif
2474}
2475
2476/*
2477 * Stop using 'keymap'.
2478 */
2479 static void
2480keymap_unload()
2481{
2482 char_u buf[KMAP_MAXLEN + 10];
2483 int i;
2484 char_u *save_cpo = p_cpo;
2485
2486 if (!(curbuf->b_kmap_state & KEYMAP_LOADED))
2487 return;
2488
2489 /* Set 'cpoptions' to "C" to avoid line continuation. */
2490 p_cpo = (char_u *)"C";
2491
2492 /* clear the ":lmap"s */
2493 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2494 {
2495 sprintf((char *)buf, "<buffer> %s",
2496 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from);
2497 (void)do_map(1, buf, LANGMAP, FALSE);
2498 }
2499
2500 p_cpo = save_cpo;
2501
2502 ga_clear(&curbuf->b_kmap_ga);
2503 curbuf->b_kmap_state &= ~KEYMAP_LOADED;
2504#ifdef FEAT_WINDOWS
2505 status_redraw_curbuf();
2506#endif
2507}
2508
2509#endif /* FEAT_KEYMAP */
2510