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