xref: /vim-8.2.3635/src/digraph.c (revision bb76f24a)
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 	{'%', '0', 0x2030},
1316 	{'1', '\'', 0x2032},
1317 	{'2', '\'', 0x2033},
1318 	{'3', '\'', 0x2034},
1319 	{'1', '"', 0x2035},
1320 	{'2', '"', 0x2036},
1321 	{'3', '"', 0x2037},
1322 	{'C', 'a', 0x2038},
1323 	{'<', '1', 0x2039},
1324 	{'>', '1', 0x203a},
1325 	{':', 'X', 0x203b},
1326 	{'\'', '-', 0x203e},
1327 	{'/', 'f', 0x2044},
1328 	{'0', 'S', 0x2070},
1329 	{'4', 'S', 0x2074},
1330 	{'5', 'S', 0x2075},
1331 	{'6', 'S', 0x2076},
1332 	{'7', 'S', 0x2077},
1333 	{'8', 'S', 0x2078},
1334 	{'9', 'S', 0x2079},
1335 	{'+', 'S', 0x207a},
1336 	{'-', 'S', 0x207b},
1337 	{'=', 'S', 0x207c},
1338 	{'(', 'S', 0x207d},
1339 	{')', 'S', 0x207e},
1340 	{'n', 'S', 0x207f},
1341 	{'0', 's', 0x2080},
1342 	{'1', 's', 0x2081},
1343 	{'2', 's', 0x2082},
1344 	{'3', 's', 0x2083},
1345 	{'4', 's', 0x2084},
1346 	{'5', 's', 0x2085},
1347 	{'6', 's', 0x2086},
1348 	{'7', 's', 0x2087},
1349 	{'8', 's', 0x2088},
1350 	{'9', 's', 0x2089},
1351 	{'+', 's', 0x208a},
1352 	{'-', 's', 0x208b},
1353 	{'=', 's', 0x208c},
1354 	{'(', 's', 0x208d},
1355 	{')', 's', 0x208e},
1356 	{'L', 'i', 0x20a4},
1357 	{'P', 't', 0x20a7},
1358 	{'W', '=', 0x20a9},
1359 	{'=', 'e', 0x20ac}, /* euro */
1360 	{'E', 'u', 0x20ac}, /* euro */
1361 	{'=', 'R', 0x20bd}, /* rouble */
1362 	{'=', 'P', 0x20bd}, /* rouble */
1363 	{'o', 'C', 0x2103},
1364 	{'c', 'o', 0x2105},
1365 	{'o', 'F', 0x2109},
1366 	{'N', '0', 0x2116},
1367 	{'P', 'O', 0x2117},
1368 	{'R', 'x', 0x211e},
1369 	{'S', 'M', 0x2120},
1370 	{'T', 'M', 0x2122},
1371 	{'O', 'm', 0x2126},
1372 	{'A', 'O', 0x212b},
1373 	{'1', '3', 0x2153},
1374 	{'2', '3', 0x2154},
1375 	{'1', '5', 0x2155},
1376 	{'2', '5', 0x2156},
1377 	{'3', '5', 0x2157},
1378 	{'4', '5', 0x2158},
1379 	{'1', '6', 0x2159},
1380 	{'5', '6', 0x215a},
1381 	{'1', '8', 0x215b},
1382 	{'3', '8', 0x215c},
1383 	{'5', '8', 0x215d},
1384 	{'7', '8', 0x215e},
1385 	{'1', 'R', 0x2160},
1386 	{'2', 'R', 0x2161},
1387 	{'3', 'R', 0x2162},
1388 	{'4', 'R', 0x2163},
1389 	{'5', 'R', 0x2164},
1390 	{'6', 'R', 0x2165},
1391 	{'7', 'R', 0x2166},
1392 	{'8', 'R', 0x2167},
1393 	{'9', 'R', 0x2168},
1394 	{'a', 'R', 0x2169},
1395 	{'b', 'R', 0x216a},
1396 	{'c', 'R', 0x216b},
1397 	{'1', 'r', 0x2170},
1398 	{'2', 'r', 0x2171},
1399 	{'3', 'r', 0x2172},
1400 	{'4', 'r', 0x2173},
1401 	{'5', 'r', 0x2174},
1402 	{'6', 'r', 0x2175},
1403 	{'7', 'r', 0x2176},
1404 	{'8', 'r', 0x2177},
1405 	{'9', 'r', 0x2178},
1406 	{'a', 'r', 0x2179},
1407 	{'b', 'r', 0x217a},
1408 	{'c', 'r', 0x217b},
1409 	{'<', '-', 0x2190},
1410 	{'-', '!', 0x2191},
1411 	{'-', '>', 0x2192},
1412 	{'-', 'v', 0x2193},
1413 	{'<', '>', 0x2194},
1414 	{'U', 'D', 0x2195},
1415 	{'<', '=', 0x21d0},
1416 	{'=', '>', 0x21d2},
1417 	{'=', '=', 0x21d4},
1418 	{'F', 'A', 0x2200},
1419 	{'d', 'P', 0x2202},
1420 	{'T', 'E', 0x2203},
1421 	{'/', '0', 0x2205},
1422 	{'D', 'E', 0x2206},
1423 	{'N', 'B', 0x2207},
1424 	{'(', '-', 0x2208},
1425 	{'-', ')', 0x220b},
1426 	{'*', 'P', 0x220f},
1427 	{'+', 'Z', 0x2211},
1428 	{'-', '2', 0x2212},
1429 	{'-', '+', 0x2213},
1430 	{'*', '-', 0x2217},
1431 	{'O', 'b', 0x2218},
1432 	{'S', 'b', 0x2219},
1433 	{'R', 'T', 0x221a},
1434 	{'0', '(', 0x221d},
1435 	{'0', '0', 0x221e},
1436 	{'-', 'L', 0x221f},
1437 	{'-', 'V', 0x2220},
1438 	{'P', 'P', 0x2225},
1439 	{'A', 'N', 0x2227},
1440 	{'O', 'R', 0x2228},
1441 	{'(', 'U', 0x2229},
1442 	{')', 'U', 0x222a},
1443 	{'I', 'n', 0x222b},
1444 	{'D', 'I', 0x222c},
1445 	{'I', 'o', 0x222e},
1446 	{'.', ':', 0x2234},
1447 	{':', '.', 0x2235},
1448 	{':', 'R', 0x2236},
1449 	{':', ':', 0x2237},
1450 	{'?', '1', 0x223c},
1451 	{'C', 'G', 0x223e},
1452 	{'?', '-', 0x2243},
1453 	{'?', '=', 0x2245},
1454 	{'?', '2', 0x2248},
1455 	{'=', '?', 0x224c},
1456 	{'H', 'I', 0x2253},
1457 	{'!', '=', 0x2260},
1458 	{'=', '3', 0x2261},
1459 	{'=', '<', 0x2264},
1460 	{'>', '=', 0x2265},
1461 	{'<', '*', 0x226a},
1462 	{'*', '>', 0x226b},
1463 	{'!', '<', 0x226e},
1464 	{'!', '>', 0x226f},
1465 	{'(', 'C', 0x2282},
1466 	{')', 'C', 0x2283},
1467 	{'(', '_', 0x2286},
1468 	{')', '_', 0x2287},
1469 	{'0', '.', 0x2299},
1470 	{'0', '2', 0x229a},
1471 	{'-', 'T', 0x22a5},
1472 	{'.', 'P', 0x22c5},
1473 	{':', '3', 0x22ee},
1474 	{'.', '3', 0x22ef},
1475 	{'E', 'h', 0x2302},
1476 	{'<', '7', 0x2308},
1477 	{'>', '7', 0x2309},
1478 	{'7', '<', 0x230a},
1479 	{'7', '>', 0x230b},
1480 	{'N', 'I', 0x2310},
1481 	{'(', 'A', 0x2312},
1482 	{'T', 'R', 0x2315},
1483 	{'I', 'u', 0x2320},
1484 	{'I', 'l', 0x2321},
1485 	{'<', '/', 0x2329},
1486 	{'/', '>', 0x232a},
1487 	{'V', 's', 0x2423},
1488 	{'1', 'h', 0x2440},
1489 	{'3', 'h', 0x2441},
1490 	{'2', 'h', 0x2442},
1491 	{'4', 'h', 0x2443},
1492 	{'1', 'j', 0x2446},
1493 	{'2', 'j', 0x2447},
1494 	{'3', 'j', 0x2448},
1495 	{'4', 'j', 0x2449},
1496 	{'1', '.', 0x2488},
1497 	{'2', '.', 0x2489},
1498 	{'3', '.', 0x248a},
1499 	{'4', '.', 0x248b},
1500 	{'5', '.', 0x248c},
1501 	{'6', '.', 0x248d},
1502 	{'7', '.', 0x248e},
1503 	{'8', '.', 0x248f},
1504 	{'9', '.', 0x2490},
1505 	{'h', 'h', 0x2500},
1506 	{'H', 'H', 0x2501},
1507 	{'v', 'v', 0x2502},
1508 	{'V', 'V', 0x2503},
1509 	{'3', '-', 0x2504},
1510 	{'3', '_', 0x2505},
1511 	{'3', '!', 0x2506},
1512 	{'3', '/', 0x2507},
1513 	{'4', '-', 0x2508},
1514 	{'4', '_', 0x2509},
1515 	{'4', '!', 0x250a},
1516 	{'4', '/', 0x250b},
1517 	{'d', 'r', 0x250c},
1518 	{'d', 'R', 0x250d},
1519 	{'D', 'r', 0x250e},
1520 	{'D', 'R', 0x250f},
1521 	{'d', 'l', 0x2510},
1522 	{'d', 'L', 0x2511},
1523 	{'D', 'l', 0x2512},
1524 	{'L', 'D', 0x2513},
1525 	{'u', 'r', 0x2514},
1526 	{'u', 'R', 0x2515},
1527 	{'U', 'r', 0x2516},
1528 	{'U', 'R', 0x2517},
1529 	{'u', 'l', 0x2518},
1530 	{'u', 'L', 0x2519},
1531 	{'U', 'l', 0x251a},
1532 	{'U', 'L', 0x251b},
1533 	{'v', 'r', 0x251c},
1534 	{'v', 'R', 0x251d},
1535 	{'V', 'r', 0x2520},
1536 	{'V', 'R', 0x2523},
1537 	{'v', 'l', 0x2524},
1538 	{'v', 'L', 0x2525},
1539 	{'V', 'l', 0x2528},
1540 	{'V', 'L', 0x252b},
1541 	{'d', 'h', 0x252c},
1542 	{'d', 'H', 0x252f},
1543 	{'D', 'h', 0x2530},
1544 	{'D', 'H', 0x2533},
1545 	{'u', 'h', 0x2534},
1546 	{'u', 'H', 0x2537},
1547 	{'U', 'h', 0x2538},
1548 	{'U', 'H', 0x253b},
1549 	{'v', 'h', 0x253c},
1550 	{'v', 'H', 0x253f},
1551 	{'V', 'h', 0x2542},
1552 	{'V', 'H', 0x254b},
1553 	{'F', 'D', 0x2571},
1554 	{'B', 'D', 0x2572},
1555 	{'T', 'B', 0x2580},
1556 	{'L', 'B', 0x2584},
1557 	{'F', 'B', 0x2588},
1558 	{'l', 'B', 0x258c},
1559 	{'R', 'B', 0x2590},
1560 	{'.', 'S', 0x2591},
1561 	{':', 'S', 0x2592},
1562 	{'?', 'S', 0x2593},
1563 	{'f', 'S', 0x25a0},
1564 	{'O', 'S', 0x25a1},
1565 	{'R', 'O', 0x25a2},
1566 	{'R', 'r', 0x25a3},
1567 	{'R', 'F', 0x25a4},
1568 	{'R', 'Y', 0x25a5},
1569 	{'R', 'H', 0x25a6},
1570 	{'R', 'Z', 0x25a7},
1571 	{'R', 'K', 0x25a8},
1572 	{'R', 'X', 0x25a9},
1573 	{'s', 'B', 0x25aa},
1574 	{'S', 'R', 0x25ac},
1575 	{'O', 'r', 0x25ad},
1576 	{'U', 'T', 0x25b2},
1577 	{'u', 'T', 0x25b3},
1578 	{'P', 'R', 0x25b6},
1579 	{'T', 'r', 0x25b7},
1580 	{'D', 't', 0x25bc},
1581 	{'d', 'T', 0x25bd},
1582 	{'P', 'L', 0x25c0},
1583 	{'T', 'l', 0x25c1},
1584 	{'D', 'b', 0x25c6},
1585 	{'D', 'w', 0x25c7},
1586 	{'L', 'Z', 0x25ca},
1587 	{'0', 'm', 0x25cb},
1588 	{'0', 'o', 0x25ce},
1589 	{'0', 'M', 0x25cf},
1590 	{'0', 'L', 0x25d0},
1591 	{'0', 'R', 0x25d1},
1592 	{'S', 'n', 0x25d8},
1593 	{'I', 'c', 0x25d9},
1594 	{'F', 'd', 0x25e2},
1595 	{'B', 'd', 0x25e3},
1596 	{'*', '2', 0x2605},
1597 	{'*', '1', 0x2606},
1598 	{'<', 'H', 0x261c},
1599 	{'>', 'H', 0x261e},
1600 	{'0', 'u', 0x263a},
1601 	{'0', 'U', 0x263b},
1602 	{'S', 'U', 0x263c},
1603 	{'F', 'm', 0x2640},
1604 	{'M', 'l', 0x2642},
1605 	{'c', 'S', 0x2660},
1606 	{'c', 'H', 0x2661},
1607 	{'c', 'D', 0x2662},
1608 	{'c', 'C', 0x2663},
1609 	{'M', 'd', 0x2669},
1610 	{'M', '8', 0x266a},
1611 	{'M', '2', 0x266b},
1612 	{'M', 'b', 0x266d},
1613 	{'M', 'x', 0x266e},
1614 	{'M', 'X', 0x266f},
1615 	{'O', 'K', 0x2713},
1616 	{'X', 'X', 0x2717},
1617 	{'-', 'X', 0x2720},
1618 	{'I', 'S', 0x3000},
1619 	{',', '_', 0x3001},
1620 	{'.', '_', 0x3002},
1621 	{'+', '"', 0x3003},
1622 	{'+', '_', 0x3004},
1623 	{'*', '_', 0x3005},
1624 	{';', '_', 0x3006},
1625 	{'0', '_', 0x3007},
1626 	{'<', '+', 0x300a},
1627 	{'>', '+', 0x300b},
1628 	{'<', '\'', 0x300c},
1629 	{'>', '\'', 0x300d},
1630 	{'<', '"', 0x300e},
1631 	{'>', '"', 0x300f},
1632 	{'(', '"', 0x3010},
1633 	{')', '"', 0x3011},
1634 	{'=', 'T', 0x3012},
1635 	{'=', '_', 0x3013},
1636 	{'(', '\'', 0x3014},
1637 	{')', '\'', 0x3015},
1638 	{'(', 'I', 0x3016},
1639 	{')', 'I', 0x3017},
1640 	{'-', '?', 0x301c},
1641 	{'A', '5', 0x3041},
1642 	{'a', '5', 0x3042},
1643 	{'I', '5', 0x3043},
1644 	{'i', '5', 0x3044},
1645 	{'U', '5', 0x3045},
1646 	{'u', '5', 0x3046},
1647 	{'E', '5', 0x3047},
1648 	{'e', '5', 0x3048},
1649 	{'O', '5', 0x3049},
1650 	{'o', '5', 0x304a},
1651 	{'k', 'a', 0x304b},
1652 	{'g', 'a', 0x304c},
1653 	{'k', 'i', 0x304d},
1654 	{'g', 'i', 0x304e},
1655 	{'k', 'u', 0x304f},
1656 	{'g', 'u', 0x3050},
1657 	{'k', 'e', 0x3051},
1658 	{'g', 'e', 0x3052},
1659 	{'k', 'o', 0x3053},
1660 	{'g', 'o', 0x3054},
1661 	{'s', 'a', 0x3055},
1662 	{'z', 'a', 0x3056},
1663 	{'s', 'i', 0x3057},
1664 	{'z', 'i', 0x3058},
1665 	{'s', 'u', 0x3059},
1666 	{'z', 'u', 0x305a},
1667 	{'s', 'e', 0x305b},
1668 	{'z', 'e', 0x305c},
1669 	{'s', 'o', 0x305d},
1670 	{'z', 'o', 0x305e},
1671 	{'t', 'a', 0x305f},
1672 	{'d', 'a', 0x3060},
1673 	{'t', 'i', 0x3061},
1674 	{'d', 'i', 0x3062},
1675 	{'t', 'U', 0x3063},
1676 	{'t', 'u', 0x3064},
1677 	{'d', 'u', 0x3065},
1678 	{'t', 'e', 0x3066},
1679 	{'d', 'e', 0x3067},
1680 	{'t', 'o', 0x3068},
1681 	{'d', 'o', 0x3069},
1682 	{'n', 'a', 0x306a},
1683 	{'n', 'i', 0x306b},
1684 	{'n', 'u', 0x306c},
1685 	{'n', 'e', 0x306d},
1686 	{'n', 'o', 0x306e},
1687 	{'h', 'a', 0x306f},
1688 	{'b', 'a', 0x3070},
1689 	{'p', 'a', 0x3071},
1690 	{'h', 'i', 0x3072},
1691 	{'b', 'i', 0x3073},
1692 	{'p', 'i', 0x3074},
1693 	{'h', 'u', 0x3075},
1694 	{'b', 'u', 0x3076},
1695 	{'p', 'u', 0x3077},
1696 	{'h', 'e', 0x3078},
1697 	{'b', 'e', 0x3079},
1698 	{'p', 'e', 0x307a},
1699 	{'h', 'o', 0x307b},
1700 	{'b', 'o', 0x307c},
1701 	{'p', 'o', 0x307d},
1702 	{'m', 'a', 0x307e},
1703 	{'m', 'i', 0x307f},
1704 	{'m', 'u', 0x3080},
1705 	{'m', 'e', 0x3081},
1706 	{'m', 'o', 0x3082},
1707 	{'y', 'A', 0x3083},
1708 	{'y', 'a', 0x3084},
1709 	{'y', 'U', 0x3085},
1710 	{'y', 'u', 0x3086},
1711 	{'y', 'O', 0x3087},
1712 	{'y', 'o', 0x3088},
1713 	{'r', 'a', 0x3089},
1714 	{'r', 'i', 0x308a},
1715 	{'r', 'u', 0x308b},
1716 	{'r', 'e', 0x308c},
1717 	{'r', 'o', 0x308d},
1718 	{'w', 'A', 0x308e},
1719 	{'w', 'a', 0x308f},
1720 	{'w', 'i', 0x3090},
1721 	{'w', 'e', 0x3091},
1722 	{'w', 'o', 0x3092},
1723 	{'n', '5', 0x3093},
1724 	{'v', 'u', 0x3094},
1725 	{'"', '5', 0x309b},
1726 	{'0', '5', 0x309c},
1727 	{'*', '5', 0x309d},
1728 	{'+', '5', 0x309e},
1729 	{'a', '6', 0x30a1},
1730 	{'A', '6', 0x30a2},
1731 	{'i', '6', 0x30a3},
1732 	{'I', '6', 0x30a4},
1733 	{'u', '6', 0x30a5},
1734 	{'U', '6', 0x30a6},
1735 	{'e', '6', 0x30a7},
1736 	{'E', '6', 0x30a8},
1737 	{'o', '6', 0x30a9},
1738 	{'O', '6', 0x30aa},
1739 	{'K', 'a', 0x30ab},
1740 	{'G', 'a', 0x30ac},
1741 	{'K', 'i', 0x30ad},
1742 	{'G', 'i', 0x30ae},
1743 	{'K', 'u', 0x30af},
1744 	{'G', 'u', 0x30b0},
1745 	{'K', 'e', 0x30b1},
1746 	{'G', 'e', 0x30b2},
1747 	{'K', 'o', 0x30b3},
1748 	{'G', 'o', 0x30b4},
1749 	{'S', 'a', 0x30b5},
1750 	{'Z', 'a', 0x30b6},
1751 	{'S', 'i', 0x30b7},
1752 	{'Z', 'i', 0x30b8},
1753 	{'S', 'u', 0x30b9},
1754 	{'Z', 'u', 0x30ba},
1755 	{'S', 'e', 0x30bb},
1756 	{'Z', 'e', 0x30bc},
1757 	{'S', 'o', 0x30bd},
1758 	{'Z', 'o', 0x30be},
1759 	{'T', 'a', 0x30bf},
1760 	{'D', 'a', 0x30c0},
1761 	{'T', 'i', 0x30c1},
1762 	{'D', 'i', 0x30c2},
1763 	{'T', 'U', 0x30c3},
1764 	{'T', 'u', 0x30c4},
1765 	{'D', 'u', 0x30c5},
1766 	{'T', 'e', 0x30c6},
1767 	{'D', 'e', 0x30c7},
1768 	{'T', 'o', 0x30c8},
1769 	{'D', 'o', 0x30c9},
1770 	{'N', 'a', 0x30ca},
1771 	{'N', 'i', 0x30cb},
1772 	{'N', 'u', 0x30cc},
1773 	{'N', 'e', 0x30cd},
1774 	{'N', 'o', 0x30ce},
1775 	{'H', 'a', 0x30cf},
1776 	{'B', 'a', 0x30d0},
1777 	{'P', 'a', 0x30d1},
1778 	{'H', 'i', 0x30d2},
1779 	{'B', 'i', 0x30d3},
1780 	{'P', 'i', 0x30d4},
1781 	{'H', 'u', 0x30d5},
1782 	{'B', 'u', 0x30d6},
1783 	{'P', 'u', 0x30d7},
1784 	{'H', 'e', 0x30d8},
1785 	{'B', 'e', 0x30d9},
1786 	{'P', 'e', 0x30da},
1787 	{'H', 'o', 0x30db},
1788 	{'B', 'o', 0x30dc},
1789 	{'P', 'o', 0x30dd},
1790 	{'M', 'a', 0x30de},
1791 	{'M', 'i', 0x30df},
1792 	{'M', 'u', 0x30e0},
1793 	{'M', 'e', 0x30e1},
1794 	{'M', 'o', 0x30e2},
1795 	{'Y', 'A', 0x30e3},
1796 	{'Y', 'a', 0x30e4},
1797 	{'Y', 'U', 0x30e5},
1798 	{'Y', 'u', 0x30e6},
1799 	{'Y', 'O', 0x30e7},
1800 	{'Y', 'o', 0x30e8},
1801 	{'R', 'a', 0x30e9},
1802 	{'R', 'i', 0x30ea},
1803 	{'R', 'u', 0x30eb},
1804 	{'R', 'e', 0x30ec},
1805 	{'R', 'o', 0x30ed},
1806 	{'W', 'A', 0x30ee},
1807 	{'W', 'a', 0x30ef},
1808 	{'W', 'i', 0x30f0},
1809 	{'W', 'e', 0x30f1},
1810 	{'W', 'o', 0x30f2},
1811 	{'N', '6', 0x30f3},
1812 	{'V', 'u', 0x30f4},
1813 	{'K', 'A', 0x30f5},
1814 	{'K', 'E', 0x30f6},
1815 	{'V', 'a', 0x30f7},
1816 	{'V', 'i', 0x30f8},
1817 	{'V', 'e', 0x30f9},
1818 	{'V', 'o', 0x30fa},
1819 	{'.', '6', 0x30fb},
1820 	{'-', '6', 0x30fc},
1821 	{'*', '6', 0x30fd},
1822 	{'+', '6', 0x30fe},
1823 	{'b', '4', 0x3105},
1824 	{'p', '4', 0x3106},
1825 	{'m', '4', 0x3107},
1826 	{'f', '4', 0x3108},
1827 	{'d', '4', 0x3109},
1828 	{'t', '4', 0x310a},
1829 	{'n', '4', 0x310b},
1830 	{'l', '4', 0x310c},
1831 	{'g', '4', 0x310d},
1832 	{'k', '4', 0x310e},
1833 	{'h', '4', 0x310f},
1834 	{'j', '4', 0x3110},
1835 	{'q', '4', 0x3111},
1836 	{'x', '4', 0x3112},
1837 	{'z', 'h', 0x3113},
1838 	{'c', 'h', 0x3114},
1839 	{'s', 'h', 0x3115},
1840 	{'r', '4', 0x3116},
1841 	{'z', '4', 0x3117},
1842 	{'c', '4', 0x3118},
1843 	{'s', '4', 0x3119},
1844 	{'a', '4', 0x311a},
1845 	{'o', '4', 0x311b},
1846 	{'e', '4', 0x311c},
1847 	{'a', 'i', 0x311e},
1848 	{'e', 'i', 0x311f},
1849 	{'a', 'u', 0x3120},
1850 	{'o', 'u', 0x3121},
1851 	{'a', 'n', 0x3122},
1852 	{'e', 'n', 0x3123},
1853 	{'a', 'N', 0x3124},
1854 	{'e', 'N', 0x3125},
1855 	{'e', 'r', 0x3126},
1856 	{'i', '4', 0x3127},
1857 	{'u', '4', 0x3128},
1858 	{'i', 'u', 0x3129},
1859 	{'v', '4', 0x312a},
1860 	{'n', 'G', 0x312b},
1861 	{'g', 'n', 0x312c},
1862 	{'1', 'c', 0x3220},
1863 	{'2', 'c', 0x3221},
1864 	{'3', 'c', 0x3222},
1865 	{'4', 'c', 0x3223},
1866 	{'5', 'c', 0x3224},
1867 	{'6', 'c', 0x3225},
1868 	{'7', 'c', 0x3226},
1869 	{'8', 'c', 0x3227},
1870 	{'9', 'c', 0x3228},
1871 	/* code points 0xe000 - 0xefff excluded, they have no assigned
1872 	 * characters, only used in proposals. */
1873 	{'f', 'f', 0xfb00},
1874 	{'f', 'i', 0xfb01},
1875 	{'f', 'l', 0xfb02},
1876 	{'f', 't', 0xfb05},
1877 	{'s', 't', 0xfb06},
1878 #      endif /* FEAT_MBYTE */
1879 
1880 	/* Vim 5.x compatible digraphs that don't conflict with the above */
1881 	{'~', '!', 161},	/* � */
1882 	{'c', '|', 162},	/* � */
1883 	{'$', '$', 163},	/* � */
1884 	{'o', 'x', 164},	/* � - currency symbol in ISO 8859-1 */
1885 	{'Y', '-', 165},	/* � */
1886 	{'|', '|', 166},	/* � */
1887 	{'c', 'O', 169},	/* � */
1888 	{'-', ',', 172},	/* � */
1889 	{'-', '=', 175},	/* � */
1890 	{'~', 'o', 176},	/* � */
1891 	{'2', '2', 178},	/* � */
1892 	{'3', '3', 179},	/* � */
1893 	{'p', 'p', 182},	/* � */
1894 	{'~', '.', 183},	/* � */
1895 	{'1', '1', 185},	/* � */
1896 	{'~', '?', 191},	/* � */
1897 	{'A', '`', 192},	/* � */
1898 	{'A', '^', 194},	/* � */
1899 	{'A', '~', 195},	/* � */
1900 	{'A', '"', 196},	/* � */
1901 	{'A', '@', 197},	/* � */
1902 	{'E', '`', 200},	/* � */
1903 	{'E', '^', 202},	/* � */
1904 	{'E', '"', 203},	/* � */
1905 	{'I', '`', 204},	/* � */
1906 	{'I', '^', 206},	/* � */
1907 	{'I', '"', 207},	/* � */
1908 	{'N', '~', 209},	/* � */
1909 	{'O', '`', 210},	/* � */
1910 	{'O', '^', 212},	/* � */
1911 	{'O', '~', 213},	/* � */
1912 	{'/', '\\', 215},	/* � - multiplication symbol in ISO 8859-1 */
1913 	{'U', '`', 217},	/* � */
1914 	{'U', '^', 219},	/* � */
1915 	{'I', 'p', 222},	/* � */
1916 	{'a', '`', 224},	/* � */
1917 	{'a', '^', 226},	/* � */
1918 	{'a', '~', 227},	/* � */
1919 	{'a', '"', 228},	/* � */
1920 	{'a', '@', 229},	/* � */
1921 	{'e', '`', 232},	/* � */
1922 	{'e', '^', 234},	/* � */
1923 	{'e', '"', 235},	/* � */
1924 	{'i', '`', 236},	/* � */
1925 	{'i', '^', 238},	/* � */
1926 	{'n', '~', 241},	/* � */
1927 	{'o', '`', 242},	/* � */
1928 	{'o', '^', 244},	/* � */
1929 	{'o', '~', 245},	/* � */
1930 	{'u', '`', 249},	/* � */
1931 	{'u', '^', 251},	/* � */
1932 	{'y', '"', 255},	/* x XX */
1933 
1934 	{NUL, NUL, NUL}
1935        };
1936 
1937 #    endif /* OLD_DIGRAPHS */
1938 
1939 #   endif /* Macintosh */
1940 #  endif /* EBCDIC */
1941 # endif    /* !HPUX_DIGRAPHS */
1942 #endif	/* !__MINT__ */
1943 
1944 /*
1945  * handle digraphs after typing a character
1946  */
1947     int
1948 do_digraph(int c)
1949 {
1950     static int	backspaced;	/* character before K_BS */
1951     static int	lastchar;	/* last typed character */
1952 
1953     if (c == -1)		/* init values */
1954     {
1955 	backspaced = -1;
1956     }
1957     else if (p_dg)
1958     {
1959 	if (backspaced >= 0)
1960 	    c = getdigraph(backspaced, c, FALSE);
1961 	backspaced = -1;
1962 	if ((c == K_BS || c == Ctrl_H) && lastchar >= 0)
1963 	    backspaced = lastchar;
1964     }
1965     lastchar = c;
1966     return c;
1967 }
1968 
1969 /*
1970  * Get a digraph.  Used after typing CTRL-K on the command line or in normal
1971  * mode.
1972  * Returns composed character, or NUL when ESC was used.
1973  */
1974     int
1975 get_digraph(
1976     int		cmdline)	/* TRUE when called from the cmdline */
1977 {
1978     int		c, cc;
1979 
1980     ++no_mapping;
1981     ++allow_keys;
1982     c = plain_vgetc();
1983     --no_mapping;
1984     --allow_keys;
1985     if (c != ESC)		/* ESC cancels CTRL-K */
1986     {
1987 	if (IS_SPECIAL(c))	/* insert special key code */
1988 	    return c;
1989 	if (cmdline)
1990 	{
1991 	    if (char2cells(c) == 1
1992 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
1993 		    && cmdline_star == 0
1994 #endif
1995 		    )
1996 		putcmdline(c, TRUE);
1997 	}
1998 #ifdef FEAT_CMDL_INFO
1999 	else
2000 	    add_to_showcmd(c);
2001 #endif
2002 	++no_mapping;
2003 	++allow_keys;
2004 	cc = plain_vgetc();
2005 	--no_mapping;
2006 	--allow_keys;
2007 	if (cc != ESC)	    /* ESC cancels CTRL-K */
2008 	    return getdigraph(c, cc, TRUE);
2009     }
2010     return NUL;
2011 }
2012 
2013 /*
2014  * Lookup the pair "char1", "char2" in the digraph tables.
2015  * If no match, return "char2".
2016  * If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80.
2017  */
2018     static int
2019 getexactdigraph(int char1, int char2, int meta_char)
2020 {
2021     int		i;
2022     int		retval = 0;
2023     digr_T	*dp;
2024 
2025     if (IS_SPECIAL(char1) || IS_SPECIAL(char2))
2026 	return char2;
2027 
2028     /*
2029      * Search user digraphs first.
2030      */
2031     dp = (digr_T *)user_digraphs.ga_data;
2032     for (i = 0; i < user_digraphs.ga_len; ++i)
2033     {
2034 	if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2035 	{
2036 	    retval = dp->result;
2037 	    break;
2038 	}
2039 	++dp;
2040     }
2041 
2042     /*
2043      * Search default digraphs.
2044      */
2045     if (retval == 0)
2046     {
2047 	dp = digraphdefault;
2048 	for (i = 0; dp->char1 != 0; ++i)
2049 	{
2050 	    if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2051 	    {
2052 		retval = dp->result;
2053 		break;
2054 	    }
2055 	    ++dp;
2056 	}
2057     }
2058 #ifdef FEAT_MBYTE
2059 # ifdef USE_UNICODE_DIGRAPHS
2060     if (retval != 0 && !enc_utf8)
2061     {
2062 	char_u	    buf[6], *to;
2063 	vimconv_T   vc;
2064 
2065 	/*
2066 	 * Convert the Unicode digraph to 'encoding'.
2067 	 */
2068 	i = utf_char2bytes(retval, buf);
2069 	retval = 0;
2070 	vc.vc_type = CONV_NONE;
2071 	if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK)
2072 	{
2073 	    vc.vc_fail = TRUE;
2074 	    to = string_convert(&vc, buf, &i);
2075 	    if (to != NULL)
2076 	    {
2077 		retval = (*mb_ptr2char)(to);
2078 		vim_free(to);
2079 	    }
2080 	    (void)convert_setup(&vc, NULL, NULL);
2081 	}
2082     }
2083 # endif
2084 
2085     /* Ignore multi-byte characters when not in multi-byte mode. */
2086     if (!has_mbyte && retval > 0xff)
2087 	retval = 0;
2088 #endif
2089 
2090     if (retval == 0)		/* digraph deleted or not found */
2091     {
2092 	if (char1 == ' ' && meta_char)	/* <space> <char> --> meta-char */
2093 	    return (char2 | 0x80);
2094 	return char2;
2095     }
2096     return retval;
2097 }
2098 
2099 /*
2100  * Get digraph.
2101  * Allow for both char1-char2 and char2-char1
2102  */
2103     int
2104 getdigraph(int char1, int char2, int meta_char)
2105 {
2106     int	    retval;
2107 
2108     if (((retval = getexactdigraph(char1, char2, meta_char)) == char2)
2109 	    && (char1 != char2)
2110 	    && ((retval = getexactdigraph(char2, char1, meta_char)) == char1))
2111 	return char2;
2112     return retval;
2113 }
2114 
2115 /*
2116  * Add the digraphs in the argument to the digraph table.
2117  * format: {c1}{c2} char {c1}{c2} char ...
2118  */
2119     void
2120 putdigraph(char_u *str)
2121 {
2122     int		char1, char2, n;
2123     int		i;
2124     digr_T	*dp;
2125 
2126     while (*str != NUL)
2127     {
2128 	str = skipwhite(str);
2129 	if (*str == NUL)
2130 	    return;
2131 	char1 = *str++;
2132 	char2 = *str++;
2133 	if (char2 == 0)
2134 	{
2135 	    EMSG(_(e_invarg));
2136 	    return;
2137 	}
2138 	if (char1 == ESC || char2 == ESC)
2139 	{
2140 	    EMSG(_("E104: Escape not allowed in digraph"));
2141 	    return;
2142 	}
2143 	str = skipwhite(str);
2144 	if (!VIM_ISDIGIT(*str))
2145 	{
2146 	    EMSG(_(e_number_exp));
2147 	    return;
2148 	}
2149 	n = getdigits(&str);
2150 
2151 	/* If the digraph already exists, replace the result. */
2152 	dp = (digr_T *)user_digraphs.ga_data;
2153 	for (i = 0; i < user_digraphs.ga_len; ++i)
2154 	{
2155 	    if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2156 	    {
2157 		dp->result = n;
2158 		break;
2159 	    }
2160 	    ++dp;
2161 	}
2162 
2163 	/* Add a new digraph to the table. */
2164 	if (i == user_digraphs.ga_len)
2165 	{
2166 	    if (ga_grow(&user_digraphs, 1) == OK)
2167 	    {
2168 		dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
2169 		dp->char1 = char1;
2170 		dp->char2 = char2;
2171 		dp->result = n;
2172 		++user_digraphs.ga_len;
2173 	    }
2174 	}
2175     }
2176 }
2177 
2178     void
2179 listdigraphs(void)
2180 {
2181     int		i;
2182     digr_T	*dp;
2183 
2184     msg_putchar('\n');
2185 
2186     dp = digraphdefault;
2187     for (i = 0; dp->char1 != NUL && !got_int; ++i)
2188     {
2189 #if defined(USE_UNICODE_DIGRAPHS) && defined(FEAT_MBYTE)
2190 	digr_T tmp;
2191 
2192 	/* May need to convert the result to 'encoding'. */
2193 	tmp.char1 = dp->char1;
2194 	tmp.char2 = dp->char2;
2195 	tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
2196 	if (tmp.result != 0 && tmp.result != tmp.char2
2197 					  && (has_mbyte || tmp.result <= 255))
2198 	    printdigraph(&tmp);
2199 #else
2200 
2201 	if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
2202 # ifdef FEAT_MBYTE
2203 		&& (has_mbyte || dp->result <= 255)
2204 # endif
2205 		)
2206 	    printdigraph(dp);
2207 #endif
2208 	++dp;
2209 	ui_breakcheck();
2210     }
2211 
2212     dp = (digr_T *)user_digraphs.ga_data;
2213     for (i = 0; i < user_digraphs.ga_len && !got_int; ++i)
2214     {
2215 	printdigraph(dp);
2216 	ui_breakcheck();
2217 	++dp;
2218     }
2219     must_redraw = CLEAR;    /* clear screen, because some digraphs may be
2220 			       wrong, in which case we messed up ScreenLines */
2221 }
2222 
2223     static void
2224 printdigraph(digr_T *dp)
2225 {
2226     char_u	buf[30];
2227     char_u	*p;
2228 
2229     int		list_width;
2230 
2231     if ((dy_flags & DY_UHEX)
2232 #ifdef FEAT_MBYTE
2233 	    || has_mbyte
2234 #endif
2235 	    )
2236 	list_width = 13;
2237     else
2238 	list_width = 11;
2239 
2240     if (dp->result != 0)
2241     {
2242 	if (msg_col > Columns - list_width)
2243 	    msg_putchar('\n');
2244 	if (msg_col)
2245 	    while (msg_col % list_width != 0)
2246 		msg_putchar(' ');
2247 
2248 	p = buf;
2249 	*p++ = dp->char1;
2250 	*p++ = dp->char2;
2251 	*p++ = ' ';
2252 #ifdef FEAT_MBYTE
2253 	if (has_mbyte)
2254 	{
2255 	    /* add a space to draw a composing char on */
2256 	    if (enc_utf8 && utf_iscomposing(dp->result))
2257 		*p++ = ' ';
2258 	    p += (*mb_char2bytes)(dp->result, p);
2259 	}
2260 	else
2261 #endif
2262 	    *p++ = (char_u)dp->result;
2263 	if (char2cells(dp->result) == 1)
2264 	    *p++ = ' ';
2265 	vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
2266 	msg_outtrans(buf);
2267     }
2268 }
2269 
2270 #endif /* FEAT_DIGRAPHS */
2271 
2272 #if defined(FEAT_KEYMAP) || defined(PROTO)
2273 
2274 /* structure used for b_kmap_ga.ga_data */
2275 typedef struct
2276 {
2277     char_u	*from;
2278     char_u	*to;
2279 } kmap_T;
2280 
2281 #define KMAP_MAXLEN 20	    /* maximum length of "from" or "to" */
2282 
2283 static void keymap_unload(void);
2284 
2285 /*
2286  * Set up key mapping tables for the 'keymap' option.
2287  * Returns NULL if OK, an error message for failure.  This only needs to be
2288  * used when setting the option, not later when the value has already been
2289  * checked.
2290  */
2291     char_u *
2292 keymap_init(void)
2293 {
2294     curbuf->b_kmap_state &= ~KEYMAP_INIT;
2295 
2296     if (*curbuf->b_p_keymap == NUL)
2297     {
2298 	/* Stop any active keymap and clear the table.  Also remove
2299 	 * b:keymap_name, as no keymap is active now. */
2300 	keymap_unload();
2301 	do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
2302     }
2303     else
2304     {
2305 	char_u	*buf;
2306 	size_t  buflen;
2307 
2308 	/* Source the keymap file.  It will contain a ":loadkeymap" command
2309 	 * which will call ex_loadkeymap() below. */
2310 	buflen = STRLEN(curbuf->b_p_keymap)
2311 # ifdef FEAT_MBYTE
2312 					   + STRLEN(p_enc)
2313 # endif
2314 						       + 14;
2315 	buf = alloc((unsigned)buflen);
2316 	if (buf == NULL)
2317 	    return e_outofmem;
2318 
2319 # ifdef FEAT_MBYTE
2320 	/* try finding "keymap/'keymap'_'encoding'.vim"  in 'runtimepath' */
2321 	vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
2322 						   curbuf->b_p_keymap, p_enc);
2323 	if (source_runtime(buf, 0) == FAIL)
2324 # endif
2325 	{
2326 	    /* try finding "keymap/'keymap'.vim" in 'runtimepath'  */
2327 	    vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
2328 							  curbuf->b_p_keymap);
2329 	    if (source_runtime(buf, 0) == FAIL)
2330 	    {
2331 		vim_free(buf);
2332 		return (char_u *)N_("E544: Keymap file not found");
2333 	    }
2334 	}
2335 	vim_free(buf);
2336     }
2337 
2338     return NULL;
2339 }
2340 
2341 /*
2342  * ":loadkeymap" command: load the following lines as the keymap.
2343  */
2344     void
2345 ex_loadkeymap(exarg_T *eap)
2346 {
2347     char_u	*line;
2348     char_u	*p;
2349     char_u	*s;
2350     kmap_T	*kp;
2351 #define KMAP_LLEN   200	    /* max length of "to" and "from" together */
2352     char_u	buf[KMAP_LLEN + 11];
2353     int		i;
2354     char_u	*save_cpo = p_cpo;
2355 
2356     if (!getline_equal(eap->getline, eap->cookie, getsourceline))
2357     {
2358 	EMSG(_("E105: Using :loadkeymap not in a sourced file"));
2359 	return;
2360     }
2361 
2362     /*
2363      * Stop any active keymap and clear the table.
2364      */
2365     keymap_unload();
2366 
2367     curbuf->b_kmap_state = 0;
2368     ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
2369 
2370     /* Set 'cpoptions' to "C" to avoid line continuation. */
2371     p_cpo = (char_u *)"C";
2372 
2373     /*
2374      * Get each line of the sourced file, break at the end.
2375      */
2376     for (;;)
2377     {
2378 	line = eap->getline(0, eap->cookie, 0);
2379 	if (line == NULL)
2380 	    break;
2381 
2382 	p = skipwhite(line);
2383 	if (*p != '"' && *p != NUL && ga_grow(&curbuf->b_kmap_ga, 1) == OK)
2384 	{
2385 	    kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len;
2386 	    s = skiptowhite(p);
2387 	    kp->from = vim_strnsave(p, (int)(s - p));
2388 	    p = skipwhite(s);
2389 	    s = skiptowhite(p);
2390 	    kp->to = vim_strnsave(p, (int)(s - p));
2391 
2392 	    if (kp->from == NULL || kp->to == NULL
2393 		    || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN
2394 		    || *kp->from == NUL || *kp->to == NUL)
2395 	    {
2396 		if (kp->to != NULL && *kp->to == NUL)
2397 		    EMSG(_("E791: Empty keymap entry"));
2398 		vim_free(kp->from);
2399 		vim_free(kp->to);
2400 	    }
2401 	    else
2402 		++curbuf->b_kmap_ga.ga_len;
2403 	}
2404 	vim_free(line);
2405     }
2406 
2407     /*
2408      * setup ":lnoremap" to map the keys
2409      */
2410     for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2411     {
2412 	vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s",
2413 				((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from,
2414 				 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to);
2415 	(void)do_map(2, buf, LANGMAP, FALSE);
2416     }
2417 
2418     p_cpo = save_cpo;
2419 
2420     curbuf->b_kmap_state |= KEYMAP_LOADED;
2421 #ifdef FEAT_WINDOWS
2422     status_redraw_curbuf();
2423 #endif
2424 }
2425 
2426 /*
2427  * Stop using 'keymap'.
2428  */
2429     static void
2430 keymap_unload(void)
2431 {
2432     char_u	buf[KMAP_MAXLEN + 10];
2433     int		i;
2434     char_u	*save_cpo = p_cpo;
2435     kmap_T	*kp;
2436 
2437     if (!(curbuf->b_kmap_state & KEYMAP_LOADED))
2438 	return;
2439 
2440     /* Set 'cpoptions' to "C" to avoid line continuation. */
2441     p_cpo = (char_u *)"C";
2442 
2443     /* clear the ":lmap"s */
2444     kp = (kmap_T *)curbuf->b_kmap_ga.ga_data;
2445     for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2446     {
2447 	vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
2448 	(void)do_map(1, buf, LANGMAP, FALSE);
2449 	vim_free(kp[i].from);
2450 	vim_free(kp[i].to);
2451     }
2452 
2453     p_cpo = save_cpo;
2454 
2455     ga_clear(&curbuf->b_kmap_ga);
2456     curbuf->b_kmap_state &= ~KEYMAP_LOADED;
2457 #ifdef FEAT_WINDOWS
2458     status_redraw_curbuf();
2459 #endif
2460 }
2461 
2462 #endif /* FEAT_KEYMAP */
2463