xref: /vim-8.2.3635/src/digraph.c (revision f0d58efc)
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 void printdigraph(digr_T *);
32 
33 /* digraphs added by the user */
34 static garray_T	user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
35 
36 /*
37  * Note: Characters marked with XX are not included literally, because some
38  * compilers cannot handle them (Amiga SAS/C is the most picky one).
39  */
40 static digr_T digraphdefault[] =
41 #ifdef __MINT__
42 
43 	/*
44 	 * ATARI digraphs
45 	 */
46        {{'C', ',', 128},	/* ~@ XX */
47 	{'u', '"', 129},	/* � */
48 	{'e', '\'', 130},	/* � */
49 	{'a', '^', 131},	/* � */
50 	{'a', '"', 132},	/* � */
51 	{'a', '`', 133},	/* � */
52 	{'a', '@', 134},	/* � */
53 	{'c', ',', 135},	/* ~G XX */
54 	{'e', '^', 136},	/* ~H XX */
55 	{'e', '"', 137},	/* � */
56 	{'e', '`', 138},	/* � */
57 	{'i', '"', 139},	/* � */
58 	{'i', '^', 140},	/* � */
59 	{'i', '`', 141},	/* � */
60 	{'A', '"', 142},	/* � */
61 	{'A', '@', 143},	/* � */
62 	{'E', '\'', 144},	/* � */
63 	{'a', 'e', 145},	/* � */
64 	{'A', 'E', 146},	/* � */
65 	{'o', '^', 147},	/* � */
66 	{'o', '"', 148},	/* � */
67 	{'o', '`', 149},	/* � */
68 	{'u', '^', 150},	/* � */
69 	{'u', '`', 151},	/* � */
70 	{'y', '"', 152},	/* � */
71 	{'O', '"', 153},	/* � */
72 	{'U', '"', 154},	/* � */
73 	{'c', '|', 155},	/* � */
74 	{'$', '$', 156},	/* � */
75 	{'Y', '-', 157},	/* ~] XX */
76 	{'s', 's', 158},	/* � */
77 	{'f', 'f', 159},	/* � */
78 	{'a', '\'', 160},	/* � */
79 	{'i', '\'', 161},	/* � */
80 	{'o', '\'', 162},	/* � */
81 	{'u', '\'', 163},	/* � */
82 	{'n', '~', 164},	/* � */
83 	{'N', '~', 165},	/* � */
84 	{'a', 'a', 166},	/* � */
85 	{'o', 'o', 167},	/* � */
86 	{'~', '?', 168},	/* � */
87 	{'-', 'a', 169},	/* � */
88 	{'a', '-', 170},	/* � */
89 	{'1', '2', 171},	/* � */
90 	{'1', '4', 172},	/* � */
91 	{'~', '!', 173},	/* � */
92 	{'<', '<', 174},	/* � */
93 	{'>', '>', 175},	/* � */
94 	{'j', 'u', 230},	/* � */
95 	{'o', '/', 237},	/* � */
96 	{'+', '-', 241},	/* � */
97 	{'>', '=', 242},	/* � */
98 	{'<', '=', 243},	/* � */
99 	{':', '-', 246},	/* � */
100 	{'~', '~', 247},	/* � */
101 	{'~', 'o', 248},	/* � */
102 	{'2', '2', 253},	/* � */
103 	{NUL, NUL, NUL}
104 	};
105 
106 #else	/* !__MINT__ */
107 # ifdef HPUX_DIGRAPHS
108 
109 	/*
110 	 * different HPUX digraphs
111 	 */
112        {{'A', '`', 161},	/* � */
113 	{'A', '^', 162},	/* � */
114 	{'E', '`', 163},	/* � */
115 	{'E', '^', 164},	/* � */
116 	{'E', '"', 165},	/* � */
117 	{'I', '^', 166},	/* � */
118 	{'I', '"', 167},	/* � */
119 	{'\'', '\'', 168},	/* � */
120 	{'`', '`', 169},	/* � */
121 	{'^', '^', 170},	/* � */
122 	{'"', '"', 171},	/* � */
123 	{'~', '~', 172},	/* � */
124 	{'U', '`', 173},	/* � */
125 	{'U', '^', 174},	/* � */
126 	{'L', '=', 175},	/* � */
127 	{'~', '_', 176},	/* � */
128 	{'Y', '\'', 177},	/* � */
129 	{'y', '\'', 178},	/* � */
130 	{'~', 'o', 179},	/* � */
131 	{'C', ',', 180},	/* � */
132 	{'c', ',', 181},	/* � */
133 	{'N', '~', 182},	/* � */
134 	{'n', '~', 183},	/* � */
135 	{'~', '!', 184},	/* � */
136 	{'~', '?', 185},	/* � */
137 	{'o', 'x', 186},	/* � */
138 	{'L', '-', 187},	/* � */
139 	{'Y', '=', 188},	/* � */
140 	{'p', 'p', 189},	/* � */
141 	{'f', 'l', 190},	/* � */
142 	{'c', '|', 191},	/* � */
143 	{'a', '^', 192},	/* � */
144 	{'e', '^', 193},	/* � */
145 	{'o', '^', 194},	/* � */
146 	{'u', '^', 195},	/* � */
147 	{'a', '\'', 196},	/* � */
148 	{'e', '\'', 197},	/* � */
149 	{'o', '\'', 198},	/* � */
150 	{'u', '\'', 199},	/* � */
151 	{'a', '`', 200},	/* � */
152 	{'e', '`', 201},	/* � */
153 	{'o', '`', 202},	/* � */
154 	{'u', '`', 203},	/* � */
155 	{'a', '"', 204},	/* � */
156 	{'e', '"', 205},	/* � */
157 	{'o', '"', 206},	/* � */
158 	{'u', '"', 207},	/* � */
159 	{'A', 'o', 208},	/* � */
160 	{'i', '^', 209},	/* � */
161 	{'O', '/', 210},	/* � */
162 	{'A', 'E', 211},	/* � */
163 	{'a', 'o', 212},	/* � */
164 	{'i', '\'', 213},	/* � */
165 	{'o', '/', 214},	/* � */
166 	{'a', 'e', 215},	/* � */
167 	{'A', '"', 216},	/* � */
168 	{'i', '`', 217},	/* � */
169 	{'O', '"', 218},	/* � */
170 	{'U', '"', 219},	/* � */
171 	{'E', '\'', 220},	/* � */
172 	{'i', '"', 221},	/* � */
173 	{'s', 's', 222},	/* � */
174 	{'O', '^', 223},	/* � */
175 	{'A', '\'', 224},	/* � */
176 	{'A', '~', 225},	/* � */
177 	{'a', '~', 226},	/* � */
178 	{'D', '-', 227},	/* � */
179 	{'d', '-', 228},	/* � */
180 	{'I', '\'', 229},	/* � */
181 	{'I', '`', 230},	/* � */
182 	{'O', '\'', 231},	/* � */
183 	{'O', '`', 232},	/* � */
184 	{'O', '~', 233},	/* � */
185 	{'o', '~', 234},	/* � */
186 	{'S', '~', 235},	/* � */
187 	{'s', '~', 236},	/* � */
188 	{'U', '\'', 237},	/* � */
189 	{'Y', '"', 238},	/* � */
190 	{'y', '"', 239},	/* � */
191 	{'p', '-', 240},	/* � */
192 	{'p', '~', 241},	/* � */
193 	{'~', '.', 242},	/* � */
194 	{'j', 'u', 243},	/* � */
195 	{'P', 'p', 244},	/* � */
196 	{'3', '4', 245},	/* � */
197 	{'-', '-', 246},	/* � */
198 	{'1', '4', 247},	/* � */
199 	{'1', '2', 248},	/* � */
200 	{'a', '_', 249},	/* � */
201 	{'o', '_', 250},	/* � */
202 	{'<', '<', 251},	/* � */
203 	{'x', 'x', 252},	/* � */
204 	{'>', '>', 253},	/* � */
205 	{'+', '-', 254},	/* � */
206 	{'n', 'u', 255},	/* x XX */
207 	{NUL, NUL, NUL}
208 	};
209 
210 # else	/* !HPUX_DIGRAPHS */
211 
212 #  ifdef EBCDIC
213 
214 	/*
215 	 * EBCDIC - ISO digraphs
216 	 * TODO: EBCDIC Table is Code-Page 1047
217 	 */
218        {{'a', '^',    66},	/* � */
219 	{'a', '"',    67},	/* � */
220 	{'a', '`',    68},	/* � */
221 	{'a', '\'',   69},	/* � */
222 	{'a', '~',    70},	/* � */
223 	{'a', '@',    71},	/* � */
224 	{'a', 'a',    71},	/* � */
225 	{'c', ',',    72},	/* � */
226 	{'n', '~',    73},	/* � */
227 	{'c', '|',    74},	/* � */
228 	{'e', '\'',   81},	/* � */
229 	{'e', '^',    82},	/* � */
230 	{'e', '"',    83},	/* � */
231 	{'e', '`',    84},	/* � */
232 	{'i', '\'',   85},	/* � */
233 	{'i', '^',    86},	/* � */
234 	{'i', '"',    87},	/* � */
235 	{'i', '`',    88},	/* � */
236 	{'s', 's',    89},	/* � */
237 	{'A', '^',    98},	/* � */
238 	{'A', '"',    99},	/* � */
239 	{'A', '`',   100},	/* � */
240 	{'A', '\'',  101},	/* � */
241 	{'A', '~',   102},	/* � */
242 	{'A', '@',   103},	/* � */
243 	{'A', 'A',   103},	/* � */
244 	{'C', ',',   104},	/* � */
245 	{'N', '~',   105},	/* � */
246 	{'|', '|',   106},	/* � */
247 	{'o', '/',   112},	/* � */
248 	{'E', '\'',  113},	/* � */
249 	{'E', '^',   114},	/* � */
250 	{'E', '"',   115},	/* � */
251 	{'E', '`',   116},	/* � */
252 	{'I', '\'',  117},	/* � */
253 	{'I', '^',   118},	/* � */
254 	{'I', '"',   119},	/* � */
255 	{'I', '`',   120},	/* � */
256 	{'O', '/',   128},	/* 0/ XX */
257 	{'<', '<',   138},	/* � */
258 	{'>', '>',   139},	/* � */
259 	{'d', '-',   140},	/* � */
260 	{'y', '\'',  141},	/* � */
261 	{'i', 'p',   142},	/* � */
262 	{'+', '-',   143},	/* � */
263 	{'~', 'o',   144},	/* � */
264 	{'a', '-',   154},	/* � */
265 	{'o', '-',   155},	/* � */
266 	{'a', 'e',   156},	/* � */
267 	{',', ',',   157},	/* , XX */
268 	{'A', 'E',   158},	/* � */
269 	{'o', 'x',   159},	/* � - currency symbol in ISO 8859-1 */
270 	{'e', '=',   159},	/* � - euro symbol in ISO 8859-15 */
271 	{'E', 'u',   159},	/* � - euro symbol in ISO 8859-15 */
272 	{'j', 'u',   160},	/* � */
273 	{'y', '"',   167},	/* x XX */
274 	{'~', '!',   170},	/* � */
275 	{'~', '?',   171},	/* � */
276 	{'D', '-',   172},	/* � */
277 	{'I', 'p',   174},	/* � */
278 	{'r', 'O',   175},	/* � */
279 	{'-', ',',   176},	/* � */
280 	{'$', '$',   177},	/* � */
281 	{'Y', '-',   178},	/* � */
282 	{'~', '.',   179},	/* � */
283 	{'c', 'O',   180},	/* � */
284 	{'p', 'a',   181},	/* � */
285 	{'p', 'p',   182},	/* � */
286 	{'1', '4',   183},	/* � */
287 	{'1', '2',   184},	/* � */
288 	{'3', '4',   185},	/* � */
289 	{'Y', '\'',  186},	/* � */
290 	{'"', '"',   187},	/* � */
291 	{'-', '=',   188},	/* � */
292 	{'\'', '\'', 190},	/* � */
293 	{'O', 'E',   191},	/* � - OE in ISO 8859-15 */
294 	{'/', '\\',  191},	/* � - multiplication symbol in ISO 8859-1 */
295 	{'-', '-',   202},	/* � */
296 	{'o', '^',   203},	/* � */
297 	{'o', '"',   204},	/* � */
298 	{'o', '`',   205},	/* � */
299 	{'o', '\'',  206},	/* � */
300 	{'o', '~',   207},	/* � */
301 	{'1', '1',   218},	/* � */
302 	{'u', '^',   219},	/* � */
303 	{'u', '"',   220},	/* � */
304 	{'u', '`',   221},	/* � */
305 	{'u', '\'',  222},	/* � */
306 	{':', '-',   225},	/* � - division symbol in ISO 8859-1 */
307 	{'o', 'e',   225},	/* � - oe in ISO 8859-15 */
308 	{'2', '2',   234},	/* � */
309 	{'O', '^',   235},	/* � */
310 	{'O', '"',   236},	/* � */
311 	{'O', '`',   237},	/* � */
312 	{'O', '\'',  238},	/* � */
313 	{'O', '~',   239},	/* � */
314 	{'3', '3',   250},	/* � */
315 	{'U', '^',   251},	/* � */
316 	{'U', '"',   252},	/* � */
317 	{'U', '`',   253},	/* � */
318 	{'U', '\'',  254},	/* � */
319 	{NUL, NUL, NUL}
320 	};
321 
322 #  else
323 #   if defined(MACOS_X) && !defined(FEAT_MBYTE)
324 
325 	/*
326 	 * Macintosh digraphs
327 	 */
328        {{'a', 't', 64},		/* @ */
329 	{'A', '"', 128},	/* ~@ XX */
330 	{'A', 'o', 129},	/* � */
331 	{'C', ',', 130},	/* � */
332 	{'E', '\'', 131},	/* � */
333 	{'N', '~', 132},	/* � */
334 	{'O', '"', 133},	/* � */
335 	{'U', '"', 134},	/* � */
336 	{'a', '\'', 135},	/* ~G XX */
337 	{'a', '`', 136},	/* ~H XX */
338 	{'a', '^', 137},	/* � */
339 	{'a', '"', 138},	/* � */
340 	{'a', '~', 139},	/* � */
341 	{'a', 'o', 140},	/* � */
342 	{'c', ',', 141},	/* � */
343 	{'e', '\'', 142},	/* � */
344 	{'e', '`', 143},	/* � */
345 	{'e', '^', 144},	/* � */
346 	{'e', '"', 145},	/* � */
347 	{'i', '\'', 146},	/* � */
348 	{'i', '`', 147},	/* � */
349 	{'i', '^', 148},	/* � */
350 	{'i', '"', 149},	/* � */
351 	{'n', '~', 150},	/* � */
352 	{'o', '\'', 151},	/* � */
353 	{'o', '`', 152},	/* � */
354 	{'o', '^', 153},	/* � */
355 	{'o', '"', 154},	/* � */
356 	{'o', '~', 155},	/* o */
357 	{'u', '\'', 156},	/* � */
358 	{'u', '`', 157},	/* ~] XX */
359 	{'u', '^', 158},	/* � */
360 	{'u', '"', 159},	/* � */
361 	{'+', '_', 160},	/* � */
362 	{'~', 'o', 161},	/* � */
363 	{'c', '|', 162},	/* � */
364 	{'$', '$', 163},	/* � */
365 	{'p', 'a', 164},	/* � */
366 	{'.', '.', 165},	/* * */
367 	{'P', 'P', 166},	/* � */
368 	{'s', 's', 167},	/* � */
369 	{'r', 'O', 168},	/* � */
370 	{'c', 'O', 169},	/* � */
371 	{'T', 'M', 170},	/* � */
372 	{'=', '/', 173},	/* � */
373 	{'A', 'E', 174},	/* � */
374 	{'O', '/', 175},	/* � */
375 	{'0', '0', 176},	/* � */
376 	{'+', '-', 177},	/* � */
377 	{'<', '=', 178},	/* � */
378 	{'>', '=', 179},	/* � */
379 	{'Y', '-', 180},	/* � */
380 	{'j', 'u', 181},	/* � */
381 	{'m', 'u', 181},	/* � */
382 	{'d', 'd', 182},	/* � */
383 	{'S', 'S', 183},	/* � */
384 	{'S', 'I', 183},	/* � */
385 	{'P', 'I', 184},	/* � */
386 	{'p', 'i', 185},	/* � */
387 	{'I', 'I', 186},	/* � */
388 	{'a', '-', 187},	/* � */
389 	{'o', '-', 188},	/* � */
390 	{'O', 'M', 189},	/* � */
391 	{'a', 'e', 190},	/* � */
392 	{'o', '/', 191},	/* � */
393 	{'~', '?', 192},	/* � */
394 	{'~', '!', 193},	/* � */
395 	{'-', ',', 194},	/* � */
396 	{'v', '-', 195},	/* ~H XX */
397 	{'f', '-', 196},	/* � */
398 	{'~', '~', 197},	/* � */
399 	{'D', 'E', 198},	/* � */
400 	{'<', '<', 199},	/* � */
401 	{'>', '>', 200},	/* � */
402 	{'.', ':', 201},	/* � */
403 	{'A', '`', 203},	/* � */
404 	{'A', '~', 204},	/* � */
405 	{'O', '~', 205},	/* � */
406 	{'O', 'E', 206},	/* � */
407 	{'o', 'e', 207},	/* � */
408 	{'-', '.', 208},	/* - */
409 	{'-', '-', 209},	/* - */
410 	{'`', '`', 210},	/* " */
411 	{'\'', '\'', 211},	/* " */
412 	{'`', ' ', 212},	/* ' */
413 	{'\'', ' ', 213},	/* ' */
414 	{'-', ':', 214},	/* � */
415 	{'D', 'I', 215},	/* � */
416 	{'y', ':', 216},	/* � */
417 	{'Y', ':', 217},	/* � */
418 	{'/', '/', 218},	/* � */
419 	{'E', '=', 219},	/* � Euro System >=8.5 */
420 	{'o', 'x', 219},	/* � Currency System <=8.1*/
421 	{'<', ' ', 220},	/* � */
422 	{'>', ' ', 221},	/* � */
423 	{'f', 'i', 222},	/* � */
424 	{'f', 'l', 223},	/* � */
425 	{'+', '+', 224},	/* � */
426 	{'~', '.', 225},	/* � */
427 	{',', ' ', 226},	/* � */
428 	{',', ',', 227},	/* � */
429 	{'%', '.', 228},	/* � */
430 	{'%', '0', 228},	/* � */
431 	{'A', '^', 229},	/* � */
432 	{'E', '^', 230},	/* � */
433 	{'A', '\'', 231},	/* � */
434 	{'E', '"', 232},	/* � */
435 	{'E', '`', 233},	/* � */
436 	{'I', '\'', 234},	/* � */
437 	{'I', '^', 235},	/* � */
438 	{'I', '"', 236},	/* � */
439 	{'I', '`', 237},	/* � */
440 	{'O', '\'', 238},	/* � */
441 	{'O', '^', 239},	/* � */
442 	{'A', 'P', 240},	/* � */
443 	{'O', '`', 241},	/* � */
444 	{'U', '\'', 242},	/* � */
445 	{'U', '^', 243},	/* � */
446 	{'U', '`', 244},	/* � */
447 	{'i', '.', 245},	/* � */
448 	{NUL, NUL, NUL}
449 	};
450 
451 #   else	/* !MACOS_X */
452 
453 #    ifdef OLD_DIGRAPHS
454 
455 	/*
456 	 * digraphs compatible with Vim 5.x
457 	 */
458        {{'~', '!', 161},	/* � */
459 	{'c', '|', 162},	/* � */
460 	{'$', '$', 163},	/* � */
461 	{'o', 'x', 164},	/* � - currency symbol in ISO 8859-1 */
462 	{'e', '=', 164},	/* � - euro symbol in ISO 8859-15 */
463 	{'Y', '-', 165},	/* � */
464 	{'|', '|', 166},	/* � */
465 	{'p', 'a', 167},	/* � */
466 	{'"', '"', 168},	/* � */
467 	{'c', 'O', 169},	/* � */
468 	{'a', '-', 170},	/* � */
469 	{'<', '<', 171},	/* � */
470 	{'-', ',', 172},	/* � */
471 	{'-', '-', 173},	/* � */
472 	{'r', 'O', 174},	/* � */
473 	{'-', '=', 175},	/* � */
474 	{'~', 'o', 176},	/* � */
475 	{'+', '-', 177},	/* � */
476 	{'2', '2', 178},	/* � */
477 	{'3', '3', 179},	/* � */
478 	{'\'', '\'', 180},	/* � */
479 	{'j', 'u', 181},	/* � */
480 	{'p', 'p', 182},	/* � */
481 	{'~', '.', 183},	/* � */
482 	{',', ',', 184},	/* � */
483 	{'1', '1', 185},	/* � */
484 	{'o', '-', 186},	/* � */
485 	{'>', '>', 187},	/* � */
486 	{'1', '4', 188},	/* � */
487 	{'1', '2', 189},	/* � */
488 	{'3', '4', 190},	/* � */
489 	{'~', '?', 191},	/* � */
490 	{'A', '`', 192},	/* � */
491 	{'A', '\'', 193},	/* � */
492 	{'A', '^', 194},	/* � */
493 	{'A', '~', 195},	/* � */
494 	{'A', '"', 196},	/* � */
495 	{'A', '@', 197},	/* � */
496 	{'A', 'A', 197},	/* � */
497 	{'A', 'E', 198},	/* � */
498 	{'C', ',', 199},	/* � */
499 	{'E', '`', 200},	/* � */
500 	{'E', '\'', 201},	/* � */
501 	{'E', '^', 202},	/* � */
502 	{'E', '"', 203},	/* � */
503 	{'I', '`', 204},	/* � */
504 	{'I', '\'', 205},	/* � */
505 	{'I', '^', 206},	/* � */
506 	{'I', '"', 207},	/* � */
507 	{'D', '-', 208},	/* � */
508 	{'N', '~', 209},	/* � */
509 	{'O', '`', 210},	/* � */
510 	{'O', '\'', 211},	/* � */
511 	{'O', '^', 212},	/* � */
512 	{'O', '~', 213},	/* � */
513 	{'O', '"', 214},	/* � */
514 	{'/', '\\', 215},	/* � - multiplication symbol in ISO 8859-1 */
515 	{'O', 'E', 215},	/* � - OE in ISO 8859-15 */
516 	{'O', '/', 216},	/* � */
517 	{'U', '`', 217},	/* � */
518 	{'U', '\'', 218},	/* � */
519 	{'U', '^', 219},	/* � */
520 	{'U', '"', 220},	/* � */
521 	{'Y', '\'', 221},	/* � */
522 	{'I', 'p', 222},	/* � */
523 	{'s', 's', 223},	/* � */
524 	{'a', '`', 224},	/* � */
525 	{'a', '\'', 225},	/* � */
526 	{'a', '^', 226},	/* � */
527 	{'a', '~', 227},	/* � */
528 	{'a', '"', 228},	/* � */
529 	{'a', '@', 229},	/* � */
530 	{'a', 'a', 229},	/* � */
531 	{'a', 'e', 230},	/* � */
532 	{'c', ',', 231},	/* � */
533 	{'e', '`', 232},	/* � */
534 	{'e', '\'', 233},	/* � */
535 	{'e', '^', 234},	/* � */
536 	{'e', '"', 235},	/* � */
537 	{'i', '`', 236},	/* � */
538 	{'i', '\'', 237},	/* � */
539 	{'i', '^', 238},	/* � */
540 	{'i', '"', 239},	/* � */
541 	{'d', '-', 240},	/* � */
542 	{'n', '~', 241},	/* � */
543 	{'o', '`', 242},	/* � */
544 	{'o', '\'', 243},	/* � */
545 	{'o', '^', 244},	/* � */
546 	{'o', '~', 245},	/* � */
547 	{'o', '"', 246},	/* � */
548 	{':', '-', 247},	/* � - division symbol in ISO 8859-1 */
549 	{'o', 'e', 247},	/* � - oe in ISO 8859-15 */
550 	{'o', '/', 248},	/* � */
551 	{'u', '`', 249},	/* � */
552 	{'u', '\'', 250},	/* � */
553 	{'u', '^', 251},	/* � */
554 	{'u', '"', 252},	/* � */
555 	{'y', '\'', 253},	/* � */
556 	{'i', 'p', 254},	/* � */
557 	{'y', '"', 255},	/* x XX */
558 	{NUL, NUL, NUL}
559 	};
560 #    else /* OLD_DIGRAPHS */
561 
562 	/*
563 	 * digraphs for Unicode from RFC1345
564 	 * (also work for ISO-8859-1 aka latin1)
565 	 */
566        {
567 	{'N', 'U', 0x0a},	/* LF for NUL */
568 	{'S', 'H', 0x01},
569 	{'S', 'X', 0x02},
570 	{'E', 'X', 0x03},
571 	{'E', 'T', 0x04},
572 	{'E', 'Q', 0x05},
573 	{'A', 'K', 0x06},
574 	{'B', 'L', 0x07},
575 	{'B', 'S', 0x08},
576 	{'H', 'T', 0x09},
577 	{'L', 'F', 0x0a},
578 	{'V', 'T', 0x0b},
579 	{'F', 'F', 0x0c},
580 	{'C', 'R', 0x0d},
581 	{'S', 'O', 0x0e},
582 	{'S', 'I', 0x0f},
583 	{'D', 'L', 0x10},
584 	{'D', '1', 0x11},
585 	{'D', '2', 0x12},
586 	{'D', '3', 0x13},
587 	{'D', '4', 0x14},
588 	{'N', 'K', 0x15},
589 	{'S', 'Y', 0x16},
590 	{'E', 'B', 0x17},
591 	{'C', 'N', 0x18},
592 	{'E', 'M', 0x19},
593 	{'S', 'B', 0x1a},
594 	{'E', 'C', 0x1b},
595 	{'F', 'S', 0x1c},
596 	{'G', 'S', 0x1d},
597 	{'R', 'S', 0x1e},
598 	{'U', 'S', 0x1f},
599 	{'S', 'P', 0x20},
600 	{'N', 'b', 0x23},
601 	{'D', 'O', 0x24},
602 	{'A', 't', 0x40},
603 	{'<', '(', 0x5b},
604 	{'/', '/', 0x5c},
605 	{')', '>', 0x5d},
606 	{'\'', '>', 0x5e},
607 	{'\'', '!', 0x60},
608 	{'(', '!', 0x7b},
609 	{'!', '!', 0x7c},
610 	{'!', ')', 0x7d},
611 	{'\'', '?', 0x7e},
612 	{'D', 'T', 0x7f},
613 	{'P', 'A', 0x80},
614 	{'H', 'O', 0x81},
615 	{'B', 'H', 0x82},
616 	{'N', 'H', 0x83},
617 	{'I', 'N', 0x84},
618 	{'N', 'L', 0x85},
619 	{'S', 'A', 0x86},
620 	{'E', 'S', 0x87},
621 	{'H', 'S', 0x88},
622 	{'H', 'J', 0x89},
623 	{'V', 'S', 0x8a},
624 	{'P', 'D', 0x8b},
625 	{'P', 'U', 0x8c},
626 	{'R', 'I', 0x8d},
627 	{'S', '2', 0x8e},
628 	{'S', '3', 0x8f},
629 	{'D', 'C', 0x90},
630 	{'P', '1', 0x91},
631 	{'P', '2', 0x92},
632 	{'T', 'S', 0x93},
633 	{'C', 'C', 0x94},
634 	{'M', 'W', 0x95},
635 	{'S', 'G', 0x96},
636 	{'E', 'G', 0x97},
637 	{'S', 'S', 0x98},
638 	{'G', 'C', 0x99},
639 	{'S', 'C', 0x9a},
640 	{'C', 'I', 0x9b},
641 	{'S', 'T', 0x9c},
642 	{'O', 'C', 0x9d},
643 	{'P', 'M', 0x9e},
644 	{'A', 'C', 0x9f},
645 	{'N', 'S', 0xa0},
646 	{'!', 'I', 0xa1},
647 	{'C', 't', 0xa2},
648 	{'P', 'd', 0xa3},
649 	{'C', 'u', 0xa4},
650 	{'Y', 'e', 0xa5},
651 	{'B', 'B', 0xa6},
652 	{'S', 'E', 0xa7},
653 	{'\'', ':', 0xa8},
654 	{'C', 'o', 0xa9},
655 	{'-', 'a', 0xaa},
656 	{'<', '<', 0xab},
657 	{'N', 'O', 0xac},
658 	{'-', '-', 0xad},
659 	{'R', 'g', 0xae},
660 	{'\'', 'm', 0xaf},
661 	{'D', 'G', 0xb0},
662 	{'+', '-', 0xb1},
663 	{'2', 'S', 0xb2},
664 	{'3', 'S', 0xb3},
665 	{'\'', '\'', 0xb4},
666 	{'M', 'y', 0xb5},
667 	{'P', 'I', 0xb6},
668 	{'.', 'M', 0xb7},
669 	{'\'', ',', 0xb8},
670 	{'1', 'S', 0xb9},
671 	{'-', 'o', 0xba},
672 	{'>', '>', 0xbb},
673 	{'1', '4', 0xbc},
674 	{'1', '2', 0xbd},
675 	{'3', '4', 0xbe},
676 	{'?', 'I', 0xbf},
677 	{'A', '!', 0xc0},
678 	{'A', '\'', 0xc1},
679 	{'A', '>', 0xc2},
680 	{'A', '?', 0xc3},
681 	{'A', ':', 0xc4},
682 	{'A', 'A', 0xc5},
683 	{'A', 'E', 0xc6},
684 	{'C', ',', 0xc7},
685 	{'E', '!', 0xc8},
686 	{'E', '\'', 0xc9},
687 	{'E', '>', 0xca},
688 	{'E', ':', 0xcb},
689 	{'I', '!', 0xcc},
690 	{'I', '\'', 0xcd},
691 	{'I', '>', 0xce},
692 	{'I', ':', 0xcf},
693 	{'D', '-', 0xd0},
694 	{'N', '?', 0xd1},
695 	{'O', '!', 0xd2},
696 	{'O', '\'', 0xd3},
697 	{'O', '>', 0xd4},
698 	{'O', '?', 0xd5},
699 	{'O', ':', 0xd6},
700 	{'*', 'X', 0xd7},
701 	{'O', '/', 0xd8},
702 	{'U', '!', 0xd9},
703 	{'U', '\'', 0xda},
704 	{'U', '>', 0xdb},
705 	{'U', ':', 0xdc},
706 	{'Y', '\'', 0xdd},
707 	{'T', 'H', 0xde},
708 	{'s', 's', 0xdf},
709 	{'a', '!', 0xe0},
710 	{'a', '\'', 0xe1},
711 	{'a', '>', 0xe2},
712 	{'a', '?', 0xe3},
713 	{'a', ':', 0xe4},
714 	{'a', 'a', 0xe5},
715 	{'a', 'e', 0xe6},
716 	{'c', ',', 0xe7},
717 	{'e', '!', 0xe8},
718 	{'e', '\'', 0xe9},
719 	{'e', '>', 0xea},
720 	{'e', ':', 0xeb},
721 	{'i', '!', 0xec},
722 	{'i', '\'', 0xed},
723 	{'i', '>', 0xee},
724 	{'i', ':', 0xef},
725 	{'d', '-', 0xf0},
726 	{'n', '?', 0xf1},
727 	{'o', '!', 0xf2},
728 	{'o', '\'', 0xf3},
729 	{'o', '>', 0xf4},
730 	{'o', '?', 0xf5},
731 	{'o', ':', 0xf6},
732 	{'-', ':', 0xf7},
733 	{'o', '/', 0xf8},
734 	{'u', '!', 0xf9},
735 	{'u', '\'', 0xfa},
736 	{'u', '>', 0xfb},
737 	{'u', ':', 0xfc},
738 	{'y', '\'', 0xfd},
739 	{'t', 'h', 0xfe},
740 	{'y', ':', 0xff},
741 
742 #      ifdef FEAT_MBYTE
743 #	define USE_UNICODE_DIGRAPHS
744 
745 	{'A', '-', 0x0100},
746 	{'a', '-', 0x0101},
747 	{'A', '(', 0x0102},
748 	{'a', '(', 0x0103},
749 	{'A', ';', 0x0104},
750 	{'a', ';', 0x0105},
751 	{'C', '\'', 0x0106},
752 	{'c', '\'', 0x0107},
753 	{'C', '>', 0x0108},
754 	{'c', '>', 0x0109},
755 	{'C', '.', 0x010a},
756 	{'c', '.', 0x010b},
757 	{'C', '<', 0x010c},
758 	{'c', '<', 0x010d},
759 	{'D', '<', 0x010e},
760 	{'d', '<', 0x010f},
761 	{'D', '/', 0x0110},
762 	{'d', '/', 0x0111},
763 	{'E', '-', 0x0112},
764 	{'e', '-', 0x0113},
765 	{'E', '(', 0x0114},
766 	{'e', '(', 0x0115},
767 	{'E', '.', 0x0116},
768 	{'e', '.', 0x0117},
769 	{'E', ';', 0x0118},
770 	{'e', ';', 0x0119},
771 	{'E', '<', 0x011a},
772 	{'e', '<', 0x011b},
773 	{'G', '>', 0x011c},
774 	{'g', '>', 0x011d},
775 	{'G', '(', 0x011e},
776 	{'g', '(', 0x011f},
777 	{'G', '.', 0x0120},
778 	{'g', '.', 0x0121},
779 	{'G', ',', 0x0122},
780 	{'g', ',', 0x0123},
781 	{'H', '>', 0x0124},
782 	{'h', '>', 0x0125},
783 	{'H', '/', 0x0126},
784 	{'h', '/', 0x0127},
785 	{'I', '?', 0x0128},
786 	{'i', '?', 0x0129},
787 	{'I', '-', 0x012a},
788 	{'i', '-', 0x012b},
789 	{'I', '(', 0x012c},
790 	{'i', '(', 0x012d},
791 	{'I', ';', 0x012e},
792 	{'i', ';', 0x012f},
793 	{'I', '.', 0x0130},
794 	{'i', '.', 0x0131},
795 	{'I', 'J', 0x0132},
796 	{'i', 'j', 0x0133},
797 	{'J', '>', 0x0134},
798 	{'j', '>', 0x0135},
799 	{'K', ',', 0x0136},
800 	{'k', ',', 0x0137},
801 	{'k', 'k', 0x0138},
802 	{'L', '\'', 0x0139},
803 	{'l', '\'', 0x013a},
804 	{'L', ',', 0x013b},
805 	{'l', ',', 0x013c},
806 	{'L', '<', 0x013d},
807 	{'l', '<', 0x013e},
808 	{'L', '.', 0x013f},
809 	{'l', '.', 0x0140},
810 	{'L', '/', 0x0141},
811 	{'l', '/', 0x0142},
812 	{'N', '\'', 0x0143},
813 	{'n', '\'', 0x0144},
814 	{'N', ',', 0x0145},
815 	{'n', ',', 0x0146},
816 	{'N', '<', 0x0147},
817 	{'n', '<', 0x0148},
818 	{'\'', 'n', 0x0149},
819 	{'N', 'G', 0x014a},
820 	{'n', 'g', 0x014b},
821 	{'O', '-', 0x014c},
822 	{'o', '-', 0x014d},
823 	{'O', '(', 0x014e},
824 	{'o', '(', 0x014f},
825 	{'O', '"', 0x0150},
826 	{'o', '"', 0x0151},
827 	{'O', 'E', 0x0152},
828 	{'o', 'e', 0x0153},
829 	{'R', '\'', 0x0154},
830 	{'r', '\'', 0x0155},
831 	{'R', ',', 0x0156},
832 	{'r', ',', 0x0157},
833 	{'R', '<', 0x0158},
834 	{'r', '<', 0x0159},
835 	{'S', '\'', 0x015a},
836 	{'s', '\'', 0x015b},
837 	{'S', '>', 0x015c},
838 	{'s', '>', 0x015d},
839 	{'S', ',', 0x015e},
840 	{'s', ',', 0x015f},
841 	{'S', '<', 0x0160},
842 	{'s', '<', 0x0161},
843 	{'T', ',', 0x0162},
844 	{'t', ',', 0x0163},
845 	{'T', '<', 0x0164},
846 	{'t', '<', 0x0165},
847 	{'T', '/', 0x0166},
848 	{'t', '/', 0x0167},
849 	{'U', '?', 0x0168},
850 	{'u', '?', 0x0169},
851 	{'U', '-', 0x016a},
852 	{'u', '-', 0x016b},
853 	{'U', '(', 0x016c},
854 	{'u', '(', 0x016d},
855 	{'U', '0', 0x016e},
856 	{'u', '0', 0x016f},
857 	{'U', '"', 0x0170},
858 	{'u', '"', 0x0171},
859 	{'U', ';', 0x0172},
860 	{'u', ';', 0x0173},
861 	{'W', '>', 0x0174},
862 	{'w', '>', 0x0175},
863 	{'Y', '>', 0x0176},
864 	{'y', '>', 0x0177},
865 	{'Y', ':', 0x0178},
866 	{'Z', '\'', 0x0179},
867 	{'z', '\'', 0x017a},
868 	{'Z', '.', 0x017b},
869 	{'z', '.', 0x017c},
870 	{'Z', '<', 0x017d},
871 	{'z', '<', 0x017e},
872 	{'O', '9', 0x01a0},
873 	{'o', '9', 0x01a1},
874 	{'O', 'I', 0x01a2},
875 	{'o', 'i', 0x01a3},
876 	{'y', 'r', 0x01a6},
877 	{'U', '9', 0x01af},
878 	{'u', '9', 0x01b0},
879 	{'Z', '/', 0x01b5},
880 	{'z', '/', 0x01b6},
881 	{'E', 'D', 0x01b7},
882 	{'A', '<', 0x01cd},
883 	{'a', '<', 0x01ce},
884 	{'I', '<', 0x01cf},
885 	{'i', '<', 0x01d0},
886 	{'O', '<', 0x01d1},
887 	{'o', '<', 0x01d2},
888 	{'U', '<', 0x01d3},
889 	{'u', '<', 0x01d4},
890 	{'A', '1', 0x01de},
891 	{'a', '1', 0x01df},
892 	{'A', '7', 0x01e0},
893 	{'a', '7', 0x01e1},
894 	{'A', '3', 0x01e2},
895 	{'a', '3', 0x01e3},
896 	{'G', '/', 0x01e4},
897 	{'g', '/', 0x01e5},
898 	{'G', '<', 0x01e6},
899 	{'g', '<', 0x01e7},
900 	{'K', '<', 0x01e8},
901 	{'k', '<', 0x01e9},
902 	{'O', ';', 0x01ea},
903 	{'o', ';', 0x01eb},
904 	{'O', '1', 0x01ec},
905 	{'o', '1', 0x01ed},
906 	{'E', 'Z', 0x01ee},
907 	{'e', 'z', 0x01ef},
908 	{'j', '<', 0x01f0},
909 	{'G', '\'', 0x01f4},
910 	{'g', '\'', 0x01f5},
911 	{';', 'S', 0x02bf},
912 	{'\'', '<', 0x02c7},
913 	{'\'', '(', 0x02d8},
914 	{'\'', '.', 0x02d9},
915 	{'\'', '0', 0x02da},
916 	{'\'', ';', 0x02db},
917 	{'\'', '"', 0x02dd},
918 	{'A', '%', 0x0386},
919 	{'E', '%', 0x0388},
920 	{'Y', '%', 0x0389},
921 	{'I', '%', 0x038a},
922 	{'O', '%', 0x038c},
923 	{'U', '%', 0x038e},
924 	{'W', '%', 0x038f},
925 	{'i', '3', 0x0390},
926 	{'A', '*', 0x0391},
927 	{'B', '*', 0x0392},
928 	{'G', '*', 0x0393},
929 	{'D', '*', 0x0394},
930 	{'E', '*', 0x0395},
931 	{'Z', '*', 0x0396},
932 	{'Y', '*', 0x0397},
933 	{'H', '*', 0x0398},
934 	{'I', '*', 0x0399},
935 	{'K', '*', 0x039a},
936 	{'L', '*', 0x039b},
937 	{'M', '*', 0x039c},
938 	{'N', '*', 0x039d},
939 	{'C', '*', 0x039e},
940 	{'O', '*', 0x039f},
941 	{'P', '*', 0x03a0},
942 	{'R', '*', 0x03a1},
943 	{'S', '*', 0x03a3},
944 	{'T', '*', 0x03a4},
945 	{'U', '*', 0x03a5},
946 	{'F', '*', 0x03a6},
947 	{'X', '*', 0x03a7},
948 	{'Q', '*', 0x03a8},
949 	{'W', '*', 0x03a9},
950 	{'J', '*', 0x03aa},
951 	{'V', '*', 0x03ab},
952 	{'a', '%', 0x03ac},
953 	{'e', '%', 0x03ad},
954 	{'y', '%', 0x03ae},
955 	{'i', '%', 0x03af},
956 	{'u', '3', 0x03b0},
957 	{'a', '*', 0x03b1},
958 	{'b', '*', 0x03b2},
959 	{'g', '*', 0x03b3},
960 	{'d', '*', 0x03b4},
961 	{'e', '*', 0x03b5},
962 	{'z', '*', 0x03b6},
963 	{'y', '*', 0x03b7},
964 	{'h', '*', 0x03b8},
965 	{'i', '*', 0x03b9},
966 	{'k', '*', 0x03ba},
967 	{'l', '*', 0x03bb},
968 	{'m', '*', 0x03bc},
969 	{'n', '*', 0x03bd},
970 	{'c', '*', 0x03be},
971 	{'o', '*', 0x03bf},
972 	{'p', '*', 0x03c0},
973 	{'r', '*', 0x03c1},
974 	{'*', 's', 0x03c2},
975 	{'s', '*', 0x03c3},
976 	{'t', '*', 0x03c4},
977 	{'u', '*', 0x03c5},
978 	{'f', '*', 0x03c6},
979 	{'x', '*', 0x03c7},
980 	{'q', '*', 0x03c8},
981 	{'w', '*', 0x03c9},
982 	{'j', '*', 0x03ca},
983 	{'v', '*', 0x03cb},
984 	{'o', '%', 0x03cc},
985 	{'u', '%', 0x03cd},
986 	{'w', '%', 0x03ce},
987 	{'\'', 'G', 0x03d8},
988 	{',', 'G', 0x03d9},
989 	{'T', '3', 0x03da},
990 	{'t', '3', 0x03db},
991 	{'M', '3', 0x03dc},
992 	{'m', '3', 0x03dd},
993 	{'K', '3', 0x03de},
994 	{'k', '3', 0x03df},
995 	{'P', '3', 0x03e0},
996 	{'p', '3', 0x03e1},
997 	{'\'', '%', 0x03f4},
998 	{'j', '3', 0x03f5},
999 	{'I', 'O', 0x0401},
1000 	{'D', '%', 0x0402},
1001 	{'G', '%', 0x0403},
1002 	{'I', 'E', 0x0404},
1003 	{'D', 'S', 0x0405},
1004 	{'I', 'I', 0x0406},
1005 	{'Y', 'I', 0x0407},
1006 	{'J', '%', 0x0408},
1007 	{'L', 'J', 0x0409},
1008 	{'N', 'J', 0x040a},
1009 	{'T', 's', 0x040b},
1010 	{'K', 'J', 0x040c},
1011 	{'V', '%', 0x040e},
1012 	{'D', 'Z', 0x040f},
1013 	{'A', '=', 0x0410},
1014 	{'B', '=', 0x0411},
1015 	{'V', '=', 0x0412},
1016 	{'G', '=', 0x0413},
1017 	{'D', '=', 0x0414},
1018 	{'E', '=', 0x0415},
1019 	{'Z', '%', 0x0416},
1020 	{'Z', '=', 0x0417},
1021 	{'I', '=', 0x0418},
1022 	{'J', '=', 0x0419},
1023 	{'K', '=', 0x041a},
1024 	{'L', '=', 0x041b},
1025 	{'M', '=', 0x041c},
1026 	{'N', '=', 0x041d},
1027 	{'O', '=', 0x041e},
1028 	{'P', '=', 0x041f},
1029 	{'R', '=', 0x0420},
1030 	{'S', '=', 0x0421},
1031 	{'T', '=', 0x0422},
1032 	{'U', '=', 0x0423},
1033 	{'F', '=', 0x0424},
1034 	{'H', '=', 0x0425},
1035 	{'C', '=', 0x0426},
1036 	{'C', '%', 0x0427},
1037 	{'S', '%', 0x0428},
1038 	{'S', 'c', 0x0429},
1039 	{'=', '"', 0x042a},
1040 	{'Y', '=', 0x042b},
1041 	{'%', '"', 0x042c},
1042 	{'J', 'E', 0x042d},
1043 	{'J', 'U', 0x042e},
1044 	{'J', 'A', 0x042f},
1045 	{'a', '=', 0x0430},
1046 	{'b', '=', 0x0431},
1047 	{'v', '=', 0x0432},
1048 	{'g', '=', 0x0433},
1049 	{'d', '=', 0x0434},
1050 	{'e', '=', 0x0435},
1051 	{'z', '%', 0x0436},
1052 	{'z', '=', 0x0437},
1053 	{'i', '=', 0x0438},
1054 	{'j', '=', 0x0439},
1055 	{'k', '=', 0x043a},
1056 	{'l', '=', 0x043b},
1057 	{'m', '=', 0x043c},
1058 	{'n', '=', 0x043d},
1059 	{'o', '=', 0x043e},
1060 	{'p', '=', 0x043f},
1061 	{'r', '=', 0x0440},
1062 	{'s', '=', 0x0441},
1063 	{'t', '=', 0x0442},
1064 	{'u', '=', 0x0443},
1065 	{'f', '=', 0x0444},
1066 	{'h', '=', 0x0445},
1067 	{'c', '=', 0x0446},
1068 	{'c', '%', 0x0447},
1069 	{'s', '%', 0x0448},
1070 	{'s', 'c', 0x0449},
1071 	{'=', '\'', 0x044a},
1072 	{'y', '=', 0x044b},
1073 	{'%', '\'', 0x044c},
1074 	{'j', 'e', 0x044d},
1075 	{'j', 'u', 0x044e},
1076 	{'j', 'a', 0x044f},
1077 	{'i', 'o', 0x0451},
1078 	{'d', '%', 0x0452},
1079 	{'g', '%', 0x0453},
1080 	{'i', 'e', 0x0454},
1081 	{'d', 's', 0x0455},
1082 	{'i', 'i', 0x0456},
1083 	{'y', 'i', 0x0457},
1084 	{'j', '%', 0x0458},
1085 	{'l', 'j', 0x0459},
1086 	{'n', 'j', 0x045a},
1087 	{'t', 's', 0x045b},
1088 	{'k', 'j', 0x045c},
1089 	{'v', '%', 0x045e},
1090 	{'d', 'z', 0x045f},
1091 	{'Y', '3', 0x0462},
1092 	{'y', '3', 0x0463},
1093 	{'O', '3', 0x046a},
1094 	{'o', '3', 0x046b},
1095 	{'F', '3', 0x0472},
1096 	{'f', '3', 0x0473},
1097 	{'V', '3', 0x0474},
1098 	{'v', '3', 0x0475},
1099 	{'C', '3', 0x0480},
1100 	{'c', '3', 0x0481},
1101 	{'G', '3', 0x0490},
1102 	{'g', '3', 0x0491},
1103 	{'A', '+', 0x05d0},
1104 	{'B', '+', 0x05d1},
1105 	{'G', '+', 0x05d2},
1106 	{'D', '+', 0x05d3},
1107 	{'H', '+', 0x05d4},
1108 	{'W', '+', 0x05d5},
1109 	{'Z', '+', 0x05d6},
1110 	{'X', '+', 0x05d7},
1111 	{'T', 'j', 0x05d8},
1112 	{'J', '+', 0x05d9},
1113 	{'K', '%', 0x05da},
1114 	{'K', '+', 0x05db},
1115 	{'L', '+', 0x05dc},
1116 	{'M', '%', 0x05dd},
1117 	{'M', '+', 0x05de},
1118 	{'N', '%', 0x05df},
1119 	{'N', '+', 0x05e0},
1120 	{'S', '+', 0x05e1},
1121 	{'E', '+', 0x05e2},
1122 	{'P', '%', 0x05e3},
1123 	{'P', '+', 0x05e4},
1124 	{'Z', 'j', 0x05e5},
1125 	{'Z', 'J', 0x05e6},
1126 	{'Q', '+', 0x05e7},
1127 	{'R', '+', 0x05e8},
1128 	{'S', 'h', 0x05e9},
1129 	{'T', '+', 0x05ea},
1130 	{',', '+', 0x060c},
1131 	{';', '+', 0x061b},
1132 	{'?', '+', 0x061f},
1133 	{'H', '\'', 0x0621},
1134 	{'a', 'M', 0x0622},
1135 	{'a', 'H', 0x0623},
1136 	{'w', 'H', 0x0624},
1137 	{'a', 'h', 0x0625},
1138 	{'y', 'H', 0x0626},
1139 	{'a', '+', 0x0627},
1140 	{'b', '+', 0x0628},
1141 	{'t', 'm', 0x0629},
1142 	{'t', '+', 0x062a},
1143 	{'t', 'k', 0x062b},
1144 	{'g', '+', 0x062c},
1145 	{'h', 'k', 0x062d},
1146 	{'x', '+', 0x062e},
1147 	{'d', '+', 0x062f},
1148 	{'d', 'k', 0x0630},
1149 	{'r', '+', 0x0631},
1150 	{'z', '+', 0x0632},
1151 	{'s', '+', 0x0633},
1152 	{'s', 'n', 0x0634},
1153 	{'c', '+', 0x0635},
1154 	{'d', 'd', 0x0636},
1155 	{'t', 'j', 0x0637},
1156 	{'z', 'H', 0x0638},
1157 	{'e', '+', 0x0639},
1158 	{'i', '+', 0x063a},
1159 	{'+', '+', 0x0640},
1160 	{'f', '+', 0x0641},
1161 	{'q', '+', 0x0642},
1162 	{'k', '+', 0x0643},
1163 	{'l', '+', 0x0644},
1164 	{'m', '+', 0x0645},
1165 	{'n', '+', 0x0646},
1166 	{'h', '+', 0x0647},
1167 	{'w', '+', 0x0648},
1168 	{'j', '+', 0x0649},
1169 	{'y', '+', 0x064a},
1170 	{':', '+', 0x064b},
1171 	{'"', '+', 0x064c},
1172 	{'=', '+', 0x064d},
1173 	{'/', '+', 0x064e},
1174 	{'\'', '+', 0x064f},
1175 	{'1', '+', 0x0650},
1176 	{'3', '+', 0x0651},
1177 	{'0', '+', 0x0652},
1178 	{'a', 'S', 0x0670},
1179 	{'p', '+', 0x067e},
1180 	{'v', '+', 0x06a4},
1181 	{'g', 'f', 0x06af},
1182 	{'0', 'a', 0x06f0},
1183 	{'1', 'a', 0x06f1},
1184 	{'2', 'a', 0x06f2},
1185 	{'3', 'a', 0x06f3},
1186 	{'4', 'a', 0x06f4},
1187 	{'5', 'a', 0x06f5},
1188 	{'6', 'a', 0x06f6},
1189 	{'7', 'a', 0x06f7},
1190 	{'8', 'a', 0x06f8},
1191 	{'9', 'a', 0x06f9},
1192 	{'B', '.', 0x1e02},
1193 	{'b', '.', 0x1e03},
1194 	{'B', '_', 0x1e06},
1195 	{'b', '_', 0x1e07},
1196 	{'D', '.', 0x1e0a},
1197 	{'d', '.', 0x1e0b},
1198 	{'D', '_', 0x1e0e},
1199 	{'d', '_', 0x1e0f},
1200 	{'D', ',', 0x1e10},
1201 	{'d', ',', 0x1e11},
1202 	{'F', '.', 0x1e1e},
1203 	{'f', '.', 0x1e1f},
1204 	{'G', '-', 0x1e20},
1205 	{'g', '-', 0x1e21},
1206 	{'H', '.', 0x1e22},
1207 	{'h', '.', 0x1e23},
1208 	{'H', ':', 0x1e26},
1209 	{'h', ':', 0x1e27},
1210 	{'H', ',', 0x1e28},
1211 	{'h', ',', 0x1e29},
1212 	{'K', '\'', 0x1e30},
1213 	{'k', '\'', 0x1e31},
1214 	{'K', '_', 0x1e34},
1215 	{'k', '_', 0x1e35},
1216 	{'L', '_', 0x1e3a},
1217 	{'l', '_', 0x1e3b},
1218 	{'M', '\'', 0x1e3e},
1219 	{'m', '\'', 0x1e3f},
1220 	{'M', '.', 0x1e40},
1221 	{'m', '.', 0x1e41},
1222 	{'N', '.', 0x1e44},
1223 	{'n', '.', 0x1e45},
1224 	{'N', '_', 0x1e48},
1225 	{'n', '_', 0x1e49},
1226 	{'P', '\'', 0x1e54},
1227 	{'p', '\'', 0x1e55},
1228 	{'P', '.', 0x1e56},
1229 	{'p', '.', 0x1e57},
1230 	{'R', '.', 0x1e58},
1231 	{'r', '.', 0x1e59},
1232 	{'R', '_', 0x1e5e},
1233 	{'r', '_', 0x1e5f},
1234 	{'S', '.', 0x1e60},
1235 	{'s', '.', 0x1e61},
1236 	{'T', '.', 0x1e6a},
1237 	{'t', '.', 0x1e6b},
1238 	{'T', '_', 0x1e6e},
1239 	{'t', '_', 0x1e6f},
1240 	{'V', '?', 0x1e7c},
1241 	{'v', '?', 0x1e7d},
1242 	{'W', '!', 0x1e80},
1243 	{'w', '!', 0x1e81},
1244 	{'W', '\'', 0x1e82},
1245 	{'w', '\'', 0x1e83},
1246 	{'W', ':', 0x1e84},
1247 	{'w', ':', 0x1e85},
1248 	{'W', '.', 0x1e86},
1249 	{'w', '.', 0x1e87},
1250 	{'X', '.', 0x1e8a},
1251 	{'x', '.', 0x1e8b},
1252 	{'X', ':', 0x1e8c},
1253 	{'x', ':', 0x1e8d},
1254 	{'Y', '.', 0x1e8e},
1255 	{'y', '.', 0x1e8f},
1256 	{'Z', '>', 0x1e90},
1257 	{'z', '>', 0x1e91},
1258 	{'Z', '_', 0x1e94},
1259 	{'z', '_', 0x1e95},
1260 	{'h', '_', 0x1e96},
1261 	{'t', ':', 0x1e97},
1262 	{'w', '0', 0x1e98},
1263 	{'y', '0', 0x1e99},
1264 	{'A', '2', 0x1ea2},
1265 	{'a', '2', 0x1ea3},
1266 	{'E', '2', 0x1eba},
1267 	{'e', '2', 0x1ebb},
1268 	{'E', '?', 0x1ebc},
1269 	{'e', '?', 0x1ebd},
1270 	{'I', '2', 0x1ec8},
1271 	{'i', '2', 0x1ec9},
1272 	{'O', '2', 0x1ece},
1273 	{'o', '2', 0x1ecf},
1274 	{'U', '2', 0x1ee6},
1275 	{'u', '2', 0x1ee7},
1276 	{'Y', '!', 0x1ef2},
1277 	{'y', '!', 0x1ef3},
1278 	{'Y', '2', 0x1ef6},
1279 	{'y', '2', 0x1ef7},
1280 	{'Y', '?', 0x1ef8},
1281 	{'y', '?', 0x1ef9},
1282 	{';', '\'', 0x1f00},
1283 	{',', '\'', 0x1f01},
1284 	{';', '!', 0x1f02},
1285 	{',', '!', 0x1f03},
1286 	{'?', ';', 0x1f04},
1287 	{'?', ',', 0x1f05},
1288 	{'!', ':', 0x1f06},
1289 	{'?', ':', 0x1f07},
1290 	{'1', 'N', 0x2002},
1291 	{'1', 'M', 0x2003},
1292 	{'3', 'M', 0x2004},
1293 	{'4', 'M', 0x2005},
1294 	{'6', 'M', 0x2006},
1295 	{'1', 'T', 0x2009},
1296 	{'1', 'H', 0x200a},
1297 	{'-', '1', 0x2010},
1298 	{'-', 'N', 0x2013},
1299 	{'-', 'M', 0x2014},
1300 	{'-', '3', 0x2015},
1301 	{'!', '2', 0x2016},
1302 	{'=', '2', 0x2017},
1303 	{'\'', '6', 0x2018},
1304 	{'\'', '9', 0x2019},
1305 	{'.', '9', 0x201a},
1306 	{'9', '\'', 0x201b},
1307 	{'"', '6', 0x201c},
1308 	{'"', '9', 0x201d},
1309 	{':', '9', 0x201e},
1310 	{'9', '"', 0x201f},
1311 	{'/', '-', 0x2020},
1312 	{'/', '=', 0x2021},
1313 	{'.', '.', 0x2025},
1314 	{',', '.', 0x2026},
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 
1879 	/* extra alternatives, easier to remember */
1880 	{'W', '`', 0x1e80},
1881 	{'w', '`', 0x1e81},
1882 	{'Y', '`', 0x1ef2},
1883 	{'y', '`', 0x1ef3},
1884 
1885 #      endif /* FEAT_MBYTE */
1886 
1887 	/* Vim 5.x compatible digraphs that don't conflict with the above */
1888 	{'~', '!', 161},	/* � */
1889 	{'c', '|', 162},	/* � */
1890 	{'$', '$', 163},	/* � */
1891 	{'o', 'x', 164},	/* � - currency symbol in ISO 8859-1 */
1892 	{'Y', '-', 165},	/* � */
1893 	{'|', '|', 166},	/* � */
1894 	{'c', 'O', 169},	/* � */
1895 	{'-', ',', 172},	/* � */
1896 	{'-', '=', 175},	/* � */
1897 	{'~', 'o', 176},	/* � */
1898 	{'2', '2', 178},	/* � */
1899 	{'3', '3', 179},	/* � */
1900 	{'p', 'p', 182},	/* � */
1901 	{'~', '.', 183},	/* � */
1902 	{'1', '1', 185},	/* � */
1903 	{'~', '?', 191},	/* � */
1904 	{'A', '`', 192},	/* � */
1905 	{'A', '^', 194},	/* � */
1906 	{'A', '~', 195},	/* � */
1907 	{'A', '"', 196},	/* � */
1908 	{'A', '@', 197},	/* � */
1909 	{'E', '`', 200},	/* � */
1910 	{'E', '^', 202},	/* � */
1911 	{'E', '"', 203},	/* � */
1912 	{'I', '`', 204},	/* � */
1913 	{'I', '^', 206},	/* � */
1914 	{'I', '"', 207},	/* � */
1915 	{'N', '~', 209},	/* � */
1916 	{'O', '`', 210},	/* � */
1917 	{'O', '^', 212},	/* � */
1918 	{'O', '~', 213},	/* � */
1919 	{'/', '\\', 215},	/* � - multiplication symbol in ISO 8859-1 */
1920 	{'U', '`', 217},	/* � */
1921 	{'U', '^', 219},	/* � */
1922 	{'I', 'p', 222},	/* � */
1923 	{'a', '`', 224},	/* � */
1924 	{'a', '^', 226},	/* � */
1925 	{'a', '~', 227},	/* � */
1926 	{'a', '"', 228},	/* � */
1927 	{'a', '@', 229},	/* � */
1928 	{'e', '`', 232},	/* � */
1929 	{'e', '^', 234},	/* � */
1930 	{'e', '"', 235},	/* � */
1931 	{'i', '`', 236},	/* � */
1932 	{'i', '^', 238},	/* � */
1933 	{'n', '~', 241},	/* � */
1934 	{'o', '`', 242},	/* � */
1935 	{'o', '^', 244},	/* � */
1936 	{'o', '~', 245},	/* � */
1937 	{'u', '`', 249},	/* � */
1938 	{'u', '^', 251},	/* � */
1939 	{'y', '"', 255},	/* x XX */
1940 
1941 	{NUL, NUL, NUL}
1942        };
1943 
1944 #    endif /* OLD_DIGRAPHS */
1945 
1946 #   endif /* Macintosh */
1947 #  endif /* EBCDIC */
1948 # endif    /* !HPUX_DIGRAPHS */
1949 #endif	/* !__MINT__ */
1950 
1951 /*
1952  * handle digraphs after typing a character
1953  */
1954     int
1955 do_digraph(int c)
1956 {
1957     static int	backspaced;	/* character before K_BS */
1958     static int	lastchar;	/* last typed character */
1959 
1960     if (c == -1)		/* init values */
1961     {
1962 	backspaced = -1;
1963     }
1964     else if (p_dg)
1965     {
1966 	if (backspaced >= 0)
1967 	    c = getdigraph(backspaced, c, FALSE);
1968 	backspaced = -1;
1969 	if ((c == K_BS || c == Ctrl_H) && lastchar >= 0)
1970 	    backspaced = lastchar;
1971     }
1972     lastchar = c;
1973     return c;
1974 }
1975 
1976 /*
1977  * Find a digraph for "val".  If found return the string to display it.
1978  * If not found return NULL.
1979  */
1980     char_u *
1981 get_digraph_for_char(int val_arg)
1982 {
1983     int		val = val_arg;
1984     int		i;
1985     int		use_defaults;
1986     digr_T	*dp;
1987     static      char_u      r[3];
1988 
1989 #if defined(FEAT_MBYTE) && defined(USE_UNICODE_DIGRAPHS)
1990     if (!enc_utf8)
1991     {
1992 	char_u	    buf[6], *to;
1993 	vimconv_T   vc;
1994 
1995 	// convert the character from 'encoding' to Unicode
1996 	i = mb_char2bytes(val, buf);
1997 	vc.vc_type = CONV_NONE;
1998 	if (convert_setup(&vc, p_enc, (char_u *)"utf-8") == OK)
1999 	{
2000 	    vc.vc_fail = TRUE;
2001 	    to = string_convert(&vc, buf, &i);
2002 	    if (to != NULL)
2003 	    {
2004 		val = utf_ptr2char(to);
2005 		vim_free(to);
2006 	    }
2007 	    (void)convert_setup(&vc, NULL, NULL);
2008 	}
2009     }
2010 #endif
2011 
2012     for (use_defaults = 0; use_defaults <= 1; use_defaults++)
2013     {
2014 	if (use_defaults == 0)
2015 	    dp = (digr_T *)user_digraphs.ga_data;
2016 	else
2017 	    dp = digraphdefault;
2018 	for (i = 0; use_defaults ? dp->char1 != NUL
2019 					       : i < user_digraphs.ga_len; ++i)
2020 	{
2021 	    if (dp->result == val)
2022 	    {
2023 		r[0] = dp->char1;
2024 		r[1] = dp->char2;
2025 		r[2] = NUL;
2026 		return r;
2027 	    }
2028 	    ++dp;
2029 	}
2030     }
2031     return NULL;
2032 }
2033 
2034 /*
2035  * Get a digraph.  Used after typing CTRL-K on the command line or in normal
2036  * mode.
2037  * Returns composed character, or NUL when ESC was used.
2038  */
2039     int
2040 get_digraph(
2041     int		cmdline)	/* TRUE when called from the cmdline */
2042 {
2043     int		c, cc;
2044 
2045     ++no_mapping;
2046     ++allow_keys;
2047     c = plain_vgetc();
2048     --no_mapping;
2049     --allow_keys;
2050     if (c != ESC)		/* ESC cancels CTRL-K */
2051     {
2052 	if (IS_SPECIAL(c))	/* insert special key code */
2053 	    return c;
2054 	if (cmdline)
2055 	{
2056 	    if (char2cells(c) == 1
2057 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
2058 		    && cmdline_star == 0
2059 #endif
2060 		    )
2061 		putcmdline(c, TRUE);
2062 	}
2063 #ifdef FEAT_CMDL_INFO
2064 	else
2065 	    add_to_showcmd(c);
2066 #endif
2067 	++no_mapping;
2068 	++allow_keys;
2069 	cc = plain_vgetc();
2070 	--no_mapping;
2071 	--allow_keys;
2072 	if (cc != ESC)	    /* ESC cancels CTRL-K */
2073 	    return getdigraph(c, cc, TRUE);
2074     }
2075     return NUL;
2076 }
2077 
2078 /*
2079  * Lookup the pair "char1", "char2" in the digraph tables.
2080  * If no match, return "char2".
2081  * If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80.
2082  */
2083     static int
2084 getexactdigraph(int char1, int char2, int meta_char)
2085 {
2086     int		i;
2087     int		retval = 0;
2088     digr_T	*dp;
2089 
2090     if (IS_SPECIAL(char1) || IS_SPECIAL(char2))
2091 	return char2;
2092 
2093     /*
2094      * Search user digraphs first.
2095      */
2096     dp = (digr_T *)user_digraphs.ga_data;
2097     for (i = 0; i < user_digraphs.ga_len; ++i)
2098     {
2099 	if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2100 	{
2101 	    retval = dp->result;
2102 	    break;
2103 	}
2104 	++dp;
2105     }
2106 
2107     /*
2108      * Search default digraphs.
2109      */
2110     if (retval == 0)
2111     {
2112 	dp = digraphdefault;
2113 	for (i = 0; dp->char1 != 0; ++i)
2114 	{
2115 	    if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2116 	    {
2117 		retval = dp->result;
2118 		break;
2119 	    }
2120 	    ++dp;
2121 	}
2122     }
2123 #ifdef FEAT_MBYTE
2124 # ifdef USE_UNICODE_DIGRAPHS
2125     if (retval != 0 && !enc_utf8)
2126     {
2127 	char_u	    buf[6], *to;
2128 	vimconv_T   vc;
2129 
2130 	/*
2131 	 * Convert the Unicode digraph to 'encoding'.
2132 	 */
2133 	i = utf_char2bytes(retval, buf);
2134 	retval = 0;
2135 	vc.vc_type = CONV_NONE;
2136 	if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK)
2137 	{
2138 	    vc.vc_fail = TRUE;
2139 	    to = string_convert(&vc, buf, &i);
2140 	    if (to != NULL)
2141 	    {
2142 		retval = (*mb_ptr2char)(to);
2143 		vim_free(to);
2144 	    }
2145 	    (void)convert_setup(&vc, NULL, NULL);
2146 	}
2147     }
2148 # endif
2149 
2150     /* Ignore multi-byte characters when not in multi-byte mode. */
2151     if (!has_mbyte && retval > 0xff)
2152 	retval = 0;
2153 #endif
2154 
2155     if (retval == 0)		/* digraph deleted or not found */
2156     {
2157 	if (char1 == ' ' && meta_char)	/* <space> <char> --> meta-char */
2158 	    return (char2 | 0x80);
2159 	return char2;
2160     }
2161     return retval;
2162 }
2163 
2164 /*
2165  * Get digraph.
2166  * Allow for both char1-char2 and char2-char1
2167  */
2168     int
2169 getdigraph(int char1, int char2, int meta_char)
2170 {
2171     int	    retval;
2172 
2173     if (((retval = getexactdigraph(char1, char2, meta_char)) == char2)
2174 	    && (char1 != char2)
2175 	    && ((retval = getexactdigraph(char2, char1, meta_char)) == char1))
2176 	return char2;
2177     return retval;
2178 }
2179 
2180 /*
2181  * Add the digraphs in the argument to the digraph table.
2182  * format: {c1}{c2} char {c1}{c2} char ...
2183  */
2184     void
2185 putdigraph(char_u *str)
2186 {
2187     int		char1, char2, n;
2188     int		i;
2189     digr_T	*dp;
2190 
2191     while (*str != NUL)
2192     {
2193 	str = skipwhite(str);
2194 	if (*str == NUL)
2195 	    return;
2196 	char1 = *str++;
2197 	char2 = *str++;
2198 	if (char2 == 0)
2199 	{
2200 	    EMSG(_(e_invarg));
2201 	    return;
2202 	}
2203 	if (char1 == ESC || char2 == ESC)
2204 	{
2205 	    EMSG(_("E104: Escape not allowed in digraph"));
2206 	    return;
2207 	}
2208 	str = skipwhite(str);
2209 	if (!VIM_ISDIGIT(*str))
2210 	{
2211 	    EMSG(_(e_number_exp));
2212 	    return;
2213 	}
2214 	n = getdigits(&str);
2215 
2216 	/* If the digraph already exists, replace the result. */
2217 	dp = (digr_T *)user_digraphs.ga_data;
2218 	for (i = 0; i < user_digraphs.ga_len; ++i)
2219 	{
2220 	    if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2221 	    {
2222 		dp->result = n;
2223 		break;
2224 	    }
2225 	    ++dp;
2226 	}
2227 
2228 	/* Add a new digraph to the table. */
2229 	if (i == user_digraphs.ga_len)
2230 	{
2231 	    if (ga_grow(&user_digraphs, 1) == OK)
2232 	    {
2233 		dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
2234 		dp->char1 = char1;
2235 		dp->char2 = char2;
2236 		dp->result = n;
2237 		++user_digraphs.ga_len;
2238 	    }
2239 	}
2240     }
2241 }
2242 
2243     void
2244 listdigraphs(void)
2245 {
2246     int		i;
2247     digr_T	*dp;
2248 
2249     msg_putchar('\n');
2250 
2251     dp = digraphdefault;
2252     for (i = 0; dp->char1 != NUL && !got_int; ++i)
2253     {
2254 #if defined(USE_UNICODE_DIGRAPHS) && defined(FEAT_MBYTE)
2255 	digr_T tmp;
2256 
2257 	/* May need to convert the result to 'encoding'. */
2258 	tmp.char1 = dp->char1;
2259 	tmp.char2 = dp->char2;
2260 	tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
2261 	if (tmp.result != 0 && tmp.result != tmp.char2
2262 					  && (has_mbyte || tmp.result <= 255))
2263 	    printdigraph(&tmp);
2264 #else
2265 
2266 	if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
2267 # ifdef FEAT_MBYTE
2268 		&& (has_mbyte || dp->result <= 255)
2269 # endif
2270 		)
2271 	    printdigraph(dp);
2272 #endif
2273 	++dp;
2274 	ui_breakcheck();
2275     }
2276 
2277     dp = (digr_T *)user_digraphs.ga_data;
2278     for (i = 0; i < user_digraphs.ga_len && !got_int; ++i)
2279     {
2280 	printdigraph(dp);
2281 	ui_breakcheck();
2282 	++dp;
2283     }
2284     must_redraw = CLEAR;    /* clear screen, because some digraphs may be
2285 			       wrong, in which case we messed up ScreenLines */
2286 }
2287 
2288     static void
2289 printdigraph(digr_T *dp)
2290 {
2291     char_u	buf[30];
2292     char_u	*p;
2293 
2294     int		list_width;
2295 
2296     if ((dy_flags & DY_UHEX)
2297 #ifdef FEAT_MBYTE
2298 	    || has_mbyte
2299 #endif
2300 	    )
2301 	list_width = 13;
2302     else
2303 	list_width = 11;
2304 
2305     if (dp->result != 0)
2306     {
2307 	if (msg_col > Columns - list_width)
2308 	    msg_putchar('\n');
2309 	if (msg_col)
2310 	    while (msg_col % list_width != 0)
2311 		msg_putchar(' ');
2312 
2313 	p = buf;
2314 	*p++ = dp->char1;
2315 	*p++ = dp->char2;
2316 	*p++ = ' ';
2317 #ifdef FEAT_MBYTE
2318 	if (has_mbyte)
2319 	{
2320 	    /* add a space to draw a composing char on */
2321 	    if (enc_utf8 && utf_iscomposing(dp->result))
2322 		*p++ = ' ';
2323 	    p += (*mb_char2bytes)(dp->result, p);
2324 	}
2325 	else
2326 #endif
2327 	    *p++ = (char_u)dp->result;
2328 	if (char2cells(dp->result) == 1)
2329 	    *p++ = ' ';
2330 	vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
2331 	msg_outtrans(buf);
2332     }
2333 }
2334 
2335 #endif /* FEAT_DIGRAPHS */
2336 
2337 #if defined(FEAT_KEYMAP) || defined(PROTO)
2338 
2339 /* structure used for b_kmap_ga.ga_data */
2340 typedef struct
2341 {
2342     char_u	*from;
2343     char_u	*to;
2344 } kmap_T;
2345 
2346 #define KMAP_MAXLEN 20	    /* maximum length of "from" or "to" */
2347 
2348 static void keymap_unload(void);
2349 
2350 /*
2351  * Set up key mapping tables for the 'keymap' option.
2352  * Returns NULL if OK, an error message for failure.  This only needs to be
2353  * used when setting the option, not later when the value has already been
2354  * checked.
2355  */
2356     char_u *
2357 keymap_init(void)
2358 {
2359     curbuf->b_kmap_state &= ~KEYMAP_INIT;
2360 
2361     if (*curbuf->b_p_keymap == NUL)
2362     {
2363 	/* Stop any active keymap and clear the table.  Also remove
2364 	 * b:keymap_name, as no keymap is active now. */
2365 	keymap_unload();
2366 	do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
2367     }
2368     else
2369     {
2370 	char_u	*buf;
2371 	size_t  buflen;
2372 
2373 	/* Source the keymap file.  It will contain a ":loadkeymap" command
2374 	 * which will call ex_loadkeymap() below. */
2375 	buflen = STRLEN(curbuf->b_p_keymap)
2376 # ifdef FEAT_MBYTE
2377 					   + STRLEN(p_enc)
2378 # endif
2379 						       + 14;
2380 	buf = alloc((unsigned)buflen);
2381 	if (buf == NULL)
2382 	    return e_outofmem;
2383 
2384 # ifdef FEAT_MBYTE
2385 	/* try finding "keymap/'keymap'_'encoding'.vim"  in 'runtimepath' */
2386 	vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
2387 						   curbuf->b_p_keymap, p_enc);
2388 	if (source_runtime(buf, 0) == FAIL)
2389 # endif
2390 	{
2391 	    /* try finding "keymap/'keymap'.vim" in 'runtimepath'  */
2392 	    vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
2393 							  curbuf->b_p_keymap);
2394 	    if (source_runtime(buf, 0) == FAIL)
2395 	    {
2396 		vim_free(buf);
2397 		return (char_u *)N_("E544: Keymap file not found");
2398 	    }
2399 	}
2400 	vim_free(buf);
2401     }
2402 
2403     return NULL;
2404 }
2405 
2406 /*
2407  * ":loadkeymap" command: load the following lines as the keymap.
2408  */
2409     void
2410 ex_loadkeymap(exarg_T *eap)
2411 {
2412     char_u	*line;
2413     char_u	*p;
2414     char_u	*s;
2415     kmap_T	*kp;
2416 #define KMAP_LLEN   200	    /* max length of "to" and "from" together */
2417     char_u	buf[KMAP_LLEN + 11];
2418     int		i;
2419     char_u	*save_cpo = p_cpo;
2420 
2421     if (!getline_equal(eap->getline, eap->cookie, getsourceline))
2422     {
2423 	EMSG(_("E105: Using :loadkeymap not in a sourced file"));
2424 	return;
2425     }
2426 
2427     /*
2428      * Stop any active keymap and clear the table.
2429      */
2430     keymap_unload();
2431 
2432     curbuf->b_kmap_state = 0;
2433     ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
2434 
2435     /* Set 'cpoptions' to "C" to avoid line continuation. */
2436     p_cpo = (char_u *)"C";
2437 
2438     /*
2439      * Get each line of the sourced file, break at the end.
2440      */
2441     for (;;)
2442     {
2443 	line = eap->getline(0, eap->cookie, 0);
2444 	if (line == NULL)
2445 	    break;
2446 
2447 	p = skipwhite(line);
2448 	if (*p != '"' && *p != NUL && ga_grow(&curbuf->b_kmap_ga, 1) == OK)
2449 	{
2450 	    kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len;
2451 	    s = skiptowhite(p);
2452 	    kp->from = vim_strnsave(p, (int)(s - p));
2453 	    p = skipwhite(s);
2454 	    s = skiptowhite(p);
2455 	    kp->to = vim_strnsave(p, (int)(s - p));
2456 
2457 	    if (kp->from == NULL || kp->to == NULL
2458 		    || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN
2459 		    || *kp->from == NUL || *kp->to == NUL)
2460 	    {
2461 		if (kp->to != NULL && *kp->to == NUL)
2462 		    EMSG(_("E791: Empty keymap entry"));
2463 		vim_free(kp->from);
2464 		vim_free(kp->to);
2465 	    }
2466 	    else
2467 		++curbuf->b_kmap_ga.ga_len;
2468 	}
2469 	vim_free(line);
2470     }
2471 
2472     /*
2473      * setup ":lnoremap" to map the keys
2474      */
2475     for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2476     {
2477 	vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s",
2478 				((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from,
2479 				 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to);
2480 	(void)do_map(2, buf, LANGMAP, FALSE);
2481     }
2482 
2483     p_cpo = save_cpo;
2484 
2485     curbuf->b_kmap_state |= KEYMAP_LOADED;
2486     status_redraw_curbuf();
2487 }
2488 
2489 /*
2490  * Stop using 'keymap'.
2491  */
2492     static void
2493 keymap_unload(void)
2494 {
2495     char_u	buf[KMAP_MAXLEN + 10];
2496     int		i;
2497     char_u	*save_cpo = p_cpo;
2498     kmap_T	*kp;
2499 
2500     if (!(curbuf->b_kmap_state & KEYMAP_LOADED))
2501 	return;
2502 
2503     /* Set 'cpoptions' to "C" to avoid line continuation. */
2504     p_cpo = (char_u *)"C";
2505 
2506     /* clear the ":lmap"s */
2507     kp = (kmap_T *)curbuf->b_kmap_ga.ga_data;
2508     for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2509     {
2510 	vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
2511 	(void)do_map(1, buf, LANGMAP, FALSE);
2512     }
2513     keymap_clear(&curbuf->b_kmap_ga);
2514 
2515     p_cpo = save_cpo;
2516 
2517     ga_clear(&curbuf->b_kmap_ga);
2518     curbuf->b_kmap_state &= ~KEYMAP_LOADED;
2519     status_redraw_curbuf();
2520 }
2521 
2522     void
2523 keymap_clear(garray_T *kmap)
2524 {
2525     int	    i;
2526     kmap_T  *kp = (kmap_T *)kmap->ga_data;
2527 
2528     for (i = 0; i < kmap->ga_len; ++i)
2529     {
2530 	vim_free(kp[i].from);
2531 	vim_free(kp[i].to);
2532     }
2533 }
2534 #endif /* FEAT_KEYMAP */
2535