xref: /vim-8.2.3635/src/digraph.c (revision eeed665b)
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 *dp, result_T *previous);
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 #define DG_START_LATIN 0xa1
647 	{'!', 'I', 0xa1},
648 	{'~', '!', 0xa1},	// � Vim 5.x compatible
649 	{'C', 't', 0xa2},
650 	{'c', '|', 0xa2},	// � Vim 5.x compatible
651 	{'P', 'd', 0xa3},
652 	{'$', '$', 0xa3},	// � Vim 5.x compatible
653 	{'C', 'u', 0xa4},
654 	{'o', 'x', 0xa4},	// � Vim 5.x compatible
655 	{'Y', 'e', 0xa5},
656 	{'Y', '-', 0xa5},	// � Vim 5.x compatible
657 	{'B', 'B', 0xa6},
658 	{'|', '|', 0xa6},	// � Vim 5.x compatible
659 	{'S', 'E', 0xa7},
660 	{'\'', ':', 0xa8},
661 	{'C', 'o', 0xa9},
662 	{'c', 'O', 0xa9},	// � Vim 5.x compatible
663 	{'-', 'a', 0xaa},
664 	{'<', '<', 0xab},
665 	{'N', 'O', 0xac},
666 	{'-', ',', 0xac},	// � Vim 5.x compatible
667 	{'-', '-', 0xad},
668 	{'R', 'g', 0xae},
669 	{'\'', 'm', 0xaf},
670 	{'-', '=', 0xaf},	// � Vim 5.x compatible
671 	{'D', 'G', 0xb0},
672 	{'~', 'o', 0xb0},	// � Vim 5.x compatible
673 	{'+', '-', 0xb1},
674 	{'2', 'S', 0xb2},
675 	{'2', '2', 0xb2},	// � Vim 5.x compatible
676 	{'3', 'S', 0xb3},
677 	{'3', '3', 0xb3},	// � Vim 5.x compatible
678 	{'\'', '\'', 0xb4},
679 	{'M', 'y', 0xb5},
680 	{'P', 'I', 0xb6},
681 	{'p', 'p', 0xb6},	// � Vim 5.x compatible
682 	{'.', 'M', 0xb7},
683 	{'~', '.', 0xb7},	// � Vim 5.x compatible
684 	{'\'', ',', 0xb8},
685 	{'1', 'S', 0xb9},
686 	{'1', '1', 0xb9},	// � Vim 5.x compatible
687 	{'-', 'o', 0xba},
688 	{'>', '>', 0xbb},
689 	{'1', '4', 0xbc},
690 	{'1', '2', 0xbd},
691 	{'3', '4', 0xbe},
692 	{'?', 'I', 0xbf},
693 	{'~', '?', 0xbf},	// � Vim 5.x compatible
694 	{'A', '!', 0xc0},
695 	{'A', '`', 0xc0},	// � Vim 5.x compatible
696 	{'A', '\'', 0xc1},
697 	{'A', '>', 0xc2},
698 	{'A', '^', 0xc2},	// � Vim 5.x compatible
699 	{'A', '?', 0xc3},
700 	{'A', '~', 0xc3},	// � Vim 5.x compatible
701 	{'A', ':', 0xc4},
702 	{'A', '"', 0xc4},	// � Vim 5.x compatible
703 	{'A', 'A', 0xc5},
704 	{'A', '@', 0xc5},	// � Vim 5.x compatible
705 	{'A', 'E', 0xc6},
706 	{'C', ',', 0xc7},
707 	{'E', '!', 0xc8},
708 	{'E', '`', 0xc8},	// � Vim 5.x compatible
709 	{'E', '\'', 0xc9},
710 	{'E', '>', 0xca},
711 	{'E', '^', 0xca},	// � Vim 5.x compatible
712 	{'E', ':', 0xcb},
713 	{'E', '"', 0xcb},	// � Vim 5.x compatible
714 	{'I', '!', 0xcc},
715 	{'I', '`', 0xcc},	// � Vim 5.x compatible
716 	{'I', '\'', 0xcd},
717 	{'I', '>', 0xce},
718 	{'I', '^', 0xce},	// � Vim 5.x compatible
719 	{'I', ':', 0xcf},
720 	{'I', '"', 0xcf},	// � Vim 5.x compatible
721 	{'D', '-', 0xd0},
722 	{'N', '?', 0xd1},
723 	{'N', '~', 0xd1},	// � Vim 5.x compatible
724 	{'O', '!', 0xd2},
725 	{'O', '`', 0xd2},	// � Vim 5.x compatible
726 	{'O', '\'', 0xd3},
727 	{'O', '>', 0xd4},
728 	{'O', '^', 0xd4},	// � Vim 5.x compatible
729 	{'O', '?', 0xd5},
730 	{'O', '~', 0xd5},	// � Vim 5.x compatible
731 	{'O', ':', 0xd6},
732 	{'*', 'X', 0xd7},
733 	{'/', '\\', 0xd7},	// � Vim 5.x compatible
734 	{'O', '/', 0xd8},
735 	{'U', '!', 0xd9},
736 	{'U', '`', 0xd9},	// � Vim 5.x compatible
737 	{'U', '\'', 0xda},
738 	{'U', '>', 0xdb},
739 	{'U', '^', 0xdb},	// � Vim 5.x compatible
740 	{'U', ':', 0xdc},
741 	{'Y', '\'', 0xdd},
742 	{'T', 'H', 0xde},
743 	{'I', 'p', 0xde},	// � Vim 5.x compatible
744 	{'s', 's', 0xdf},
745 	{'a', '!', 0xe0},
746 	{'a', '`', 0xe0},	// � Vim 5.x compatible
747 	{'a', '\'', 0xe1},
748 	{'a', '>', 0xe2},
749 	{'a', '^', 0xe2},	// � Vim 5.x compatible
750 	{'a', '?', 0xe3},
751 	{'a', '~', 0xe3},	// � Vim 5.x compatible
752 	{'a', ':', 0xe4},
753 	{'a', '"', 0xe4},	// � Vim 5.x compatible
754 	{'a', 'a', 0xe5},
755 	{'a', '@', 0xe5},	// � Vim 5.x compatible
756 	{'a', 'e', 0xe6},
757 	{'c', ',', 0xe7},
758 	{'e', '!', 0xe8},
759 	{'e', '`', 0xe8},	// � Vim 5.x compatible
760 	{'e', '\'', 0xe9},
761 	{'e', '>', 0xea},
762 	{'e', '^', 0xea},	// � Vim 5.x compatible
763 	{'e', ':', 0xeb},
764 	{'e', '"', 0xeb},	// � Vim 5.x compatible
765 	{'i', '!', 0xec},
766 	{'i', '`', 0xec},	// � Vim 5.x compatible
767 	{'i', '\'', 0xed},
768 	{'i', '>', 0xee},
769 	{'i', '^', 0xee},	// � Vim 5.x compatible
770 	{'i', ':', 0xef},
771 	{'d', '-', 0xf0},
772 	{'n', '?', 0xf1},
773 	{'n', '~', 0xf1},	// � Vim 5.x compatible
774 	{'o', '!', 0xf2},
775 	{'o', '`', 0xf2},	// � Vim 5.x compatible
776 	{'o', '\'', 0xf3},
777 	{'o', '>', 0xf4},
778 	{'o', '^', 0xf4},	// � Vim 5.x compatible
779 	{'o', '?', 0xf5},
780 	{'o', '~', 0xf5},	// � Vim 5.x compatible
781 	{'o', ':', 0xf6},
782 	{'-', ':', 0xf7},
783 	{'o', '/', 0xf8},
784 	{'u', '!', 0xf9},
785 	{'u', '`', 0xf9},	// � Vim 5.x compatible
786 	{'u', '\'', 0xfa},
787 	{'u', '>', 0xfb},
788 	{'u', '^', 0xfb},	// � Vim 5.x compatible
789 	{'u', ':', 0xfc},
790 	{'y', '\'', 0xfd},
791 	{'t', 'h', 0xfe},
792 	{'y', ':', 0xff},
793 	{'y', '"', 0xff},	// x XX  Vim 5.x compatible
794 
795 #      ifdef FEAT_MBYTE
796 #	define USE_UNICODE_DIGRAPHS
797 
798 	{'A', '-', 0x0100},
799 	{'a', '-', 0x0101},
800 	{'A', '(', 0x0102},
801 	{'a', '(', 0x0103},
802 	{'A', ';', 0x0104},
803 	{'a', ';', 0x0105},
804 	{'C', '\'', 0x0106},
805 	{'c', '\'', 0x0107},
806 	{'C', '>', 0x0108},
807 	{'c', '>', 0x0109},
808 	{'C', '.', 0x010a},
809 	{'c', '.', 0x010b},
810 	{'C', '<', 0x010c},
811 	{'c', '<', 0x010d},
812 	{'D', '<', 0x010e},
813 	{'d', '<', 0x010f},
814 	{'D', '/', 0x0110},
815 	{'d', '/', 0x0111},
816 	{'E', '-', 0x0112},
817 	{'e', '-', 0x0113},
818 	{'E', '(', 0x0114},
819 	{'e', '(', 0x0115},
820 	{'E', '.', 0x0116},
821 	{'e', '.', 0x0117},
822 	{'E', ';', 0x0118},
823 	{'e', ';', 0x0119},
824 	{'E', '<', 0x011a},
825 	{'e', '<', 0x011b},
826 	{'G', '>', 0x011c},
827 	{'g', '>', 0x011d},
828 	{'G', '(', 0x011e},
829 	{'g', '(', 0x011f},
830 	{'G', '.', 0x0120},
831 	{'g', '.', 0x0121},
832 	{'G', ',', 0x0122},
833 	{'g', ',', 0x0123},
834 	{'H', '>', 0x0124},
835 	{'h', '>', 0x0125},
836 	{'H', '/', 0x0126},
837 	{'h', '/', 0x0127},
838 	{'I', '?', 0x0128},
839 	{'i', '?', 0x0129},
840 	{'I', '-', 0x012a},
841 	{'i', '-', 0x012b},
842 	{'I', '(', 0x012c},
843 	{'i', '(', 0x012d},
844 	{'I', ';', 0x012e},
845 	{'i', ';', 0x012f},
846 	{'I', '.', 0x0130},
847 	{'i', '.', 0x0131},
848 	{'I', 'J', 0x0132},
849 	{'i', 'j', 0x0133},
850 	{'J', '>', 0x0134},
851 	{'j', '>', 0x0135},
852 	{'K', ',', 0x0136},
853 	{'k', ',', 0x0137},
854 	{'k', 'k', 0x0138},
855 	{'L', '\'', 0x0139},
856 	{'l', '\'', 0x013a},
857 	{'L', ',', 0x013b},
858 	{'l', ',', 0x013c},
859 	{'L', '<', 0x013d},
860 	{'l', '<', 0x013e},
861 	{'L', '.', 0x013f},
862 	{'l', '.', 0x0140},
863 	{'L', '/', 0x0141},
864 	{'l', '/', 0x0142},
865 	{'N', '\'', 0x0143},
866 	{'n', '\'', 0x0144},
867 	{'N', ',', 0x0145},
868 	{'n', ',', 0x0146},
869 	{'N', '<', 0x0147},
870 	{'n', '<', 0x0148},
871 	{'\'', 'n', 0x0149},
872 	{'N', 'G', 0x014a},
873 	{'n', 'g', 0x014b},
874 	{'O', '-', 0x014c},
875 	{'o', '-', 0x014d},
876 	{'O', '(', 0x014e},
877 	{'o', '(', 0x014f},
878 	{'O', '"', 0x0150},
879 	{'o', '"', 0x0151},
880 	{'O', 'E', 0x0152},
881 	{'o', 'e', 0x0153},
882 	{'R', '\'', 0x0154},
883 	{'r', '\'', 0x0155},
884 	{'R', ',', 0x0156},
885 	{'r', ',', 0x0157},
886 	{'R', '<', 0x0158},
887 	{'r', '<', 0x0159},
888 	{'S', '\'', 0x015a},
889 	{'s', '\'', 0x015b},
890 	{'S', '>', 0x015c},
891 	{'s', '>', 0x015d},
892 	{'S', ',', 0x015e},
893 	{'s', ',', 0x015f},
894 	{'S', '<', 0x0160},
895 	{'s', '<', 0x0161},
896 	{'T', ',', 0x0162},
897 	{'t', ',', 0x0163},
898 	{'T', '<', 0x0164},
899 	{'t', '<', 0x0165},
900 	{'T', '/', 0x0166},
901 	{'t', '/', 0x0167},
902 	{'U', '?', 0x0168},
903 	{'u', '?', 0x0169},
904 	{'U', '-', 0x016a},
905 	{'u', '-', 0x016b},
906 	{'U', '(', 0x016c},
907 	{'u', '(', 0x016d},
908 	{'U', '0', 0x016e},
909 	{'u', '0', 0x016f},
910 	{'U', '"', 0x0170},
911 	{'u', '"', 0x0171},
912 	{'U', ';', 0x0172},
913 	{'u', ';', 0x0173},
914 	{'W', '>', 0x0174},
915 	{'w', '>', 0x0175},
916 	{'Y', '>', 0x0176},
917 	{'y', '>', 0x0177},
918 	{'Y', ':', 0x0178},
919 	{'Z', '\'', 0x0179},
920 	{'z', '\'', 0x017a},
921 	{'Z', '.', 0x017b},
922 	{'z', '.', 0x017c},
923 	{'Z', '<', 0x017d},
924 	{'z', '<', 0x017e},
925 	{'O', '9', 0x01a0},
926 	{'o', '9', 0x01a1},
927 	{'O', 'I', 0x01a2},
928 	{'o', 'i', 0x01a3},
929 	{'y', 'r', 0x01a6},
930 	{'U', '9', 0x01af},
931 	{'u', '9', 0x01b0},
932 	{'Z', '/', 0x01b5},
933 	{'z', '/', 0x01b6},
934 	{'E', 'D', 0x01b7},
935 	{'A', '<', 0x01cd},
936 	{'a', '<', 0x01ce},
937 	{'I', '<', 0x01cf},
938 	{'i', '<', 0x01d0},
939 	{'O', '<', 0x01d1},
940 	{'o', '<', 0x01d2},
941 	{'U', '<', 0x01d3},
942 	{'u', '<', 0x01d4},
943 	{'A', '1', 0x01de},
944 	{'a', '1', 0x01df},
945 	{'A', '7', 0x01e0},
946 	{'a', '7', 0x01e1},
947 	{'A', '3', 0x01e2},
948 	{'a', '3', 0x01e3},
949 	{'G', '/', 0x01e4},
950 	{'g', '/', 0x01e5},
951 	{'G', '<', 0x01e6},
952 	{'g', '<', 0x01e7},
953 	{'K', '<', 0x01e8},
954 	{'k', '<', 0x01e9},
955 	{'O', ';', 0x01ea},
956 	{'o', ';', 0x01eb},
957 	{'O', '1', 0x01ec},
958 	{'o', '1', 0x01ed},
959 	{'E', 'Z', 0x01ee},
960 	{'e', 'z', 0x01ef},
961 	{'j', '<', 0x01f0},
962 	{'G', '\'', 0x01f4},
963 	{'g', '\'', 0x01f5},
964 	{';', 'S', 0x02bf},
965 	{'\'', '<', 0x02c7},
966 	{'\'', '(', 0x02d8},
967 	{'\'', '.', 0x02d9},
968 	{'\'', '0', 0x02da},
969 	{'\'', ';', 0x02db},
970 	{'\'', '"', 0x02dd},
971 #define DG_START_GREEK 0x0386
972 	{'A', '%', 0x0386},
973 	{'E', '%', 0x0388},
974 	{'Y', '%', 0x0389},
975 	{'I', '%', 0x038a},
976 	{'O', '%', 0x038c},
977 	{'U', '%', 0x038e},
978 	{'W', '%', 0x038f},
979 	{'i', '3', 0x0390},
980 	{'A', '*', 0x0391},
981 	{'B', '*', 0x0392},
982 	{'G', '*', 0x0393},
983 	{'D', '*', 0x0394},
984 	{'E', '*', 0x0395},
985 	{'Z', '*', 0x0396},
986 	{'Y', '*', 0x0397},
987 	{'H', '*', 0x0398},
988 	{'I', '*', 0x0399},
989 	{'K', '*', 0x039a},
990 	{'L', '*', 0x039b},
991 	{'M', '*', 0x039c},
992 	{'N', '*', 0x039d},
993 	{'C', '*', 0x039e},
994 	{'O', '*', 0x039f},
995 	{'P', '*', 0x03a0},
996 	{'R', '*', 0x03a1},
997 	{'S', '*', 0x03a3},
998 	{'T', '*', 0x03a4},
999 	{'U', '*', 0x03a5},
1000 	{'F', '*', 0x03a6},
1001 	{'X', '*', 0x03a7},
1002 	{'Q', '*', 0x03a8},
1003 	{'W', '*', 0x03a9},
1004 	{'J', '*', 0x03aa},
1005 	{'V', '*', 0x03ab},
1006 	{'a', '%', 0x03ac},
1007 	{'e', '%', 0x03ad},
1008 	{'y', '%', 0x03ae},
1009 	{'i', '%', 0x03af},
1010 	{'u', '3', 0x03b0},
1011 	{'a', '*', 0x03b1},
1012 	{'b', '*', 0x03b2},
1013 	{'g', '*', 0x03b3},
1014 	{'d', '*', 0x03b4},
1015 	{'e', '*', 0x03b5},
1016 	{'z', '*', 0x03b6},
1017 	{'y', '*', 0x03b7},
1018 	{'h', '*', 0x03b8},
1019 	{'i', '*', 0x03b9},
1020 	{'k', '*', 0x03ba},
1021 	{'l', '*', 0x03bb},
1022 	{'m', '*', 0x03bc},
1023 	{'n', '*', 0x03bd},
1024 	{'c', '*', 0x03be},
1025 	{'o', '*', 0x03bf},
1026 	{'p', '*', 0x03c0},
1027 	{'r', '*', 0x03c1},
1028 	{'*', 's', 0x03c2},
1029 	{'s', '*', 0x03c3},
1030 	{'t', '*', 0x03c4},
1031 	{'u', '*', 0x03c5},
1032 	{'f', '*', 0x03c6},
1033 	{'x', '*', 0x03c7},
1034 	{'q', '*', 0x03c8},
1035 	{'w', '*', 0x03c9},
1036 	{'j', '*', 0x03ca},
1037 	{'v', '*', 0x03cb},
1038 	{'o', '%', 0x03cc},
1039 	{'u', '%', 0x03cd},
1040 	{'w', '%', 0x03ce},
1041 	{'\'', 'G', 0x03d8},
1042 	{',', 'G', 0x03d9},
1043 	{'T', '3', 0x03da},
1044 	{'t', '3', 0x03db},
1045 	{'M', '3', 0x03dc},
1046 	{'m', '3', 0x03dd},
1047 	{'K', '3', 0x03de},
1048 	{'k', '3', 0x03df},
1049 	{'P', '3', 0x03e0},
1050 	{'p', '3', 0x03e1},
1051 	{'\'', '%', 0x03f4},
1052 	{'j', '3', 0x03f5},
1053 #define DG_START_CYRILLIC 0x0401
1054 	{'I', 'O', 0x0401},
1055 	{'D', '%', 0x0402},
1056 	{'G', '%', 0x0403},
1057 	{'I', 'E', 0x0404},
1058 	{'D', 'S', 0x0405},
1059 	{'I', 'I', 0x0406},
1060 	{'Y', 'I', 0x0407},
1061 	{'J', '%', 0x0408},
1062 	{'L', 'J', 0x0409},
1063 	{'N', 'J', 0x040a},
1064 	{'T', 's', 0x040b},
1065 	{'K', 'J', 0x040c},
1066 	{'V', '%', 0x040e},
1067 	{'D', 'Z', 0x040f},
1068 	{'A', '=', 0x0410},
1069 	{'B', '=', 0x0411},
1070 	{'V', '=', 0x0412},
1071 	{'G', '=', 0x0413},
1072 	{'D', '=', 0x0414},
1073 	{'E', '=', 0x0415},
1074 	{'Z', '%', 0x0416},
1075 	{'Z', '=', 0x0417},
1076 	{'I', '=', 0x0418},
1077 	{'J', '=', 0x0419},
1078 	{'K', '=', 0x041a},
1079 	{'L', '=', 0x041b},
1080 	{'M', '=', 0x041c},
1081 	{'N', '=', 0x041d},
1082 	{'O', '=', 0x041e},
1083 	{'P', '=', 0x041f},
1084 	{'R', '=', 0x0420},
1085 	{'S', '=', 0x0421},
1086 	{'T', '=', 0x0422},
1087 	{'U', '=', 0x0423},
1088 	{'F', '=', 0x0424},
1089 	{'H', '=', 0x0425},
1090 	{'C', '=', 0x0426},
1091 	{'C', '%', 0x0427},
1092 	{'S', '%', 0x0428},
1093 	{'S', 'c', 0x0429},
1094 	{'=', '"', 0x042a},
1095 	{'Y', '=', 0x042b},
1096 	{'%', '"', 0x042c},
1097 	{'J', 'E', 0x042d},
1098 	{'J', 'U', 0x042e},
1099 	{'J', 'A', 0x042f},
1100 	{'a', '=', 0x0430},
1101 	{'b', '=', 0x0431},
1102 	{'v', '=', 0x0432},
1103 	{'g', '=', 0x0433},
1104 	{'d', '=', 0x0434},
1105 	{'e', '=', 0x0435},
1106 	{'z', '%', 0x0436},
1107 	{'z', '=', 0x0437},
1108 	{'i', '=', 0x0438},
1109 	{'j', '=', 0x0439},
1110 	{'k', '=', 0x043a},
1111 	{'l', '=', 0x043b},
1112 	{'m', '=', 0x043c},
1113 	{'n', '=', 0x043d},
1114 	{'o', '=', 0x043e},
1115 	{'p', '=', 0x043f},
1116 	{'r', '=', 0x0440},
1117 	{'s', '=', 0x0441},
1118 	{'t', '=', 0x0442},
1119 	{'u', '=', 0x0443},
1120 	{'f', '=', 0x0444},
1121 	{'h', '=', 0x0445},
1122 	{'c', '=', 0x0446},
1123 	{'c', '%', 0x0447},
1124 	{'s', '%', 0x0448},
1125 	{'s', 'c', 0x0449},
1126 	{'=', '\'', 0x044a},
1127 	{'y', '=', 0x044b},
1128 	{'%', '\'', 0x044c},
1129 	{'j', 'e', 0x044d},
1130 	{'j', 'u', 0x044e},
1131 	{'j', 'a', 0x044f},
1132 	{'i', 'o', 0x0451},
1133 	{'d', '%', 0x0452},
1134 	{'g', '%', 0x0453},
1135 	{'i', 'e', 0x0454},
1136 	{'d', 's', 0x0455},
1137 	{'i', 'i', 0x0456},
1138 	{'y', 'i', 0x0457},
1139 	{'j', '%', 0x0458},
1140 	{'l', 'j', 0x0459},
1141 	{'n', 'j', 0x045a},
1142 	{'t', 's', 0x045b},
1143 	{'k', 'j', 0x045c},
1144 	{'v', '%', 0x045e},
1145 	{'d', 'z', 0x045f},
1146 	{'Y', '3', 0x0462},
1147 	{'y', '3', 0x0463},
1148 	{'O', '3', 0x046a},
1149 	{'o', '3', 0x046b},
1150 	{'F', '3', 0x0472},
1151 	{'f', '3', 0x0473},
1152 	{'V', '3', 0x0474},
1153 	{'v', '3', 0x0475},
1154 	{'C', '3', 0x0480},
1155 	{'c', '3', 0x0481},
1156 	{'G', '3', 0x0490},
1157 	{'g', '3', 0x0491},
1158 #define DG_START_HEBREW 0x05d0
1159 	{'A', '+', 0x05d0},
1160 	{'B', '+', 0x05d1},
1161 	{'G', '+', 0x05d2},
1162 	{'D', '+', 0x05d3},
1163 	{'H', '+', 0x05d4},
1164 	{'W', '+', 0x05d5},
1165 	{'Z', '+', 0x05d6},
1166 	{'X', '+', 0x05d7},
1167 	{'T', 'j', 0x05d8},
1168 	{'J', '+', 0x05d9},
1169 	{'K', '%', 0x05da},
1170 	{'K', '+', 0x05db},
1171 	{'L', '+', 0x05dc},
1172 	{'M', '%', 0x05dd},
1173 	{'M', '+', 0x05de},
1174 	{'N', '%', 0x05df},
1175 	{'N', '+', 0x05e0},
1176 	{'S', '+', 0x05e1},
1177 	{'E', '+', 0x05e2},
1178 	{'P', '%', 0x05e3},
1179 	{'P', '+', 0x05e4},
1180 	{'Z', 'j', 0x05e5},
1181 	{'Z', 'J', 0x05e6},
1182 	{'Q', '+', 0x05e7},
1183 	{'R', '+', 0x05e8},
1184 	{'S', 'h', 0x05e9},
1185 	{'T', '+', 0x05ea},
1186 #define DG_START_ARABIC 0x060c
1187 	{',', '+', 0x060c},
1188 	{';', '+', 0x061b},
1189 	{'?', '+', 0x061f},
1190 	{'H', '\'', 0x0621},
1191 	{'a', 'M', 0x0622},
1192 	{'a', 'H', 0x0623},
1193 	{'w', 'H', 0x0624},
1194 	{'a', 'h', 0x0625},
1195 	{'y', 'H', 0x0626},
1196 	{'a', '+', 0x0627},
1197 	{'b', '+', 0x0628},
1198 	{'t', 'm', 0x0629},
1199 	{'t', '+', 0x062a},
1200 	{'t', 'k', 0x062b},
1201 	{'g', '+', 0x062c},
1202 	{'h', 'k', 0x062d},
1203 	{'x', '+', 0x062e},
1204 	{'d', '+', 0x062f},
1205 	{'d', 'k', 0x0630},
1206 	{'r', '+', 0x0631},
1207 	{'z', '+', 0x0632},
1208 	{'s', '+', 0x0633},
1209 	{'s', 'n', 0x0634},
1210 	{'c', '+', 0x0635},
1211 	{'d', 'd', 0x0636},
1212 	{'t', 'j', 0x0637},
1213 	{'z', 'H', 0x0638},
1214 	{'e', '+', 0x0639},
1215 	{'i', '+', 0x063a},
1216 	{'+', '+', 0x0640},
1217 	{'f', '+', 0x0641},
1218 	{'q', '+', 0x0642},
1219 	{'k', '+', 0x0643},
1220 	{'l', '+', 0x0644},
1221 	{'m', '+', 0x0645},
1222 	{'n', '+', 0x0646},
1223 	{'h', '+', 0x0647},
1224 	{'w', '+', 0x0648},
1225 	{'j', '+', 0x0649},
1226 	{'y', '+', 0x064a},
1227 	{':', '+', 0x064b},
1228 	{'"', '+', 0x064c},
1229 	{'=', '+', 0x064d},
1230 	{'/', '+', 0x064e},
1231 	{'\'', '+', 0x064f},
1232 	{'1', '+', 0x0650},
1233 	{'3', '+', 0x0651},
1234 	{'0', '+', 0x0652},
1235 	{'a', 'S', 0x0670},
1236 	{'p', '+', 0x067e},
1237 	{'v', '+', 0x06a4},
1238 	{'g', 'f', 0x06af},
1239 	{'0', 'a', 0x06f0},
1240 	{'1', 'a', 0x06f1},
1241 	{'2', 'a', 0x06f2},
1242 	{'3', 'a', 0x06f3},
1243 	{'4', 'a', 0x06f4},
1244 	{'5', 'a', 0x06f5},
1245 	{'6', 'a', 0x06f6},
1246 	{'7', 'a', 0x06f7},
1247 	{'8', 'a', 0x06f8},
1248 	{'9', 'a', 0x06f9},
1249 #define DG_START_LATIN_EXTENDED 0x1e02
1250 	{'B', '.', 0x1e02},
1251 	{'b', '.', 0x1e03},
1252 	{'B', '_', 0x1e06},
1253 	{'b', '_', 0x1e07},
1254 	{'D', '.', 0x1e0a},
1255 	{'d', '.', 0x1e0b},
1256 	{'D', '_', 0x1e0e},
1257 	{'d', '_', 0x1e0f},
1258 	{'D', ',', 0x1e10},
1259 	{'d', ',', 0x1e11},
1260 	{'F', '.', 0x1e1e},
1261 	{'f', '.', 0x1e1f},
1262 	{'G', '-', 0x1e20},
1263 	{'g', '-', 0x1e21},
1264 	{'H', '.', 0x1e22},
1265 	{'h', '.', 0x1e23},
1266 	{'H', ':', 0x1e26},
1267 	{'h', ':', 0x1e27},
1268 	{'H', ',', 0x1e28},
1269 	{'h', ',', 0x1e29},
1270 	{'K', '\'', 0x1e30},
1271 	{'k', '\'', 0x1e31},
1272 	{'K', '_', 0x1e34},
1273 	{'k', '_', 0x1e35},
1274 	{'L', '_', 0x1e3a},
1275 	{'l', '_', 0x1e3b},
1276 	{'M', '\'', 0x1e3e},
1277 	{'m', '\'', 0x1e3f},
1278 	{'M', '.', 0x1e40},
1279 	{'m', '.', 0x1e41},
1280 	{'N', '.', 0x1e44},
1281 	{'n', '.', 0x1e45},
1282 	{'N', '_', 0x1e48},
1283 	{'n', '_', 0x1e49},
1284 	{'P', '\'', 0x1e54},
1285 	{'p', '\'', 0x1e55},
1286 	{'P', '.', 0x1e56},
1287 	{'p', '.', 0x1e57},
1288 	{'R', '.', 0x1e58},
1289 	{'r', '.', 0x1e59},
1290 	{'R', '_', 0x1e5e},
1291 	{'r', '_', 0x1e5f},
1292 	{'S', '.', 0x1e60},
1293 	{'s', '.', 0x1e61},
1294 	{'T', '.', 0x1e6a},
1295 	{'t', '.', 0x1e6b},
1296 	{'T', '_', 0x1e6e},
1297 	{'t', '_', 0x1e6f},
1298 	{'V', '?', 0x1e7c},
1299 	{'v', '?', 0x1e7d},
1300 	{'W', '!', 0x1e80},
1301 	{'W', '`', 0x1e80}, // extra alternative, easier to remember
1302 	{'w', '!', 0x1e81},
1303 	{'w', '`', 0x1e81}, // extra alternative, easier to remember
1304 	{'W', '\'', 0x1e82},
1305 	{'w', '\'', 0x1e83},
1306 	{'W', ':', 0x1e84},
1307 	{'w', ':', 0x1e85},
1308 	{'W', '.', 0x1e86},
1309 	{'w', '.', 0x1e87},
1310 	{'X', '.', 0x1e8a},
1311 	{'x', '.', 0x1e8b},
1312 	{'X', ':', 0x1e8c},
1313 	{'x', ':', 0x1e8d},
1314 	{'Y', '.', 0x1e8e},
1315 	{'y', '.', 0x1e8f},
1316 	{'Z', '>', 0x1e90},
1317 	{'z', '>', 0x1e91},
1318 	{'Z', '_', 0x1e94},
1319 	{'z', '_', 0x1e95},
1320 	{'h', '_', 0x1e96},
1321 	{'t', ':', 0x1e97},
1322 	{'w', '0', 0x1e98},
1323 	{'y', '0', 0x1e99},
1324 	{'A', '2', 0x1ea2},
1325 	{'a', '2', 0x1ea3},
1326 	{'E', '2', 0x1eba},
1327 	{'e', '2', 0x1ebb},
1328 	{'E', '?', 0x1ebc},
1329 	{'e', '?', 0x1ebd},
1330 	{'I', '2', 0x1ec8},
1331 	{'i', '2', 0x1ec9},
1332 	{'O', '2', 0x1ece},
1333 	{'o', '2', 0x1ecf},
1334 	{'U', '2', 0x1ee6},
1335 	{'u', '2', 0x1ee7},
1336 	{'Y', '!', 0x1ef2},
1337 	{'Y', '`', 0x1ef2}, // extra alternative, easier to remember
1338 	{'y', '!', 0x1ef3},
1339 	{'y', '`', 0x1ef3}, // extra alternative, easier to remember
1340 	{'Y', '2', 0x1ef6},
1341 	{'y', '2', 0x1ef7},
1342 	{'Y', '?', 0x1ef8},
1343 	{'y', '?', 0x1ef9},
1344 #define DG_START_GREEK_EXTENDED 0x1f00
1345 	{';', '\'', 0x1f00},
1346 	{',', '\'', 0x1f01},
1347 	{';', '!', 0x1f02},
1348 	{',', '!', 0x1f03},
1349 	{'?', ';', 0x1f04},
1350 	{'?', ',', 0x1f05},
1351 	{'!', ':', 0x1f06},
1352 	{'?', ':', 0x1f07},
1353 #define DG_START_PUNCTUATION 0x2002
1354 	{'1', 'N', 0x2002},
1355 	{'1', 'M', 0x2003},
1356 	{'3', 'M', 0x2004},
1357 	{'4', 'M', 0x2005},
1358 	{'6', 'M', 0x2006},
1359 	{'1', 'T', 0x2009},
1360 	{'1', 'H', 0x200a},
1361 	{'-', '1', 0x2010},
1362 	{'-', 'N', 0x2013},
1363 	{'-', 'M', 0x2014},
1364 	{'-', '3', 0x2015},
1365 	{'!', '2', 0x2016},
1366 	{'=', '2', 0x2017},
1367 	{'\'', '6', 0x2018},
1368 	{'\'', '9', 0x2019},
1369 	{'.', '9', 0x201a},
1370 	{'9', '\'', 0x201b},
1371 	{'"', '6', 0x201c},
1372 	{'"', '9', 0x201d},
1373 	{':', '9', 0x201e},
1374 	{'9', '"', 0x201f},
1375 	{'/', '-', 0x2020},
1376 	{'/', '=', 0x2021},
1377 	{'.', '.', 0x2025},
1378 	{',', '.', 0x2026},
1379 	{'%', '0', 0x2030},
1380 	{'1', '\'', 0x2032},
1381 	{'2', '\'', 0x2033},
1382 	{'3', '\'', 0x2034},
1383 	{'1', '"', 0x2035},
1384 	{'2', '"', 0x2036},
1385 	{'3', '"', 0x2037},
1386 	{'C', 'a', 0x2038},
1387 	{'<', '1', 0x2039},
1388 	{'>', '1', 0x203a},
1389 	{':', 'X', 0x203b},
1390 	{'\'', '-', 0x203e},
1391 	{'/', 'f', 0x2044},
1392 #define DG_START_SUB_SUPER 0x2070
1393 	{'0', 'S', 0x2070},
1394 	{'4', 'S', 0x2074},
1395 	{'5', 'S', 0x2075},
1396 	{'6', 'S', 0x2076},
1397 	{'7', 'S', 0x2077},
1398 	{'8', 'S', 0x2078},
1399 	{'9', 'S', 0x2079},
1400 	{'+', 'S', 0x207a},
1401 	{'-', 'S', 0x207b},
1402 	{'=', 'S', 0x207c},
1403 	{'(', 'S', 0x207d},
1404 	{')', 'S', 0x207e},
1405 	{'n', 'S', 0x207f},
1406 	{'0', 's', 0x2080},
1407 	{'1', 's', 0x2081},
1408 	{'2', 's', 0x2082},
1409 	{'3', 's', 0x2083},
1410 	{'4', 's', 0x2084},
1411 	{'5', 's', 0x2085},
1412 	{'6', 's', 0x2086},
1413 	{'7', 's', 0x2087},
1414 	{'8', 's', 0x2088},
1415 	{'9', 's', 0x2089},
1416 	{'+', 's', 0x208a},
1417 	{'-', 's', 0x208b},
1418 	{'=', 's', 0x208c},
1419 	{'(', 's', 0x208d},
1420 	{')', 's', 0x208e},
1421 #define DG_START_CURRENCY 0x20a4
1422 	{'L', 'i', 0x20a4},
1423 	{'P', 't', 0x20a7},
1424 	{'W', '=', 0x20a9},
1425 	{'=', 'e', 0x20ac}, /* euro */
1426 	{'E', 'u', 0x20ac}, /* euro */
1427 	{'=', 'R', 0x20bd}, /* rouble */
1428 	{'=', 'P', 0x20bd}, /* rouble */
1429 #define DG_START_OTHER1 0x2103
1430 	{'o', 'C', 0x2103},
1431 	{'c', 'o', 0x2105},
1432 	{'o', 'F', 0x2109},
1433 	{'N', '0', 0x2116},
1434 	{'P', 'O', 0x2117},
1435 	{'R', 'x', 0x211e},
1436 	{'S', 'M', 0x2120},
1437 	{'T', 'M', 0x2122},
1438 	{'O', 'm', 0x2126},
1439 	{'A', 'O', 0x212b},
1440 	{'1', '3', 0x2153},
1441 	{'2', '3', 0x2154},
1442 	{'1', '5', 0x2155},
1443 	{'2', '5', 0x2156},
1444 	{'3', '5', 0x2157},
1445 	{'4', '5', 0x2158},
1446 	{'1', '6', 0x2159},
1447 	{'5', '6', 0x215a},
1448 	{'1', '8', 0x215b},
1449 	{'3', '8', 0x215c},
1450 	{'5', '8', 0x215d},
1451 	{'7', '8', 0x215e},
1452 #define DG_START_ROMAN 0x2160
1453 	{'1', 'R', 0x2160},
1454 	{'2', 'R', 0x2161},
1455 	{'3', 'R', 0x2162},
1456 	{'4', 'R', 0x2163},
1457 	{'5', 'R', 0x2164},
1458 	{'6', 'R', 0x2165},
1459 	{'7', 'R', 0x2166},
1460 	{'8', 'R', 0x2167},
1461 	{'9', 'R', 0x2168},
1462 	{'a', 'R', 0x2169},
1463 	{'b', 'R', 0x216a},
1464 	{'c', 'R', 0x216b},
1465 	{'1', 'r', 0x2170},
1466 	{'2', 'r', 0x2171},
1467 	{'3', 'r', 0x2172},
1468 	{'4', 'r', 0x2173},
1469 	{'5', 'r', 0x2174},
1470 	{'6', 'r', 0x2175},
1471 	{'7', 'r', 0x2176},
1472 	{'8', 'r', 0x2177},
1473 	{'9', 'r', 0x2178},
1474 	{'a', 'r', 0x2179},
1475 	{'b', 'r', 0x217a},
1476 	{'c', 'r', 0x217b},
1477 #define DG_START_ARROWS 0x2190
1478 	{'<', '-', 0x2190},
1479 	{'-', '!', 0x2191},
1480 	{'-', '>', 0x2192},
1481 	{'-', 'v', 0x2193},
1482 	{'<', '>', 0x2194},
1483 	{'U', 'D', 0x2195},
1484 	{'<', '=', 0x21d0},
1485 	{'=', '>', 0x21d2},
1486 	{'=', '=', 0x21d4},
1487 #define DG_START_MATH 0x2200
1488 	{'F', 'A', 0x2200},
1489 	{'d', 'P', 0x2202},
1490 	{'T', 'E', 0x2203},
1491 	{'/', '0', 0x2205},
1492 	{'D', 'E', 0x2206},
1493 	{'N', 'B', 0x2207},
1494 	{'(', '-', 0x2208},
1495 	{'-', ')', 0x220b},
1496 	{'*', 'P', 0x220f},
1497 	{'+', 'Z', 0x2211},
1498 	{'-', '2', 0x2212},
1499 	{'-', '+', 0x2213},
1500 	{'*', '-', 0x2217},
1501 	{'O', 'b', 0x2218},
1502 	{'S', 'b', 0x2219},
1503 	{'R', 'T', 0x221a},
1504 	{'0', '(', 0x221d},
1505 	{'0', '0', 0x221e},
1506 	{'-', 'L', 0x221f},
1507 	{'-', 'V', 0x2220},
1508 	{'P', 'P', 0x2225},
1509 	{'A', 'N', 0x2227},
1510 	{'O', 'R', 0x2228},
1511 	{'(', 'U', 0x2229},
1512 	{')', 'U', 0x222a},
1513 	{'I', 'n', 0x222b},
1514 	{'D', 'I', 0x222c},
1515 	{'I', 'o', 0x222e},
1516 	{'.', ':', 0x2234},
1517 	{':', '.', 0x2235},
1518 	{':', 'R', 0x2236},
1519 	{':', ':', 0x2237},
1520 	{'?', '1', 0x223c},
1521 	{'C', 'G', 0x223e},
1522 	{'?', '-', 0x2243},
1523 	{'?', '=', 0x2245},
1524 	{'?', '2', 0x2248},
1525 	{'=', '?', 0x224c},
1526 	{'H', 'I', 0x2253},
1527 	{'!', '=', 0x2260},
1528 	{'=', '3', 0x2261},
1529 	{'=', '<', 0x2264},
1530 	{'>', '=', 0x2265},
1531 	{'<', '*', 0x226a},
1532 	{'*', '>', 0x226b},
1533 	{'!', '<', 0x226e},
1534 	{'!', '>', 0x226f},
1535 	{'(', 'C', 0x2282},
1536 	{')', 'C', 0x2283},
1537 	{'(', '_', 0x2286},
1538 	{')', '_', 0x2287},
1539 	{'0', '.', 0x2299},
1540 	{'0', '2', 0x229a},
1541 	{'-', 'T', 0x22a5},
1542 	{'.', 'P', 0x22c5},
1543 	{':', '3', 0x22ee},
1544 	{'.', '3', 0x22ef},
1545 #define DG_START_TECHNICAL 0x2302
1546 	{'E', 'h', 0x2302},
1547 	{'<', '7', 0x2308},
1548 	{'>', '7', 0x2309},
1549 	{'7', '<', 0x230a},
1550 	{'7', '>', 0x230b},
1551 	{'N', 'I', 0x2310},
1552 	{'(', 'A', 0x2312},
1553 	{'T', 'R', 0x2315},
1554 	{'I', 'u', 0x2320},
1555 	{'I', 'l', 0x2321},
1556 	{'<', '/', 0x2329},
1557 	{'/', '>', 0x232a},
1558 #define DG_START_OTHER2 0x2423
1559 	{'V', 's', 0x2423},
1560 	{'1', 'h', 0x2440},
1561 	{'3', 'h', 0x2441},
1562 	{'2', 'h', 0x2442},
1563 	{'4', 'h', 0x2443},
1564 	{'1', 'j', 0x2446},
1565 	{'2', 'j', 0x2447},
1566 	{'3', 'j', 0x2448},
1567 	{'4', 'j', 0x2449},
1568 	{'1', '.', 0x2488},
1569 	{'2', '.', 0x2489},
1570 	{'3', '.', 0x248a},
1571 	{'4', '.', 0x248b},
1572 	{'5', '.', 0x248c},
1573 	{'6', '.', 0x248d},
1574 	{'7', '.', 0x248e},
1575 	{'8', '.', 0x248f},
1576 	{'9', '.', 0x2490},
1577 #define DG_START_DRAWING 0x2500
1578 	{'h', 'h', 0x2500},
1579 	{'H', 'H', 0x2501},
1580 	{'v', 'v', 0x2502},
1581 	{'V', 'V', 0x2503},
1582 	{'3', '-', 0x2504},
1583 	{'3', '_', 0x2505},
1584 	{'3', '!', 0x2506},
1585 	{'3', '/', 0x2507},
1586 	{'4', '-', 0x2508},
1587 	{'4', '_', 0x2509},
1588 	{'4', '!', 0x250a},
1589 	{'4', '/', 0x250b},
1590 	{'d', 'r', 0x250c},
1591 	{'d', 'R', 0x250d},
1592 	{'D', 'r', 0x250e},
1593 	{'D', 'R', 0x250f},
1594 	{'d', 'l', 0x2510},
1595 	{'d', 'L', 0x2511},
1596 	{'D', 'l', 0x2512},
1597 	{'L', 'D', 0x2513},
1598 	{'u', 'r', 0x2514},
1599 	{'u', 'R', 0x2515},
1600 	{'U', 'r', 0x2516},
1601 	{'U', 'R', 0x2517},
1602 	{'u', 'l', 0x2518},
1603 	{'u', 'L', 0x2519},
1604 	{'U', 'l', 0x251a},
1605 	{'U', 'L', 0x251b},
1606 	{'v', 'r', 0x251c},
1607 	{'v', 'R', 0x251d},
1608 	{'V', 'r', 0x2520},
1609 	{'V', 'R', 0x2523},
1610 	{'v', 'l', 0x2524},
1611 	{'v', 'L', 0x2525},
1612 	{'V', 'l', 0x2528},
1613 	{'V', 'L', 0x252b},
1614 	{'d', 'h', 0x252c},
1615 	{'d', 'H', 0x252f},
1616 	{'D', 'h', 0x2530},
1617 	{'D', 'H', 0x2533},
1618 	{'u', 'h', 0x2534},
1619 	{'u', 'H', 0x2537},
1620 	{'U', 'h', 0x2538},
1621 	{'U', 'H', 0x253b},
1622 	{'v', 'h', 0x253c},
1623 	{'v', 'H', 0x253f},
1624 	{'V', 'h', 0x2542},
1625 	{'V', 'H', 0x254b},
1626 	{'F', 'D', 0x2571},
1627 	{'B', 'D', 0x2572},
1628 #define DG_START_BLOCK 0x2580
1629 	{'T', 'B', 0x2580},
1630 	{'L', 'B', 0x2584},
1631 	{'F', 'B', 0x2588},
1632 	{'l', 'B', 0x258c},
1633 	{'R', 'B', 0x2590},
1634 	{'.', 'S', 0x2591},
1635 	{':', 'S', 0x2592},
1636 	{'?', 'S', 0x2593},
1637 #define DG_START_SHAPES 0x25a0
1638 	{'f', 'S', 0x25a0},
1639 	{'O', 'S', 0x25a1},
1640 	{'R', 'O', 0x25a2},
1641 	{'R', 'r', 0x25a3},
1642 	{'R', 'F', 0x25a4},
1643 	{'R', 'Y', 0x25a5},
1644 	{'R', 'H', 0x25a6},
1645 	{'R', 'Z', 0x25a7},
1646 	{'R', 'K', 0x25a8},
1647 	{'R', 'X', 0x25a9},
1648 	{'s', 'B', 0x25aa},
1649 	{'S', 'R', 0x25ac},
1650 	{'O', 'r', 0x25ad},
1651 	{'U', 'T', 0x25b2},
1652 	{'u', 'T', 0x25b3},
1653 	{'P', 'R', 0x25b6},
1654 	{'T', 'r', 0x25b7},
1655 	{'D', 't', 0x25bc},
1656 	{'d', 'T', 0x25bd},
1657 	{'P', 'L', 0x25c0},
1658 	{'T', 'l', 0x25c1},
1659 	{'D', 'b', 0x25c6},
1660 	{'D', 'w', 0x25c7},
1661 	{'L', 'Z', 0x25ca},
1662 	{'0', 'm', 0x25cb},
1663 	{'0', 'o', 0x25ce},
1664 	{'0', 'M', 0x25cf},
1665 	{'0', 'L', 0x25d0},
1666 	{'0', 'R', 0x25d1},
1667 	{'S', 'n', 0x25d8},
1668 	{'I', 'c', 0x25d9},
1669 	{'F', 'd', 0x25e2},
1670 	{'B', 'd', 0x25e3},
1671 #define DG_START_SYMBOLS 0x2605
1672 	{'*', '2', 0x2605},
1673 	{'*', '1', 0x2606},
1674 	{'<', 'H', 0x261c},
1675 	{'>', 'H', 0x261e},
1676 	{'0', 'u', 0x263a},
1677 	{'0', 'U', 0x263b},
1678 	{'S', 'U', 0x263c},
1679 	{'F', 'm', 0x2640},
1680 	{'M', 'l', 0x2642},
1681 	{'c', 'S', 0x2660},
1682 	{'c', 'H', 0x2661},
1683 	{'c', 'D', 0x2662},
1684 	{'c', 'C', 0x2663},
1685 	{'M', 'd', 0x2669},
1686 	{'M', '8', 0x266a},
1687 	{'M', '2', 0x266b},
1688 	{'M', 'b', 0x266d},
1689 	{'M', 'x', 0x266e},
1690 	{'M', 'X', 0x266f},
1691 #define DG_START_DINGBATS 0x2713
1692 	{'O', 'K', 0x2713},
1693 	{'X', 'X', 0x2717},
1694 	{'-', 'X', 0x2720},
1695 #define DG_START_CJK_SYMBOLS 0x3000
1696 	{'I', 'S', 0x3000},
1697 	{',', '_', 0x3001},
1698 	{'.', '_', 0x3002},
1699 	{'+', '"', 0x3003},
1700 	{'+', '_', 0x3004},
1701 	{'*', '_', 0x3005},
1702 	{';', '_', 0x3006},
1703 	{'0', '_', 0x3007},
1704 	{'<', '+', 0x300a},
1705 	{'>', '+', 0x300b},
1706 	{'<', '\'', 0x300c},
1707 	{'>', '\'', 0x300d},
1708 	{'<', '"', 0x300e},
1709 	{'>', '"', 0x300f},
1710 	{'(', '"', 0x3010},
1711 	{')', '"', 0x3011},
1712 	{'=', 'T', 0x3012},
1713 	{'=', '_', 0x3013},
1714 	{'(', '\'', 0x3014},
1715 	{')', '\'', 0x3015},
1716 	{'(', 'I', 0x3016},
1717 	{')', 'I', 0x3017},
1718 	{'-', '?', 0x301c},
1719 #define DG_START_HIRAGANA 0x3041
1720 	{'A', '5', 0x3041},
1721 	{'a', '5', 0x3042},
1722 	{'I', '5', 0x3043},
1723 	{'i', '5', 0x3044},
1724 	{'U', '5', 0x3045},
1725 	{'u', '5', 0x3046},
1726 	{'E', '5', 0x3047},
1727 	{'e', '5', 0x3048},
1728 	{'O', '5', 0x3049},
1729 	{'o', '5', 0x304a},
1730 	{'k', 'a', 0x304b},
1731 	{'g', 'a', 0x304c},
1732 	{'k', 'i', 0x304d},
1733 	{'g', 'i', 0x304e},
1734 	{'k', 'u', 0x304f},
1735 	{'g', 'u', 0x3050},
1736 	{'k', 'e', 0x3051},
1737 	{'g', 'e', 0x3052},
1738 	{'k', 'o', 0x3053},
1739 	{'g', 'o', 0x3054},
1740 	{'s', 'a', 0x3055},
1741 	{'z', 'a', 0x3056},
1742 	{'s', 'i', 0x3057},
1743 	{'z', 'i', 0x3058},
1744 	{'s', 'u', 0x3059},
1745 	{'z', 'u', 0x305a},
1746 	{'s', 'e', 0x305b},
1747 	{'z', 'e', 0x305c},
1748 	{'s', 'o', 0x305d},
1749 	{'z', 'o', 0x305e},
1750 	{'t', 'a', 0x305f},
1751 	{'d', 'a', 0x3060},
1752 	{'t', 'i', 0x3061},
1753 	{'d', 'i', 0x3062},
1754 	{'t', 'U', 0x3063},
1755 	{'t', 'u', 0x3064},
1756 	{'d', 'u', 0x3065},
1757 	{'t', 'e', 0x3066},
1758 	{'d', 'e', 0x3067},
1759 	{'t', 'o', 0x3068},
1760 	{'d', 'o', 0x3069},
1761 	{'n', 'a', 0x306a},
1762 	{'n', 'i', 0x306b},
1763 	{'n', 'u', 0x306c},
1764 	{'n', 'e', 0x306d},
1765 	{'n', 'o', 0x306e},
1766 	{'h', 'a', 0x306f},
1767 	{'b', 'a', 0x3070},
1768 	{'p', 'a', 0x3071},
1769 	{'h', 'i', 0x3072},
1770 	{'b', 'i', 0x3073},
1771 	{'p', 'i', 0x3074},
1772 	{'h', 'u', 0x3075},
1773 	{'b', 'u', 0x3076},
1774 	{'p', 'u', 0x3077},
1775 	{'h', 'e', 0x3078},
1776 	{'b', 'e', 0x3079},
1777 	{'p', 'e', 0x307a},
1778 	{'h', 'o', 0x307b},
1779 	{'b', 'o', 0x307c},
1780 	{'p', 'o', 0x307d},
1781 	{'m', 'a', 0x307e},
1782 	{'m', 'i', 0x307f},
1783 	{'m', 'u', 0x3080},
1784 	{'m', 'e', 0x3081},
1785 	{'m', 'o', 0x3082},
1786 	{'y', 'A', 0x3083},
1787 	{'y', 'a', 0x3084},
1788 	{'y', 'U', 0x3085},
1789 	{'y', 'u', 0x3086},
1790 	{'y', 'O', 0x3087},
1791 	{'y', 'o', 0x3088},
1792 	{'r', 'a', 0x3089},
1793 	{'r', 'i', 0x308a},
1794 	{'r', 'u', 0x308b},
1795 	{'r', 'e', 0x308c},
1796 	{'r', 'o', 0x308d},
1797 	{'w', 'A', 0x308e},
1798 	{'w', 'a', 0x308f},
1799 	{'w', 'i', 0x3090},
1800 	{'w', 'e', 0x3091},
1801 	{'w', 'o', 0x3092},
1802 	{'n', '5', 0x3093},
1803 	{'v', 'u', 0x3094},
1804 	{'"', '5', 0x309b},
1805 	{'0', '5', 0x309c},
1806 	{'*', '5', 0x309d},
1807 	{'+', '5', 0x309e},
1808 #define DG_START_KATAKANA 0x30a1
1809 	{'a', '6', 0x30a1},
1810 	{'A', '6', 0x30a2},
1811 	{'i', '6', 0x30a3},
1812 	{'I', '6', 0x30a4},
1813 	{'u', '6', 0x30a5},
1814 	{'U', '6', 0x30a6},
1815 	{'e', '6', 0x30a7},
1816 	{'E', '6', 0x30a8},
1817 	{'o', '6', 0x30a9},
1818 	{'O', '6', 0x30aa},
1819 	{'K', 'a', 0x30ab},
1820 	{'G', 'a', 0x30ac},
1821 	{'K', 'i', 0x30ad},
1822 	{'G', 'i', 0x30ae},
1823 	{'K', 'u', 0x30af},
1824 	{'G', 'u', 0x30b0},
1825 	{'K', 'e', 0x30b1},
1826 	{'G', 'e', 0x30b2},
1827 	{'K', 'o', 0x30b3},
1828 	{'G', 'o', 0x30b4},
1829 	{'S', 'a', 0x30b5},
1830 	{'Z', 'a', 0x30b6},
1831 	{'S', 'i', 0x30b7},
1832 	{'Z', 'i', 0x30b8},
1833 	{'S', 'u', 0x30b9},
1834 	{'Z', 'u', 0x30ba},
1835 	{'S', 'e', 0x30bb},
1836 	{'Z', 'e', 0x30bc},
1837 	{'S', 'o', 0x30bd},
1838 	{'Z', 'o', 0x30be},
1839 	{'T', 'a', 0x30bf},
1840 	{'D', 'a', 0x30c0},
1841 	{'T', 'i', 0x30c1},
1842 	{'D', 'i', 0x30c2},
1843 	{'T', 'U', 0x30c3},
1844 	{'T', 'u', 0x30c4},
1845 	{'D', 'u', 0x30c5},
1846 	{'T', 'e', 0x30c6},
1847 	{'D', 'e', 0x30c7},
1848 	{'T', 'o', 0x30c8},
1849 	{'D', 'o', 0x30c9},
1850 	{'N', 'a', 0x30ca},
1851 	{'N', 'i', 0x30cb},
1852 	{'N', 'u', 0x30cc},
1853 	{'N', 'e', 0x30cd},
1854 	{'N', 'o', 0x30ce},
1855 	{'H', 'a', 0x30cf},
1856 	{'B', 'a', 0x30d0},
1857 	{'P', 'a', 0x30d1},
1858 	{'H', 'i', 0x30d2},
1859 	{'B', 'i', 0x30d3},
1860 	{'P', 'i', 0x30d4},
1861 	{'H', 'u', 0x30d5},
1862 	{'B', 'u', 0x30d6},
1863 	{'P', 'u', 0x30d7},
1864 	{'H', 'e', 0x30d8},
1865 	{'B', 'e', 0x30d9},
1866 	{'P', 'e', 0x30da},
1867 	{'H', 'o', 0x30db},
1868 	{'B', 'o', 0x30dc},
1869 	{'P', 'o', 0x30dd},
1870 	{'M', 'a', 0x30de},
1871 	{'M', 'i', 0x30df},
1872 	{'M', 'u', 0x30e0},
1873 	{'M', 'e', 0x30e1},
1874 	{'M', 'o', 0x30e2},
1875 	{'Y', 'A', 0x30e3},
1876 	{'Y', 'a', 0x30e4},
1877 	{'Y', 'U', 0x30e5},
1878 	{'Y', 'u', 0x30e6},
1879 	{'Y', 'O', 0x30e7},
1880 	{'Y', 'o', 0x30e8},
1881 	{'R', 'a', 0x30e9},
1882 	{'R', 'i', 0x30ea},
1883 	{'R', 'u', 0x30eb},
1884 	{'R', 'e', 0x30ec},
1885 	{'R', 'o', 0x30ed},
1886 	{'W', 'A', 0x30ee},
1887 	{'W', 'a', 0x30ef},
1888 	{'W', 'i', 0x30f0},
1889 	{'W', 'e', 0x30f1},
1890 	{'W', 'o', 0x30f2},
1891 	{'N', '6', 0x30f3},
1892 	{'V', 'u', 0x30f4},
1893 	{'K', 'A', 0x30f5},
1894 	{'K', 'E', 0x30f6},
1895 	{'V', 'a', 0x30f7},
1896 	{'V', 'i', 0x30f8},
1897 	{'V', 'e', 0x30f9},
1898 	{'V', 'o', 0x30fa},
1899 	{'.', '6', 0x30fb},
1900 	{'-', '6', 0x30fc},
1901 	{'*', '6', 0x30fd},
1902 	{'+', '6', 0x30fe},
1903 #define DG_START_BOPOMOFO 0x3105
1904 	{'b', '4', 0x3105},
1905 	{'p', '4', 0x3106},
1906 	{'m', '4', 0x3107},
1907 	{'f', '4', 0x3108},
1908 	{'d', '4', 0x3109},
1909 	{'t', '4', 0x310a},
1910 	{'n', '4', 0x310b},
1911 	{'l', '4', 0x310c},
1912 	{'g', '4', 0x310d},
1913 	{'k', '4', 0x310e},
1914 	{'h', '4', 0x310f},
1915 	{'j', '4', 0x3110},
1916 	{'q', '4', 0x3111},
1917 	{'x', '4', 0x3112},
1918 	{'z', 'h', 0x3113},
1919 	{'c', 'h', 0x3114},
1920 	{'s', 'h', 0x3115},
1921 	{'r', '4', 0x3116},
1922 	{'z', '4', 0x3117},
1923 	{'c', '4', 0x3118},
1924 	{'s', '4', 0x3119},
1925 	{'a', '4', 0x311a},
1926 	{'o', '4', 0x311b},
1927 	{'e', '4', 0x311c},
1928 	{'a', 'i', 0x311e},
1929 	{'e', 'i', 0x311f},
1930 	{'a', 'u', 0x3120},
1931 	{'o', 'u', 0x3121},
1932 	{'a', 'n', 0x3122},
1933 	{'e', 'n', 0x3123},
1934 	{'a', 'N', 0x3124},
1935 	{'e', 'N', 0x3125},
1936 	{'e', 'r', 0x3126},
1937 	{'i', '4', 0x3127},
1938 	{'u', '4', 0x3128},
1939 	{'i', 'u', 0x3129},
1940 	{'v', '4', 0x312a},
1941 	{'n', 'G', 0x312b},
1942 	{'g', 'n', 0x312c},
1943 #define DG_START_OTHER3 0x3220
1944 	{'1', 'c', 0x3220},
1945 	{'2', 'c', 0x3221},
1946 	{'3', 'c', 0x3222},
1947 	{'4', 'c', 0x3223},
1948 	{'5', 'c', 0x3224},
1949 	{'6', 'c', 0x3225},
1950 	{'7', 'c', 0x3226},
1951 	{'8', 'c', 0x3227},
1952 	{'9', 'c', 0x3228},
1953 	/* code points 0xe000 - 0xefff excluded, they have no assigned
1954 	 * characters, only used in proposals. */
1955 	{'f', 'f', 0xfb00},
1956 	{'f', 'i', 0xfb01},
1957 	{'f', 'l', 0xfb02},
1958 	{'f', 't', 0xfb05},
1959 	{'s', 't', 0xfb06},
1960 #      endif /* FEAT_MBYTE */
1961 
1962 	{NUL, NUL, NUL}
1963        };
1964 
1965 #    endif /* OLD_DIGRAPHS */
1966 
1967 #   endif /* Macintosh */
1968 #  endif /* EBCDIC */
1969 # endif    /* !HPUX_DIGRAPHS */
1970 #endif	/* !__MINT__ */
1971 
1972 /*
1973  * handle digraphs after typing a character
1974  */
1975     int
1976 do_digraph(int c)
1977 {
1978     static int	backspaced;	/* character before K_BS */
1979     static int	lastchar;	/* last typed character */
1980 
1981     if (c == -1)		/* init values */
1982     {
1983 	backspaced = -1;
1984     }
1985     else if (p_dg)
1986     {
1987 	if (backspaced >= 0)
1988 	    c = getdigraph(backspaced, c, FALSE);
1989 	backspaced = -1;
1990 	if ((c == K_BS || c == Ctrl_H) && lastchar >= 0)
1991 	    backspaced = lastchar;
1992     }
1993     lastchar = c;
1994     return c;
1995 }
1996 
1997 /*
1998  * Find a digraph for "val".  If found return the string to display it.
1999  * If not found return NULL.
2000  */
2001     char_u *
2002 get_digraph_for_char(int val_arg)
2003 {
2004     int		val = val_arg;
2005     int		i;
2006     int		use_defaults;
2007     digr_T	*dp;
2008     static      char_u      r[3];
2009 
2010 #if defined(USE_UNICODE_DIGRAPHS)
2011     if (!enc_utf8)
2012     {
2013 	char_u	    buf[6], *to;
2014 	vimconv_T   vc;
2015 
2016 	// convert the character from 'encoding' to Unicode
2017 	i = mb_char2bytes(val, buf);
2018 	vc.vc_type = CONV_NONE;
2019 	if (convert_setup(&vc, p_enc, (char_u *)"utf-8") == OK)
2020 	{
2021 	    vc.vc_fail = TRUE;
2022 	    to = string_convert(&vc, buf, &i);
2023 	    if (to != NULL)
2024 	    {
2025 		val = utf_ptr2char(to);
2026 		vim_free(to);
2027 	    }
2028 	    (void)convert_setup(&vc, NULL, NULL);
2029 	}
2030     }
2031 #endif
2032 
2033     for (use_defaults = 0; use_defaults <= 1; use_defaults++)
2034     {
2035 	if (use_defaults == 0)
2036 	    dp = (digr_T *)user_digraphs.ga_data;
2037 	else
2038 	    dp = digraphdefault;
2039 	for (i = 0; use_defaults ? dp->char1 != NUL
2040 					       : i < user_digraphs.ga_len; ++i)
2041 	{
2042 	    if (dp->result == val)
2043 	    {
2044 		r[0] = dp->char1;
2045 		r[1] = dp->char2;
2046 		r[2] = NUL;
2047 		return r;
2048 	    }
2049 	    ++dp;
2050 	}
2051     }
2052     return NULL;
2053 }
2054 
2055 /*
2056  * Get a digraph.  Used after typing CTRL-K on the command line or in normal
2057  * mode.
2058  * Returns composed character, or NUL when ESC was used.
2059  */
2060     int
2061 get_digraph(
2062     int		cmdline)	/* TRUE when called from the cmdline */
2063 {
2064     int		c, cc;
2065 
2066     ++no_mapping;
2067     ++allow_keys;
2068     c = plain_vgetc();
2069     --no_mapping;
2070     --allow_keys;
2071     if (c != ESC)		/* ESC cancels CTRL-K */
2072     {
2073 	if (IS_SPECIAL(c))	/* insert special key code */
2074 	    return c;
2075 	if (cmdline)
2076 	{
2077 	    if (char2cells(c) == 1
2078 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
2079 		    && cmdline_star == 0
2080 #endif
2081 		    )
2082 		putcmdline(c, TRUE);
2083 	}
2084 #ifdef FEAT_CMDL_INFO
2085 	else
2086 	    add_to_showcmd(c);
2087 #endif
2088 	++no_mapping;
2089 	++allow_keys;
2090 	cc = plain_vgetc();
2091 	--no_mapping;
2092 	--allow_keys;
2093 	if (cc != ESC)	    /* ESC cancels CTRL-K */
2094 	    return getdigraph(c, cc, TRUE);
2095     }
2096     return NUL;
2097 }
2098 
2099 /*
2100  * Lookup the pair "char1", "char2" in the digraph tables.
2101  * If no match, return "char2".
2102  * If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80.
2103  */
2104     static int
2105 getexactdigraph(int char1, int char2, int meta_char)
2106 {
2107     int		i;
2108     int		retval = 0;
2109     digr_T	*dp;
2110 
2111     if (IS_SPECIAL(char1) || IS_SPECIAL(char2))
2112 	return char2;
2113 
2114     /*
2115      * Search user digraphs first.
2116      */
2117     dp = (digr_T *)user_digraphs.ga_data;
2118     for (i = 0; i < user_digraphs.ga_len; ++i)
2119     {
2120 	if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2121 	{
2122 	    retval = dp->result;
2123 	    break;
2124 	}
2125 	++dp;
2126     }
2127 
2128     /*
2129      * Search default digraphs.
2130      */
2131     if (retval == 0)
2132     {
2133 	dp = digraphdefault;
2134 	for (i = 0; dp->char1 != 0; ++i)
2135 	{
2136 	    if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2137 	    {
2138 		retval = dp->result;
2139 		break;
2140 	    }
2141 	    ++dp;
2142 	}
2143     }
2144 #ifdef FEAT_MBYTE
2145 # ifdef USE_UNICODE_DIGRAPHS
2146     if (retval != 0 && !enc_utf8)
2147     {
2148 	char_u	    buf[6], *to;
2149 	vimconv_T   vc;
2150 
2151 	/*
2152 	 * Convert the Unicode digraph to 'encoding'.
2153 	 */
2154 	i = utf_char2bytes(retval, buf);
2155 	retval = 0;
2156 	vc.vc_type = CONV_NONE;
2157 	if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK)
2158 	{
2159 	    vc.vc_fail = TRUE;
2160 	    to = string_convert(&vc, buf, &i);
2161 	    if (to != NULL)
2162 	    {
2163 		retval = (*mb_ptr2char)(to);
2164 		vim_free(to);
2165 	    }
2166 	    (void)convert_setup(&vc, NULL, NULL);
2167 	}
2168     }
2169 # endif
2170 
2171     /* Ignore multi-byte characters when not in multi-byte mode. */
2172     if (!has_mbyte && retval > 0xff)
2173 	retval = 0;
2174 #endif
2175 
2176     if (retval == 0)		/* digraph deleted or not found */
2177     {
2178 	if (char1 == ' ' && meta_char)	/* <space> <char> --> meta-char */
2179 	    return (char2 | 0x80);
2180 	return char2;
2181     }
2182     return retval;
2183 }
2184 
2185 /*
2186  * Get digraph.
2187  * Allow for both char1-char2 and char2-char1
2188  */
2189     int
2190 getdigraph(int char1, int char2, int meta_char)
2191 {
2192     int	    retval;
2193 
2194     if (((retval = getexactdigraph(char1, char2, meta_char)) == char2)
2195 	    && (char1 != char2)
2196 	    && ((retval = getexactdigraph(char2, char1, meta_char)) == char1))
2197 	return char2;
2198     return retval;
2199 }
2200 
2201 /*
2202  * Add the digraphs in the argument to the digraph table.
2203  * format: {c1}{c2} char {c1}{c2} char ...
2204  */
2205     void
2206 putdigraph(char_u *str)
2207 {
2208     int		char1, char2, n;
2209     int		i;
2210     digr_T	*dp;
2211 
2212     while (*str != NUL)
2213     {
2214 	str = skipwhite(str);
2215 	if (*str == NUL)
2216 	    return;
2217 	char1 = *str++;
2218 	char2 = *str++;
2219 	if (char2 == 0)
2220 	{
2221 	    EMSG(_(e_invarg));
2222 	    return;
2223 	}
2224 	if (char1 == ESC || char2 == ESC)
2225 	{
2226 	    EMSG(_("E104: Escape not allowed in digraph"));
2227 	    return;
2228 	}
2229 	str = skipwhite(str);
2230 	if (!VIM_ISDIGIT(*str))
2231 	{
2232 	    EMSG(_(e_number_exp));
2233 	    return;
2234 	}
2235 	n = getdigits(&str);
2236 
2237 	/* If the digraph already exists, replace the result. */
2238 	dp = (digr_T *)user_digraphs.ga_data;
2239 	for (i = 0; i < user_digraphs.ga_len; ++i)
2240 	{
2241 	    if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2242 	    {
2243 		dp->result = n;
2244 		break;
2245 	    }
2246 	    ++dp;
2247 	}
2248 
2249 	/* Add a new digraph to the table. */
2250 	if (i == user_digraphs.ga_len)
2251 	{
2252 	    if (ga_grow(&user_digraphs, 1) == OK)
2253 	    {
2254 		dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
2255 		dp->char1 = char1;
2256 		dp->char2 = char2;
2257 		dp->result = n;
2258 		++user_digraphs.ga_len;
2259 	    }
2260 	}
2261     }
2262 }
2263 
2264 #if defined(USE_UNICODE_DIGRAPHS)
2265     static void
2266 digraph_header(char *msg)
2267 {
2268     if (msg_col > 0)
2269 	msg_putchar('\n');
2270     msg_outtrans_attr((char_u *)msg, HL_ATTR(HLF_CM));
2271     msg_putchar('\n');
2272 }
2273 #endif
2274 
2275     void
2276 listdigraphs(int use_headers)
2277 {
2278     int		i;
2279     digr_T	*dp;
2280     result_T	previous = 0;
2281 
2282     msg_putchar('\n');
2283 
2284     dp = digraphdefault;
2285     for (i = 0; dp->char1 != NUL && !got_int; ++i)
2286     {
2287 #if defined(USE_UNICODE_DIGRAPHS)
2288 	digr_T tmp;
2289 
2290 	/* May need to convert the result to 'encoding'. */
2291 	tmp.char1 = dp->char1;
2292 	tmp.char2 = dp->char2;
2293 	tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
2294 	if (tmp.result != 0 && tmp.result != tmp.char2
2295 					  && (has_mbyte || tmp.result <= 255))
2296 	    printdigraph(&tmp, use_headers ? &previous : NULL);
2297 #else
2298 
2299 	if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
2300 # ifdef FEAT_MBYTE
2301 		&& (has_mbyte || dp->result <= 255)
2302 # endif
2303 		)
2304 	    printdigraph(dp, use_headers ? &previous : NULL);
2305 #endif
2306 	++dp;
2307 	ui_breakcheck();
2308     }
2309 
2310     dp = (digr_T *)user_digraphs.ga_data;
2311     for (i = 0; i < user_digraphs.ga_len && !got_int; ++i)
2312     {
2313 #if defined(USE_UNICODE_DIGRAPHS)
2314 	if (previous >= 0 && use_headers)
2315 	    digraph_header(_("Custom"));
2316 	previous = -1;
2317 #endif
2318 	printdigraph(dp, NULL);
2319 	ui_breakcheck();
2320 	++dp;
2321     }
2322     must_redraw = CLEAR;    /* clear screen, because some digraphs may be
2323 			       wrong, in which case we messed up ScreenLines */
2324 }
2325 
2326 struct dg_header_entry {
2327     int	    dg_start;
2328     char    *dg_header;
2329 } header_table[] = {
2330     {DG_START_LATIN, N_("Latin supplement")},
2331     {DG_START_GREEK, N_("Greek and Coptic")},
2332     {DG_START_CYRILLIC, N_("Cyrillic")},
2333     {DG_START_HEBREW, N_("Hebrew")},
2334     {DG_START_ARABIC, N_("Arabic")},
2335     {DG_START_LATIN_EXTENDED, N_("Latin extended")},
2336     {DG_START_GREEK_EXTENDED, N_("Greek extended")},
2337     {DG_START_PUNCTUATION, N_("Punctuation")},
2338     {DG_START_SUB_SUPER, N_("Super- and subscripts")},
2339     {DG_START_CURRENCY, N_("Currency")},
2340     {DG_START_OTHER1, N_("Other")},
2341     {DG_START_ROMAN, N_("Roman numbers")},
2342     {DG_START_ARROWS, N_("Arrows")},
2343     {DG_START_MATH, N_("Mathematical operators")},
2344     {DG_START_TECHNICAL, N_("Technical")},
2345     {DG_START_OTHER2, N_("Other")},
2346     {DG_START_DRAWING, N_("Box drawing")},
2347     {DG_START_BLOCK, N_("Block elements")},
2348     {DG_START_SHAPES, N_("Geometric shapes")},
2349     {DG_START_SYMBOLS, N_("Symbols")},
2350     {DG_START_DINGBATS, N_("Dingbats")},
2351     {DG_START_CJK_SYMBOLS, N_("CJK symbols and punctuation")},
2352     {DG_START_HIRAGANA, N_("Hiragana")},
2353     {DG_START_KATAKANA, N_("Katakana")},
2354     {DG_START_BOPOMOFO, N_("Bopomofo")},
2355     {DG_START_OTHER3, N_("Other")},
2356     {0xfffffff, NULL},
2357 };
2358 
2359     static void
2360 printdigraph(digr_T *dp, result_T *previous)
2361 {
2362     char_u	buf[30];
2363     char_u	*p;
2364 
2365     int		list_width;
2366 
2367     if ((dy_flags & DY_UHEX)
2368 #ifdef FEAT_MBYTE
2369 	    || has_mbyte
2370 #endif
2371 	    )
2372 	list_width = 13;
2373     else
2374 	list_width = 11;
2375 
2376     if (dp->result != 0)
2377     {
2378 #if defined(USE_UNICODE_DIGRAPHS)
2379 	if (previous != NULL)
2380 	{
2381 	    int i;
2382 
2383 	    for (i = 0; header_table[i].dg_header != NULL; ++i)
2384 		if (*previous < header_table[i].dg_start
2385 			&& dp->result >= header_table[i].dg_start
2386 			&& dp->result < header_table[i + 1].dg_start)
2387 		{
2388 		    digraph_header(_(header_table[i].dg_header));
2389 		    break;
2390 		}
2391 	    *previous = dp->result;
2392 	}
2393 #endif
2394 	if (msg_col > Columns - list_width)
2395 	    msg_putchar('\n');
2396 	if (msg_col)
2397 	    while (msg_col % list_width != 0)
2398 		msg_putchar(' ');
2399 
2400 	p = buf;
2401 	*p++ = dp->char1;
2402 	*p++ = dp->char2;
2403 	*p++ = ' ';
2404 	*p = NUL;
2405 	msg_outtrans(buf);
2406 	p = buf;
2407 #ifdef FEAT_MBYTE
2408 	if (has_mbyte)
2409 	{
2410 	    /* add a space to draw a composing char on */
2411 	    if (enc_utf8 && utf_iscomposing(dp->result))
2412 		*p++ = ' ';
2413 	    p += (*mb_char2bytes)(dp->result, p);
2414 	}
2415 	else
2416 #endif
2417 	    *p++ = (char_u)dp->result;
2418 	*p = NUL;
2419 	msg_outtrans_attr(buf, HL_ATTR(HLF_8));
2420 	p = buf;
2421 	if (char2cells(dp->result) == 1)
2422 	    *p++ = ' ';
2423 	vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
2424 	msg_outtrans(buf);
2425     }
2426 }
2427 
2428 #endif /* FEAT_DIGRAPHS */
2429 
2430 #if defined(FEAT_KEYMAP) || defined(PROTO)
2431 
2432 /* structure used for b_kmap_ga.ga_data */
2433 typedef struct
2434 {
2435     char_u	*from;
2436     char_u	*to;
2437 } kmap_T;
2438 
2439 #define KMAP_MAXLEN 20	    /* maximum length of "from" or "to" */
2440 
2441 static void keymap_unload(void);
2442 
2443 /*
2444  * Set up key mapping tables for the 'keymap' option.
2445  * Returns NULL if OK, an error message for failure.  This only needs to be
2446  * used when setting the option, not later when the value has already been
2447  * checked.
2448  */
2449     char_u *
2450 keymap_init(void)
2451 {
2452     curbuf->b_kmap_state &= ~KEYMAP_INIT;
2453 
2454     if (*curbuf->b_p_keymap == NUL)
2455     {
2456 	/* Stop any active keymap and clear the table.  Also remove
2457 	 * b:keymap_name, as no keymap is active now. */
2458 	keymap_unload();
2459 	do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
2460     }
2461     else
2462     {
2463 	char_u	*buf;
2464 	size_t  buflen;
2465 
2466 	/* Source the keymap file.  It will contain a ":loadkeymap" command
2467 	 * which will call ex_loadkeymap() below. */
2468 	buflen = STRLEN(curbuf->b_p_keymap)
2469 # ifdef FEAT_MBYTE
2470 					   + STRLEN(p_enc)
2471 # endif
2472 						       + 14;
2473 	buf = alloc((unsigned)buflen);
2474 	if (buf == NULL)
2475 	    return e_outofmem;
2476 
2477 # ifdef FEAT_MBYTE
2478 	/* try finding "keymap/'keymap'_'encoding'.vim"  in 'runtimepath' */
2479 	vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
2480 						   curbuf->b_p_keymap, p_enc);
2481 	if (source_runtime(buf, 0) == FAIL)
2482 # endif
2483 	{
2484 	    /* try finding "keymap/'keymap'.vim" in 'runtimepath'  */
2485 	    vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
2486 							  curbuf->b_p_keymap);
2487 	    if (source_runtime(buf, 0) == FAIL)
2488 	    {
2489 		vim_free(buf);
2490 		return (char_u *)N_("E544: Keymap file not found");
2491 	    }
2492 	}
2493 	vim_free(buf);
2494     }
2495 
2496     return NULL;
2497 }
2498 
2499 /*
2500  * ":loadkeymap" command: load the following lines as the keymap.
2501  */
2502     void
2503 ex_loadkeymap(exarg_T *eap)
2504 {
2505     char_u	*line;
2506     char_u	*p;
2507     char_u	*s;
2508     kmap_T	*kp;
2509 #define KMAP_LLEN   200	    /* max length of "to" and "from" together */
2510     char_u	buf[KMAP_LLEN + 11];
2511     int		i;
2512     char_u	*save_cpo = p_cpo;
2513 
2514     if (!getline_equal(eap->getline, eap->cookie, getsourceline))
2515     {
2516 	EMSG(_("E105: Using :loadkeymap not in a sourced file"));
2517 	return;
2518     }
2519 
2520     /*
2521      * Stop any active keymap and clear the table.
2522      */
2523     keymap_unload();
2524 
2525     curbuf->b_kmap_state = 0;
2526     ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
2527 
2528     /* Set 'cpoptions' to "C" to avoid line continuation. */
2529     p_cpo = (char_u *)"C";
2530 
2531     /*
2532      * Get each line of the sourced file, break at the end.
2533      */
2534     for (;;)
2535     {
2536 	line = eap->getline(0, eap->cookie, 0);
2537 	if (line == NULL)
2538 	    break;
2539 
2540 	p = skipwhite(line);
2541 	if (*p != '"' && *p != NUL && ga_grow(&curbuf->b_kmap_ga, 1) == OK)
2542 	{
2543 	    kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len;
2544 	    s = skiptowhite(p);
2545 	    kp->from = vim_strnsave(p, (int)(s - p));
2546 	    p = skipwhite(s);
2547 	    s = skiptowhite(p);
2548 	    kp->to = vim_strnsave(p, (int)(s - p));
2549 
2550 	    if (kp->from == NULL || kp->to == NULL
2551 		    || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN
2552 		    || *kp->from == NUL || *kp->to == NUL)
2553 	    {
2554 		if (kp->to != NULL && *kp->to == NUL)
2555 		    EMSG(_("E791: Empty keymap entry"));
2556 		vim_free(kp->from);
2557 		vim_free(kp->to);
2558 	    }
2559 	    else
2560 		++curbuf->b_kmap_ga.ga_len;
2561 	}
2562 	vim_free(line);
2563     }
2564 
2565     /*
2566      * setup ":lnoremap" to map the keys
2567      */
2568     for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2569     {
2570 	vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s",
2571 				((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from,
2572 				 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to);
2573 	(void)do_map(2, buf, LANGMAP, FALSE);
2574     }
2575 
2576     p_cpo = save_cpo;
2577 
2578     curbuf->b_kmap_state |= KEYMAP_LOADED;
2579     status_redraw_curbuf();
2580 }
2581 
2582 /*
2583  * Stop using 'keymap'.
2584  */
2585     static void
2586 keymap_unload(void)
2587 {
2588     char_u	buf[KMAP_MAXLEN + 10];
2589     int		i;
2590     char_u	*save_cpo = p_cpo;
2591     kmap_T	*kp;
2592 
2593     if (!(curbuf->b_kmap_state & KEYMAP_LOADED))
2594 	return;
2595 
2596     /* Set 'cpoptions' to "C" to avoid line continuation. */
2597     p_cpo = (char_u *)"C";
2598 
2599     /* clear the ":lmap"s */
2600     kp = (kmap_T *)curbuf->b_kmap_ga.ga_data;
2601     for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2602     {
2603 	vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
2604 	(void)do_map(1, buf, LANGMAP, FALSE);
2605     }
2606     keymap_clear(&curbuf->b_kmap_ga);
2607 
2608     p_cpo = save_cpo;
2609 
2610     ga_clear(&curbuf->b_kmap_ga);
2611     curbuf->b_kmap_state &= ~KEYMAP_LOADED;
2612     status_redraw_curbuf();
2613 }
2614 
2615     void
2616 keymap_clear(garray_T *kmap)
2617 {
2618     int	    i;
2619     kmap_T  *kp = (kmap_T *)kmap->ga_data;
2620 
2621     for (i = 0; i < kmap->ga_len; ++i)
2622     {
2623 	vim_free(kp[i].from);
2624 	vim_free(kp[i].to);
2625     }
2626 }
2627 #endif /* FEAT_KEYMAP */
2628