standards-version: 3.8.4
[ckermit.git] / ckuxla.c
1 #include "ckcsym.h"
2
3 #include "ckcdeb.h"                     /* Includes... */
4 #include "ckcker.h"
5 #include "ckucmd.h"
6 #include "ckcxla.h"
7
8 #ifdef NOXFER
9 #define zdstuff(a)
10 #endif /* NOXFER */
11
12 #ifndef NOCSETS
13 char *xlav = "Character Set Translation 8.0.042, 3 Jul 2000";
14
15 /*  C K U X L A  */
16
17 /*  C-Kermit tables and functions supporting character set translation.  */
18 /*
19   Author: Frank da Cruz <fdc@columbia.edu>,
20   Columbia University Academic Information Systems, New York City.
21
22   Copyright (C) 1985, 2004,
23     Trustees of Columbia University in the City of New York.
24     All rights reserved.  See the C-Kermit COPYING.TXT file or the
25     copyright text in the ckcmai.c module for disclaimer and permissions.
26 */
27
28 /* Character set translation data and functions */
29
30 extern int zincnt;                      /* File i/o macros and variables */
31 extern char *zinptr;
32 extern int zoutcnt;
33 extern char *zoutptr;
34 extern int byteorder;
35 extern int xfrxla;
36
37 int tslevel  = TS_L0;                   /* Transfer syntax level (0,1,2) */
38 int tcharset = TC_TRANSP;               /* Transfer syntax character set */
39 int tcs_save = -1;                      /* For save/restore term charset */
40 int tcs_transp = 0;                     /* Term charset is TRANSPARENT flag */
41
42 #ifdef CKOUNI
43 int tcsr     = TX_8859_1;               /* Remote terminal character set */
44 #else /* CKOUNI */
45 int tcsr     = FC_USASCII;
46 #endif /* CKOUNI */
47 int language = L_USASCII;               /* Language */
48
49 #ifdef UNICODE
50 int ucsbom = 1;                         /* Add BOM to new UCS files? */
51 int ucsorder = -1;                      /* Default byte order for UCS files */
52 int fileorder = -1;                     /* Byte order of current file */
53                                         /* 0 = BE, 1 = LE */
54 #endif /* UNICODE */
55 /*
56   Default local file and terminal character set.
57   Normally ASCII, but for some systems we know otherwise.
58 */
59 int fcs_save = -1;
60 #ifdef datageneral                      /* Data General AOS/VS */
61 int fcharset = FC_DGMCS;                /* uses the DG International set */
62 int dcset8   = FC_DGMCS;
63 int dcset7   = FC_USASCII;
64 int tcsl     = FC_DGMCS;
65 #else
66 #ifdef NEXT                             /* The NeXT workstation */
67 int fcharset = FC_NEXT;                 /* uses its own 8-bit set */
68 int dcset8   = FC_NEXT;
69 int dcset7   = FC_USASCII;
70 int tcsl     = FC_NEXT;
71 #else
72 #ifdef MAC                              /* The Macintosh */
73 int fcharset = FC_APPQD;                /* uses an extended version of */
74 int dcset8   = FC_APPQD;
75 int dcset7   = FC_USASCII;
76 int tcsl     = FC_APPQD;                /* Apple Quickdraw */
77 #else
78 #ifdef AUX
79 int fcharset = FC_APPQD;                /* Ditto for Apple A/UX */
80 int dcset8   = FC_APPQD;
81 int dcset7   = FC_USASCII;
82 int tcsl     = FC_APPQD;
83 #else
84 #ifdef AMIGA                            /* The Commodore Amiga */
85 int fcharset = FC_1LATIN;               /* uses Latin-1 */
86 int dcset8   = FC_1LATIN;
87 int dcset7   = FC_USASCII;
88 int tcsl     = FC_1LATIN;
89 #else                                   /* All others */
90 #ifdef CKOUNI                           /* OS/2 Unicode */
91 int fcharset = FC_1LATIN;
92 int dcset8   = FC_1LATIN;
93 int dcset7   = FC_USASCII;
94 int tcsl     = TX_8859_1;
95 int prncs    = TX_CP437;
96 #else                                   /* All others */
97 int fcharset = FC_USASCII;              /* use ASCII by default */
98 int dcset8   = FC_1LATIN;               /* But default 8-bit set is Latin-1 */
99 int dcset7   = FC_USASCII;
100 int tcsl     = FC_USASCII;
101 int prncs    = FC_CP437;
102 #endif /* CKOUNI */
103 #endif /* AMIGA */
104 #endif /* AUX */
105 #endif /* MAC */
106 #endif /* NEXT */
107 #endif /* datageneral */
108
109 int s_cset = XMODE_A;                   /* SEND charset selection = AUTO */
110 int r_cset = XMODE_A;                   /* RECV charset selection = AUTO */
111 int afcset[MAXFCSETS+1];                /* Character-set associations */
112 int axcset[MAXTCSETS+1];
113 int xlatype = XLA_NONE;                 /* Translation type */
114
115 #ifdef UNICODE
116 #ifdef CK_ANSIC
117 extern int (*xl_utc[MAXTCSETS+1])(USHORT);  /* Unicode to TCS */
118 extern int (*xl_ufc[MAXFCSETS+1])(USHORT);  /* Unicode to FCS */
119 extern USHORT (*xl_tcu[MAXTCSETS+1])(CHAR); /* TCS to Unicode */
120 extern USHORT (*xl_fcu[MAXFCSETS+1])(CHAR); /* FCS to Unicode */
121 #else
122 extern int (*xl_utc[MAXTCSETS+1])();
123 extern int (*xl_ufc[MAXFCSETS+1])();
124 extern USHORT (*xl_tcu[MAXTCSETS+1])();
125 extern USHORT (*xl_fcu[MAXFCSETS+1])();
126 #endif /* CK_ANSIC */
127 #endif /* UNICODE */
128
129 /* Bureaucracy section */
130
131 _PROTOTYP( CHAR xnel1, (CHAR c) );      /* NeXT to Latin-1 */
132 _PROTOTYP( CHAR xl143, (CHAR c) );      /* Latin-1 to IBM CP437 */
133 _PROTOTYP( CHAR xl1as, (CHAR c) );      /* Latin-1 to US ASCII */
134 _PROTOTYP( CHAR zl1as, (CHAR c) );      /* Latin-1 to US ASCII */
135
136 #ifdef CYRILLIC
137 _PROTOTYP( CHAR xassk, (CHAR c) );      /* ASCII to Short KOI */
138 _PROTOTYP( CHAR xskcy, (CHAR c) );      /* Short KOI to Latin/Cyrillic */
139 #endif /* CYRILLIC */
140
141 #ifdef LATIN2
142 _PROTOTYP( CHAR xnel2, (CHAR c) );      /* NeXT to Latin-2 */
143 _PROTOTYP( CHAR xl243, (CHAR c) );      /* Latin-2 to IBM CP437 */
144 _PROTOTYP( CHAR xl2as, (CHAR c) );      /* Latin-2 to US ASCII */
145 _PROTOTYP( CHAR zl2as, (CHAR c) );      /* Latin-2 to US ASCII */
146 _PROTOTYP( CHAR xl2r8, (CHAR c) );      /* Latin-2 to HP */
147 _PROTOTYP( CHAR xl2l9, (CHAR c) );      /* Latin-2 to Latin-9 */
148 _PROTOTYP( CHAR xl9l2, (CHAR c) );      /* Latin-9 to Latin-2 */
149 _PROTOTYP( CHAR xl2mz, (CHAR c) );      /* Latin-2 to Mazovia */
150 _PROTOTYP( CHAR xmzl2, (CHAR c) );      /* Mazovia to Latin-2 */
151 _PROTOTYP( CHAR xl1mz, (CHAR c) );      /* Latin-1 to Mazovia */
152 _PROTOTYP( CHAR xmzl1, (CHAR c) );      /* Mazovia to Latin-1 */
153 _PROTOTYP( CHAR xmzl9, (CHAR c) );      /* Latin-9 to Mazovia */
154 _PROTOTYP( CHAR xl9mz, (CHAR c) );      /* Mazovia to Latin-9 */
155 #endif /* LATIN2 */
156
157 /* Transfer character-set info */
158
159 struct csinfo tcsinfo[] = {
160 /*  Name              size code      designator alphabet keyword            */
161   "TRANSPARENT",       256,TC_TRANSP, "",      AL_UNK,  "transparent",  /* 0 */
162   "ASCII",             128,TC_USASCII,"",      AL_ROMAN,"ascii",        /* 1 */
163   "ISO 8859-1 Latin-1",256,TC_1LATIN, "I6/100",AL_ROMAN,"latin1-iso",   /* 2 */
164 #ifdef LATIN2
165   "ISO 8859-2 Latin-2",256,TC_2LATIN, "I6/101",AL_ROMAN,"latin2-iso",   /* 3 */
166 #endif /* LATIN2 */
167 #ifdef CYRILLIC
168   /* 4 */
169   "ISO 8859-5 Latin/Cyrillic",256,TC_CYRILL,"I6/144",AL_CYRIL,"cyrillic-iso",
170 #endif /* CYRILLIC */
171 #ifdef KANJI
172   "Japanese EUC",16384,TC_JEUC,  "I14/87/13", AL_JAPAN, "euc-jp",       /* 5 */
173 #endif /* KANJI */
174 #ifdef HEBREW
175   /* 6 */
176   "ISO 8859-8 Latin/Hebrew",256,TC_HEBREW,"I6/138",AL_HEBREW,"hebrew-iso",
177 #endif /* HEBREW */
178 #ifdef GREEK
179   "ISO 8859-7 Latin/Greek",256,TC_GREEK,"I6/126",AL_GREEK,"greek-iso", /*  7 */
180 #endif /* GREEK */
181   "ISO 8859-15 Latin-9",256,TC_9LATIN,"I6/203",AL_ROMAN,"latin9-iso",  /*  8 */
182   "ISO 10646 / Unicode UCS-2",64000,TC_UCS2,"I162",AL_UNIV,"ucs2",     /*  9 */
183   "ISO 10646 / Unicode UTF-8",64000,TC_UTF8,"I190",AL_UNIV,"utf8",     /* 10 */
184   "",0,0,"",0,""
185 };
186 int ntcsets = (sizeof(tcsinfo) / sizeof(struct csinfo)) - 1;
187
188 struct keytab tcstab[] = {              /* Keyword table for */
189     "ascii",         TC_USASCII, 0,     /* SET TRANSFER CHARACTER-SET */
190 #ifdef CYRILLIC
191     "cyrillic-iso",  TC_CYRILL,  0,
192 #endif /* CYRILLIC */
193 #ifdef GREEK
194     "elot928-greek", TC_GREEK,   CM_INV,
195 #endif /* GREEK */
196 #ifdef KANJI
197     "euc-jp",        TC_JEUC,    0,
198 #endif /* KANJI */
199 #ifdef GREEK
200     "greek-iso",     TC_GREEK,   0,
201 #endif /* GREEK */
202 #ifdef HEBREW
203     "hebrew-iso",    TC_HEBREW,  0,
204 #endif /* HEBREW */
205 #ifdef KANJI
206     "japanese-euc",  TC_JEUC,    CM_INV,
207 #endif /* KANJI */
208     "l",             TC_1LATIN,  CM_ABR|CM_INV,
209     "la",            TC_1LATIN,  CM_ABR|CM_INV,
210     "lat",           TC_1LATIN,  CM_ABR|CM_INV,
211     "lati",          TC_1LATIN,  CM_ABR|CM_INV,
212     "latin",         TC_1LATIN,  CM_ABR|CM_INV,
213     "latin1-iso",    TC_1LATIN,  0,
214 #ifdef LATIN2
215     "latin2-iso",    TC_2LATIN,  0,
216 #endif /* LATIN2 */
217     "latin9-iso",    TC_9LATIN,  0,
218     "transparent",   TC_TRANSP,  0,
219 #ifdef UNICODE
220     "ucs2",          TC_UCS2,    0,
221     "utf8",          TC_UTF8,    0,
222 #endif /* UNICODE */
223     "", 0, 0
224 };
225 int ntcs = (sizeof(tcstab) / sizeof(struct keytab)) - 1;
226
227 /* File character set information structure, indexed by character set code, */
228 /* as defined in ckuxla.h.  This table must be in order of file character */
229 /* set number! */
230
231 struct csinfo fcsinfo[] = { /* File character set information... */
232   /* Descriptive Name              Size  Designator */
233   "US ASCII",                     128, FC_USASCII, NULL, AL_ROMAN, "ascii",
234   "British/UK ISO-646",           128, FC_UKASCII, NULL, AL_ROMAN, "british",
235   "Dutch ISO-646",                128, FC_DUASCII, NULL, AL_ROMAN, "dutch",
236   "Finnish ISO-646",              128, FC_FIASCII, NULL, AL_ROMAN, "finnish",
237   "French ISO-646",               128, FC_FRASCII, NULL, AL_ROMAN, "french",
238   "Canadian-French NRC", 128, FC_FCASCII, NULL, AL_ROMAN, "canadian-french",
239   "German ISO-646",               128, FC_GEASCII, NULL, AL_ROMAN, "german",
240   "Hungarian ISO-646",            128, FC_HUASCII, NULL, AL_ROMAN, "hungarian",
241   "Italian ISO-646",              128, FC_ITASCII, NULL, AL_ROMAN, "italian",
242   "Norwegian/Danish ISO-646",128,FC_NOASCII,NULL,AL_ROMAN,"norwegian/danish",
243   "Portuguese ISO-646",           128, FC_POASCII, NULL, AL_ROMAN,"portuguese",
244   "Spanish ISO-646",              128, FC_SPASCII, NULL, AL_ROMAN, "spanish",
245   "Swedish ISO-646",              128, FC_SWASCII, NULL, AL_ROMAN, "swedish",
246   "Swiss NRC",                    128, FC_CHASCII, NULL, AL_ROMAN, "swiss",
247   "ISO 8859-1 Latin-1",           256, FC_1LATIN,  NULL, AL_ROMAN,"latin1-iso",
248   "ISO 8859-2 Latin-2",           256, FC_2LATIN,  NULL, AL_ROMAN,"latin2-iso",
249   "DEC Multinational", 256,  FC_DECMCS, NULL,AL_ROMAN,"dec-multinational",
250   "NeXT Multinational", 256, FC_NEXT,   NULL,AL_ROMAN,"next-multinational",
251   "PC Code Page 437",            256, FC_CP437,   NULL, AL_ROMAN,"cp437",
252   "PC Code Page 850",            256, FC_CP850,   NULL, AL_ROMAN,"cp850",
253   "PC Code Page 852",            256, FC_CP852,   NULL, AL_ROMAN,"cp852",
254   "Apple Macintosh Latin", 256, FC_APPQD,   NULL, AL_ROMAN,"macintosh-latin",
255   "Data General International",256,FC_DGMCS,NULL,AL_ROMAN,"dg-international",
256   "Hewlett Packard Roman8",    256, FC_HPR8,    NULL, AL_ROMAN, "hp-roman8",
257   "ISO 8859-5 Latin/Cyrillic", 256, FC_CYRILL,  NULL, AL_CYRIL,"cyrillic-iso",
258   "CP866 Cyrillic",            256, FC_CP866,   NULL, AL_CYRIL,"cp866",
259   "Short KOI",                 128, FC_KOI7,    NULL, AL_CYRIL,"short-koi",
260   "Old KOI-8 Cyrillic",        256, FC_KOI8,    NULL, AL_CYRIL,"koi8-cyrillic",
261   "Japanese JIS7",        16384, FC_JIS7,    NULL, AL_JAPAN, "jis7-kanji",
262   "Japanese Shift JIS",   16384, FC_SHJIS,   NULL, AL_JAPAN, "shift-jis-kanji",
263   "Japanese EUC",         16384, FC_JEUC,    NULL, AL_JAPAN, "euc-jp",
264   "Japanese DEC Kanji",   16384, FC_JDEC,    NULL, AL_JAPAN, "dec-kanji",
265   "Hebrew-7 DEC",           128, FC_HE7,     NULL, AL_HEBREW, "hebrew-7",
266   "ISO 8859-8 Latin/Hebrew",256, FC_HEBREW,  NULL, AL_HEBREW, "hebrew-iso",
267   "CP862 Hebrew",           256, FC_CP862,   NULL, AL_HEBREW, "cp862-hebrew",
268   "ELOT 927 Greek",         128, FC_ELOT,    NULL, AL_GREEK, "elot927-greek",
269   "ISO 8859-7 Latin/Greek", 256, FC_GREEK,   NULL, AL_GREEK, "greek-iso",
270   "CP869 Greek",            256, FC_CP869,   NULL, AL_GREEK, "cp869-greek",
271   "ISO 8859-15 Latin-9",    256, FC_9LATIN,  NULL, AL_ROMAN, "latin9-iso",
272   "PC Code Page 858",       256, FC_CP850,   NULL, AL_ROMAN, "cp858",
273   "PC Code Page 855",       256, FC_CP855,   NULL, AL_CYRIL, "cp855-cyrillic",
274   "Windows Code Page 1251", 256, FC_CP1251,  NULL, AL_CYRIL, "cp1251-cyrillic",
275   "Bulgarian PC Code Page", 256, FC_BULGAR,  NULL, AL_CYRIL, "bulgaria-pc",
276   "Windows Code Page 1250", 256, FC_CP1250,  NULL, AL_ROMAN, "cp1250",
277   "Polish Mazovia PC Code Page", 256, FC_MAZOVIA, NULL, AL_ROMAN, "mazovia-pc",
278   "ISO 10646 / Unicode UCS-2", 64000, FC_UCS2, NULL, AL_UNIV, "ucs2",
279   "ISO 10646 / Unicode UTF-8", 64000, FC_UCS2, NULL, AL_UNIV, "utf8",
280   "KOI8-R Russian+Boxdrawing",256,  FC_KOI8R, NULL, AL_CYRIL,"koi8r",
281   "KOI8-U Ukrainian+Boxdrawing",256,FC_KOI8U, NULL, AL_CYRIL,"koi8u",
282   "Windows Code Page 1252", 256, FC_CP1252,  NULL, AL_ROMAN, "cp1252",
283   "",0,0,NULL,0,NULL
284 };
285
286 /* Local file character sets */
287 /* Includes 7-bit National Replacement Character Sets of ISO 646 */
288 /* Plus ISO Latin-1, DEC Multinational Character Set (MCS), NeXT char set, */
289 /* Various PC and Windows code pages, etc. */
290
291 struct keytab fcstab[] = { /* Keyword table for 'set file character-set' */
292 /*
293   IMPORTANT: This table is replicated below as ttcstab (terminal character
294   set table).  The only differences are the addition of TRANSPARENT
295   and the removal of the Kanji sets, which are not supported yet.
296   If you make changes to this table, also change ttcstab.
297 */
298
299 /* Keyword             Value       Flags */
300     "apple-quickdraw",    FC_APPQD,   CM_INV, /* Apple Quickdraw */
301     "ascii",              FC_USASCII, 0, /* ASCII */
302     "british",            FC_UKASCII, 0, /* British NRC */
303     "bulgaria-pc",        FC_BULGAR,  0, /* Bulgarian PC Code Page */
304     "canadian-french",    FC_FCASCII, 0, /* French Canadian NRC */
305 #ifdef LATIN2
306     "cp1250",             FC_CP1250,  0, /* Windows CP 1250 */
307 #endif /* LATIN2 */
308 #ifdef CYRILLIC
309     "cp1251-cyrillic",    FC_CP1251,  0, /* Windows CP 1251 */
310 #endif /* CYRILLIC */
311     "cp1252",             FC_CP1252,  0, /* Windows CP 1252 */
312     "cp437",              FC_CP437,   0, /* PC CP437 */
313     "cp850",              FC_CP850,   0, /* PC CP850 */
314 #ifdef LATIN2
315     "cp852",              FC_CP852,   0, /* PC CP852 */
316 #endif /* LATIN2 */
317 #ifdef CYRILLIC
318     "cp855-cyrillic",     FC_CP855,   0, /* PC CP855 */
319 #endif /* CYRILLIC */
320     "cp858",              FC_CP858,   0, /* PC CP858 */
321 #ifdef HEBREW
322     "cp862-hebrew",       FC_CP862,   0, /* PC CP862 */
323 #endif /* HEBREW */
324 #ifdef CYRILLIC
325     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
326 #endif /* CYRILLIC */
327 #ifdef GREEK
328     "cp869-greek",        FC_CP869,   0, /* CP869 Greek */
329 #endif /* GREEK */
330 #ifdef CYRILLIC
331     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
332 #endif /* CYRILLIC */
333     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
334 #ifdef KANJI
335     "dec-kanji",          FC_JDEC,    0, /* Japanese DEC Kanji */
336 #endif /* KANJI */
337     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
338     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
339     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
340 #ifdef GREEK
341     "elot927-greek",      FC_ELOT,    0, /* ELOT 927 Greek */
342     "elot928-greek",      FC_GREEK,   0, /* Same as ISO 8859-7 Latin/Greek */
343 #endif /* GREEK */
344 #ifdef KANJI
345     "euc-jp",             FC_JEUC,    0, /* Japanese EUC */
346 #endif /* KANJI */
347     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
348     "french",             FC_FRASCII, 0, /* French NRC */
349     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
350     "german",             FC_GEASCII, 0, /* German NRC */
351 #ifdef GREEK
352     "greek-iso",          FC_GREEK,   0, /* ISO 8859-7 Latin/Greek */
353 #endif /* GREEK */
354 #ifdef HEBREW
355     "he",                 FC_HEBREW,  CM_ABR|CM_INV,
356     "heb",                FC_HEBREW,  CM_ABR|CM_INV,
357     "hebr",               FC_HEBREW,  CM_ABR|CM_INV,
358     "hebre",              FC_HEBREW,  CM_ABR|CM_INV,
359     "hebrew",             FC_HEBREW,  CM_ABR|CM_INV,
360     "hebrew-7",           FC_HE7,     0, /* DEC 7-Bit Hebrew */
361     "hebrew-iso",         FC_HEBREW,  0, /* ISO Latin/Hebrew */
362 #endif /* HEBREW */
363     "hp-roman8",          FC_HPR8,    0, /* Hewlett Packard Roman8 */
364     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
365 #ifdef KANJI
366     "iso2022jp-kanji",    FC_JIS7,    0, /* Synonym for JIS-7 */
367 #endif /* KANJI */
368     "italian",            FC_ITASCII, 0, /* Italian NRC */
369 #ifdef KANJI
370     "japanese-euc",       FC_JEUC,    CM_INV, /* Japanese EUC */
371     "jis7-kanji",         FC_JIS7,    0, /* Japanese JIS7 7bit code */
372 #endif /* KANJI */
373 #ifdef CYRILLIC
374     "k",                  FC_KOI8,    CM_ABR|CM_INV,
375     "ko",                 FC_KOI8,    CM_ABR|CM_INV,
376     "koi",                FC_KOI8,    CM_ABR|CM_INV,
377     "koi8",               FC_KOI8,    0, /* Old KOI-8 Cyrillic */
378     "koi8-cyrillic",      FC_KOI8,    CM_INV,
379     "koi8r",              FC_KOI8R,   0, /* KOI8-R RFC1489 */
380     "koi8u",              FC_KOI8U,   0, /* KOI8-U RFC2319 */
381 #endif /* CYRILLIC */
382     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
383     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
384     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
385     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
386     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
387     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
388 #ifdef LATIN2
389     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
390 #endif /* LATIN2 */
391     "latin9-iso",         FC_9LATIN,  0, /* ISO Latin Alphabet 9 */
392     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin" */
393 #ifdef LATIN2
394     "mazovia-pc",         FC_MAZOVIA, 0, /* Polish Mazovia PC code page */
395 #endif /* LATIN2 */
396     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
397     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
398     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
399 #ifdef KANJI
400     "shift-jis-kanji",    FC_SHJIS,   0, /* Japanese Kanji Shift-JIS */
401 #endif /* KANJI */
402 #ifdef CYRILLIC
403     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
404 #endif /* CYRILLIC */
405     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
406     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
407     "swiss",              FC_CHASCII, 0, /* Swiss NRC */
408 #ifdef UNICODE
409     "ucs2",               FC_UCS2,    0, /* ISO 10646 / Unicode UCS-2 */
410     "utf8",               FC_UTF8,    0, /* ISO 10646 / Unicode UTF-8 */
411 #endif /* UNICODE */
412     "", 0, 0
413 };
414 int nfilc = (sizeof(fcstab) / sizeof(struct keytab)) - 1;
415
416 struct keytab ttcstab[] = { /* Keyword table for SET TERMINAL CHARACTER-SET */
417 /*
418   IMPORTANT: This table is a replica of fcstab, immediately above, with the
419   addition of TRANSPARENT and deletion of the Japanese sets.  If you make
420   changes to this table, make the corresponding changes to fcstab.
421 */
422 /* Keyword               Value       Flags */
423     "apple-quickdraw",    FC_APPQD,   CM_INV, /* Apple Quickdraw */
424     "ascii",              FC_USASCII, 0, /* ASCII */
425     "british",            FC_UKASCII, 0, /* British NRC */
426     "bulgaria-pc",        FC_BULGAR,  0, /* Bulgarian PC Code Page */
427     "canadian-french",    FC_FCASCII, 0, /* French Canadian NRC */
428 #ifdef LATIN2
429     "cp1250",             FC_CP1250,  0, /* Windows CP 1250 */
430 #endif /* LATIN2 */
431 #ifdef CYRILLIC
432     "cp1251-cyrillic",    FC_CP1251,  0, /* Windows CP 1251 */
433 #endif /* CYRILLIC */
434     "cp1252",             FC_CP1252,  0, /* Windows CP 1252 */
435     "cp437",              FC_CP437,   0, /* IBM CP437 */
436     "cp850",              FC_CP850,   0, /* IBM CP850 */
437 #ifdef LATIN2
438     "cp852",              FC_CP852,   0, /* IBM CP852 */
439 #endif /* LATIN2 */
440 #ifdef CYRILLIC
441     "cp855-cyrillic",     FC_CP855,   0, /* PC CP855 */
442 #endif /* CYRILLIC */
443     "cp858",              FC_CP858,   0, /* PC CP858 */
444 #ifdef HEBREW
445     "cp862-hebrew",       FC_CP862,   0, /* PC CP862 */
446 #endif /* HEBREW */
447 #ifdef CYRILLIC
448     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
449 #endif /* CYRILLIC */
450 #ifdef GREEK
451     "cp869-greek",        FC_CP869,   0, /* CP869 Greek */
452 #endif /* GREEK */
453 #ifdef CYRILLIC
454     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
455 #endif /* CYRILLIC */
456     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
457 #ifdef COMMENT
458 #ifdef KANJI
459     "dec-kanji",          FC_JDEC,    0, /* Japanese DEC Kanji */
460 #endif /* KANJI */
461 #endif /* COMMENT */
462     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
463     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
464     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
465 #ifdef GREEK
466     "elot927-greek",      FC_ELOT,    0, /* ELOT 927 Greek */
467     "elot928-greek",      FC_GREEK,   0, /* Same as ISO 8859-7 Latin/Greek */
468 #endif /* GREEK */
469     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
470     "french",             FC_FRASCII, 0, /* French NRC */
471     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
472     "german",             FC_GEASCII, 0, /* German NRC */
473 #ifdef GREEK
474     "greek-iso",          FC_GREEK,   0, /* ISO 8859-7 Latin/Greek */
475 #endif /* GREEK */
476 #ifdef HEBREW
477     "he",                 FC_HEBREW,  CM_ABR|CM_INV,
478     "heb",                FC_HEBREW,  CM_ABR|CM_INV,
479     "hebr",               FC_HEBREW,  CM_ABR|CM_INV,
480     "hebre",              FC_HEBREW,  CM_ABR|CM_INV,
481     "hebrew",             FC_HEBREW,  CM_ABR|CM_INV,
482     "hebrew-7",           FC_HE7,     0, /* DEC 7-Bit Hebrew */
483     "hebrew-iso",         FC_HEBREW,  0, /* ISO Latin/Hebrew */
484 #endif /* HEBREW */
485     "hp-roman8",          FC_HPR8,    0, /* Hewlett Packard Roman8 */
486     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
487     "italian",            FC_ITASCII, 0, /* Italian NRC */
488 #ifdef COMMENT
489 /* Kanji terminal character sets not implemented yet */
490 #ifdef KANJI
491     "japanese-euc",       FC_JEUC,    0, /* Japanese EUC */
492     "jis7-kanji",         FC_JIS7,    0, /* Japanese JIS7 7bit code */
493 #endif /* KANJI */
494 #endif /* COMMENT */
495 #ifdef CYRILLIC
496     "k",                  FC_KOI8,    CM_ABR|CM_INV,
497     "ko",                 FC_KOI8,    CM_ABR|CM_INV,
498     "koi",                FC_KOI8,    CM_ABR|CM_INV,
499     "koi8",               FC_KOI8,    0, /* Old KOI-8 Cyrillic */
500     "koi8-cyrillic",      FC_KOI8,    CM_INV,
501     "koi8r",              FC_KOI8R,   0, /* KOI8-R RFC1489 */
502     "koi8u",              FC_KOI8U,   0, /* KOI8-U RFC2319 */
503 #endif /* CYRILLIC */
504     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
505     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
506     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
507     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
508     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
509     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
510 #ifdef LATIN2
511     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
512 #endif /* LATIN2 */
513     "latin9-iso",         FC_9LATIN,  0, /* ISO Latin Alphabet 9 */
514     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin */
515 #ifdef LATIN2
516     "mazovia-pc",         FC_MAZOVIA, 0, /* Polish Mazovia PC code page */
517 #endif /* LATIN2 */
518     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
519     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
520     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
521 #ifdef COMMENT
522 /* Kanji terminal character sets not implemented yet. */
523 #ifdef KANJI
524     "shift-jis-kanji",    FC_SHJIS,   0, /* Japanese Kanji Shift-JIS */
525 #endif /* KANJI */
526 #endif /* COMMENT */
527 #ifdef CYRILLIC
528     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
529 #endif /* CYRILLIC */
530     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
531     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
532     "swiss",              FC_CHASCII, 0, /* Swiss NRC */
533     "transparent",        FC_TRANSP,  0, /* Transparent */
534 #ifdef UNICODE
535     "utf8",               FC_UTF8,    0, /* ISO 10646 / Unicode UTF-8 */
536 #endif /* UNICODE */
537     "", 0, 0
538 };
539 int ntermc = (sizeof(ttcstab) / sizeof(struct keytab)) - 1;
540
541 /* This table contains the equivalent FCS number for each TCS. */
542 /* If the TC_xxx symbol definitions are ever changed, fix this table. */
543 /* Ditto if another TCS is added. */
544
545 int
546 cseqtab[MAXTCSETS+1] = {                /* TCS/FCS equivalency table */
547     -1,                                 /*  0 = Transparent */
548     FC_USASCII,                         /*  1 = ASCII */
549     FC_1LATIN,                          /*  2 = Latin-1 */
550     FC_2LATIN,                          /*  3 = Latin-2 */
551     FC_CYRILL,                          /*  4 = Latin/Cyrillic */
552     FC_JEUC,                            /*  5 = Japanese EUC */
553     FC_HEBREW,                          /*  6 = Latin/Hebrew */
554     FC_GREEK,                           /*  7 = Latin/Greek */
555     FC_9LATIN,                          /*  8 = Latin-9 */
556     FC_UCS2,                            /*  9 = UCS-2 */
557     FC_UTF8                             /* 10 = UTF-8 */
558 };
559
560 /*
561  Languages:
562
563  This table allows C-Kermit to have a SET LANGUAGE command to apply special
564  language-specific rules when translating from a character set that contains
565  national characters into plain ASCII, like German umlaut-a becomes ae.
566
567  Originally, I thought it would be a good idea to let SET LANGUAGE also select
568  an appropriate FILE CHARACTER-SET and TRANSFER CHARACTER-SET automatically,
569  and these are included in the langinfo structure.  Later I realized that this
570  was a bad idea.  Any particular language (e.g. Dutch) can be represented by
571  many different and incompatible character sets.
572
573  (But we could use the new (1998) ASSOCIATE command for this...)
574 */
575
576 struct langinfo langs[] = {
577 /*  Language code   File Charset Xfer Charset Name */
578     L_USASCII,      FC_USASCII,  TC_USASCII,  "ASCII (American English)",
579     L_DANISH,       FC_NOASCII,  TC_1LATIN,   "Danish",
580     L_DUTCH,        FC_DUASCII,  TC_1LATIN,   "Dutch",
581     L_FINNISH,      FC_FIASCII,  TC_1LATIN,   "Finnish",
582     L_FRENCH,       FC_FRASCII,  TC_1LATIN,   "French",
583     L_GERMAN,       FC_GEASCII,  TC_1LATIN,   "German",
584 #ifdef GREEK
585     L_GREEK,        FC_GREEK,    TC_GREEK,    "Greek",
586 #endif /* GREEK */
587 #ifdef HEBREW
588     L_HEBREW,       FC_HEBREW,   TC_HEBREW,   "Hebrew",
589 #endif /* HEBREW */
590     L_HUNGARIAN,    FC_HUASCII,  TC_2LATIN,   "Hungarian",
591     L_ICELANDIC,    FC_USASCII,  TC_1LATIN,   "Icelandic",
592     L_ITALIAN,      FC_ITASCII,  TC_1LATIN,   "Italian",
593 #ifdef KANJI
594     L_JAPANESE,     FC_JEUC,     TC_JEUC,     "Japanese",
595 #endif /* KANJI */
596     L_NORWEGIAN,    FC_NOASCII,  TC_1LATIN,   "Norwegian",
597     L_PORTUGUESE,   FC_POASCII,  TC_1LATIN,   "Portuguese",
598 #ifdef CYRILLIC
599     L_RUSSIAN,      FC_CP866,    TC_CYRILL,   "Russian",
600 #endif /* CYRILLIC */
601     L_SPANISH,      FC_SPASCII,  TC_1LATIN,   "Spanish",
602     L_SWEDISH,      FC_SWASCII,  TC_1LATIN,   "Swedish",
603     L_SWISS,        FC_CHASCII,  TC_1LATIN,   "Swiss"
604 };
605 int nlangs = (sizeof(langs) / sizeof(struct langinfo));
606
607 /*
608   Keyword table for the SET LANGUAGE command.
609   Only a few of these (German, Scandinavian, etc) actually do anything.
610   The language is used to invoke special translation rules when converting
611   from an 8-bit character set to ASCII; for example, German u-diaeresis
612   becomes "ue", Dutch y-diaeresis becomes "ij".  Languages without associated
613   rules are invisible (CM_INV).
614 */
615 struct keytab lngtab[] = {
616     "ascii",            L_USASCII,    CM_INV,
617     "danish",           L_DANISH,     0,
618     "dutch",            L_DUTCH,      0,
619     "english",          L_USASCII,    CM_INV,
620     "finnish",          L_FINNISH,    0,
621     "french",           L_FRENCH,     0,
622     "german",           L_GERMAN,     0,
623 #ifdef GREEK
624     "greek",            L_GREEK,      CM_INV,
625 #endif /* GREEK */
626 #ifdef HEBREW
627     "hebrew",           L_HEBREW,     CM_INV,
628 #endif /* HEBREW */
629     "hungarian",        L_HUNGARIAN,  CM_INV,
630     "icelandic",        L_ICELANDIC,  0,
631     "italian",          L_ITALIAN,    CM_INV,
632 #ifdef KANJI
633     "japanese",         L_JAPANESE,   CM_INV,
634 #endif /* KANJI */
635     "norwegian",        L_NORWEGIAN,  0,
636     "none",             L_USASCII,    0,
637     "portuguese",       L_PORTUGUESE, CM_INV,
638 #ifdef CYRILLIC
639     "russian",          L_RUSSIAN,    0,
640 #endif /* CYRILLIC */
641     "spanish",          L_SPANISH,    CM_INV,
642     "swedish",          L_SWEDISH,    0,
643 #ifdef CYRILLIC
644     "ukrainian",        L_RUSSIAN,    0,
645 #endif /* CYRILLIC */
646     "", 0, 0
647 };
648 int nlng = (sizeof(lngtab) / sizeof(struct keytab)) - 1; /* how many */
649
650
651 /* Translation tables ... */
652
653 /*
654   For each pair of (transfer,file) character sets, we need two translation
655   functions, one for sending, one for receiving.
656 */
657
658 /*
659   Here is the first table, Latin-1 to ASCII, fully annotated...
660   This one is absolutely NOT invertible, since we're going from an 8-bit
661   set to a 7-bit set.  Accented letters are mapped to unaccented
662   equivalents, C1 control characters are all translated to "?", etc.
663 */
664 CONST CHAR
665 yl1as[] = {  /* ISO 8859-1 Latin Alphabet 1 to US ASCII */
666       /*  Source character    Description               => Translation */
667       /*  Dec row/col Set                                           */
668   0,  /*  000  00/00  C0 NUL  Ctrl-@                    =>  (self)  */
669   1,  /*  001  00/01  C0 SOH  Ctrl-A                    =>  (self)  */
670   2,  /*  002  00/02  C0 STX  Ctrl-B                    =>  (self)  */
671   3,  /*  003  00/03  C0 ETX  Ctrl-C                    =>  (self)  */
672   4,  /*  004  00/04  C0 EOT  Ctrl-D                    =>  (self)  */
673   5,  /*  005  00/05  C0 ENQ  Ctrl-E                    =>  (self)  */
674   6,  /*  006  00/06  C0 ACK  Ctrl-F                    =>  (self)  */
675   7,  /*  007  00/07  C0 BEL  Ctrl-G                    =>  (self)  */
676   8,  /*  008  00/08  C0 BS   Ctrl-H                    =>  (self)  */
677   9,  /*  009  00/09  C0 HT   Ctrl-I                    =>  (self)  */
678  10,  /*  010  00/10  C0 LF   Ctrl-J                    =>  (self)  */
679  11,  /*  011  00/11  C0 VT   Ctrl-K                    =>  (self)  */
680  12,  /*  012  00/12  C0 FF   Ctrl-L                    =>  (self)  */
681  13,  /*  013  00/13  C0 CR   Ctrl-M                    =>  (self)  */
682  14,  /*  014  00/14  C0 SO   Ctrl-N                    =>  (self)  */
683  15,  /*  015  00/15  C0 SI   Ctrl-O                    =>  (self)  */
684  16,  /*  016  01/00  C0 DLE  Ctrl-P                    =>  (self)  */
685  17,  /*  017  01/01  C0 DC1  Ctrl-Q                    =>  (self)  */
686  18,  /*  018  01/02  C0 DC2  Ctrl-R                    =>  (self)  */
687  19,  /*  019  01/03  C0 DC3  Ctrl-S                    =>  (self)  */
688  20,  /*  020  01/04  C0 DC4  Ctrl-T                    =>  (self)  */
689  21,  /*  021  01/05  C0 NAK  Ctrl-U                    =>  (self)  */
690  22,  /*  022  01/06  C0 SYN  Ctrl-V                    =>  (self)  */
691  23,  /*  023  01/07  C0 ETB  Ctrl-W                    =>  (self)  */
692  24,  /*  024  01/08  C0 CAN  Ctrl-X                    =>  (self)  */
693  25,  /*  025  01/09  C0 EM   Ctrl-Y                    =>  (self)  */
694  26,  /*  026  01/10  C0 SUB  Ctrl-Z                    =>  (self)  */
695  27,  /*  027  01/11  C0 ESC  Ctrl-[                    =>  (self)  */
696  28,  /*  028  01/12  C0 FS   Ctrl-\                    =>  (self)  */
697  29,  /*  029  01/13  C0 GS   Ctrl-]                    =>  (self)  */
698  30,  /*  030  01/14  C0 RS   Ctrl-^                    =>  (self)  */
699  31,  /*  031  01/15  C0 US   Ctrl-_                    =>  (self)  */
700  32,  /*  032  02/00     SP   Space                     =>  (self)  */
701  33,  /*  033  02/01  G0 !    Exclamation mark          =>  (self)  */
702  34,  /*  034  02/02  G0 "    Doublequote               =>  (self)  */
703  35,  /*  035  02/03  G0 #    Number sign               =>  (self)  */
704  36,  /*  036  02/04  G0 $    Dollar sign               =>  (self)  */
705  37,  /*  037  02/05  G0 %    Percent sign              =>  (self)  */
706  38,  /*  038  02/06  G0 &    Ampersand                 =>  (self)  */
707  39,  /*  039  02/07  G0 '    Apostrophe                =>  (self)  */
708  40,  /*  040  02/08  G0 (    Left parenthesis          =>  (self)  */
709  41,  /*  041  02/09  G0 )    Right parenthesis         =>  (self)  */
710  42,  /*  042  02/10  G0 *    Asterisk                  =>  (self)  */
711  43,  /*  043  02/11  G0 +    Plus sign                 =>  (self)  */
712  44,  /*  044  02/12  G0 ,    Comma                     =>  (self)  */
713  45,  /*  045  02/13  G0 -    Hyphen, minus sign        =>  (self)  */
714  46,  /*  046  02/14  G0 .    Period, full stop         =>  (self)  */
715  47,  /*  047  02/15  G0 /    Slash, solidus            =>  (self)  */
716  48,  /*  048  03/00  G0 0    Digit 0                   =>  (self)  */
717  49,  /*  049  03/01  G0 1    Digit 1                   =>  (self)  */
718  50,  /*  050  03/02  G0 2    Digit 2                   =>  (self)  */
719  51,  /*  051  03/03  G0 3    Digit 3                   =>  (self)  */
720  52,  /*  052  03/04  G0 4    Digit 4                   =>  (self)  */
721  53,  /*  053  03/05  G0 5    Digit 5                   =>  (self)  */
722  54,  /*  054  03/06  G0 6    Digit 6                   =>  (self)  */
723  55,  /*  055  03/07  G0 7    Digit 7                   =>  (self)  */
724  56,  /*  056  03/08  G0 8    Digit 8                   =>  (self)  */
725  57,  /*  057  03/09  G0 9    Digit 9                   =>  (self)  */
726  58,  /*  058  03/10  G0 :    Colon                     =>  (self)  */
727  59,  /*  059  03/11  G0 ;    Semicolon                 =>  (self)  */
728  60,  /*  060  03/12  G0 <    Less-than sign            =>  (self)  */
729  61,  /*  061  03/13  G0 =    Equals sign               =>  (self)  */
730  62,  /*  062  03/14  G0 >    Greater-than sign         =>  (self)  */
731  63,  /*  063  03/15  G0 ?    Question mark             =>  (self)  */
732  64,  /*  064  04/00  G0 @    Commercial at sign        =>  (self)  */
733  65,  /*  065  04/01  G0 A    Letter A                  =>  (self)  */
734  66,  /*  066  04/02  G0 B    Letter B                  =>  (self)  */
735  67,  /*  067  04/03  G0 C    Letter C                  =>  (self)  */
736  68,  /*  068  04/04  G0 D    Letter D                  =>  (self)  */
737  69,  /*  069  04/05  G0 E    Letter E                  =>  (self)  */
738  70,  /*  070  04/06  G0 F    Letter F                  =>  (self)  */
739  71,  /*  071  04/07  G0 G    Letter G                  =>  (self)  */
740  72,  /*  072  04/08  G0 H    Letter H                  =>  (self)  */
741  73,  /*  073  04/09  G0 I    Letter I                  =>  (self)  */
742  74,  /*  074  04/10  G0 J    Letter J                  =>  (self)  */
743  75,  /*  075  04/11  G0 K    Letter K                  =>  (self)  */
744  76,  /*  076  04/12  G0 L    Letter L                  =>  (self)  */
745  77,  /*  077  04/13  G0 M    Letter M                  =>  (self)  */
746  78,  /*  078  04/14  G0 N    Letter N                  =>  (self)  */
747  79,  /*  079  04/15  G0 O    Letter O                  =>  (self)  */
748  80,  /*  080  05/00  G0 P    Letter P                  =>  (self)  */
749  81,  /*  081  05/01  G0 Q    Letter Q                  =>  (self)  */
750  82,  /*  082  05/02  G0 R    Letter R                  =>  (self)  */
751  83,  /*  083  05/03  G0 S    Letter S                  =>  (self)  */
752  84,  /*  084  05/04  G0 T    Letter T                  =>  (self)  */
753  85,  /*  085  05/05  G0 U    Letter U                  =>  (self)  */
754  86,  /*  086  05/06  G0 V    Letter V                  =>  (self)  */
755  87,  /*  087  05/07  G0 W    Letter W                  =>  (self)  */
756  88,  /*  088  05/08  G0 X    Letter X                  =>  (self)  */
757  89,  /*  089  05/09  G0 Y    Letter Y                  =>  (self)  */
758  90,  /*  090  05/10  G0 Z    Letter Z                  =>  (self)  */
759  91,  /*  091  05/11  G0 [    Left square bracket       =>  (self)  */
760  92,  /*  092  05/12  G0 \    Reverse slash             =>  (self)  */
761  93,  /*  093  05/13  G0 ]    Right square bracket      =>  (self)  */
762  94,  /*  094  05/14  G0 ^    Circumflex accent         =>  (self)  */
763  95,  /*  095  05/15  G0 _    Underline, low line       =>  (self)  */
764  96,  /*  096  06/00  G0 `    Grave accent              =>  (self)  */
765  97,  /*  097  06/01  G0 a    Letter a                  =>  (self)  */
766  98,  /*  098  06/02  G0 b    Letter b                  =>  (self)  */
767  99,  /*  099  06/03  G0 c    Letter c                  =>  (self)  */
768 100,  /*  100  06/04  G0 d    Letter d                  =>  (self)  */
769 101,  /*  101  06/05  G0 e    Letter e                  =>  (self)  */
770 102,  /*  102  06/06  G0 f    Letter f                  =>  (self)  */
771 103,  /*  103  06/07  G0 g    Letter g                  =>  (self)  */
772 104,  /*  104  06/08  G0 h    Letter h                  =>  (self)  */
773 105,  /*  105  06/09  G0 i    Letter i                  =>  (self)  */
774 106,  /*  106  06/10  G0 j    Letter j                  =>  (self)  */
775 107,  /*  107  06/11  G0 k    Letter k                  =>  (self)  */
776 108,  /*  108  06/12  G0 l    Letter l                  =>  (self)  */
777 109,  /*  109  06/13  G0 m    Letter m                  =>  (self)  */
778 110,  /*  110  06/14  G0 n    Letter n                  =>  (self)  */
779 111,  /*  111  06/15  G0 o    Letter o                  =>  (self)  */
780 112,  /*  112  07/00  G0 p    Letter p                  =>  (self)  */
781 113,  /*  113  07/01  G0 q    Letter q                  =>  (self)  */
782 114,  /*  114  07/02  G0 r    Letter r                  =>  (self)  */
783 115,  /*  115  07/03  G0 s    Letter s                  =>  (self)  */
784 116,  /*  116  07/04  G0 t    Letter t                  =>  (self)  */
785 117,  /*  117  07/05  G0 u    Letter u                  =>  (self)  */
786 118,  /*  118  07/06  G0 v    Letter v                  =>  (self)  */
787 119,  /*  119  07/07  G0 w    Letter w                  =>  (self)  */
788 120,  /*  120  07/08  G0 x    Letter x                  =>  (self)  */
789 121,  /*  121  07/09  G0 y    Letter y                  =>  (self)  */
790 122,  /*  122  07/10  G0 z    Letter z                  =>  (self)  */
791 123,  /*  123  07/11  G0 {    Left curly bracket        =>  (self)  */
792 124,  /*  124  07/12  G0 |    Vertical bar              =>  (self)  */
793 125,  /*  125  07/13  G0 }    Right curly bracket       =>  (self)  */
794 126,  /*  126  07/14  G0 ~    Tilde                     =>  (self)  */
795 127,  /*  127  07/15     DEL  Delete, Rubout            =>  (self)  */
796 UNK,  /*  128  08/00  C1                                =>  UNK     */
797 UNK,  /*  129  08/01  C1                                =>  UNK     */
798 UNK,  /*  130  08/02  C1                                =>  UNK     */
799 UNK,  /*  131  08/03  C1                                =>  UNK     */
800 UNK,  /*  132  08/04  C1 IND                            =>  UNK     */
801 UNK,  /*  133  08/05  C1 NEL                            =>  UNK     */
802 UNK,  /*  134  08/06  C1 SSA                            =>  UNK     */
803 UNK,  /*  135  08/07  C1 ESA                            =>  UNK     */
804 UNK,  /*  136  08/08  C1 HTS                            =>  UNK     */
805 UNK,  /*  137  08/09  C1                                =>  UNK     */
806 UNK,  /*  138  08/10  C1                                =>  UNK     */
807 UNK,  /*  139  08/11  C1                                =>  UNK     */
808 UNK,  /*  140  08/12  C1                                =>  UNK     */
809 UNK,  /*  141  08/13  C1 RI                             =>  UNK     */
810 UNK,  /*  142  08/14  C1 SS2                            =>  UNK     */
811 UNK,  /*  143  08/15  C1 SS3                            =>  UNK     */
812 UNK,  /*  144  09/00  C1 DCS                            =>  UNK     */
813 UNK,  /*  145  09/01  C1                                =>  UNK     */
814 UNK,  /*  146  09/02  C1                                =>  UNK     */
815 UNK,  /*  147  09/03  C1 STS                            =>  UNK     */
816 UNK,  /*  148  09/04  C1                                =>  UNK     */
817 UNK,  /*  149  09/05  C1                                =>  UNK     */
818 UNK,  /*  150  09/06  C1 SPA                            =>  UNK     */
819 UNK,  /*  151  09/07  C1 EPA                            =>  UNK     */
820 UNK,  /*  152  09/08  C1                                =>  UNK     */
821 UNK,  /*  153  09/09  C1                                =>  UNK     */
822 UNK,  /*  154  09/10  C1                                =>  UNK     */
823 UNK,  /*  155  09/11  C1 CSI                            =>  UNK     */
824 UNK,  /*  156  09/12  C1 ST                             =>  UNK     */
825 UNK,  /*  157  09/13  C1 OSC                            =>  UNK     */
826 UNK,  /*  158  09/14  C1 PM                             =>  UNK     */
827 UNK,  /*  159  09/15  C1 APC                            =>  UNK     */
828  32,  /*  160  10/00  G1      No-break space            =>  SP      */
829  33,  /*  161  10/01  G1      Inverted exclamation      =>  !       */
830  99,  /*  162  10/02  G1      Cent sign                 =>  c       */
831  35,  /*  163  10/03  G1      Pound sign                =>  #       */
832  36,  /*  164  10/04  G1      Currency sign             =>  $       */
833  89,  /*  165  10/05  G1      Yen sign                  =>  Y       */
834 124,  /*  166  10/06  G1      Broken bar                =>  |       */
835  80,  /*  167  10/07  G1      Paragraph sign            =>  P       */
836  34,  /*  168  10/08  G1      Diaeresis                 =>  "       */
837  67,  /*  169  10/09  G1      Copyright sign            =>  C       */
838  97,  /*  170  10/10  G1      Feminine ordinal          =>  a       */
839  34,  /*  171  10/11  G1      Left angle quotation      =>  "       */
840 126,  /*  172  10/12  G1      Not sign                  =>  ~       */
841  45,  /*  173  10/13  G1      Soft hyphen               =>  -       */
842  82,  /*  174  10/14  G1      Registered trade mark     =>  R       */
843  95,  /*  175  10/15  G1      Macron                    =>  _       */
844 111,  /*  176  11/00  G1      Degree sign, ring above   =>  o       */
845 UNK,  /*  177  11/01  G1      Plus-minus sign           =>  UNK     */
846  50,  /*  178  11/02  G1      Superscript two           =>  2       */
847  51,  /*  179  11/03  G1      Superscript three         =>  3       */
848  39,  /*  180  11/04  G1      Acute accent              =>  '       */
849 117,  /*  181  11/05  G1      Micro sign                =>  u       */
850  45,  /*  182  11/06  G1      Pilcrow sign              =>  -       */
851  45,  /*  183  11/07  G1      Middle dot                =>  -       */
852  44,  /*  184  11/08  G1      Cedilla                   =>  ,       */
853  49,  /*  185  11/09  G1      Superscript one           =>  1       */
854 111,  /*  186  11/10  G1      Masculine ordinal         =>  o       */
855  34,  /*  187  11/11  G1      Right angle quotation     =>  "       */
856 UNK,  /*  188  11/12  G1      One quarter               =>  UNK     */
857 UNK,  /*  189  11/13  G1      One half                  =>  UNK     */
858 UNK,  /*  190  11/14  G1      Three quarters            =>  UNK     */
859  63,  /*  191  11/15  G1      Inverted question mark    =>  ?       */
860  65,  /*  192  12/00  G1      A grave                   =>  A       */
861  65,  /*  193  12/01  G1      A acute                   =>  A       */
862  65,  /*  194  12/02  G1      A circumflex              =>  A       */
863  65,  /*  195  12/03  G1      A tilde                   =>  A       */
864  65,  /*  196  12/04  G1      A diaeresis               =>  A       */
865  65,  /*  197  12/05  G1      A ring above              =>  A       */
866  65,  /*  198  12/06  G1      A with E                  =>  A       */
867  67,  /*  199  12/07  G1      C Cedilla                 =>  C       */
868  69,  /*  200  12/08  G1      E grave                   =>  E       */
869  69,  /*  201  12/09  G1      E acute                   =>  E       */
870  69,  /*  202  12/10  G1      E circumflex              =>  E       */
871  69,  /*  203  12/11  G1      E diaeresis               =>  E       */
872  73,  /*  204  12/12  G1      I grave                   =>  I       */
873  73,  /*  205  12/13  G1      I acute                   =>  I       */
874  73,  /*  206  12/14  G1      I circumflex              =>  I       */
875  73,  /*  207  12/15  G1      I diaeresis               =>  I       */
876  68,  /*  208  13/00  G1      Icelandic Eth             =>  D       */
877  78,  /*  209  13/01  G1      N tilde                   =>  N       */
878  79,  /*  210  13/02  G1      O grave                   =>  O       */
879  79,  /*  211  13/03  G1      O acute                   =>  O       */
880  79,  /*  212  13/04  G1      O circumflex              =>  O       */
881  79,  /*  213  13/05  G1      O tilde                   =>  O       */
882  79,  /*  214  13/06  G1      O diaeresis               =>  O       */
883 120,  /*  215  13/07  G1      Multiplication sign       =>  x       */
884  79,  /*  216  13/08  G1      O oblique stroke          =>  O       */
885  85,  /*  217  13/09  G1      U grave                   =>  U       */
886  85,  /*  218  13/10  G1      U acute                   =>  U       */
887  85,  /*  219  13/11  G1      U circumflex              =>  U       */
888  85,  /*  220  13/12  G1      U diaeresis               =>  U       */
889  89,  /*  221  13/13  G1      Y acute                   =>  Y       */
890  84,  /*  222  13/14  G1      Icelandic Thorn           =>  T       */
891 115,  /*  223  13/15  G1      German sharp s            =>  s       */
892  97,  /*  224  14/00  G1      a grave                   =>  a       */
893  97,  /*  225  14/01  G1      a acute                   =>  a       */
894  97,  /*  226  14/02  G1      a circumflex              =>  a       */
895  97,  /*  227  14/03  G1      a tilde                   =>  a       */
896  97,  /*  228  14/04  G1      a diaeresis               =>  a       */
897  97,  /*  229  14/05  G1      a ring above              =>  a       */
898  97,  /*  230  14/06  G1      a with e                  =>  a       */
899  99,  /*  231  14/07  G1      c cedilla                 =>  c       */
900 101,  /*  232  14/08  G1      e grave                   =>  e       */
901 101,  /*  233  14/09  G1      e acute                   =>  e       */
902 101,  /*  234  14/10  G1      e circumflex              =>  e       */
903 101,  /*  235  14/11  G1      e diaeresis               =>  e       */
904 105,  /*  236  14/12  G1      i grave                   =>  i       */
905 105,  /*  237  14/13  G1      i acute                   =>  i       */
906 105,  /*  238  14/14  G1      i circumflex              =>  i       */
907 105,  /*  239  14/15  G1      i diaeresis               =>  i       */
908 100,  /*  240  15/00  G1      Icelandic eth             =>  d       */
909 110,  /*  241  15/01  G1      n tilde                   =>  n       */
910 111,  /*  242  15/02  G1      o grave                   =>  o       */
911 111,  /*  243  15/03  G1      o acute                   =>  o       */
912 111,  /*  244  15/04  G1      o circumflex              =>  o       */
913 111,  /*  245  15/05  G1      o tilde                   =>  o       */
914 111,  /*  246  15/06  G1      o diaeresis               =>  o       */
915  47,  /*  247  15/07  G1      Division sign             =>  /       */
916 111,  /*  248  15/08  G1      o oblique stroke          =>  o       */
917 117,  /*  249  15/09  G1      u grave                   =>  u       */
918 117,  /*  250  15/10  G1      u acute                   =>  u       */
919 117,  /*  251  15/11  G1      u circumflex              =>  u       */
920 117,  /*  252  15/12  G1      u diaeresis               =>  u       */
921 121,  /*  253  15/13  G1      y acute                   =>  y       */
922 116,  /*  254  15/14  G1      Icelandic thorn           =>  t       */
923 121   /*  255  15/15  G1      y diaeresis               =>  y       */
924 };
925
926
927 /* Translation tables for ISO Latin Alphabet 1 to local file character sets */
928
929 /*
930   Most of the remaining tables are not annotated like the one above, because
931   the size of the resulting source file would be ridiculous.  Each row in the
932   following tables corresponds to a column of ISO 8859-1.
933 */
934
935 CONST CHAR
936 yl185[] = {  /* ISO 8859-1 Latin Alphabet 1 (Latin-1) to IBM Code Page 850 */
937 /*
938   This is based on IBM's official invertible translation.  Reference: IBM
939   Character Data Representation Architecture (CDRA), Level 1, Registry,
940   SC09-1291-00 (1990), p.152.  (Note: Latin-1 is IBM Code Page 00819.)  Note:
941   IBM's bizarre rearrangement of C0 controls and DEL has been undone in this
942   table.
943 */
944   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
945  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
946  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
947  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
948  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
949  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
950  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
951 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
952 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
953 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
954 255, 173, 189, 156, 207, 190, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
955 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
956 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
957 209, 165, 227, 224, 226, 229, 153, 158, 157, 235, 233, 234, 154, 237, 232, 225,
958 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
959 208, 164, 149, 162, 147, 228, 148, 246, 155, 151, 163, 150, 129, 236, 231, 152
960 };
961
962 CONST CHAR
963 y85l1[] = {  /* IBM Code Page 850 to Latin-1 */
964 /*
965   This is from IBM CDRA page 153.  It is the inverse of yl185[].
966   As of edit 183, this table is no longer pure CDRA.  The translations
967   involving C0 controls and DEL have been removed.
968 */
969   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
970  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
971  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
972  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
973  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
974  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
975  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
976 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
977 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
978 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 248, 163, 216, 215, 159,
979 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
980 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 162, 165, 147,
981 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
982 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
983 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
984 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
985 };
986
987 #ifdef COMMENT
988 CONST CHAR
989 yl1r8[] = {  /* Latin-1 to Hewlett Packard Roman8 */
990 /* This is HP's official translation, straight from iconv */
991 /* It is NOT invertible. */
992   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
993  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
994  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
995  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
996  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
997  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
998  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
999 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1000 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1001 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1002 160, 184, 191, 187, 186, 188, 124, 189, 171,  99, 249, 251, 126,  45,  82, 176,
1003 179, 254,  50,  51, 168, 243, 244, 242,  44,  49, 250, 253, 247, 248, 245, 185,
1004 161, 224, 162, 225, 216, 208, 211, 180, 163, 220, 164, 165, 230, 229, 166, 167,
1005 227, 182, 232, 231, 223, 233, 218, 120, 210, 173, 237, 174, 219, 177, 240, 222,
1006 200, 196, 192, 226, 204, 212, 215, 181, 201, 197, 193, 205, 217, 213, 209, 221,
1007 228, 183, 202, 198, 194, 234, 206,  47, 214, 203, 199, 195, 207, 178, 241, 239
1008 };
1009 CONST CHAR
1010 yr8l1[] = {  /* Hewlett Packard Roman8 to Latin-1 */
1011 /* This is HP's official translation, straight from iconv */
1012 /* It is NOT invertible. */
1013   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1014  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1015  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1016  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1017  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1018  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1019  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1020 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1021 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1022 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1023 160, 192, 194, 200, 202, 203, 206, 207, 180,  96,  94, 168, 126, 217, 219, 163,
1024 175, 221, 253, 176, 199, 231, 209, 241, 161, 191, 164, 163, 165, 167, 102, 162,
1025 226, 234, 244, 251, 225, 233, 243, 250, 224, 232, 242, 249, 228, 235, 246, 252,
1026 197, 238, 216, 198, 229, 237, 248, 230, 196, 236, 214, 220, 201, 239, 223, 212,
1027 193, 195, 227, 208, 240, 205, 204, 211, 210, 213, 245,  83, 115, 218,  89, 255,
1028 222, 254, 183, 181, 182, 190,  45, 188, 189, 170, 186, 171,  42, 187, 177, 160
1029 };
1030 #else /* !COMMENT */
1031 /* This is an invertible mapping, approved by HP in January 1994. */
1032 CONST CHAR
1033 yl1r8[] = {  /* ISO Latin-1 to HP Roman8, Invertible */
1034   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1035  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1036  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1037  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1038  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1039  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1040  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1041 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1042 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1043 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1044 160, 184, 191, 187, 186, 188, 169, 189, 171, 170, 249, 251, 172, 175, 190, 176,
1045 179, 254, 235, 236, 168, 243, 244, 242, 238, 246, 250, 253, 247, 248, 245, 185,
1046 161, 224, 162, 225, 216, 208, 211, 180, 163, 220, 164, 165, 230, 229, 166, 167,
1047 227, 182, 232, 231, 223, 233, 218, 252, 210, 173, 237, 174, 219, 177, 240, 222,
1048 200, 196, 192, 226, 204, 212, 215, 181, 201, 197, 193, 205, 217, 213, 209, 221,
1049 228, 183, 202, 198, 194, 234, 206, 255, 214, 203, 199, 195, 207, 178, 241, 239
1050 };
1051
1052 CONST CHAR
1053 yr8l1[] = { /* HP Roman8 to ISO Latin-1, Invertible */
1054   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1055  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1056  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1057  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1058  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1059  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1060  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1061 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1062 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1063 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1064 160, 192, 194, 200, 202, 203, 206, 207, 180, 166, 169, 168, 172, 217, 219, 173,
1065 175, 221, 253, 176, 199, 231, 209, 241, 161, 191, 164, 163, 165, 167, 174, 162,
1066 226, 234, 244, 251, 225, 233, 243, 250, 224, 232, 242, 249, 228, 235, 246, 252,
1067 197, 238, 216, 198, 229, 237, 248, 230, 196, 236, 214, 220, 201, 239, 223, 212,
1068 193, 195, 227, 208, 240, 205, 204, 211, 210, 213, 245, 178, 179, 218, 184, 255,
1069 222, 254, 183, 181, 182, 190, 185, 188, 189, 170, 186, 171, 215, 187, 177, 247
1070 };
1071 #endif /* COMMENT */
1072
1073 CONST CHAR
1074 yl143[] = {  /* Latin-1 to IBM Code Page 437 */
1075 /*
1076   Although the IBM CDRA does not include an official translation between CP437
1077   and ISO Latin Alphabet 1, it does include an official, invertible
1078   translation between CP437 and CP850 (page 196), and another from CP850 to
1079   Latin-1 (CP819) (page 153).  This translation was obtained with a two-step
1080   process based on those tables.
1081   As of edit 183, the translation is modified to leave C0 controls alone.
1082 */
1083   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1084  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1085  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1086  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1087  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1088  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1089  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1090 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1091 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
1092 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
1093 255, 173, 155, 156, 207, 157, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
1094 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
1095 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
1096 209, 165, 227, 224, 226, 229, 153, 158, 190, 235, 233, 234, 154, 237, 232, 225,
1097 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
1098 208, 164, 149, 162, 147, 228, 148, 246, 189, 151, 163, 150, 129, 236, 231, 152
1099 };
1100
1101 CONST CHAR
1102 y43l1[] = {  /* IBM Code Page 437 to Latin-1 */
1103 /*
1104   This table is the inverse of yl143[].
1105 */
1106   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1107  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1108  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1109  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1110  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1111  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1112  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1113 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1114 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
1115 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 215, 159,
1116 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
1117 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 248, 216, 147,
1118 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
1119 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
1120 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
1121 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
1122 };
1123
1124 CONST CHAR
1125 yl1aq[] = {  /* Latin-1 to Extended Mac Latin (based on Apple QuickDraw) */
1126   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1127  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1128  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1129  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1130  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1131  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1132  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1133 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1134 182, 183, 184, 185, 189, 196, 197, 198, 206, 207, 210, 211, 217, 218, 195, 212,
1135 209, 215, 213, 226, 227, 228, 240, 245, 246, 247, 249, 250, 251, 253, 254, 255,
1136 202, 193, 162, 163, 219, 180, 201, 164, 172, 169, 187, 199, 194, 208, 168, 248,
1137 161, 177, 170, 173, 171, 181, 166, 225, 252, 176, 188, 200, 178, 179, 186, 192,
1138 203, 231, 229, 204, 128, 129, 174, 130, 233, 131, 230, 232, 237, 234, 235, 236,
1139 220, 132, 241, 238, 239, 205, 133, 165, 175, 244, 242, 243, 134, 160, 222, 167,
1140 136, 135, 137, 139, 138, 140, 190, 141, 143, 142, 144, 145, 147, 146, 148, 149,
1141 221, 150, 152, 151, 153, 155, 154, 214, 191, 157, 156, 158, 159, 224, 223, 216
1142 };
1143
1144 CONST CHAR
1145 yl1du[] = {  /* Latin-1 to Dutch ISO 646 */
1146   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1147  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1148  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1149  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1150 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1151  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
1152  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1153 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK,  39, 127,
1154 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1155 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1156  32,  33, UNK,  35, 124, UNK, UNK,  93, 123,  67, UNK,  34, UNK,  45,  82, UNK,
1157  91, UNK, UNK, UNK, 126, 117, UNK, UNK,  44, UNK, UNK,  34, 125,  92,  64,  63,
1158  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1159 UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
1160  97,  97,  97,  97,  97,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
1161 UNK, 110, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK,  91
1162 };
1163
1164 CONST CHAR
1165 yl1fi[] = {  /* Latin-1 to Finnish ISO NRC (*not* ISO 646) */
1166   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1167  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1168  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1169  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1170  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1171  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
1172 UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1173 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
1174 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1175 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1176  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1177 UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1178  65,  65,  65,  65,  91,  93,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1179 UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
1180  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
1181 UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
1182 };
1183
1184 CONST CHAR
1185 yl1fr[] = {  /* Latin-1 to French ISO 646 */
1186   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1187  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1188  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1189  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1190 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1191  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
1192  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1193 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
1194 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1195 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1196  32,  33, UNK,  35, UNK, UNK, UNK,  93,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1197  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1198  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1199 UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
1200  64,  97,  97,  97,  97,  97,  97,  92, 125, 123, 101, 101, 105, 105, 105, 105,
1201 UNK, 110, 111, 111, 111, 111, 111,  47, 111, 124, 117, 117, 117, 121, UNK, 121
1202 };
1203
1204 CONST CHAR
1205 yl1fc[] = {  /* Latin-1 to French-Canadian ISO 646 */
1206   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1207  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1208  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1209  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1210 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1211  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
1212 UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1213 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
1214 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1215 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1216  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1217 UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1218  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1219 UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
1220  64,  97,  91,  97,  97,  97,  97,  92, 125, 123,  93, 101, 105, 105,  94, 105,
1221 UNK, 110, 111, 111,  96, 111, 111,  47, 111, 124, 117, 126, 117, 121, UNK, 121
1222 };
1223
1224 CONST CHAR
1225 yl1ge[] = {  /* Latin-1 to German ISO 646 */
1226   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1227  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1228  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1229  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1230 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1231  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
1232  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1233 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
1234 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1235 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1236  32,  33, UNK, UNK, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1237 UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1238  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1239 UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 126,
1240  97,  97,  97,  97, 123,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
1241 UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
1242 };
1243
1244 CONST CHAR
1245 yl1hu[] = {  /* Latin-1 to Hungarian ISO-646 */
1246   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1247  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1248  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1249  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1250  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1251  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1252  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1253 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1254 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1255 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1256  32,  33, UNK, UNK,  36, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1257 UNK,  64, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1258  65,  65,  65,  65,  65,  65,  65,  67,  69,  91,  69,  69,  73,  73,  73,  73,
1259 UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 115,
1260  97,  96,  97,  97,  97,  97,  97,  99, 101, 123, 101, 101, 105, 105, 105, 105,
1261 UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
1262 };
1263
1264 CONST CHAR
1265 yl1it[] = {  /* Latin-1 to Italian ISO 646 */
1266   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1267  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1268  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1269  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1270 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1271  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
1272 UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1273 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
1274 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1275 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1276  32,  33, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1277  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1278  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1279 UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
1280 123,  97,  97,  97,  97,  97,  97,  92, 125,  93, 101, 101, 126, 105, 105, 105,
1281 UNK, 110, 124, 111, 111, 111, 111,  47, 111,  96, 117, 117, 117, 121, UNK, 121
1282 };
1283
1284 CONST CHAR
1285 yl1ne[] = {  /* Latin-1 to NeXT */
1286 /* NEED TO MAKE THIS ONE INVERTIBLE, LIKE CP850 */
1287 /*
1288   Which means finding all the graphic characters in the NeXT set that have
1289   no equivalent in Latin-1 and assigning them to the UNK positions (mostly
1290   Latin-1 C1 controls).  Then make the ynel1[] table be the inverse of this
1291   one.  But first we should try to get an official Latin-1/NeXT translation
1292   table from NeXT, Inc.
1293 */
1294   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1295  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1296  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1297  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1298  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1299  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1300  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1301 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1302 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
1303 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
1304  32, 161, 162, 163, 168, 165, 181, 167, 200, 160, 227, 171, 190, UNK, 176, 197,
1305 202, 209, 201, 204, 194, 157, 182, 183, 203, 192, 235, 187, 210, 211, 212, 191,
1306 129, 130, 131, 132, 133, 134, 225, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1307 144, 145, 146, 147, 148, 149, 150, 158, 233, 151, 152, 153, 154, 155, 156, 251,
1308 213, 214, 215, 216, 217, 218, 241, 219, 220, 221, 222, 223, 224, 226, 228, 229,
1309 230, 231, 236, 237, 238, 239, 240, 159, 249, 242, 243, 244, 246, 247, 252, 253
1310 };
1311
1312 CONST CHAR
1313 yl1no[] = {  /* Latin-1 to Norwegian/Danish ISO 646 */
1314   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1315  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1316  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1317  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1318  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1319  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
1320  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1321 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, 126, 127,
1322 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1323 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1324  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1325 UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1326  65,  65,  65,  65,  65,  93,  91,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1327 UNK,  78,  79,  79,  79,  79,  79, 120,  92,  85,  85,  85,  85,  89, UNK, 115,
1328  97,  97,  97,  97,  97, 125, 123,  99, 101, 101, 101, 101, 105, 105, 105, 105,
1329 UNK, 110, 111, 111, 111, 111, 111,  47, 124, 117, 117, 117, 117, 121, UNK, 121
1330 };
1331
1332 CONST CHAR
1333 yl1po[] = {  /* Latin-1 to Portuguese ISO 646 */
1334   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1335  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1336  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1337  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1338  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1339  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
1340  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1341 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, 126, 127,
1342 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1343 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1344  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1345 UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1346  65,  65,  65,  91,  65,  65,  65,  92,  69,  69,  69,  69,  73,  73,  73,  73,
1347 UNK,  78,  79,  79,  79,  93,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
1348  97,  97,  97, 123,  97,  97,  97, 124, 101, 101, 101, 101, 105, 105, 105, 105,
1349 UNK, 110, 111, 111, 111, 125, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
1350 };
1351
1352 CONST CHAR
1353 yl1sp[] = {  /* Latin-1 to Spanish ISO 646 */
1354   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1355  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1356  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1357  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1358 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1359  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
1360  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1361 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,  96, UNK, UNK, 126, 127,
1362 126, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1363 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1364  32,  91, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1365 123, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  93,
1366  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1367 UNK,  92,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
1368 124,  97,  97,  97,  97,  97,  97, 125, 101, 101, 101, 101, 105, 105, 105, 105,
1369 UNK, 124, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
1370 };
1371
1372 CONST CHAR
1373 yl1sw[] = {  /* Latin-1 to Swedish ISO 646 */
1374   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1375  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1376  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1377  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1378 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1379  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
1380 UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1381 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
1382 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1383 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1384  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1385 UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1386  65,  65,  65,  65,  91,  93,  65,  67,  69,  64,  69,  69,  73,  73,  73,  73,
1387 UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
1388  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
1389 UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
1390 };
1391
1392 CONST CHAR
1393 yl1ch[] = {  /* Latin-1 to Swiss ISO 646 */
1394   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1395  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1396  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1397  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1398 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1399  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK, UNK,
1400  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1401 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
1402 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1403 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1404  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
1405 UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
1406  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
1407 UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
1408  64,  97,  97,  97, 123,  97,  97,  92,  95,  91,  93, 101, 105, 105,  94, 105,
1409 UNK, 110, 111, 111,  96, 111, 124,  47, 111,  35, 117, 126, 125, 121, UNK, 121
1410 };
1411
1412 CONST CHAR
1413 yl1dm[] = {  /* Latin-1 to DEC Multinational Character Set */
1414   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1415  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1416  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1417  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1418  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1419  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1420  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1421 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1422 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1423 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1424  32, 161, 162, 163, 168, 165, 124, 167,  34, 169, 170, 171, 126, UNK,  82, UNK,
1425 176, 177, 178, 179,  39, 181, 182, 183,  44, 185, 186, 187, 188, 189, UNK, 191,
1426 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1427 UNK, 209, 210, 211, 212, 213, 214, 120, 216, 217, 218, 219, 220, 221, UNK, 223,
1428 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1429 UNK, 241, 242, 243, 244, 245, 246,  47, 248, 249, 250, 251, 252, UNK, UNK, 253
1430 };
1431
1432 CONST CHAR
1433 yl1dg[] = {  /* Latin-1 to Data General International Character Set */
1434   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1435  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1436  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1437  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1438  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1439  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1440  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1441 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1442 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1443 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1444 160, 171, 167, 168, 166, 181, 191, 187, 189, 173, 169, 177, 161, 255, 174, 175,
1445 188, 182, 164, 165, 190, 163, 178, 185, 186, 179, 170, 176, 223, 162, 220, 172,
1446 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
1447 184, 208, 210, 209, 211, 213, 212, 215, 214, 217, 216, 218, 219, 221, 222, 252,
1448 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
1449 183, 240, 242, 241, 243, 245, 244, 247, 246, 249, 248, 250, 251, 180, 254, 253
1450 };
1451
1452
1453 /* Local file character sets to ISO Latin Alphabet 1 */
1454
1455 #ifdef NOTUSED
1456 CONST CHAR
1457 yasl1[] = {  /* ASCII to Latin-1 */
1458   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1459  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1460  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1461  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1462  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1463  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1464  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1465 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127
1466 };
1467 #endif /* NOTUSED */
1468
1469 CONST CHAR
1470 yaql1[] = {  /* Extended Mac Latin (based on Apple Quickdraw) to Latin-1 */
1471   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1472  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1473  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1474  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1475  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1476  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1477  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1478 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1479 196, 197, 199, 201, 209, 214, 220, 225, 224, 226, 228, 227, 229, 231, 233, 232,
1480 234, 235, 237, 236, 238, 239, 241, 243, 242, 244, 246, 245, 250, 249, 251, 252,
1481 221, 176, 162, 163, 167, 215, 182, 223, 174, 169, 178, 180, 168, 179, 198, 216,
1482 185, 177, 188, 189, 165, 181, 128, 129, 130, 131, 190, 170, 186, 132, 230, 248,
1483 191, 161, 172, 142, 133, 134, 135, 171, 187, 166, 160, 192, 195, 213, 136, 137,
1484 173, 144, 138, 139, 143, 146, 247, 145, 255, 140, 141, 164, 208, 240, 222, 254,
1485 253, 183, 147, 148, 149, 194, 202, 193, 203, 200, 205, 206, 207, 204, 211, 212,
1486 150, 210, 218, 219, 217, 151, 152, 153, 175, 154, 155, 156, 184, 157, 158, 159
1487 };
1488
1489 CONST CHAR
1490 ydul1[] = {  /* Dutch ISO 646 to Latin-1 */
1491   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1492  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1493  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1494  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1495 190,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1496  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 255, 189, 124,  94,  95,
1497  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1498 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 168, 164, 188,  39, 127
1499 };
1500
1501 CONST CHAR
1502 yfil1[] = {  /* Finnish NRC (*not* ISO-646) to Latin-1 */
1503   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1504  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1505  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1506  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1507  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1508  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
1509 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1510 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
1511 };
1512
1513 CONST CHAR
1514 yfrl1[] = {  /* French ISO 646 to Latin-1 */
1515   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1516  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1517  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1518  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1519 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1520  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 167,  94,  95,
1521  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1522 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 168, 127
1523 };
1524
1525 CONST CHAR
1526 yfcl1[] = {  /* French-Canadian ISO 646 to Latin-1 */
1527   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1528  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1529  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1530  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1531 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1532  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 226, 231, 234, 238,  95,
1533 244,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1534 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 251, 127
1535 };
1536
1537 CONST CHAR
1538 ygel1[] = {  /* German ISO 646 to Latin-1 */
1539   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1540  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1541  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1542  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1543 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1544  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 220,  94,  95,
1545  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1546 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 252, 223, 127
1547 };
1548
1549 CONST CHAR
1550 yitl1[] = {  /* Italian ISO 646 to Latin-1 */
1551   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1552  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1553  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1554  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1555 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1556  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 233,  94,  95,
1557 249,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1558 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 224, 242, 232, 236, 127
1559 };
1560
1561 CONST CHAR
1562 ynel1[] = {  /* NeXT to Latin-1 */
1563 /* NEED TO MAKE THIS ONE INVERTIBLE */
1564   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1565  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1566  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1567  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1568  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1569  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1570  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1571 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1572 160, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1573 208, 209, 210, 211, 212, 213, 214, 217, 218, 219, 220, 221, 222, 181, 215, 247,
1574 169, 161, 162, 163, UNK, 165, UNK, 167, 164, UNK, UNK, 171, UNK, UNK, UNK, UNK,
1575 174, UNK, UNK, UNK, 183, 166, 182, UNK, UNK, UNK, UNK, 187, UNK, UNK, 172, 191,
1576 185,  96, 180,  94, 126, 175, UNK, UNK, 168, 178, 176, 184, 179, UNK, UNK, UNK,
1577 UNK, 177, 188, 189, 190, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235,
1578 236, 198, 237, 170, 238, 239, 240, 241, UNK, 216, UNK, 186, 242, 243, 244, 245,
1579 246, 230, 249, 250, 251, UNK, 252, 253, UNK, 248, UNK, 223, 254, 255, UNK, UNK
1580 };
1581
1582 CONST CHAR
1583 ynol1[] = {  /* Norwegian/Danish ISO 646 to Latin-1 */
1584   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1585  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1586  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1587  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1588  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1589  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 198, 216, 197,  94,  95,
1590  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1591 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 230, 248, 229, 126, 127
1592 };
1593
1594 CONST CHAR
1595 ypol1[] = {  /* Portuguese ISO 646 to Latin-1 */
1596   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1597  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1598  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1599  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1600  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1601  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 195, 199, 213,  94,  95,
1602  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1603 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 227, 231, 245, 126, 127
1604 };
1605
1606 CONST CHAR
1607 yspl1[] = {  /* Spanish ISO 646 to Latin-1 */
1608   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1609  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1610  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1611  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1612 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1613  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 161, 209, 191,  94,  95,
1614  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1615 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 176, 241, 231, 126, 127
1616 };
1617
1618 CONST CHAR
1619 yswl1[] = {  /* Swedish ISO 646 to Latin-1 */
1620   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1621  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1622  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1623  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1624 201,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1625  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
1626 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1627 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
1628 };
1629
1630 CONST CHAR
1631 ychl1[] = {  /* Swiss ISO 646 to Latin-1 */
1632   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1633  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1634  32,  33,  34, 249,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1635  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1636 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1637  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 233, 231, 234, 238, 232,
1638 244,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1639 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 252, 251, 127
1640 };
1641
1642 CONST CHAR
1643 yhul1[] = {  /* Hungarian ISO 646 to Latin-1 */
1644   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1645  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1646  32,  33,  34,  35, 164,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1647  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1648 193,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1649  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 201, 214, 220,  94,  95,
1650 225,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1651 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 246, 252,  34, 127
1652 };
1653
1654 CONST CHAR
1655 ydml1[] = {  /* DEC Multinational Character Set to Latin-1 */
1656 /* Note: This is a null translation */
1657   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1658  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1659  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1660  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1661  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1662  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1663  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1664 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1665 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1666 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1667 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
1668 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1669 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1670 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
1671 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1672 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
1673 };
1674
1675 CONST CHAR
1676 ydgl1[] = {  /* Data General International to Latin-1 */
1677   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1678  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1679  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1680  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1681  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1682  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1683  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1684 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1685 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1686 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1687 160, 172, 189, 181, 178, 179, 164, 162, 163, 170, 186, 161, 191, 169, 174, 175,
1688 187, 171, 182, 185, 253, 165, 177, 240, 208, 183, 184, 167, 176, 168, 180, 166,
1689 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
1690 209, 211, 210, 212, 214, 213, 216, 215, 218, 217, 219, 220, 190, 221, 222, 188,
1691 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
1692 241, 243, 242, 244, 246, 245, 248, 247, 250, 249, 251, 252, 223, 255, 254, 173
1693 };
1694
1695
1696 /* Translation tables for Cyrillic character sets */
1697
1698 #ifdef CYRILLIC
1699 CONST CHAR
1700 ylcac[] = {  /* Latin/Cyrillic to CP866 */
1701   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1702  16,  17,  18,  19, 208, 209,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1703  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1704  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1705  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1706  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1707  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1708 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1709 196, 179, 192, 217, 191, 218, 195, 193, 180, 194, 197, 176, 177, 178, 211, 216,
1710 205, 186, 200, 188, 187, 201, 204, 202, 185, 203, 206, 223, 220, 219, 254, UNK,
1711 255, 240, 132, 131, 242,  83,  73, 244,  74, 139, 141, 151, 138,  45, 246, 135,
1712 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1713 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1714 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
1715 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1716 252, 241, 164, 163, 243, 115, 105, 245, 106, 171, 173, 231, 170,  21, 247, 167
1717 };
1718
1719 CONST CHAR
1720 ylc55[] = {  /* Latin/Cyrillic to CP855 (inverse of y55lc) */
1721   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1722  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1723  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1724  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1725  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1726  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1727  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1728 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1729 174, 175, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194, 195,
1730 196, 197, 200, 201, 202, 203, 204, 205, 206, 207, 217, 218, 219, 220, 223, 254,
1731 255, 133, 129, 131, 135, 137, 139, 141, 143, 145, 147, 149, 151, 240, 153, 155,
1732 161, 163, 236, 173, 167, 169, 234, 244, 184, 190, 199, 209, 211, 213, 215, 221,
1733 226, 228, 230, 232, 171, 182, 165, 252, 246, 250, 159, 242, 238, 248, 157, 224,
1734 160, 162, 235, 172, 166, 168, 233, 243, 183, 189, 198, 208, 210, 212, 214, 216,
1735 225, 227, 229, 231, 170, 181, 164, 251, 245, 249, 158, 241, 237, 247, 156, 222,
1736 239, 132, 128, 130, 134, 136, 138, 140, 142, 144, 146, 148, 150, 253, 152, 154
1737 };
1738
1739 CONST CHAR
1740 ylc1251[] = {  /* Latin/Cyrillic to CP1251 (inverse of y1251lc) */
1741   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1742  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1743  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1744  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1745  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1746  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1747  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1748 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1749 130, 132, 133, 134, 135, 136, 137, 139, 145, 146, 147, 148, 149, 150, 151, 152,
1750 153, 155, 164, 165, 166, 169, 171, 172, 174, 176, 177, 180, 181, 182, 183, 187,
1751 160, 168, 128, 129, 170, 189, 178, 175, 163, 138, 140, 142, 141, 173, 161, 143,
1752 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1753 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
1754 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1755 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
1756 185, 184, 144, 131, 186, 190, 179, 191, 188, 154, 156, 158, 157, 167, 162, 159
1757 };
1758
1759 CONST CHAR
1760 ylcbu[] = {  /* Latin/Cyrillic to Bulgarian PC Code Page */
1761   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1762  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1763  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1764  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1765  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1766  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1767  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1768 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1769 255, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
1770 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1771 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1772 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
1773 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1774 213, 207, 208, 209, 210, 211, 212, 215, 216, 217, 218, 219, 220, 221, 222, 223,
1775 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1776 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 214, 253, 254
1777 };
1778
1779 CONST CHAR
1780 ylck8[] = {  /* Latin/Cyrillic to Old KOI-8 Cyrillic */
1781   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1782  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1783  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1784  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1785  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1786  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1787  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1788 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1789 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1790 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1791 UNK, 229, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 235, UNK, 245, UNK,
1792 225, 226, 247, 231, 228, 229, 246, 250, 233, 234, 235, 236, 237, 238, 239, 240,
1793 242, 243, 244, 245, 230, 232, 227, 254, 251, 253, 255, 249, 248, 252, 224, 241,
1794 193, 194, 215, 199, 196, 197, 214, 218, 201, 202, 203, 204, 205, 206, 207, 208,
1795 210, 211, 212, 213, 198, 200, 195, 222, 219, 221, 223, 217, 216, 220, 192, 209,
1796 UNK, 197, UNK, UNK, UNK, 115, 105, 105, 106, UNK, UNK, UNK, 203, UNK, 213, UNK
1797 };
1798
1799 CONST CHAR
1800 yaclc[] = {  /* CP866 to Latin/Cyrillic */
1801 /* NEED TO MAKE THIS ONE INVERTIBLE */
1802   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1803  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1804  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1805  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1806  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1807  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1808  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1809 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1810 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1811 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1812 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
1813 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
1814 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
1815 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
1816 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1817 161, 241, 164, 244, 167, 247, 174, 254, UNK, UNK, UNK, UNK, 240, UNK, UNK, UNK
1818 };
1819
1820 CONST CHAR
1821 y55lc[] = {  /* CP855 to Latin/Cyrillic (inverse of ylc55) */
1822   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1823  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1824  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1825  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1826  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1827  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1828  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1829 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1830 242, 162, 243, 163, 241, 161, 244, 164, 245, 165, 246, 166, 247, 167, 248, 168,
1831 249, 169, 250, 170, 251, 171, 252, 172, 254, 174, 255, 175, 238, 206, 234, 202,
1832 208, 176, 209, 177, 230, 198, 212, 180, 213, 181, 228, 196, 211, 179, 128, 129,
1833 130, 131, 132, 133, 134, 229, 197, 216, 184, 135, 136, 137, 138, 217, 185, 139,
1834 140, 141, 142, 143, 144, 145, 218, 186, 146, 147, 148, 149, 150, 151, 152, 153,
1835 219, 187, 220, 188, 221, 189, 222, 190, 223, 154, 155, 156, 157, 191, 239, 158,
1836 207, 224, 192, 225, 193, 226, 194, 227, 195, 214, 182, 210, 178, 236, 204, 240,
1837 173, 235, 203, 215, 183, 232, 200, 237, 205, 233, 201, 231, 199, 253, 159, 160
1838 };
1839
1840 CONST CHAR
1841 y1251lc[] = {  /* CP1251 to Latin/Cyrillic (inverse of ylc1251) */
1842   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1843  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1844  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1845  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1846  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1847  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1848  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1849 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1850 162, 163, 128, 243, 129, 130, 131, 132, 133, 134, 169, 135, 170, 172, 171, 175,
1851 242, 136, 137, 138, 139, 140, 141, 142, 143, 144, 249, 145, 250, 252, 251, 255,
1852 160, 174, 254, 168, 146, 147, 148, 253, 161, 149, 164, 150, 151, 173, 152, 167,
1853 153, 154, 166, 246, 155, 156, 157, 158, 241, 240, 244, 159, 248, 165, 245, 247,
1854 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1855 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1856 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
1857 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239
1858 };
1859
1860 CONST CHAR
1861 ybulc[] = {  /* Bulgarian PC Code Page to Latin/Cyrillic */
1862   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1863  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1864  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1865  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1866  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1867  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1868  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1869 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1870 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1871 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
1872 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1873 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1874 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 209,
1875 210, 211, 212, 213, 214, 208, 253, 215, 216, 217, 218, 219, 220, 221, 222, 223,
1876 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1877 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 254, 255, 128
1878 };
1879
1880 CONST CHAR
1881 yk8lc[] = {  /* Old KOI-8 Cyrillic to Latin/Cyrillic */
1882   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1883  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1884  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1885  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1886  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1887  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1888  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1889 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1890 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1891 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1892 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
1893 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
1894 238, 208, 209, 230, 212, 213, 228, 211, 229, 216, 217, 218, 219, 220, 221, 222,
1895 223, 239, 224, 225, 226, 227, 214, 210, 236, 235, 215, 232, 237, 233, 231, 234,
1896 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
1897 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
1898 };
1899
1900 CONST CHAR
1901 ylcsk[] = {  /* Latin/Cyrillic to Short KOI */
1902   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1903  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1904  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1905  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1906  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1907  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1908  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1909  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94, 127,
1910   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1911  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1912  32, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107,  45, 117, UNK,
1913  97,  98, 119, 103, 100, 101, 118, 122, 105, 106, 107, 108, 109, 110, 111, 112,
1914 114, 115, 116, 117, 102, 104,  99, 126, 123, 125,  39, 121, 120, 124,  96, 113,
1915  97,  98, 119, 103, 100, 101, 118, 122, 105, 106, 107, 108, 109, 110, 111, 112,
1916 114, 115, 116, 117, 102, 104,  99, 126, 123, 125,  39, 121, 120, 124,  96, 113,
1917 UNK, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107, UNK, 117, UNK
1918 };
1919
1920 CONST CHAR yskcy[] = {  /* Short KOI to Latin/Cyrillic */
1921   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1922  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1923  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1924  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1925  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1926  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1927 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
1928 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
1929 };
1930 #endif /* CYRILLIC */
1931
1932 #ifdef LATIN2
1933
1934 /* Latin-2 tables */
1935
1936 CONST CHAR
1937 yl252[] = {                             /* Latin-2 to Code Page 852 */
1938   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1939  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1940  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1941  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1942  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1943  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1944  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1945 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1946 174, 175, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194, 195,
1947 196, 197, 200, 201, 202, 203, 204, 205, 206, 217, 218, 219, 220, 223, 240, 254,
1948 255, 164, 244, 157, 207, 149, 151, 245, 249, 230, 184, 155, 141, 170, 166, 189,
1949 248, 165, 242, 136, 239, 150, 152, 243, 247, 231, 173, 156, 171, 241, 167, 190,
1950 232, 181, 182, 198, 142, 145, 143, 128, 172, 144, 168, 211, 183, 214, 215, 210,
1951 209, 227, 213, 224, 226, 138, 153, 158, 252, 222, 233, 235, 154, 237, 221, 225,
1952 234, 160, 131, 199, 132, 146, 134, 135, 159, 130, 169, 137, 216, 161, 140, 212,
1953 208, 228, 229, 162, 147, 139, 148, 246, 253, 133, 163, 251, 129, 236, 238, 250
1954 };
1955
1956 CONST CHAR
1957 y52l2[] = {                             /* Code Page 852 to Latin-2 */
1958   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1959  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1960  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1961  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1962  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1963  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1964  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1965 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1966 199, 252, 233, 226, 228, 249, 230, 231, 179, 235, 213, 245, 238, 172, 196, 198,
1967 201, 197, 229, 244, 246, 165, 181, 166, 182, 214, 220, 171, 187, 163, 215, 232,
1968 225, 237, 243, 250, 161, 177, 174, 190, 202, 234, 173, 188, 200, 186, 128, 129,
1969 130, 131, 132, 133, 134, 193, 194, 204, 170, 135, 136, 137, 138, 175, 191, 139,
1970 140, 141, 142, 143, 144, 145, 195, 227, 146, 147, 148, 149, 150, 151, 152, 164,
1971 240, 208, 207, 203, 239, 210, 205, 206, 236, 153, 154, 155, 156, 222, 217, 157,
1972 211, 223, 212, 209, 241, 242, 169, 185, 192, 218, 224, 219, 253, 221, 254, 180,
1973 158, 189, 178, 183, 162, 167, 247, 184, 176, 168, 255, 251, 216, 248, 159, 160
1974 };
1975
1976 CONST CHAR
1977 yl21250[] = {                           /* Latin-2 to Code Page 1250 */
1978   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1979  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
1980  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
1981  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
1982  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
1983  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
1984  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
1985 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1986 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 139, 144, 145, 146, 147, 148,
1987 149, 150, 151, 152, 153, 155, 166, 169, 171, 172, 174, 177, 181, 182, 183, 187,
1988 160, 165, 162, 163, 164, 188, 140, 167, 168, 138, 170, 141, 143, 173, 142, 175,
1989 176, 185, 178, 179, 180, 190, 156, 161, 184, 154, 186, 157, 159, 189, 158, 191,
1990 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1991 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
1992 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
1993 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
1994 };
1995
1996 CONST CHAR
1997 y1250l2[] = {                           /* Code Page 1250 to Latin-2 */
1998   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
1999  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2000  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2001  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2002  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2003  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2004  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2005 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2006 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 169, 138, 166, 171, 174, 172,
2007 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 185, 149, 182, 187, 190, 188,
2008 160, 183, 162, 163, 164, 161, 150, 167, 168, 151, 170, 152, 153, 173, 154, 175,
2009 176, 155, 178, 179, 180, 156, 157, 158, 184, 177, 186, 159, 165, 189, 181, 191,
2010 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2011 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
2012 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
2013 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
2014 };
2015
2016 CONST CHAR
2017 yl2mz[] = {                          /* Latin-2 to Mazovia (NOT invertible) */
2018   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2019  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2020  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2021  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2022  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2023  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2024  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2025 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2026 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
2027 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
2028 255, 143, UNK, 156, 155,  76, 152,  21,  34,  83,  83,  84, 160,  45,  90, 161,
2029 248, 134,  44, 146,  39, 108, 158, UNK,  44, 115, 115, 116, 166,  34, 122, 167,
2030  82,  65,  65,  65, 142,  76, 149, 128,  67,  69, 144,  69,  69,  73,  73,  68,
2031  68, 165,  78, 163,  79, 153, 153, 250,  82,  85,  85, 154, 154,  89,  84, 225,
2032 114,  97, 131,  97, 132, 108, 141, 135,  99, 130, 145, 137, 101, 105, 140, 101,
2033 100, 164, 110, 162, 147, 148, 148, 246, 114, 117, 117, 129, 129, 121, 116, 249
2034 };
2035
2036 CONST CHAR
2037 ymzl2[] = {                          /* Mazovia to Latin-2 (NOT INVERTIBLE) */
2038   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2039  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2040  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2041  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2042  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2043  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2044  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2045 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2046 128, 252, 233, 226, 228,  97, 177, 231, 101, 235, 101, 105, 238, 230, 196, 161,
2047 202, 234, 179, 244, 246, 198, 117, 117, 166, 214, 220, 164, 163,  89, 182, 102,
2048 172, 175, 243, 211, 242, 210, 188, 191,  63, UNK, UNK, UNK, UNK,  33,  34,  34,
2049 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2050 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2051 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2052 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2053 UNK, UNK, UNK, UNK, UNK, UNK, 247, UNK, 176, 255, 215, UNK, UNK, UNK, UNK, 160
2054 };
2055
2056 CONST CHAR
2057 yl2l1[] = {                             /* Latin-2 to Latin-1 */
2058   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2059  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2060  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2061  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2062  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2063  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2064  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2065 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2066 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
2067 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
2068 160, 'A', UNK, 'L', 164, 'L', 'S', 167, 168, 'S', 'S', 'T', 'Z', 173, 'Z', 'Z',
2069 176, 'a', UNK, 'l', 180, 'l', 's', UNK, 184, 's', 's', 't', 'z', UNK, 'z', 'z',
2070 'R', 193, 194, 'A', 196, 'L', 'C', 199, 'C', 201, 'E', 203, 'E', 205, 'I', 'D',
2071 208, 'N', 'N', 211, 212, 'O', 214, 215, 'R', 'U', 218, 'U', 220, 221, 'T', 223,
2072 'r', 225, 226, 'a', 228, 'l', 'c', 231, 'c', 233, 'e', 235, 'e', 237, 'i', 'd',
2073 240, 'n', 'n', 243, 244, 'o', 246, 247, 'r', 'u', 250, 'u', 252, 253, 't', '.'
2074 };
2075
2076 CONST CHAR
2077 yl1l2[] = {                             /* Latin-1 to Latin-2 */
2078   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2079  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2080  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2081  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2082  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2083  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2084  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2085 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2086 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
2087 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
2088 160, 'A', UNK, 'L', 164, UNK, UNK, 167, 168, 'C', 'a', '<', '>', 173, 'R', UNK,
2089 176, UNK, UNK, UNK, 180, UNK, UNK, UNK, 184, UNK, 'o', '>', UNK, UNK, UNK, UNK,
2090 'A', 193, 194, 'A', 196, 'A', 'A', 199, 'E', 201, 'E', 203, 'I', 205, 'I', 'I',
2091 208, 'N', 'O', 211, 212, 'O', 214, 215, 'O', 'U', 218, 'U', 220, 221, UNK, 223,
2092 'a', 225, 226, 'a', 228, 'a', 'a', 231, 'e', 233, 'e', 235, 'i', 237, 'i', 'i',
2093 240, 'n', 'o', 243, 244, 'o', 246, 247, 'o', 'u', 250, 'u', 252, 253, UNK, 'y'
2094 };
2095
2096 CONST CHAR
2097 yl2as[] = {                             /* Latin-2 to ASCII */
2098   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2099  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2100  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2101  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2102  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2103  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2104  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2105 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2106 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2107 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2108  32, 'A', UNK, 'L', UNK, 'L', 'S', UNK,  34, 'S', 'S', 'T', 'Z', '-', 'Z', 'Z',
2109 UNK, 'a', UNK, 'l',  39, 'l', 's', UNK,  44, 's', 's', 't', 'z', UNK, 'z', 'z',
2110 'R', 'A', 'A', 'A', 'A', 'L', 'C', 'C', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'D',
2111 'D', 'N', 'N', 'O', 'O', 'O', 'O', 'x', 'R', 'U', 'U', 'U', 'U', 'Y', 'T', 's',
2112 'r', 'a', 'a', 'a', 'a', 'l', 'c', 'c', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'd',
2113 'd', 'n', 'n', 'o', 'o', 'o', 'o', '/', 'r', 'u', 'u', 'u', 'u', 'y', 't', '.'
2114 };
2115 #endif /* LATIN2 */
2116
2117 #ifdef HEBREW
2118 /*
2119   8-bit Tables providing invertible translation between Latin/Hebrew and CP862.
2120 */
2121 CONST CHAR
2122 y62lh[] = {  /* PC Code Page 862 to ISO 8859-8 Latin/Hebrew */
2123   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2124  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2125  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2126  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2127  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2128  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2129  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2130 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2131 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
2132 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 162, 163, 165, 128, 129,
2133 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 172, 189, 188, 140, 171, 187,
2134 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
2135 157, 158, 159, 161, 164, 166, 167, 168, 169, 170, 173, 174, 175, 223, 179, 180,
2136 182, 184, 185, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
2137 203, 204, 205, 206, 207, 208, 181, 209, 210, 211, 212, 213, 214, 215, 216, 217,
2138 218, 177, 219, 220, 221, 222, 186, 251, 176, 183, 252, 253, 254, 178, 255, 160
2139 };
2140
2141 CONST CHAR
2142 ylh62[] = {  /* ISO 8859-8 Latin/Hebrew to PC Code Page 862 */
2143   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2144  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2145  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2146  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2147  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2148  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2149  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2150 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2151 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 173, 176, 177, 178,
2152 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2153 255, 195, 155, 156, 196, 157, 197, 198, 199, 200, 201, 174, 170, 202, 203, 204,
2154 248, 241, 253, 206, 207, 230, 208, 249, 209, 210, 246, 175, 172, 171, 211, 212,
2155 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
2156 229, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 205,
2157 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
2158 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 247, 250, 251, 252, 254
2159 };
2160 /*
2161   7-bit table providing readable translation from DEC Hebrew-7 to CP862.
2162 */
2163 CONST CHAR
2164 yh762[] = {
2165   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2166  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2167  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2168  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2169  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2170  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2171 UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2172  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127
2173 };
2174 /*
2175   8-bit table providing readable translation from CP862 to Hebrew-7.
2176 */
2177 CONST CHAR
2178 y62h7[] = {  /* PC Code Page 862 to Hebrew-7 */
2179   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2180  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2181  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2182  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2183  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2184  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2185  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2186  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
2187  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2188 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, UNK,
2189 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2190 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2191 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2192 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2193 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2194 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK
2195 };
2196 /*
2197   7-bit table providing readable translation from Hebrew-7 to ISO Latin/Hebrew.
2198 */
2199 CONST CHAR
2200 yh7lh[] = {
2201   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2202  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2203  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2204  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2205  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2206  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2207 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
2208 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 123, 124, 125, 126, 127
2209 };
2210 /*
2211   8-bit table providing readable translation from ISO Latin/Hebrew to Hebrew-7.
2212 */
2213 CONST CHAR
2214 ylhh7[] = {  /* Latin/Hebrew to Hebrew-7 */
2215   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2216  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2217  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2218  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2219  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2220  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2221  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2222  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
2223 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2224 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2225 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2226 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2227 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2228 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2229  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2230 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, UNK
2231 };
2232 #endif /* HEBREW */
2233
2234 #ifdef GREEK
2235 /*
2236   8-bit Tables providing invertible translation between Latin/Greek and CP869.
2237 */
2238 CONST CHAR
2239 ylg69[] = {  /* ISO 8859-7 Latin/Greek to PC Code Page 869 */
2240   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2241  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2242  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2243  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2244  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2245  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2246  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2247 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2248 135, 147, 148, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194,
2249 195, 196, 197, 200, 201, 202, 203, 204, 205, 206, 217, 218, 219, 220, 223, 254,
2250 255, 139, 140, 156, 128, 129, 138, 245, 249, 151, 130, 174, 137, 240, 131, 142,
2251 248, 241, 153, 154, 239, 247, 134, 136, 141, 143, 144, 175, 146, 171, 149, 152,
2252 161, 164, 165, 166, 167, 168, 169, 170, 172, 173, 181, 182, 183, 184, 189, 190,
2253 198, 199, 132, 207, 208, 209, 210, 211, 212, 213, 145, 150, 155, 157, 158, 159,
2254 252, 214, 215, 216, 221, 222, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
2255 234, 235, 237, 236, 238, 242, 243, 244, 246, 250, 160, 251, 162, 163, 253, 133
2256 };
2257
2258 CONST CHAR
2259 y69lg[] = {  /* PC Code Page 869 to ISO 8859-7 Latin/Greek */
2260   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2261  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2262  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2263  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2264  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2265  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2266  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2267 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2268 164, 165, 170, 174, 210, 255, 182, 128, 183, 172, 166, 161, 162, 184, 175, 185,
2269 186, 218, 188, 129, 130, 190, 219, 169, 191, 178, 179, 220, 163, 221, 222, 223,
2270 250, 192, 252, 253, 193, 194, 195, 196, 197, 198, 199, 189, 200, 201, 171, 187,
2271 131, 132, 133, 134, 135, 202, 203, 204, 205, 136, 137, 138, 139, 206, 207, 140,
2272 141, 142, 143, 144, 145, 146, 208, 209, 147, 148, 149, 150, 151, 152, 153, 211,
2273 212, 213, 214, 215, 216, 217, 225, 226, 227, 154, 155, 156, 157, 228, 229, 158,
2274 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 243, 242, 244, 180,
2275 173, 177, 245, 246, 247, 167, 248, 181, 176, 168, 249, 251, 224, 254, 159, 160
2276 };
2277 /*
2278   7-bit table providing readable translation from ELOT 927 to CP869.
2279 */
2280 CONST CHAR
2281 yeg69[] = {
2282   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2283  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2284  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2285  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2286  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2287  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2288  96, 164, 165, 166, 167, 168, 169, 170, 172, 173, 181, 182, 183, 184, 189, 190,
2289 198, 199, 207, 208, 209, 210, 211, 212, 213,  32,  32,  23, 124, 125, 126, 127
2290 };
2291 /*
2292   8-bit table providing readable translation from CP869 to ELOT 927.
2293 */
2294 CONST CHAR
2295 y69eg[] = {  /* PC Code Page 869 to ELOT 927 */
2296   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2297  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2298  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2299  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2300  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2301  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2302  96,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2303  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
2304 UNK, UNK, UNK, UNK, UNK, UNK,  97, UNK,  46, UNK, 124,  39,  39, 101,  45, 103,
2305 105, 105, 111, UNK, UNK, 116, 116, UNK, 120,  50,  51,  97, UNK, 101, 103, 105,
2306 105, 105, 111, 116,  97,  98,  99, 100, 101, 102, 103, UNK, 104, 105,  34,  34,
2307 UNK, UNK, UNK, UNK, UNK, 106, 107, 108, 109, UNK, UNK, UNK, UNK, 110, 111, UNK,
2308 UNK, UNK, UNK, UNK, UNK, UNK, 112, 113, UNK, UNK, UNK, UNK, UNK, UNK, UNK, 114,
2309 115, 116, 117, 118, 119, 120,  97,  98,  99, UNK, UNK, UNK, UNK, 100, 101, UNK,
2310 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115,  39,
2311  45, UNK, 116, 117, 118, UNK, 119, UNK, UNK, UNK, 120, 116, 116, 120, UNK,  32
2312
2313 };
2314 /*
2315   7-bit table providing readable translation from ELOT 927 to ISO Latin/Greek.
2316 */
2317 CONST CHAR
2318 yeglg[] = {
2319   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2320  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2321  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2322  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2323  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2324  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2325  96, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2326 208, 209, 211, 212, 213, 214, 215, 216, 217,  32,  32, 123, 124, 125, 126, 127
2327 };
2328 /*
2329   8-bit table providing readable translation from ISO Latin/Greek to ELOT 927.
2330 */
2331 CONST CHAR
2332 ylgeg[] = {  /* Latin/Greek to ELOT 927 */
2333   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
2334  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
2335  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
2336  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
2337  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2338  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
2339  96,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
2340  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
2341 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2342 UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
2343  32,  39,  39, UNK, UNK, UNK, 124, UNK,  34, UNK, UNK,  34, UNK,  45, UNK,  45,
2344 UNK, UNK,  50,  51,  39, UNK,  97,  46, 101, 103, 105,  34, 111, UNK, 116, 120,
2345 UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2346 112, 113, UNK, 114, 115, 116, 117, 118, 119, 120, 105, 116,  97, 101, 103, 105,
2347 116,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2348 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 105, 116, 111, 116, 120, UNK
2349 };
2350 #endif /* GREEK */
2351
2352 /* Translation functions ... */
2353
2354 CHAR                                    /* The identity function... */
2355 #ifdef CK_ANSIC
2356 ident(CHAR c)                           /* (no longer used) */
2357 #else
2358 ident(c) CHAR c;
2359 #endif /* CK_ANSIC */
2360 { /* ident */
2361     return(c);                          /* Instead, enter NULL in the  */
2362 }                                       /* table of functions to avoid */
2363                                         /* needless function calls.    */
2364
2365 CHAR
2366 #ifdef CK_ANSIC
2367 xleft128(CHAR c)
2368 #else
2369 xleft128(c) CHAR c;
2370 #endif /* CK_ANSIC */
2371 { /* xleft128 */
2372     return((c < 128) ? c : '?');
2373 }
2374
2375 CHAR
2376 #ifdef CK_ANSIC
2377 xleft160(CHAR c)
2378 #else
2379 xleft160(c) CHAR c;
2380 #endif /* CK_ANSIC */
2381 { /* xleft160 */
2382     return((c < 160) ? c : '?');
2383 }
2384
2385
2386 CHAR
2387 #ifdef CK_ANSIC
2388 xl1as(CHAR c)
2389 #else
2390 xl1as(c) CHAR c;
2391 #endif /* CK_ANSIC */
2392 { /* xl1as */                           /* Latin-1 to US ASCII... */
2393     switch(langs[language].id) {
2394
2395       case L_DUTCH:
2396         if (c == 255) {                 /* Dutch umlaut-y */
2397             zmstuff('j');               /* becomes ij */
2398             return('i');
2399         } else return(yl1as[c]);        /* all others by the book */
2400
2401       case L_GERMAN:
2402         switch (c) {                    /* German, special rules. */
2403           case 196:                     /* umlaut-A -> Ae */
2404             zmstuff('e');
2405             return('A');
2406           case 214:                     /* umlaut-O -> Oe */
2407             zmstuff('e');
2408             return('O');
2409           case 220:                     /* umlaut-U -> Ue */
2410             zmstuff('e');
2411             return('U');
2412           case 228:                     /* umlaut-a -> ae */
2413             zmstuff('e');
2414             return('a');
2415           case 246:                     /* umlaut-o -> oe */
2416             zmstuff('e');
2417             return('o');
2418           case 252:                     /* umlaut-u -> ue */
2419             zmstuff('e');
2420             return('u');
2421           case 223:                     /* ess-zet -> ss */
2422             zmstuff('s');
2423             return('s');
2424           default: return(yl1as[c]);    /* all others by the book */
2425         }
2426       case L_DANISH:
2427       case L_FINNISH:
2428       case L_NORWEGIAN:
2429       case L_SWEDISH:
2430         switch (c) {                    /* Scandanavian languages. */
2431           case 196:                     /* umlaut-A -> Ae */
2432           case 198:                     /* AE ligature also -> Ae */
2433             zmstuff('e');
2434             return('A');
2435           case 214:                     /* umlaut-O -> Oe */
2436           case 216:                     /* O-slash -> Oe */
2437             zmstuff('e');
2438             return('O');
2439           case 220:                     /* umlaut-U -> Ue */
2440           /*  return('Y'); replaced by "Ue" by popular demand. */
2441           /*  Y for Umlaut-U is only used in German names. */
2442             zmstuff('e');
2443             return('U');
2444           case 228:                     /* umlaut-a -> ae */
2445           case 230:                     /* ditto for ae ligature */
2446             zmstuff('e');
2447             return('a');
2448           case 246:                     /* umlaut-o -> oe */
2449           case 248:                     /* o-slash -> oe */
2450             zmstuff('e');
2451             return('o');
2452           case 252:                     /* umlaut-u -> ue */
2453           /*  return('y'); replaced by "ue" by popular demand. */
2454             zmstuff('e');
2455             return('u');
2456           case 197:                     /* A-ring -> Aa */
2457             zmstuff('a');
2458             return('A');
2459           case 229:                     /* a-ring -> aa */
2460             zmstuff('a');
2461             return('a');
2462           default: return(yl1as[c]);    /* All others by the book */
2463         }
2464       case L_ICELANDIC:                 /* Icelandic. */
2465         switch (c) {
2466           case 198:                     /* uppercase AE -> AE */
2467             zmstuff('e');
2468             return('A');
2469           case 208:                     /* uppercase Eth -> D */
2470             return('D');
2471           case 214:                     /* uppercase O-diaeresis -> Oe */
2472             zmstuff('e');
2473             return('O');
2474           case 222:                     /* uppercase Thorn -> Th */
2475             zmstuff('h');
2476             return('T');
2477           case 230:                     /* lowercase ae -> ae */
2478             zmstuff('e');
2479             return('a');
2480           case 240:                     /* lowercase Eth -> d */
2481             return('d');
2482           case 246:                     /* lowercase O-diaeresis -> oe */
2483             zmstuff('e');
2484             return('o');
2485           case 254:                     /* lowercase Thorn -> th */
2486             zmstuff('h');
2487             return('t');
2488           default: return(yl1as[c]);    /* All others by the book */
2489         }
2490       default:
2491         return(yl1as[c]);               /* None of the above, by the table. */
2492     }
2493 }
2494
2495 CHAR                                    /* CP1252 to ASCII */
2496 #ifdef CK_ANSIC
2497 xw1as(CHAR c)
2498 #else
2499 xw1as(c) CHAR c;
2500 #endif /* CK_ANSIC */
2501 { /* xw1as */
2502     switch(c) {                         /* Microsoft name... */
2503       case 0x80: return('?');           /* Euro Sign */
2504       case 0x82: return('\047');        /* Single Low-9 Quotation Mark */
2505       case 0x83: return('f');           /* Latin Small Letter f with Hook */
2506       case 0x84: return('"');           /* Double low-9 Quotation Mark */
2507       case 0x85: return('-');           /* Horizontal Ellipsis */
2508       case 0x86: return('+');           /* Dagger */
2509       case 0x87: return('+');           /* Double Dagger */
2510       case 0x88: return('^');           /* Modifier Letter Circumflex Accent */
2511       case 0x89: return('?');           /* Per Mille Sign */
2512       case 0x8A: return('S');           /* Latin Capital Letter S with Caron */
2513       case 0x8B: return('<');           /* Single Left Angle Quotation Mark */
2514       case 0x8C: return('O');           /* Latin Capital Ligature OE */
2515       case 0x8E: return('Z');           /* Latin Capital Letter Z with Caron */
2516       case 0x91: return('\047');        /* Left Single Quotation Mark */
2517       case 0x92: return('\047');        /* Right Single Quotation Mark */
2518       case 0x93: return('"');           /* Left Double Quotation Mark */
2519       case 0x94: return('"');           /* Right Double Quotation Mark */
2520       case 0x95: return('.');           /* Bullet */
2521       case 0x96: return('-');           /* En Dash */
2522       case 0x97: return('-');           /* Em Dash */
2523       case 0x98: return('~');           /* Small Tilde */
2524       case 0x99: return('T');           /* Trade Mark Sign */
2525       case 0x9A: return('s');           /* Latin Small Letter s with Caron */
2526       case 0x9B: return('>');           /* Single Right Angle Quotation Mark */
2527       case 0x9C: return('o');           /* Latin Small Ligature OE */
2528       case 0x9E: return('z');           /* Latin Small Letter z with Caron */
2529       case 0x9F: return('Y');           /* Latin Capital Letter Y Diaeresis */
2530       default:
2531         if (c > 0x80 && c < 0xa0)
2532           return('?');
2533         else
2534           return(yl1as[c]);
2535     }
2536 }
2537
2538 CHAR                                    /* CP1252 to Latin-1 */
2539 #ifdef CK_ANSIC
2540 xw1l1(CHAR c)
2541 #else
2542 xw1l1(c) CHAR c;
2543 #endif /* CK_ANSIC */
2544 { /* xw1l1 */
2545     if (c == 0x95) return(0xb7);        /* Middle dot */
2546     return((c < 160) ? xw1as(c) : c);
2547 }
2548
2549 CHAR                                    /* Latin-1 to German */
2550 #ifdef CK_ANSIC
2551 xl1ge(CHAR c)
2552 #else
2553 xl1ge(c) CHAR c;
2554 #endif /* CK_ANSIC */
2555 { /* xl1ge */
2556     return(yl1ge[c]);
2557 }
2558
2559 CHAR                                    /* German to Latin-1 */
2560 #ifdef CK_ANSIC
2561 xgel1(CHAR c)
2562 #else
2563 xgel1(c) CHAR c;
2564 #endif /* CK_ANSIC */
2565 { /* xgel1 */
2566     if (c & 0x80)
2567       return(UNK);
2568     return(ygel1[c]);
2569 }
2570
2571 CHAR
2572 #ifdef CK_ANSIC
2573 xgeas(CHAR c)
2574 #else
2575 xgeas(c) CHAR c;
2576 #endif /* CK_ANSIC */
2577 { /* xgeas */                           /* German ISO 646 to ASCII */
2578     if (c & 0x80)
2579       return(UNK);
2580     switch (c) {
2581       case 91:                          /* umlaut-A -> Ae */
2582         zmstuff('e');
2583         return('A');
2584       case 92:                          /* umlaut-O -> Oe */
2585         zmstuff('e');
2586         return('O');
2587       case 93:                          /* umlaut-U -> Ue */
2588         zmstuff('e');
2589         return('U');
2590       case 123:                         /* umlaut-a -> ae */
2591         zmstuff('e');
2592         return('a');
2593       case 124:                         /* umlaut-o -> oe */
2594         zmstuff('e');
2595         return('o');
2596       case 125:                         /* umlaut-u -> ue */
2597         zmstuff('e');
2598         return('u');
2599       case 126:                         /* ess-zet -> ss */
2600         zmstuff('s');
2601         return('s');
2602       default:  return(c);              /* all others stay the same */
2603     }
2604 }
2605
2606 CHAR
2607 #ifdef CK_ANSIC
2608 xl1w1(CHAR c)
2609 #else
2610 xl1w1(c) CHAR c;
2611 #endif /* CK_ANSIC */
2612 { /* xl1w1 */                           /* Latin-1 to CP1252 (Windows L1) */
2613     if (c > 127 && c < 160)
2614       return(UNK);
2615     else
2616       return(c);
2617 }
2618
2619 CHAR
2620 #ifdef CK_ANSIC
2621 xduas(CHAR c)
2622 #else
2623 xduas(c) CHAR c;
2624 #endif /* CK_ANSIC */
2625 { /* xduas */                           /* Dutch ISO 646 to US ASCII */
2626     if (c & 0x80)
2627       return(UNK);
2628     switch (c) {
2629       case 64:  return(UNK);            /* 3/4 */
2630       case 91:                          /* y-diaeresis */
2631         zmstuff('j');
2632         return('i');
2633       case 92:  return(UNK);            /* 1/2 */
2634       case 93:  return(124);            /* vertical bar */
2635       case 123: return(34);             /* diaeresis */
2636       case 124: return(UNK);            /* Florin */
2637       case 125: return(UNK);            /* 1/4 */
2638       case 126: return(39);             /* Apostrophe */
2639       default:  return(c);
2640     }
2641 }
2642
2643 CHAR
2644 #ifdef CK_ANSIC
2645 xfias(CHAR c)
2646 #else
2647 xfias(c) CHAR c;
2648 #endif /* CK_ANSIC */
2649 { /* xfias */                           /* Finnish ISO 646 to US ASCII */
2650     if (c & 0x80)
2651       return(UNK);
2652     switch (c) {
2653       case 91:                          /* A-diaeresis */
2654         zmstuff('e');
2655         return('A');
2656       case 92:                          /* O-diaeresis */
2657         zmstuff('e');
2658         return('O');
2659       case 93:                          /* A-ring */
2660         zmstuff('a');
2661         return('A');
2662       case 94:                          /* U-diaeresis */
2663         /* return('Y'); */
2664         zmstuff('e');
2665         return('U');
2666       case 96:                          /* e-acute */
2667         return('e');
2668       case 123:                         /* a-diaeresis */
2669         zmstuff('e');
2670         return('a');
2671       case 124:                         /* o-diaeresis */
2672         zmstuff('e');
2673         return('o');
2674       case 125:                         /* a-ring */
2675         zmstuff('a');
2676         return('a');
2677       case 126:                         /* u-diaeresis */
2678         /* return('y'); */
2679         zmstuff('e');
2680         return('U');
2681       default:
2682         return(c);
2683     }
2684 }
2685
2686 CHAR
2687 #ifdef CK_ANSIC
2688 xfras(CHAR c)
2689 #else
2690 xfras(c) CHAR c;
2691 #endif /* CK_ANSIC */
2692 { /* xfras */                           /* French ISO 646 to US ASCII */
2693     if (c & 0x80)
2694       return(UNK);
2695     switch (c) {
2696       case 64:  return(97);             /* a grave */
2697       case 91:  return(UNK);            /* degree sign */
2698       case 92:  return(99);             /* c cedilla */
2699       case 93:  return(UNK);            /* paragraph sign */
2700       case 123: return(101);            /* e acute */
2701       case 124: return(117);            /* u grave */
2702       case 125: return(101);            /* e grave */
2703       case 126: return(34);             /* diaeresis */
2704       default:  return(c);
2705     }
2706 }
2707
2708 CHAR
2709 #ifdef CK_ANSIC
2710 xfcas(CHAR c)
2711 #else
2712 xfcas(c) CHAR c;
2713 #endif /* CK_ANSIC */
2714 { /* xfcas */                           /* French Canadian ISO 646 to ASCII */
2715     if (c & 0x80)
2716       return(UNK);
2717     switch (c) {
2718       case 64:  return('a');            /* a grave */
2719       case 91:  return('a');            /* a circumflex */
2720       case 92:  return('c');            /* c cedilla */
2721       case 93:  return('e');            /* e circumflex */
2722       case 94:  return('i');            /* i circumflex */
2723       case 96:  return('o');            /* o circumflex */
2724       case 123: return('e');            /* e acute */
2725       case 124: return('u');            /* u grave */
2726       case 125: return('e');            /* e grave */
2727       case 126: return('u');            /* u circumflex */
2728       default:  return(c);
2729     }
2730 }
2731
2732 CHAR
2733 #ifdef CK_ANSIC
2734 xitas(CHAR c)
2735 #else
2736 xitas(c) CHAR c;
2737 #endif /* CK_ANSIC */
2738 { /* xitas */                           /* Italian ISO 646 to ASCII */
2739     if (c & 0x80)
2740       return(UNK);
2741     switch (c) {
2742       case 91:  return(UNK);            /* degree */
2743       case 92:  return('c');            /* c cedilla */
2744       case 93:  return('e');            /* e acute */
2745       case 96:  return('u');            /* u grave */
2746       case 123: return('a');            /* a grave */
2747       case 124: return('o');            /* o grave */
2748       case 125: return('e');            /* e grave */
2749       case 126: return('i');            /* i grave */
2750       default:  return(c);
2751     }
2752 }
2753
2754 CHAR
2755 #ifdef CK_ANSIC
2756 xneas(CHAR c)
2757 #else
2758 xneas(c) CHAR c;
2759 #endif /* CK_ANSIC */
2760 { /* xneas */                           /* NeXT to ASCII */
2761     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
2762         if (c == 234) {                 /* handle OE digraph. */
2763             zmstuff('E');
2764             return('O');
2765         } else if (c == 250) {          /* Also lowercase oe. */
2766             zmstuff('e');
2767             return('o');
2768         }
2769     }
2770     c = xnel1(c);                       /* Convert to Latin-1 */
2771     return(yl1as[c]);                   /* Convert Latin-1 to ASCII */
2772 }
2773
2774 CHAR
2775 #ifdef CK_ANSIC
2776 xnoas(CHAR c)
2777 #else
2778 xnoas(c) CHAR c;
2779 #endif /* CK_ANSIC */
2780 { /* xnoas */                           /* Norge/Danish ISO 646 to ASCII */
2781     if (c & 0x80)
2782       return(UNK);
2783     switch (c) {
2784       case 91:
2785         zmstuff('E');                   /* AE digraph */
2786         return('A');
2787       case 92: return('O');             /* O slash */
2788       case 93:                          /* A ring */
2789         zmstuff('a');
2790         return('A');
2791       case 123:                         /* ae digraph */
2792         zmstuff('e');
2793         return('a');
2794       case 124: return('o');            /* o slash */
2795       case 125:                         /* a ring */
2796         zmstuff('a');
2797         return('a');
2798       default:  return(c);
2799     }
2800 }
2801
2802 CHAR
2803 #ifdef CK_ANSIC
2804 xpoas(CHAR c)
2805 #else
2806 xpoas(c) CHAR c;
2807 #endif /* CK_ANSIC */
2808 { /* xpoas */                           /* Portuguese ISO 646 to ASCII */
2809     if (c & 0x80)
2810       return(UNK);
2811     switch (c) {
2812       case 91:  return('A');            /* A tilde */
2813       case 92:  return('C');            /* C cedilla */
2814       case 93:  return('O');            /* O tilde */
2815       case 123: return('a');            /* a tilde */
2816       case 124: return('c');            /* c cedilla */
2817       case 125: return('o');            /* o tilde */
2818       default:  return(c);
2819     }
2820 }
2821
2822 CHAR
2823 #ifdef CK_ANSIC
2824 xspas(CHAR c)
2825 #else
2826 xspas(c) CHAR c;
2827 #endif /* CK_ANSIC */
2828 { /* xspas */                           /* Spanish ISO 646 to ASCII */
2829     if (c & 0x80)
2830       return(UNK);
2831     switch (c) {
2832       case 91:  return(33);             /* Inverted exclamation */
2833       case 92:  return('N');            /* N tilde */
2834       case 93:  return(63);             /* Inverted question mark */
2835       case 123: return(UNK);            /* degree */
2836       case 124: return('n');            /* n tilde */
2837       case 125: return('c');            /* c cedilla */
2838       default:  return(c);
2839     }
2840 }
2841
2842 CHAR
2843 #ifdef CK_ANSIC
2844 xswas(CHAR c)
2845 #else
2846 xswas(c) CHAR c;
2847 #endif /* CK_ANSIC */
2848 { /* xswas */                           /* Swedish ISO 646 to ASCII */
2849     if (c & 0x80)
2850       return(UNK);
2851     switch (c) {
2852       case 64:  return('E');            /* E acute */
2853       case 91:                          /* A diaeresis */
2854         zmstuff('e');
2855         return('A');
2856       case 92:                          /* O diaeresis */
2857         zmstuff('e');
2858         return('O');
2859       case 93:                          /* A ring */
2860         zmstuff('a');
2861         return('A');
2862       case 94:                          /* U diaeresis */
2863         /* return('Y'); */
2864         zmstuff('e');
2865         return('U');
2866       case 96:  return('e');            /* e acute */
2867       case 123:                         /* a diaeresis */
2868         zmstuff('e');
2869         return('a');
2870       case 124:                         /* o diaeresis */
2871         zmstuff('e');
2872         return('o');
2873       case 125:                         /* a ring */
2874         zmstuff('a');
2875         return('a');
2876       case 126:                         /* u diaeresis */
2877         /* return('y'); */
2878         zmstuff('e');
2879         return('u');
2880       default:  return(c);
2881     }
2882 }
2883
2884 CHAR
2885 #ifdef CK_ANSIC
2886 xchas(CHAR c)
2887 #else
2888 xchas(c) CHAR c;
2889 #endif /* CK_ANSIC */
2890 { /* xchas */                           /* Swiss ISO 646 to ASCII */
2891     if (c & 0x80)
2892       return(UNK);
2893     switch (c) {
2894       case 35:  return('u');            /* u grave */
2895       case 64:  return('a');            /* a grave */
2896       case 91:  return('e');            /* e acute */
2897       case 92:  return('c');            /* c cedilla */
2898       case 93:  return('e');            /* e circumflex */
2899       case 94:  return('i');            /* i circumflex */
2900       case 95:  return('e');            /* e grave */
2901       case 96:  return('o');            /* o circumflex */
2902       case 123:                         /* a diaeresis */
2903         zmstuff('e');
2904         return('a');
2905       case 124:                         /* o diaeresis */
2906         zmstuff('e');
2907         return('o');
2908       case 125:                         /* u diaeresis */
2909         zmstuff('e');
2910         return('u');
2911       case 126: return('u');            /* u circumflex */
2912       default:  return(c);
2913     }
2914 }
2915
2916 CHAR
2917 #ifdef CK_ANSIC
2918 xhuas(CHAR c)
2919 #else
2920 xhuas(c) CHAR c;
2921 #endif /* CK_ANSIC */
2922 { /* xhuas */                           /* Hungarian ISO 646 to ASCII */
2923     if (c & 0x80)
2924       return(UNK);
2925     switch (c) {
2926       case 64:  return('A');            /* A acute */
2927       case 91:  return('E');            /* E acute */
2928       case 92:  return('O');            /* O diaeresis */
2929       case 93:  return('U');            /* U diaeresis */
2930       case 96:  return('a');            /* a acute */
2931       case 123: return('e');            /* e acute */
2932       case 124: return('o');            /* o acute */
2933       case 125: return('u');            /* u acute */
2934       case 126: return(34);             /* double acute accent */
2935       default:  return(c);
2936     }
2937 }
2938
2939 CHAR
2940 #ifdef CK_ANSIC
2941 xdmas(CHAR c)
2942 #else
2943 xdmas(c) CHAR c;
2944 #endif /* CK_ANSIC */
2945 { /* xdmas */                           /* DEC MCS to ASCII */
2946     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
2947         if (c == 215) {                 /* handle OE digraph. */
2948             zmstuff('E');
2949             return('O');
2950         } else if (c == 247) {          /* Also lowercase oe. */
2951             zmstuff('e');
2952             return('o');
2953         }
2954     }
2955     return(yl1as[c]);                   /* Otherwise treat like Latin-1 */
2956 }
2957
2958 CHAR
2959 #ifdef CK_ANSIC
2960 xdgas(CHAR c)
2961 #else
2962 xdgas(c) CHAR c;
2963 #endif /* CK_ANSIC */
2964 { /*  xdgas */                          /* Data General to ASCII */
2965     switch(c) {
2966       case 180: return('f');            /* Florin */
2967       case 183: return('<');            /* Less-equal */
2968       case 184: return('>');            /* Greater-equal */
2969       case 186: return(96);             /* Grave accent */
2970       case 191: return('^');            /* Uparrow */
2971       case 215:
2972         if (langs[language].id == L_FRENCH) { /* OE digraph */
2973             zmstuff('E');
2974             return('O');
2975         } else return('O');
2976       case 247:
2977         if (langs[language].id == L_FRENCH) { /* oe digraph */
2978             zmstuff('e');
2979             return('o');
2980         } else return('o');
2981       case 175: case 179: case 220: case 222:
2982       case 223: case 254: case 255:
2983         return(UNK);
2984       default:                          /* The rest, convert to Latin-1 */
2985         return(yl1as[ydgl1[c]]);        /* and from there to ASCII */
2986     }
2987 }
2988
2989 CHAR
2990 #ifdef CK_ANSIC
2991 xr8as(CHAR c)
2992 #else
2993 xr8as(c) CHAR c;
2994 #endif /* CK_ANSIC */
2995 { /*  xr8as */                          /* Hewlett Packard Roman8 to ASCII */
2996     switch(c) {
2997       case 175: return('L');            /* Lira */
2998       case 190: return('f');            /* Florin */
2999       case 235: return('S');            /* S caron */
3000       case 236: return('s');            /* s caron */
3001       case 246: return('-');            /* Horizontal bar */
3002       case 252: return('*');            /* Solid box */
3003       default:                          /* The rest, convert to Latin-1 */
3004         return(yl1as[yr8l1[c]]);        /* and from there to ASCII */
3005     }
3006 }
3007
3008 CHAR
3009 #ifdef CK_ANSIC
3010 xukl1(CHAR c)
3011 #else
3012 xukl1(c) CHAR c;
3013 #endif /* CK_ANSIC */
3014 { /* xukl1 */                           /* UK ASCII to Latin-1 */
3015     if (c & 0x80)
3016       return(UNK);
3017     if (c == 35)
3018       return(163);
3019     else return(c);
3020 }
3021
3022 CHAR
3023 #ifdef CK_ANSIC
3024 xl1uk(CHAR c)
3025 #else
3026 xl1uk(c) CHAR c;
3027 #endif /* CK_ANSIC */
3028 { /* xl1uk */                           /* Latin-1 to UK ASCII */
3029     if (c == 163)
3030       return(35);
3031     else return(yl1as[c]);
3032 }
3033
3034 CHAR                                    /* Latin-1 to French ISO 646 */
3035 #ifdef CK_ANSIC
3036 xl1fr(CHAR c)
3037 #else
3038 xl1fr(c) CHAR c;
3039 #endif /* CK_ANSIC */
3040 { /* xl1fr */
3041     return(yl1fr[c]);
3042 }
3043
3044
3045 CHAR                                    /* French ISO 646 to Latin-1 */
3046 #ifdef CK_ANSIC
3047 xfrl1(CHAR c)
3048 #else
3049 xfrl1(c) CHAR c;
3050 #endif /* CK_ANSIC */
3051 { /* xfrl1 */
3052     if (c & 0x80)
3053       return(UNK);
3054     return(yfrl1[c]);
3055 }
3056
3057 CHAR                                    /* Latin-1 to Dutch ASCII */
3058 #ifdef CK_ANSIC
3059 xl1du(CHAR c)
3060 #else
3061 xl1du(c) CHAR c;
3062 #endif /* CK_ANSIC */
3063 { /* xl1du */
3064     return(yl1du[c]);
3065 }
3066
3067 CHAR
3068 #ifdef CK_ANSIC
3069 xdul1(CHAR c)
3070 #else
3071 xdul1(c) CHAR c;
3072 #endif /* CK_ANSIC */
3073 { /* xdul1 */                           /* Dutch ISO 646 to Latin-1 */
3074     if (c & 0x80)
3075       return(UNK);
3076     return(ydul1[c]);
3077 }
3078
3079 CHAR
3080 #ifdef CK_ANSIC
3081 xfil1(CHAR c)
3082 #else
3083 xfil1(c) CHAR c;
3084 #endif /* CK_ANSIC */
3085 { /* xfil1 */                           /* Finnish ISO 646 to Latin-1 */
3086     if (c & 0x80)
3087       return(UNK);
3088     return(yfil1[c]);
3089 }
3090
3091 CHAR
3092 #ifdef CK_ANSIC
3093 xl1fi(CHAR c)
3094 #else
3095 xl1fi(c) CHAR c;
3096 #endif /* CK_ANSIC */
3097 { /* xl1fi */                           /* Latin-1 to Finnish ISO 646 */
3098     return(yl1fi[c]);
3099 }
3100
3101 CHAR
3102 #ifdef CK_ANSIC
3103 xfcl1(CHAR c)
3104 #else
3105 xfcl1(c) CHAR c;
3106 #endif /* CK_ANSIC */
3107 { /* xfcl1 */                           /* French Canadian ISO646 to Latin-1 */
3108     if (c & 0x80)
3109       return(UNK);
3110     return(yfcl1[c]);
3111 }
3112
3113 CHAR
3114 #ifdef CK_ANSIC
3115 xl1fc(CHAR c)
3116 #else
3117 xl1fc(c) CHAR c;
3118 #endif /* CK_ANSIC */
3119 { /* xl1fc */                           /* Latin-1 to French Canadian ISO646 */
3120     return(yl1fc[c]);
3121 }
3122
3123 CHAR
3124 #ifdef CK_ANSIC
3125 xitl1(CHAR c)
3126 #else
3127 xitl1(c) CHAR c;
3128 #endif /* CK_ANSIC */
3129 { /* xitl1 */                           /* Italian ISO 646 to Latin-1 */
3130     if (c & 0x80)
3131       return(UNK);
3132     return(yitl1[c]);
3133 }
3134
3135 CHAR
3136 #ifdef CK_ANSIC
3137 xl1it(CHAR c)
3138 #else
3139 xl1it(c) CHAR c;
3140 #endif /* CK_ANSIC */
3141 { /* xl1it */                           /* Latin-1 to Italian ISO 646 */
3142     return(yl1it[c]);
3143 }
3144
3145 CHAR
3146 #ifdef CK_ANSIC
3147 xnel1(CHAR c)
3148 #else
3149 xnel1(c) CHAR c;
3150 #endif /* CK_ANSIC */
3151 { /* xnel1 */                           /* NeXT to Latin-1 */
3152     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
3153         if (c == 234) {                 /* handle OE digraph. */
3154             zmstuff('E');
3155             return('O');
3156         } else if (c == 250) {          /* Also lowercase oe. */
3157             zmstuff('e');
3158             return('o');
3159         }
3160     }
3161     return(ynel1[c]);
3162 }
3163
3164 CHAR
3165 #ifdef CK_ANSIC
3166 xnel9(CHAR c)
3167 #else
3168 xnel9(c) CHAR c;
3169 #endif /* CK_ANSIC */
3170 { /* xnel9 */                           /* NeXT to Latin-9 */
3171     switch (c) {
3172       case 234: return(188);            /* OE */
3173       case 250: return(189);            /* oe */
3174       case 188: return(234);            /* keep it invertible... */
3175       case 189: return(250);            /* oe */
3176       default:
3177         return(ynel1[c]);
3178     }
3179 }
3180
3181 CHAR
3182 #ifdef CK_ANSIC
3183 xl1ne(CHAR c)
3184 #else
3185 xl1ne(c) CHAR c;
3186 #endif /* CK_ANSIC */
3187 { /* xl1ne */                           /* Latin-1 to NeXT */
3188     return(yl1ne[c]);
3189 }
3190
3191 CHAR
3192 #ifdef CK_ANSIC
3193 xl9ne(CHAR c)
3194 #else
3195 xl9ne(c) CHAR c;
3196 #endif /* CK_ANSIC */
3197 { /* xl9ne */                           /* Latin-9 to NeXT */
3198     switch (c) {
3199       case 188: return(234);            /* OE */
3200       case 189: return(250);            /* oe */
3201       case 234: return(188);            /* OE */
3202       case 250: return(189);            /* oe */
3203       default:
3204         return(yl1ne[c]);
3205     }
3206 }
3207
3208 CHAR
3209 #ifdef CK_ANSIC
3210 xnol1(CHAR c)
3211 #else
3212 xnol1(c) CHAR c;
3213 #endif /* CK_ANSIC */
3214 { /* xnol1 */                           /* Norway/Denmark ISO 646 to Latin-1 */
3215     if (c & 0x80)
3216       return(UNK);
3217     return(ynol1[c]);
3218 }
3219
3220 CHAR
3221 #ifdef CK_ANSIC
3222 xl1no(CHAR c)
3223 #else
3224 xl1no(c) CHAR c;
3225 #endif /* CK_ANSIC */
3226 { /* xl1no */                           /* Latin-1 to Norway/Denmark ISO 646 */
3227     return(yl1no[c]);
3228 }
3229
3230 CHAR
3231 #ifdef CK_ANSIC
3232 xpol1(CHAR c)
3233 #else
3234 xpol1(c) CHAR c;
3235 #endif /* CK_ANSIC */
3236 { /* xpol1 */                           /* Portuguese ISO 646 to Latin-1 */
3237     if (c & 0x80)
3238       return(UNK);
3239     return(ypol1[c]);
3240 }
3241
3242 CHAR
3243 #ifdef CK_ANSIC
3244 xl1po(CHAR c)
3245 #else
3246 xl1po(c) CHAR c;
3247 #endif /* CK_ANSIC */
3248 { /* xl1po */                           /* Latin-1 to Portuguese ISO 646 */
3249     return(yl1po[c]);
3250 }
3251
3252 CHAR
3253 #ifdef CK_ANSIC
3254 xspl1(CHAR c)
3255 #else
3256 xspl1(c) CHAR c;
3257 #endif /* CK_ANSIC */
3258 { /* xspl1 */                           /* Spanish ISO 646 to Latin-1 */
3259     if (c & 0x80)
3260       return(UNK);
3261     return(yspl1[c]);
3262 }
3263
3264 CHAR
3265 #ifdef CK_ANSIC
3266 xl1sp(CHAR c)
3267 #else
3268 xl1sp(c) CHAR c;
3269 #endif /* CK_ANSIC */
3270 { /* xl1sp */                           /* Latin-1 to Spanish ISO 646 */
3271     return(yl1sp[c]);
3272 }
3273
3274 CHAR
3275 #ifdef CK_ANSIC
3276 xswl1(CHAR c)
3277 #else
3278 xswl1(c) CHAR c;
3279 #endif /* CK_ANSIC */
3280 { /* xswl1 */                           /* Swedish ISO 646 to Latin-1 */
3281     if (c & 0x80)
3282       return(UNK);
3283     return(yswl1[c]);
3284 }
3285
3286 CHAR
3287 #ifdef CK_ANSIC
3288 xl1sw(CHAR c)
3289 #else
3290 xl1sw(c) CHAR c;
3291 #endif /* CK_ANSIC */
3292 { /* xl1sw */                           /* Latin-1 to Swedish ISO 646 */
3293     return(yl1sw[c]);
3294 }
3295
3296 CHAR
3297 #ifdef CK_ANSIC
3298 xchl1(CHAR c)
3299 #else
3300 xchl1(c) CHAR c;
3301 #endif /* CK_ANSIC */
3302 { /* xchl1 */                           /* Swiss ISO 646 to Latin-1 */
3303     if (c & 0x80)
3304       return(UNK);
3305     return(ychl1[c]);
3306 }
3307
3308 CHAR
3309 #ifdef CK_ANSIC
3310 xl1ch(CHAR c)
3311 #else
3312 xl1ch(c) CHAR c;
3313 #endif /* CK_ANSIC */
3314 { /* xl1ch */                           /* Latin-1 to Swiss ISO 646 */
3315     return(yl1ch[c]);
3316 }
3317
3318 CHAR
3319 #ifdef CK_ANSIC
3320 xhul1(CHAR c)
3321 #else
3322 xhul1(c) CHAR c;
3323 #endif /* CK_ANSIC */
3324 { /* xhul1 */                           /* Hungarian ISO 646 to Latin-1 */
3325     if (c & 0x80)
3326       return(UNK);
3327     return(yhul1[c]);
3328 }
3329
3330 CHAR
3331 #ifdef CK_ANSIC
3332 xl1hu(CHAR c)
3333 #else
3334 xl1hu(c) CHAR c;
3335 #endif /* CK_ANSIC */
3336 { /* xl1hu */                           /* Latin-1 to Hungarian ISO 646 */
3337     return(yl1hu[c]);
3338 }
3339
3340 CHAR
3341 #ifdef CK_ANSIC
3342 xl1dm(CHAR c)
3343 #else
3344 xl1dm(c) CHAR c;
3345 #endif /* CK_ANSIC */
3346 { /* xl1dm */                           /* Latin-1 to DEC MCS */
3347     return(yl1dm[c]);
3348 }
3349
3350 CHAR
3351 #ifdef CK_ANSIC
3352 xl9dm(CHAR c)
3353 #else
3354 xl9dm(c) CHAR c;
3355 #endif /* CK_ANSIC */
3356 { /* xl9dm */                           /* Latin-9 to DEC MCS */
3357     switch (c) {
3358       case 188: return(215);
3359       case 189: return(247);
3360       case 215: return(188);
3361       case 247: return(189);
3362       default:
3363         return(yl1dm[c]);
3364     }
3365 }
3366
3367 CHAR
3368 #ifdef CK_ANSIC
3369 xl9w1(CHAR c)
3370 #else
3371 xl9w1(c) CHAR c;
3372 #endif /* CK_ANSIC */
3373 { /* xl9w1 */                           /* Latin-9 to CP1252 */
3374     if (c < 128)
3375       return(c);
3376     else if (c < 160)
3377       return('?');
3378     switch (c) {
3379       case 0xa4: return(0x80);          /* Euro */
3380       case 0xa6: return(0x8a);          /* S-caron */
3381       case 0xa8: return(0x9a);          /* s-caron */
3382       case 0xb4: return(0x8e);          /* Z-caron */
3383       case 0xb8: return(0x9e);          /* z-caron */
3384       case 0xbc: return(0x8c);          /* OE */
3385       case 0xbd: return(0x9c);          /* oe */
3386       case 0xbe: return(0x9f);          /* Y-diaeresis */
3387       default:
3388         return(c);
3389     }
3390 }
3391
3392 CHAR
3393 #ifdef CK_ANSIC
3394 xl1dg(CHAR c)
3395 #else
3396 xl1dg(c) CHAR c;
3397 #endif /* CK_ANSIC */
3398 { /* xl1dg */                           /* Latin-1 to DG ICS */
3399     return(yl1dg[c]);
3400 }
3401
3402 CHAR
3403 #ifdef CK_ANSIC
3404 xdml1(CHAR c)
3405 #else
3406 xdml1(c) CHAR c;
3407 #endif /* CK_ANSIC */
3408 { /* xdml1 */                           /* DEC MCS to Latin-1 */
3409     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
3410         if (c == 215) {                 /* handle OE digraph. */
3411             zmstuff('E');
3412             return('O');
3413         } else if (c == 247) {          /* Also lowercase oe. */
3414             zmstuff('e');
3415             return('o');
3416         }
3417     }
3418     return(ydml1[c]);
3419 }
3420
3421 CHAR
3422 #ifdef CK_ANSIC
3423 xdml9(CHAR c)
3424 #else
3425 xdml9(c) CHAR c;
3426 #endif /* CK_ANSIC */
3427 { /* xdml9 */                           /* DEC MCS to Latin-9 */
3428     switch (c) {
3429       case 215: return(188);            /* OE */
3430       case 247: return(189);            /* oe */
3431       case 188: return(215);            /* and swap the other two... */
3432       case 189: return(247);            /* (1/4 and 1/2) */
3433       default:                          /* to keep it invertible */
3434         return(ydml1[c]);
3435     }
3436 }
3437
3438 CHAR
3439 #ifdef CK_ANSIC
3440 xdgl1(CHAR c)
3441 #else
3442 xdgl1(c) CHAR c;
3443 #endif /* CK_ANSIC */
3444 { /* xdgl1 */                           /* DG International CS to Latin-1 */
3445     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
3446         if (c == 215) {                 /* handle OE digraph. */
3447             zmstuff('E');
3448             return('O');
3449         } else if (c == 247) {          /* Also lowercase oe. */
3450             zmstuff('e');
3451             return('o');
3452         }
3453     }
3454     return(ydgl1[c]);
3455 }
3456
3457 CHAR
3458 #ifdef CK_ANSIC
3459 xr8l1(CHAR c)
3460 #else
3461 xr8l1(c) CHAR c;
3462 #endif /* CK_ANSIC */
3463 { /* xr8l1 */                           /* Hewlett Packard Roman8 to Latin-1 */
3464     return(yr8l1[c]);
3465 }
3466
3467 CHAR
3468 #ifdef CK_ANSIC
3469 xl1r8(CHAR c)
3470 #else
3471 xl1r8(c) CHAR c;
3472 #endif /* CK_ANSIC */
3473 { /* xl1r8 */                           /* Latin-1 to Hewlett Packard Roman8 */
3474     return(yl1r8[c]);
3475 }
3476
3477 /* Translation functions for receiving files and translating them into ASCII */
3478
3479 CHAR
3480 #ifdef CK_ANSIC
3481 zl1as(CHAR c)
3482 #else
3483 zl1as(c) CHAR c;
3484 #endif /* CK_ANSIC */
3485 { /* zl1as */
3486     switch(langs[language].id) {
3487
3488       case L_DUTCH:
3489         if (c == 255) {                 /* Dutch umlaut-y */
3490             zdstuff('j');               /* becomes ij */
3491             return('i');
3492         } else return(yl1as[c]);        /* all others by the book */
3493
3494       case L_GERMAN:
3495         switch (c) {                    /* German, special rules. */
3496           case 196:                     /* umlaut-A -> Ae */
3497             zdstuff('e');
3498             return('A');
3499           case 214:                     /* umlaut-O -> Oe */
3500             zdstuff('e');
3501             return('O');
3502           case 220:                     /* umlaut-U -> Ue */
3503             zdstuff('e');
3504             return('U');
3505           case 228:                     /* umlaut-a -> ae */
3506             zdstuff('e');
3507             return('a');
3508           case 246:                     /* umlaut-o -> oe */
3509             zdstuff('e');
3510             return('o');
3511           case 252:                     /* umlaut-u -> ue */
3512             zdstuff('e');
3513             return('u');
3514           case 223:                     /* ess-zet -> ss */
3515             zdstuff('s');
3516             return('s');
3517           default: return(yl1as[c]);    /* all others by the book */
3518         }
3519       case L_DANISH:
3520       case L_FINNISH:
3521       case L_NORWEGIAN:
3522       case L_SWEDISH:
3523         switch (c) {                    /* Scandanavian languages. */
3524           case 196:                     /* umlaut-A -> Ae */
3525             zdstuff('e');
3526             return('A');
3527           case 214:                     /* umlaut-O -> Oe */
3528           case 216:                     /* O-slash -> Oe */
3529             zdstuff('e');
3530             return('O');
3531           case 220:                     /* umlaut-U -> Y */
3532             /* return('Y'); */
3533             zdstuff('e');
3534             return('U');
3535           case 228:                     /* umlaut-a -> ae */
3536             zdstuff('e');
3537             return('a');
3538           case 246:                     /* umlaut-o -> oe */
3539           case 248:                     /* o-slash -> oe */
3540             zdstuff('e');
3541             return('o');
3542           case 252:                     /* umlaut-u -> y */
3543             /* return('y'); */
3544             zdstuff('e');
3545             return('u');
3546           case 197:                     /* A-ring -> Aa */
3547             zdstuff('a');
3548             return('A');
3549           case 229:                     /* a-ring -> aa */
3550             zdstuff('a');
3551             return('a');
3552           default: return(yl1as[c]);    /* All others by the book */
3553         }
3554       default:
3555         return(yl1as[c]);               /* No language, go by the table. */
3556     }
3557 }
3558
3559 CHAR                                    /* IBM CP437 to Latin-1 */
3560 #ifdef CK_ANSIC
3561 x43l1(CHAR c)
3562 #else
3563 x43l1(c) CHAR c;
3564 #endif /* CK_ANSIC */
3565 { /* x43l1 */
3566     return(y43l1[c]);
3567 }
3568
3569 CHAR                                    /* IBM CP850 to Latin-1 */
3570 #ifdef CK_ANSIC
3571 x85l1(CHAR c)
3572 #else
3573 x85l1(c) CHAR c;
3574 #endif /* CK_ANSIC */
3575 { /* x85l1 */
3576     return(y85l1[c]);
3577 }
3578
3579 CHAR                                    /* Latin-1 to IBM CP437 */
3580 #ifdef CK_ANSIC
3581 xl143(CHAR c)
3582 #else
3583 xl143(c) CHAR c;
3584 #endif /* CK_ANSIC */
3585 { /* xl143 */
3586     return(yl143[c]);
3587 }
3588
3589 CHAR                                    /* Latin-1 to CP850 */
3590 #ifdef CK_ANSIC
3591 xl185(CHAR c)
3592 #else
3593 xl185(c) CHAR c;
3594 #endif /* CK_ANSIC */
3595 { /* xl185 */
3596     return(yl185[c]);
3597 }
3598
3599 CHAR
3600 #ifdef CK_ANSIC
3601 x43as(CHAR c)
3602 #else
3603 x43as(c) CHAR c;
3604 #endif /* CK_ANSIC */
3605 { /* x43as */                           /* CP437 to ASCII */
3606     c = y43l1[c];                       /* Translate to Latin-1 */
3607     return(xl143(c));                   /* and from Latin-1 to ASCII. */
3608 }
3609
3610 CHAR
3611 #ifdef CK_ANSIC
3612 x85as(CHAR c)
3613 #else
3614 x85as(c) CHAR c;
3615 #endif /* CK_ANSIC */
3616 { /* x85as */                           /* CP850 to ASCII */
3617     c = y85l1[c];                       /* Translate to Latin-1 */
3618     return(xl1as(c));                   /* and from Latin-1 to ASCII. */
3619 }
3620
3621 CHAR                                    /* Macintosh Latin to Latin-1 */
3622 #ifdef CK_ANSIC
3623 xaql1(CHAR c)
3624 #else
3625 xaql1(c) CHAR c;
3626 #endif /* CK_ANSIC */
3627 { /* xaql1 */
3628     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
3629         if (c == 206) {                 /* handle OE digraph. */
3630             zmstuff('E');
3631             return('O');
3632         } else if (c == 207) {          /* Also lowercase oe. */
3633             zmstuff('e');
3634             return('o');
3635         }
3636     }
3637     return(yaql1[c]);
3638 }
3639
3640 CHAR                                    /* Macintosh Latin to ASCII */
3641 #ifdef CK_ANSIC
3642 xaqas(CHAR c)
3643 #else
3644 xaqas(c) CHAR c;
3645 #endif /* CK_ANSIC */
3646 { /* xaqas */
3647     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
3648         if (c == 206) {                 /* handle OE digraph. */
3649             zmstuff('E');
3650             return('O');
3651         } else if (c == 207) {          /* Also lowercase oe. */
3652             zmstuff('e');
3653             return('o');
3654         }
3655     }
3656     c = yaql1[c];                       /* Translate to Latin-1 */
3657     return(xl1as(c));                   /* then to ASCII. */
3658 }
3659
3660 CHAR                                    /* Latin-1 to Macintosh Latin */
3661 #ifdef CK_ANSIC
3662 xl1aq(CHAR c)
3663 #else
3664 xl1aq(c) CHAR c;
3665 #endif /* CK_ANSIC */
3666 { /* xl1aq */
3667     return(yl1aq[c]);
3668 }
3669
3670 #ifdef LATIN2
3671
3672 /* Translation functions for Latin Alphabet 2 */
3673
3674 CHAR                                    /* Latin-2 to Latin-1 */
3675 #ifdef CK_ANSIC
3676 xl2l1(CHAR c)
3677 #else
3678 xl2l1(c) CHAR c;
3679 #endif /* CK_ANSIC */
3680 { /* xll2l1 */
3681     return(yl2l1[c]);
3682 }
3683
3684 CHAR
3685 #ifdef CK_ANSIC
3686 xl2w1(CHAR c)
3687 #else
3688 xl2w1(c) CHAR c;
3689 #endif /* CK_ANSIC */
3690 { /* xl2w1 */                           /* Latin-2 to CP1252 (Windows L1) */
3691     if (c > 127 && c < 160)
3692       return(UNK);
3693     else
3694       return(yl2l1[c]);
3695 }
3696
3697 CHAR                                    /* Latin-1 to Latin-2 */
3698 #ifdef CK_ANSIC
3699 xl1l2(CHAR c)
3700 #else
3701 xl1l2(c) CHAR c;
3702 #endif /* CK_ANSIC */
3703 { /* xll1l2 */
3704     return(yl1l2[c]);
3705 }
3706
3707 CHAR                                    /* CP1252 to Latin-1 */
3708 #ifdef CK_ANSIC
3709 xw1l2(CHAR c)
3710 #else
3711 xw1l2(c) CHAR c;
3712 #endif /* CK_ANSIC */
3713 { /* xw1l2 */
3714     switch (c) {
3715       case 0x8a: return(0xa9);          /* S caron */
3716       case 0x8e: return(0xae);          /* Z caron */
3717       case 0x9a: return(0xb9);          /* s caron */
3718       case 0x9e: return(0xbe);          /* z caron */
3719       default:
3720         return((c < 160) ? xw1as(c) : xl1l2(c));
3721     }
3722 }
3723
3724
3725 CHAR                                    /* Latin-2 to ASCII */
3726 #ifdef CK_ANSIC
3727 xl2as(CHAR c)
3728 #else
3729 xl2as(c) CHAR c;
3730 #endif /* CK_ANSIC */
3731 { /* xll2as */
3732     return(yl2as[c]);
3733 }
3734
3735 CHAR                                    /* Latin-2 to CP852 */
3736 #ifdef CK_ANSIC
3737 xl252(CHAR c)
3738 #else
3739 xl252(c) CHAR c;
3740 #endif /* CK_ANSIC */
3741 { /* xll252 */
3742     return(yl252[c]);
3743 }
3744
3745 CHAR                                    /* Latin-2 to Mazovia */
3746 #ifdef CK_ANSIC
3747 xl2mz(CHAR c)
3748 #else
3749 xl2mz(c) CHAR c;
3750 #endif /* CK_ANSIC */
3751 { /* xll2mz */
3752     return(yl2mz[c]);
3753 }
3754
3755 CHAR                                    /* Latin-1 to Mazovia */
3756 #ifdef CK_ANSIC
3757 xl1mz(CHAR c)
3758 #else
3759 xl1mz(c) CHAR c;
3760 #endif /* CK_ANSIC */
3761 { /* xll1mz */
3762     return(yl2mz[yl1l2[c]]);
3763 }
3764
3765 CHAR                                    /* Mazovia to Latin-1 */
3766 #ifdef CK_ANSIC
3767 xmzl1(CHAR c)
3768 #else
3769 xmzl1(c) CHAR c;
3770 #endif /* CK_ANSIC */
3771 { /* xmzl1 */
3772     return(yl2l1[ymzl2[c]]);
3773 }
3774
3775 CHAR                                    /* Mazovia to Latin-9 */
3776 #ifdef CK_ANSIC
3777 xmzl9(CHAR c)
3778 #else
3779 xmzl9(c) CHAR c;
3780 #endif /* CK_ANSIC */
3781 { /* xmzl9 */
3782     return(xl2l9(ymzl2[c]));
3783 }
3784
3785 CHAR                                    /* CP852 to Latin-2 */
3786 #ifdef CK_ANSIC
3787 x52l2(CHAR c)
3788 #else
3789 x52l2(c) CHAR c;
3790 #endif /* CK_ANSIC */
3791 { /* x52l2 */
3792     return(y52l2[c]);
3793 }
3794
3795 CHAR                                    /* Mazovia to Latin-2 */
3796 #ifdef CK_ANSIC
3797 xmzl2(CHAR c)
3798 #else
3799 xmzl2(c) CHAR c;
3800 #endif /* CK_ANSIC */
3801 { /* xmzl2 */
3802     return(ymzl2[c]);
3803 }
3804
3805 CHAR                                    /* Latin-2 to CP1250 */
3806 #ifdef CK_ANSIC
3807 xl21250(CHAR c)
3808 #else
3809 xl21250(c) CHAR c;
3810 #endif /* CK_ANSIC */
3811 { /* xll21250 */
3812     return(yl21250[c]);
3813 }
3814
3815 CHAR                                    /* CP1250 to Latin-2 */
3816 #ifdef CK_ANSIC
3817 x1250l2(CHAR c)
3818 #else
3819 x1250l2(c) CHAR c;
3820 #endif /* CK_ANSIC */
3821 { /* x1250l2 */
3822     return(y1250l2[c]);
3823 }
3824
3825 CHAR                                    /* CP852 to ASCII */
3826 #ifdef CK_ANSIC
3827 x52as(CHAR c)
3828 #else
3829 x52as(c) CHAR c;
3830 #endif /* CK_ANSIC */
3831 { /* xl52as */
3832     return(yl2as[y52l2[c]]);            /* CP852 -> Latin-2 -> ASCII */
3833 }
3834
3835 CHAR                                    /* CP1250 to ASCII */
3836 #ifdef CK_ANSIC
3837 x1250as(CHAR c)
3838 #else
3839 x1250as(c) CHAR c;
3840 #endif /* CK_ANSIC */
3841 { /* xl1250as */
3842     return(yl2as[y1250l2[c]]);          /* CP81250 -> Latin-2 -> ASCII */
3843 }
3844
3845
3846 CHAR                                    /* CP852 to Latin-1 */
3847 #ifdef CK_ANSIC
3848 x52l1(CHAR c)
3849 #else
3850 x52l1(c) CHAR c;
3851 #endif /* CK_ANSIC */
3852 { /* xl52l1 */
3853     return(yl2l1[y52l2[c]]);            /* CP852 -> Latin-2 -> Latin-1 */
3854 }
3855
3856 CHAR                                    /* CP1250 to Latin-1 */
3857 #ifdef CK_ANSIC
3858 x1250l1(CHAR c)
3859 #else
3860 x1250l1(c) CHAR c;
3861 #endif /* CK_ANSIC */
3862 { /* xl1250l1 */
3863     return(yl2l1[y1250l2[c]]);          /* CP1250 -> Latin-2 -> Latin-1 */
3864 }
3865
3866 CHAR                                    /* CP1250 to Latin-9 */
3867 #ifdef CK_ANSIC
3868 x1250l9(CHAR c)
3869 #else
3870 x1250l9(c) CHAR c;
3871 #endif /* CK_ANSIC */
3872 { /* x1250l9 */
3873     if (c == (CHAR)128)                 /* Euro */
3874       return((CHAR)164);
3875     else
3876       return(xl2l9(y1250l2[c]));        /* CP1250 -> Latin-2 -> Latin-9 */
3877 }
3878
3879 CHAR                                    /* Latin-1 to CP852 */
3880 #ifdef CK_ANSIC
3881 xl152(CHAR c)
3882 #else
3883 xl152(c) CHAR c;
3884 #endif /* CK_ANSIC */
3885 { /* xll152 */
3886     return(yl252[yl1l2[c]]);            /* Latin-1 -> Latin-2 -> CP852 */
3887 }
3888
3889 CHAR                                    /* Latin-1 to CP1250 */
3890 #ifdef CK_ANSIC
3891 xl11250(CHAR c)
3892 #else
3893 xl11250(c) CHAR c;
3894 #endif /* CK_ANSIC */
3895 { /* xll11250 */
3896     return(yl21250[yl1l2[c]]);          /* Latin-1 -> Latin-2 -> CP1250 */
3897 }
3898
3899 CHAR                                    /* Latin-9 to CP1250 */
3900 #ifdef CK_ANSIC
3901 xl91250(CHAR c)
3902 #else
3903 xl91250(c) CHAR c;
3904 #endif /* CK_ANSIC */
3905 { /* xll91250 */
3906     if (c == (CHAR)164)                 /* Euro */
3907       return((CHAR)128);
3908     else
3909       return(yl21250[xl9l2(c)]);        /* Latin-9 -> Latin-2 -> CP1250 */
3910 }
3911
3912 CHAR                                    /* Latin-9 to Mazovia */
3913 #ifdef CK_ANSIC
3914 xl9mz(CHAR c)
3915 #else
3916 xl9mz(c) CHAR c;
3917 #endif /* CK_ANSIC */
3918 { /* xll9mz */
3919     return(yl2mz[xl9l2(c)]);            /* Latin-9 -> Latin-2 -> Mazovia */
3920 }
3921
3922 CHAR                                    /* Latin-9 to Mazovia */
3923 #ifdef CK_ANSIC
3924 xmzas(CHAR c)
3925 #else
3926 xmzas(c) CHAR c;
3927 #endif /* CK_ANSIC */
3928 { /* xmzas */
3929     return(yl2as[xmzl2(c)]);            /* Mazovia -> Latin-2 -> ASCII */
3930 }
3931
3932 CHAR                                    /* Latin-2 to NeXT */
3933 #ifdef CK_ANSIC
3934 xl2ne(CHAR c)
3935 #else
3936 xl2ne(c) CHAR c;
3937 #endif /* CK_ANSIC */
3938 { /* xll2ne */
3939     switch(c) {
3940       case 162: return(198);            /* Breve */
3941       case 163: return(232);            /* L with stroke */
3942       case 178: return(206);            /* Ogonek */
3943       case 179: return(248);            /* l with stroke */
3944       case 183: return(207);            /* Caron */
3945       case 189: return(205);            /* Double acute */
3946       case 208: return(144);            /* D stroke = Eth */
3947       case 240: return(230);            /* d stroke = eth */
3948       case 255: return(199);            /* Dot above */
3949       default:  return(yl1ne[yl2l1[c]]);
3950     }
3951 }
3952
3953 CHAR                                    /* Latin-2 to CP437 */
3954 #ifdef CK_ANSIC
3955 xl243(CHAR c)
3956 #else
3957 xl243(c) CHAR c;
3958 #endif /* CK_ANSIC */
3959 { /* xll243 */
3960     return(yl1l2[y43l1[c]]);
3961 }
3962
3963 CHAR                                    /* Latin-2 to CP850 */
3964 #ifdef CK_ANSIC
3965 xl285(CHAR c)
3966 #else
3967 xl285(c) CHAR c;
3968 #endif /* CK_ANSIC */
3969 { /* xll285 */
3970     return(yl1l2[y85l1[c]]);
3971 }
3972
3973 CHAR                                    /* Latin-2 to Apple */
3974 #ifdef CK_ANSIC
3975 xl2aq(CHAR c)
3976 #else
3977 xl2aq(c) CHAR c;
3978 #endif /* CK_ANSIC */
3979 { /* xl2aq */
3980     return(yl1aq[yl2l1[c]]);            /* Could do more... */
3981 }
3982
3983 CHAR                                    /* Latin-2 to DGI */
3984 #ifdef CK_ANSIC
3985 xl2dg(CHAR c)
3986 #else
3987 xl2dg(c) CHAR c;
3988 #endif /* CK_ANSIC */
3989 { /* xll2dg */
3990     return(ydgl1[yl1l2[c]]);
3991 }
3992
3993 CHAR                                    /* Latin-2 to Short KOI */
3994 #ifdef CK_ANSIC
3995 xl2sk(CHAR c)
3996 #else
3997 xl2sk(c) CHAR c;
3998 #endif /* CK_ANSIC */
3999 { /* xll2sk */
4000     return(islower(c) ? toupper(c) : c);
4001 }
4002
4003 CHAR                                    /* NeXT to Latin-2 */
4004 #ifdef CK_ANSIC
4005 xnel2(CHAR c)
4006 #else
4007 xnel2(c) CHAR c;
4008 #endif /* CK_ANSIC */
4009 { /* xnel2 */
4010     switch (c) {
4011       case 144: return(208);            /* D stroke = Eth */
4012       case 198: return(162);            /* Breve */
4013       case 199: return(255);            /* Dot above */
4014       case 205: return(189);            /* Double acute */
4015       case 206: return(178);            /* Ogonek */
4016       case 207: return(183);            /* Caron */
4017       case 230: return(240);            /* d stroke = eth */
4018       case 232: return(163);            /* L with stroke */
4019       case 248: return(179);            /* l with stroke */
4020       default:  return(yl1l2[ynel1[c]]); /* Others, go thru Latin-1 */
4021     }
4022 }
4023
4024 CHAR                                    /* CP437 to Latin-2 */
4025 #ifdef CK_ANSIC
4026 x43l2(CHAR c)
4027 #else
4028 x43l2(c) CHAR c;
4029 #endif /* CK_ANSIC */
4030 { /* xl43l2 */
4031     return(yl1l2[y43l1[c]]);
4032 }
4033
4034 CHAR                                    /* CP850 to Latin-2 */
4035 #ifdef CK_ANSIC
4036 x85l2(CHAR c)
4037 #else
4038 x85l2(c) CHAR c;
4039 #endif /* CK_ANSIC */
4040 { /* xl85l2 */
4041     return(yl1l2[y85l1[c]]);
4042 }
4043
4044 CHAR                                    /* Apple to Latin-2 */
4045 #ifdef CK_ANSIC
4046 xaql2(CHAR c)
4047 #else
4048 xaql2(c) CHAR c;
4049 #endif /* CK_ANSIC */
4050 { /* xlaql2 */
4051     switch (c) {
4052       case 249: return(162);            /* Breve accent */
4053       case 250: return(255);            /* Dot accent */
4054       case 253: return(189);            /* Double acute */
4055       default: return(yl1l2[yaql1[c]]);
4056     }
4057 }
4058
4059 CHAR                                    /* DGI to Latin-2 */
4060 #ifdef CK_ANSIC
4061 xdgl2(CHAR c)
4062 #else
4063 xdgl2(c) CHAR c;
4064 #endif /* CK_ANSIC */
4065 { /* xldgl2 */
4066     return(yl1l2[ydgl1[c]]);            /* (for now) */
4067 }
4068
4069 CHAR                                    /* Short KOI to Latin-2 */
4070 #ifdef CK_ANSIC
4071 xskl2(CHAR c)
4072 #else
4073 xskl2(c) CHAR c;
4074 #endif /* CK_ANSIC */
4075 { /* xlskl2 */
4076     return(islower(c) ? toupper(c) : c);
4077 }
4078
4079 CHAR                                    /* Latin-2 to German */
4080 #ifdef CK_ANSIC
4081 xl2ge(CHAR c)
4082 #else
4083 xl2ge(c) CHAR c;
4084 #endif /* CK_ANSIC */
4085 { /* xll2ge */
4086     switch(c) {
4087       case 167: return(64);             /* Paragraph sign */
4088       case 196: return(91);             /* A-diaeresis */
4089       case 214: return(92);             /* O-diaeresis */
4090       case 220: return(93);             /* U-diaeresis */
4091       case 223: return(126);            /* double-s */
4092       case 228: return(123);            /* a-diaeresis */
4093       case 246: return(124);            /* o-diaeresis */
4094       case 252: return(125);            /* u-diaeresis */
4095       default:  return(yl2as[c]);       /* Others */
4096     }
4097 }
4098
4099 CHAR                                    /* German to Latin-2 */
4100 #ifdef CK_ANSIC
4101 xgel2(CHAR c)
4102 #else
4103 xgel2(c) CHAR c;
4104 #endif /* CK_ANSIC */
4105 { /* xlgel2 */
4106     if (c & 0x80)
4107       return(UNK);
4108     switch(c) {
4109       case 64:  return(167);            /* Paragraph sign */
4110       case 91:  return(196);            /* A-diaeresis */
4111       case 92:  return(214);            /* O-diaeresis */
4112       case 93:  return(220);            /* U-diaeresis */
4113       case 123: return(228);            /* a-diaeresis */
4114       case 126: return(223);            /* double-s */
4115       case 124: return(246);            /* o-diaeresis */
4116       case 125: return(252);            /* u-diaeresis */
4117       default:  return(c);              /* Others */
4118     }
4119 }
4120
4121 CHAR                                    /* Latin-2 to Hungarian */
4122 #ifdef CK_ANSIC
4123 xl2hu(CHAR c)
4124 #else
4125 xl2hu(c) CHAR c;
4126 #endif /* CK_ANSIC */
4127 { /* xll2hu */
4128     switch(c) {
4129       case 164: return(36);             /* Currency symbol */
4130       case 189: return(126);            /* Double acute accent */
4131       case 193: return(64);             /* A-acute */
4132       case 201: return(91);             /* E-acute */
4133       case 214: return(92);             /* O-diaeresis */
4134       case 220: return(93);             /* U-diaeresis */
4135       case 225: return(96);             /* a-acute */
4136       case 233: return(123);            /* e-acute */
4137       case 246: return(124);            /* o-diaeresis */
4138       case 252: return(125);            /* u-diaeresis */
4139       default:  return(yl2as[c]);       /* Others */
4140     }
4141 }
4142
4143 CHAR                                    /* Hungarian to Latin-2 */
4144 #ifdef CK_ANSIC
4145 xhul2(CHAR c)
4146 #else
4147 xhul2(c) CHAR c;
4148 #endif /* CK_ANSIC */
4149 { /* xlhul2 */
4150     if (c & 0x80)
4151       return(UNK);
4152     switch(c) {
4153       case 36:  return(164);            /* Currency symbol */
4154       case 64:  return(193);            /* A-acute */
4155       case 91:  return(201);            /* E-acute */
4156       case 92:  return(214);            /* O-diaeresis */
4157       case 93:  return(220);            /* U-diaeresis */
4158       case 96:  return(225);            /* a-acute */
4159       case 123: return(233);            /* e-acute */
4160       case 124: return(246);            /* o-diaeresis */
4161       case 125: return(252);            /* u-diaeresis */
4162       case 126: return(189);            /* Double acute accent */
4163       default:  return(c);              /* Others */
4164     }
4165 }
4166
4167 CHAR
4168 #ifdef CK_ANSIC
4169 xr8l2(CHAR c)
4170 #else
4171 xr8l2(c) CHAR c;
4172 #endif /* CK_ANSIC */
4173 { /* xr8l2 */ /* Hewlett Packard Roman8 to Latin-2 */
4174     switch (c) {
4175       case 235: return(169);            /* S caron */
4176       case 236: return(185);            /* s caron */
4177       default:  return(yl1l2[yr8l1[c]]);
4178     }
4179 }
4180
4181 CHAR
4182 #ifdef CK_ANSIC
4183 xl2r8(CHAR c)
4184 #else
4185 xl2r8(c) CHAR c;
4186 #endif /* CK_ANSIC */
4187 { /* xl2r8 */ /* Latin-2 to Hewlett Packard Roman8 Character Set */
4188     switch (c) {
4189       case 169: return(235);            /* S caron */
4190       case 185: return(236);            /* s caron */
4191       default:  return(yr8l1[yl1l2[c]]);
4192     }
4193 }
4194
4195 #else /* NOLATIN2 */
4196
4197 #define xl1mz NULL
4198 #define xmzl1 NULL
4199 #define xl2mz NULL
4200 #define xmzl2 NULL
4201 #define xl9mz NULL
4202 #define xmzl9 NULL
4203 #define xmzas NULL
4204
4205 #define xl11250 NULL
4206 #define xl21250 NULL
4207 #define xl91250 NULL
4208
4209 #define x1250as NULL
4210 #define x1250l1 NULL
4211 #define x1250l2 NULL
4212 #define x1250l9 NULL
4213
4214 #define xl2l1 NULL
4215 #define xl2w1 NULL
4216 #define xl1l2 NULL
4217 #define xw1l2 NULL
4218 #define xl2as NULL
4219 #define xl252 NULL
4220 #define x52l2 NULL
4221 #define x52as NULL
4222 #define x52l1 NULL
4223 #define xl152 NULL
4224 #define xl2ne NULL
4225 #define xl243 NULL
4226 #define xl285 NULL
4227 #define xl2aq NULL
4228 #define xl2dg NULL
4229 #define xl2sk NULL
4230 #define xnel2 NULL
4231 #define x43l2 NULL
4232 #define x85l2 NULL
4233 #define xaql2 NULL
4234 #define xdgl2 NULL
4235 #define xskl2 NULL
4236 #define xl2ge NULL
4237 #define xgel2 NULL
4238 #define xl2hu NULL
4239 #define xhul2 NULL
4240 #define xl2r8 NULL
4241 #define xr8l2 NULL
4242 #endif /* LATIN2 */
4243
4244 /* This one can also be used for ELOT 927, Hebrew 7, etc */
4245
4246 CHAR
4247 #ifdef CK_ANSIC
4248 xassk(CHAR c)
4249 #else
4250 xassk(c) CHAR c;
4251 #endif /* CK_ANSIC */
4252 { /* xassk */                           /* ASCII to Short KOI */
4253     if (c & 0x80)
4254       return(UNK);
4255     return((c > 95) ? (c - 32) : c);    /* Fold columns 6-7 to 4-5 */
4256 }
4257
4258 #ifdef CYRILLIC
4259 /* Translation functions for Cyrillic character sets */
4260
4261 CHAR                                    /* Latin/Cyrillic to CP866 */
4262 #ifdef CK_ANSIC
4263 xlcac(CHAR c)
4264 #else
4265 xlcac(c) CHAR c;
4266 #endif /* CK_ANSIC */
4267 { /* xlcac */                           /* PC Code Page 866 */
4268     return(ylcac[c]);
4269 }
4270
4271 CHAR                                    /* Latin/Cyrillic to */
4272 #ifdef CK_ANSIC
4273 xlc55(CHAR c)
4274 #else
4275 xlc55(c) CHAR c;
4276 #endif /* CK_ANSIC */
4277 { /* xlc55 */                           /* PC Code Page 855 */
4278     return(ylc55[c]);
4279 }
4280
4281 CHAR                                    /* Latin/Cyrillic to */
4282 #ifdef CK_ANSIC
4283 xlc1251(CHAR c)
4284 #else
4285 xlc1251(c) CHAR c;
4286 #endif /* CK_ANSIC */
4287 { /* xlc1251 */                         /* PC Code Page 1251 */
4288     return(ylc1251[c]);
4289 }
4290
4291 CHAR                                    /* Latin/Cyrillic to... */
4292 #ifdef CK_ANSIC
4293 xlcbu(CHAR c)
4294 #else
4295 xlcbu(c) CHAR c;
4296 #endif /* CK_ANSIC */
4297 { /* xlcbu */                           /* Bulgarian PC Code Page */
4298     return(ylcbu[c]);
4299 }
4300
4301 CHAR                                    /* Latin/Cyrillic to Old KOI-8 */
4302 #ifdef CK_ANSIC
4303 xlck8(CHAR c)
4304 #else
4305 xlck8(c) CHAR c;
4306 #endif /* CK_ANSIC */
4307 { /* xlck8 */
4308     return(ylck8[c]);
4309 }
4310
4311 CHAR                                    /* Latin/Cyrillic to KOI8-R */
4312 #ifdef CK_ANSIC
4313 xlckr(CHAR c)
4314 #else
4315 xlckr(c) CHAR c;
4316 #endif /* CK_ANSIC */
4317 { /* xlckr */
4318     switch(c) {
4319       case 0xa1: return(0xb3);          /* Io */
4320       case 0xf1: return(0xa3);          /* io */
4321       default:
4322         if (c > 0x7f && c < 0xc0)
4323           return(UNK);
4324         return(ylck8[c]);
4325     }
4326 }
4327
4328 CHAR                                    /* Latin/Cyrillic to  KOI8-U */
4329 #ifdef CK_ANSIC
4330 xlcku(CHAR c)
4331 #else
4332 xlcku(c) CHAR c;
4333 #endif /* CK_ANSIC */
4334 { /* xlcku */
4335     switch(c) {
4336       case 0xa1: return(0xb3);          /* Io */
4337       case 0xf1: return(0xa3);          /* io */
4338       case 0xf4: return(0xa4);          /* Ukrainian ie */
4339       case 0xf6: return(0xa6);          /* Ukrainian i */
4340       case 0xf7: return(0xa7);          /* Ukrainian yi */
4341       case 0xf3: return(0xad);          /* Ukrainian ghe with upturn */
4342       case 0xa4: return(0xb4);          /* Ukrainian Ie */
4343       case 0xa6: return(0xb6);          /* Ukrainian I */
4344       case 0xa7: return(0xb7);          /* Ukrainian Yi */
4345       case 0xa3: return(0xbd);          /* Ukrainian Ghe with upturn */
4346       default:
4347         if (c > 0x7f && c < 0xc0)
4348           return(UNK);
4349         return(ylck8[c]);
4350     }
4351 }
4352
4353 CHAR
4354 #ifdef CK_ANSIC
4355 xlcsk(CHAR c)
4356 #else
4357 xlcsk(c) CHAR c;
4358 #endif /* CK_ANSIC */
4359 { /* xlcsk */                           /* Latin/Cyrillic to Short KOI */
4360     return(ylcsk[c]);
4361 }
4362
4363 CHAR
4364 #ifdef CK_ANSIC
4365 xlcas(CHAR c)
4366 #else
4367 xlcas(c) CHAR c;
4368 #endif /* CK_ANSIC */
4369 { /* xlcas */                           /* Latin/Cyrillic to ASCII */
4370     if (langs[language].id == L_RUSSIAN)
4371       return(ylcsk[c]);
4372     else
4373       return((c > 127) ? '?' : c);
4374 }
4375
4376 CHAR                                    /* CP866 */
4377 #ifdef CK_ANSIC
4378 xaclc(CHAR c)
4379 #else
4380 xaclc(c) CHAR c;
4381 #endif /* CK_ANSIC */
4382 { /* xaclc */                           /* to Latin/Cyrillic */
4383     return(yaclc[c]);
4384 }
4385
4386 CHAR                                    /* CP855 */
4387 #ifdef CK_ANSIC
4388 x55lc(CHAR c)
4389 #else
4390 x55lc(c) CHAR c;
4391 #endif /* CK_ANSIC */
4392 { /* x55lc */                           /* to Latin/Cyrillic */
4393     return(y55lc[c]);
4394 }
4395
4396 CHAR                                    /* Bulgarian PC Code Page ... */
4397 #ifdef CK_ANSIC
4398 xbulc(CHAR c)
4399 #else
4400 xbulc(c) CHAR c;
4401 #endif /* CK_ANSIC */
4402 { /* xbulc */                           /* to Latin/Cyrillic */
4403     return(ybulc[c]);
4404 }
4405
4406 CHAR                                    /* CP1251 */
4407 #ifdef CK_ANSIC
4408 x1251lc(CHAR c)
4409 #else
4410 x1251lc(c) CHAR c;
4411 #endif /* CK_ANSIC */
4412 { /* x1251lc */                         /* to Latin/Cyrillic */
4413     return(y1251lc[c]);
4414 }
4415
4416 CHAR                                    /* Old KOI-8 to Latin/Cyrillic */
4417 #ifdef CK_ANSIC
4418 xk8lc(CHAR c)
4419 #else
4420 xk8lc(c) CHAR c;
4421 #endif /* CK_ANSIC */
4422 { /* xk8lc */
4423     return(yk8lc[c]);
4424 }
4425
4426 CHAR                                    /* KOI8-R to Latin/Cyrillic */
4427 #ifdef CK_ANSIC
4428 xkrlc(CHAR c)
4429 #else
4430 xkrlc(c) CHAR c;
4431 #endif /* CK_ANSIC */
4432 { /* xkrlc */
4433     if (c == 0xb3) return(0xa1);
4434     else if (c == 0xa3) return(0xf1);
4435     else if (c > 0x7f && c < 0xc0)
4436       return(UNK);
4437     return(yk8lc[c]);
4438 }
4439
4440 CHAR                                    /* KOI8-U to Latin/Cyrillic */
4441 #ifdef CK_ANSIC
4442 xkulc(CHAR c)
4443 #else
4444 xkulc(c) CHAR c;
4445 #endif /* CK_ANSIC */
4446 { /* xkulc */
4447     switch (c) {
4448       case 0xb3: return(0xa1);          /* Io */
4449       case 0xa3: return(0xf1);          /* io */
4450       case 0xa4: return(0xf4);          /* Ukrainian ie */
4451       case 0xa6: return(0xf6);          /* Ukrainian i */
4452       case 0xa7: return(0xf7);          /* Ukrainian yi */
4453       case 0xad: return(0xf3);          /* Ukrainian ghe with upturn */
4454       case 0xb4: return(0xa4);          /* Ukrainian Ie */
4455       case 0xb6: return(0xa6);          /* Ukrainian I */
4456       case 0xb7: return(0xa7);          /* Ukrainian Yi */
4457       case 0xbd: return(0xa3);          /* Ukrainian Ghe with upturn */
4458       /* Note substitution of Gje for Ghe-Upturn, which is not in 8859-5 */
4459       default:
4460         if (c > 0x7f && c < 0xc0)
4461           return(UNK);
4462         return(yk8lc[c]);
4463     }
4464 }
4465
4466 CHAR
4467 #ifdef CK_ANSIC
4468 xskcy(CHAR c)
4469 #else
4470 xskcy(c) CHAR c;
4471 #endif /* CK_ANSIC */
4472 { /* xskcy */                   /* Short KOI to Latin/Cyrillic */
4473     return(yskcy[c & 0x7f]);
4474 }
4475
4476 CHAR
4477 #ifdef CK_ANSIC
4478 xascy(CHAR c)
4479 #else
4480 xascy(c) CHAR c;
4481 #endif /* CK_ANSIC */
4482 { /* xascy */                   /* ASCII to Latin/Cyrillic */
4483     if (langs[language].id == L_RUSSIAN) { /* If LANGUAGE == RUSSIAN  */
4484         return(yskcy[c & 0x7f]);        /* treat ASCII as Short KOI */
4485     } else return((c > 127) ? '?' : c);
4486 }
4487
4488 CHAR
4489 #ifdef CK_ANSIC
4490 xacas(CHAR c)
4491 #else
4492 xacas(c) CHAR c;
4493 #endif /* CK_ANSIC */
4494 { /* xacas */                   /* CP866 to ASCII */
4495     if (langs[language].id == L_RUSSIAN) {
4496         c = yaclc[c];                   /* First to Latin/Cyrillic */
4497         return(ylcsk[c]);               /* Then to Short KOI */
4498     } else return((c > 127) ? '?' : c);
4499 }
4500
4501 CHAR
4502 #ifdef CK_ANSIC
4503 x55as(CHAR c)
4504 #else
4505 x55as(c) CHAR c;
4506 #endif /* CK_ANSIC */
4507 { /* x55as */                   /* CP855 to ASCII */
4508     if (langs[language].id == L_RUSSIAN) {
4509         c = y55lc[c];                   /* First to Latin/Cyrillic */
4510         return(ylcsk[c]);               /* Then to Short KOI */
4511     } else return((c > 127) ? '?' : c);
4512 }
4513
4514 CHAR
4515 #ifdef CK_ANSIC
4516 x1251as(CHAR c)
4517 #else
4518 x1251as(c) CHAR c;
4519 #endif /* CK_ANSIC */
4520 { /* x1251as */                 /* CP81251 to ASCII */
4521     if (langs[language].id == L_RUSSIAN) {
4522         c = y1251lc[c];                 /* First to Latin/Cyrillic */
4523         return(ylcsk[c]);               /* Then to Short KOI */
4524     } else return((c > 127) ? '?' : c);
4525 }
4526
4527 CHAR
4528 #ifdef CK_ANSIC
4529 xskas(CHAR c)
4530 #else
4531 xskas(c) CHAR c;
4532 #endif /* CK_ANSIC */
4533 { /* xskas */                           /* Short KOI to ASCII */
4534     return((c > 95) ? '?' : c);
4535 }
4536
4537 CHAR
4538 #ifdef CK_ANSIC
4539 xk8as(CHAR c)
4540 #else
4541 xk8as(c) CHAR c;
4542 #endif /* CK_ANSIC */
4543 { /* xk8as */                           /* Old KOI-8 Cyrillic to ASCII */
4544     if (langs[language].id == L_RUSSIAN) {
4545         c = yk8lc[c];                   /* First to Latin/Cyrillic */
4546         return(ylcsk[c]);               /* Then to Short KOI */
4547     } else return((c > 127) ? '?' : c);
4548 }
4549
4550 CHAR
4551 #ifdef CK_ANSIC
4552 xl1sk(CHAR c)
4553 #else
4554 xl1sk(c) CHAR c;
4555 #endif /* CK_ANSIC */
4556 { /* xl1sk */                           /* Latin-1 to Short KOI */
4557     c = zl1as(c);                       /* Convert to ASCII */
4558     return(c = xassk(c));               /* Convert ASCII to Short KOI */
4559 }
4560
4561 CHAR
4562 #ifdef CK_ANSIC
4563 xw1lc(CHAR c)
4564 #else
4565 xw1lc(c) CHAR c;
4566 #endif /* CK_ANSIC */
4567 { /* xw1lc */                           /* CP1252 to Latin/Cyrillic */
4568     return((c < 160) ? xw1as(c) : zl1as(c));
4569 }
4570
4571 CHAR
4572 #ifdef CK_ANSIC
4573 xaslc(CHAR c)
4574 #else
4575 xaslc(c) CHAR c;
4576 #endif /* CK_ANSIC */
4577 { /* xaslc */                   /* ASCII to Latin/Cyrillic */
4578     if (langs[language].id == L_RUSSIAN)
4579       return(yskcy[c & 0x7f]);
4580     else return(c & 0x7f);
4581 }
4582
4583 CHAR
4584 #ifdef CK_ANSIC
4585 xasac(CHAR c)
4586 #else
4587 xasac(c) CHAR c;
4588 #endif /* CK_ANSIC */
4589 { /* xasac */                   /* ASCII to CP866 */
4590     if (c & 0x80)
4591       return(UNK);
4592     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
4593         c = xskcy(c);                   /* Translate to Latin/Cyrillic */
4594         return(ylcac[c]);               /* Then to CP866 */
4595     } else return(c & 0x7f);
4596 }
4597
4598 CHAR
4599 #ifdef CK_ANSIC
4600 xas55(CHAR c)
4601 #else
4602 xas55(c) CHAR c;
4603 #endif /* CK_ANSIC */
4604 { /* xas55 */                   /* ASCII to CP855 */
4605     if (c & 0x80)
4606       return(UNK);
4607     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
4608         c = xskcy(c);                   /* Translate to Latin/Cyrillic */
4609         return(ylc55[c]);               /* Then to CP866 */
4610     } else return(c & 0x7f);
4611 }
4612
4613 CHAR
4614 #ifdef CK_ANSIC
4615 xas1251(CHAR c)
4616 #else
4617 xas1251(c) CHAR c;
4618 #endif /* CK_ANSIC */
4619 { /* xas1251 */                 /* ASCII to CP81251 */
4620     if (c & 0x80)
4621       return(UNK);
4622     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
4623         c = xskcy(c);                   /* Translate to Latin/Cyrillic */
4624         return(ylc1251[c]);             /* Then to CP866 */
4625     } else return(c & 0x7f);
4626 }
4627
4628 CHAR
4629 #ifdef CK_ANSIC
4630 xask8(CHAR c)
4631 #else
4632 xask8(c) CHAR c;
4633 #endif /* CK_ANSIC */
4634 { /* xask8 */                   /* ASCII to KOI-8 */
4635     if (c & 0x80)
4636       return(UNK);
4637     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
4638         c = xskcy(c);                   /* Translate to Latin/Cyrillic */
4639         return(ylck8[c]);               /* Then to KOI-8 */
4640     } else return(c & 0x7f);
4641 }
4642 #else /* No Cyrillic */
4643 #define xacas NULL
4644 #define x55as NULL
4645 #define x1251as NULL
4646 #define xaclc NULL
4647 #define x55lc NULL
4648 #define x1251lc NULL
4649 #define xasac NULL
4650 #define xas55 NULL
4651 #define xas1251 NULL
4652 #define xascy NULL
4653 #define xask8 NULL
4654 #define xaslc NULL
4655 #define xassk NULL
4656 #define xk8as NULL
4657 #define xk8lc NULL
4658 #define xkrlc NULL
4659 #define xkulc NULL
4660 #define xl1sk NULL
4661 #define xw1lc NULL
4662 #define xlcac NULL
4663 #define xlc55 NULL
4664 #define xlc1251 NULL
4665 #define xlcas NULL
4666 #define xlck8 NULL
4667 #define xlckr NULL
4668 #define xlcku NULL
4669 #define xlch7 NULL
4670 #define xlcsk NULL
4671 #define xskas NULL
4672 #define xskcy NULL
4673 #define xbulc NULL
4674 #define xlcbu NULL
4675 #endif /* CYRILLIC */
4676
4677 /* Translation functions for Hebrew character sets */
4678
4679 #ifdef HEBREW
4680
4681 CHAR
4682 #ifdef CK_ANSIC
4683 xash7(CHAR c)
4684 #else
4685 xash7(c) CHAR c;
4686 #endif /* CK_ANSIC */
4687 { /* xash7 */                   /* ASCII to Hebrew-7 */
4688     if (c & 0x80)
4689       return(UNK);
4690     if (c == 96) return('?');
4691     if (c > 96 && c < 123) return(c - 32);
4692     else return(c);
4693 }
4694
4695 CHAR
4696 #ifdef CK_ANSIC
4697 xl1h7(CHAR c)
4698 #else
4699 xl1h7(c) CHAR c;
4700 #endif /* CK_ANSIC */
4701 { /* xl1h7 */                   /* Latin-1 to Hebrew-7 */
4702     return(xash7(xl1as(c)));
4703 }
4704
4705 CHAR
4706 #ifdef CK_ANSIC
4707 xl1lh(CHAR c)
4708 #else
4709 xl1lh(c) CHAR c;
4710 #endif /* CK_ANSIC */
4711 { /* xl1lh */                           /* Latin-1 to Latin/Hebrew */
4712     switch(c) {
4713       case 170: return('a');            /* Feminine ordinal */
4714       case 186: return('o');            /* Masculine ordinal */
4715       case 215: return(170);            /* Times */
4716       case 247: return(186);            /* Divide */
4717       default:  return( (c > 190) ? xl1as(c) : c );
4718     }
4719 }
4720
4721 CHAR
4722 #ifdef CK_ANSIC
4723 xw1lh(CHAR c)
4724 #else
4725 xw1lh(c) CHAR c;
4726 #endif /* CK_ANSIC */
4727 { /* xw1lh */                           /* CP1252 to Latin/Hebrew */
4728     switch(c) {
4729       case 170: return('a');            /* Feminine ordinal */
4730       case 186: return('o');            /* Masculine ordinal */
4731       case 215: return(170);            /* Times */
4732       case 247: return(186);            /* Divide */
4733       default:
4734         if (c < 160)
4735           return(xw1as(c));
4736         else
4737           return((c > 190) ? xl1as(c) : c);
4738     }
4739 }
4740
4741 #ifdef LATIN2
4742 CHAR
4743 #ifdef CK_ANSIC
4744 xl2h7(CHAR c)
4745 #else
4746 xl2h7(c) CHAR c;
4747 #endif /* CK_ANSIC */
4748 { /* xl2h7 */                           /* Latin-2 to Hebrew-7 */
4749     return(xash7(xl2as(c)));
4750 }
4751 #else
4752 #define xl2h7 NULL
4753 #endif /* LATIN2 */
4754
4755 #ifndef NOCYRIL
4756 CHAR
4757 #ifdef CK_ANSIC
4758 xlch7(CHAR c)
4759 #else
4760 xlch7(c) CHAR c;
4761 #endif /* CK_ANSIC */
4762 { /* xlch7 */                           /* Latin/Cyrillic to Hebrew-7 */
4763     return(xash7(xlcas(c)));
4764 }
4765 #endif /* NOCYRIL */
4766
4767 CHAR
4768 #ifdef CK_ANSIC
4769 xlhas(CHAR c)
4770 #else
4771 xlhas(c) CHAR c;
4772 #endif /* CK_ANSIC */
4773 { /* xlhas */                   /* Latin/Hebrew to ASCII */
4774     return( (c > 127) ? '?' : c );
4775 }
4776
4777 CHAR
4778 #ifdef CK_ANSIC
4779 xlhl1(CHAR c)
4780 #else
4781 xlhl1(c) CHAR c;
4782 #endif /* CK_ANSIC */
4783 { /* xlhl1 */                   /* Latin/Hebrew to Latin-1 */
4784     switch (c) {
4785       case 170: return(215);
4786       case 186: return(247);
4787       default: return( (c > 190) ? '?' : c );
4788     }
4789 }
4790
4791 CHAR
4792 #ifdef CK_ANSIC
4793 xlhw1(CHAR c)
4794 #else
4795 xlhw1(c) CHAR c;
4796 #endif /* CK_ANSIC */
4797 { /* xlhw1 */                   /* Latin/Hebrew to CP1252 */
4798     if (c > 127 && c < 160)
4799       return('?');
4800     switch (c) {
4801       case 170: return(215);
4802       case 186: return(247);
4803       default: return( (c > 190) ? '?' : c );
4804     }
4805 }
4806
4807 CHAR
4808 #ifdef CK_ANSIC
4809 xlh62(CHAR c)
4810 #else
4811 xlh62(c) CHAR c;
4812 #endif /* CK_ANSIC */
4813 { /* xlh62 */                   /* Latin/Hebrew to CP862 */
4814     return(ylh62[c]);
4815 }
4816
4817 CHAR
4818 #ifdef CK_ANSIC
4819 xl162(CHAR c)
4820 #else
4821 xl162(c) CHAR c;
4822 #endif /* CK_ANSIC */
4823 { /* xl162 */                   /* Latin-1 to CP862 */
4824     return(xlh62(xl1lh(c)));    /* Via Latin/Hebrew */
4825 }
4826
4827 CHAR
4828 #ifdef CK_ANSIC
4829 xlhh7(CHAR c)
4830 #else
4831 xlhh7(c) CHAR c;
4832 #endif /* CK_ANSIC */
4833 { /* xlhh7 */                   /* Latin/Hebrew to Hebrew-7 */
4834     return(ylhh7[c]);
4835 }
4836
4837 CHAR
4838 #ifdef CK_ANSIC
4839 xh7as(CHAR c)
4840 #else
4841 xh7as(c) CHAR c;
4842 #endif /* CK_ANSIC */
4843 { /* xh7as */                   /* Hebrew-7 to ASCII */
4844     if (c & 0x80)
4845       return(UNK);
4846     return( (c > 95 && c < 123) ? '?' : c );
4847 }
4848
4849 CHAR
4850 #ifdef CK_ANSIC
4851 x62lh(CHAR c)
4852 #else
4853 x62lh(c) CHAR c;
4854 #endif /* CK_ANSIC */
4855 { /* x62lh */                   /* CP862 to Latin/Hebrew */
4856     return(y62lh[c]);
4857 }
4858
4859 CHAR
4860 #ifdef CK_ANSIC
4861 x62as(CHAR c)
4862 #else
4863 x62as(c) CHAR c;
4864 #endif /* CK_ANSIC */
4865 { /* x62as */                   /* CP862 to ASCII */
4866     return( xlhas(x62lh(c)) );
4867 }
4868
4869 CHAR
4870 #ifdef CK_ANSIC
4871 x62l1(CHAR c)
4872 #else
4873 x62l1(c) CHAR c;
4874 #endif /* CK_ANSIC */
4875 { /* x62l1 */                   /* CP862 to Latin-1 */
4876     return( xlhl1(x62lh(c)) );
4877 }
4878
4879 CHAR
4880 #ifdef CK_ANSIC
4881 xh7lh(CHAR c)
4882 #else
4883 xh7lh(c) CHAR c;
4884 #endif /* CK_ANSIC */
4885 { /* xh7lh */                   /* Hebrew-7 to Latin/Hebrew */
4886     if (c & 0x80)
4887       return(UNK);
4888     return(yh7lh[c]);
4889 }
4890
4891 #else /* No Hebrew */
4892
4893 #define xash7 NULL
4894 #define xl1h7 NULL
4895 #define xl2h7 NULL
4896 #define xlch7 NULL
4897 #define xl1lh NULL
4898 #define xw1lh NULL
4899 #define xlhas NULL
4900 #define xlhl1 NULL
4901 #define xlhw1 NULL
4902 #define xl162 NULL
4903 #define xlhh7 NULL
4904 #define xlh62 NULL
4905 #define xh7as NULL
4906 #define x62as NULL
4907 #define x62l1 NULL
4908 #define xh7lh NULL
4909 #define x62lh NULL
4910
4911 #endif /* HEBREW */
4912
4913 /* Translation functions for Greek character sets */
4914
4915 #ifdef GREEK
4916
4917 CHAR
4918 #ifdef CK_ANSIC
4919 xaseg(CHAR c)
4920 #else
4921 xaseg(c) CHAR c;
4922 #endif /* CK_ANSIC */
4923 { /* xaseg */                   /* ASCII to ELOT 927 */
4924     if (c & 0x80)
4925       return(UNK);
4926     if (c > 96 && c < 123) return(c - 32);
4927     else return(c);
4928 }
4929
4930 CHAR
4931 #ifdef CK_ANSIC
4932 xl1eg(CHAR c)
4933 #else
4934 xl1eg(c) CHAR c;
4935 #endif /* CK_ANSIC */
4936 { /* xl1ge */                   /* Latin-1 to ELOT 927 */
4937     return(xaseg(xl1as(c)));
4938 }
4939
4940 CHAR
4941 #ifdef CK_ANSIC
4942 xl2lg(CHAR c)
4943 #else
4944 xl2lg(c) CHAR c;
4945 #endif /* CK_ANSIC */
4946 { /* xl2lg */                   /* Latin-1 to Latin/Greek */
4947     if (c < 160) return(c);
4948     else if (c == 160 || c == 168 || c == 173 || c == 174)
4949       return(c);
4950     else return('?');
4951 }
4952
4953 CHAR
4954 #ifdef CK_ANSIC
4955 xl1lg(CHAR c)
4956 #else
4957 xl1lg(c) CHAR c;
4958 #endif /* CK_ANSIC */
4959 { /* xl1lg */                   /* Latin-1 to Latin/Greek */
4960     if (c < 160) return(c);
4961     switch(c) {
4962       case 160:                         /* Themselves */
4963       case 164:
4964       case 166:
4965       case 167:
4966       case 168:
4967       case 169:
4968       case 171:
4969       case 172:
4970       case 173:
4971       case 176:
4972       case 177:
4973       case 178:
4974       case 179:
4975       case 180:
4976       case 187:
4977       case 189:
4978         return(c);
4979       case 181:                         /* Lowercase mu */
4980         return(236);
4981       default:
4982         return(UNK);
4983     }
4984 }
4985
4986 CHAR
4987 #ifdef CK_ANSIC
4988 xw1lg(CHAR c)
4989 #else
4990 xw1lg(c) CHAR c;
4991 #endif /* CK_ANSIC */
4992 { /* xw1lg */                           /* CP1252 to Latin/Greek */
4993     return((c < 160) ? xw1as(c) : xl1lg(c));
4994 }
4995
4996
4997 #ifdef LATIN2
4998 CHAR
4999 #ifdef CK_ANSIC
5000 xl2eg(CHAR c)
5001 #else
5002 xl2eg(c) CHAR c;
5003 #endif /* CK_ANSIC */
5004 { /* xl2eg */                           /* Latin-2 to ELOT 927 */
5005     return(xaseg(xl2as(c)));
5006 }
5007 #else
5008 #define xl2eg NULL
5009 #endif /* LATIN2 */
5010
5011 #ifndef NOCYRIL
5012 CHAR
5013 #ifdef CK_ANSIC
5014 xlceg(CHAR c)
5015 #else
5016 xlceg(c) CHAR c;
5017 #endif /* CK_ANSIC */
5018 { /* xlceg */                   /* Latin/Cyrillic to ELOT 927 */
5019     return(xaseg(xlcas(c)));
5020 }
5021 #endif /* NOCYRIL */
5022
5023 CHAR
5024 #ifdef CK_ANSIC
5025 xlgas(CHAR c)
5026 #else
5027 xlgas(c) CHAR c;
5028 #endif /* CK_ANSIC */
5029 { /* xlgas */                   /* Latin/Greek to ASCII */
5030     return( (c > 127) ? '?' : c );
5031 }
5032
5033 CHAR
5034 #ifdef CK_ANSIC
5035 xlgl1(CHAR c)
5036 #else
5037 xlgl1(c) CHAR c;
5038 #endif /* CK_ANSIC */
5039 { /* xlgl1 */                   /* Latin/Greek to Latin-1 */
5040     if (c == 236)
5041       return(181);
5042     else
5043       return(xl1lg(c));
5044 }
5045
5046 CHAR
5047 #ifdef CK_ANSIC
5048 xlgw1(CHAR c)
5049 #else
5050 xlgw1(c) CHAR c;
5051 #endif /* CK_ANSIC */
5052 { /* xlgw1 */                   /* Latin/Greek to Latin-1 */
5053     if (c > 127 && c < 160)
5054       return('?');
5055     return(xlgl1(c));
5056 }
5057
5058 CHAR
5059 #ifdef CK_ANSIC
5060 xlg69(CHAR c)
5061 #else
5062 xlg69(c) CHAR c;
5063 #endif /* CK_ANSIC */
5064 { /* xlg69 */                   /* Latin/Greek to CP869 */
5065     return(ylg69[c]);
5066 }
5067
5068 CHAR
5069 #ifdef CK_ANSIC
5070 xl169(CHAR c)
5071 #else
5072 xl169(c) CHAR c;
5073 #endif /* CK_ANSIC */
5074 { /* xl169 */                   /* Latin-1 to CP869 */
5075     return(xlg69(xl1lg(c)));    /* Via Latin/Greek */
5076 }
5077
5078 CHAR
5079 #ifdef CK_ANSIC
5080 xlgeg(CHAR c)
5081 #else
5082 xlgeg(c) CHAR c;
5083 #endif /* CK_ANSIC */
5084 { /* xlgeg */                   /* Latin/Greek to ELOT 927 */
5085     return(ylgeg[c]);
5086 }
5087
5088 CHAR
5089 #ifdef CK_ANSIC
5090 xegas(CHAR c)
5091 #else
5092 xegas(c) CHAR c;
5093 #endif /* CK_ANSIC */
5094 { /* xegas */                   /* ELOT 927 to ASCII */
5095     if (c & 0x80)
5096       return(UNK);
5097     return( (c > 96 && c < 123) ? '?' : c );
5098 }
5099
5100 CHAR
5101 #ifdef CK_ANSIC
5102 x69lg(CHAR c)
5103 #else
5104 x69lg(c) CHAR c;
5105 #endif /* CK_ANSIC */
5106 { /* x69lg */                   /* CP869 to Latin/Greek */
5107     return(y69lg[c]);
5108 }
5109
5110 CHAR
5111 #ifdef CK_ANSIC
5112 x69as(CHAR c)
5113 #else
5114 x69as(c) CHAR c;
5115 #endif /* CK_ANSIC */
5116 { /* x69as */                   /* CP869 to ASCII */
5117     return( xlgas(x69lg(c)) );
5118 }
5119
5120 CHAR
5121 #ifdef CK_ANSIC
5122 x69l1(CHAR c)
5123 #else
5124 x69l1(c) CHAR c;
5125 #endif /* CK_ANSIC */
5126 { /* x69l1 */                   /* CP869 to Latin-1 */
5127     return( xlgl1(x69lg(c)) );
5128 }
5129
5130 CHAR
5131 #ifdef CK_ANSIC
5132 xeglg(CHAR c)
5133 #else
5134 xeglg(c) CHAR c;
5135 #endif /* CK_ANSIC */
5136 { /* xeglg */                   /* ELOT 927 to Latin/Greek */
5137     return(yeglg[c]);
5138 }
5139
5140 #else /* No Greek */
5141
5142 #define x69as NULL
5143 #define x69l1 NULL
5144 #define x69lg NULL
5145 #define xaseg NULL
5146 #define xegas NULL
5147 #define xeglg NULL
5148 #define xl169 NULL
5149 #define xl1eg NULL
5150 #define xl1lg NULL
5151 #define xw1lg NULL
5152 #define xl2ge NULL
5153 #define xl2lg NULL
5154 #define xlcge NULL
5155 #define xlg69 NULL
5156 #define xlgas NULL
5157 #define xlgeg NULL
5158 #define xlgge NULL
5159 #define xlgl1 NULL
5160 #define xlgw1 NULL
5161
5162 #endif /* GREEK */
5163
5164
5165 /* Translation functions for Japanese Kanji character sets */
5166
5167 #ifdef KANJI
5168 /*
5169   Translate Kanji Transfer Character Set (EUC) to local file character set,
5170   contributed by Dr. Hirofumi Fujii, Japan High Energy Research Laboratory
5171   (KEK), Tokyo, Japan.
5172
5173   a is a byte to be translated, which may be a single-byte character,
5174   the Katakana prefix, the first byte of a two-byte Kanji character, or the
5175   second byte of 2-byte Kanji character.
5176
5177   fn is the output function.
5178
5179   Returns 0 on success, -1 on failure.
5180 */
5181
5182 _PROTOTYP(static int jpnxas, (int, int[]) );
5183 _PROTOTYP(static int jpnxkt, (int, int[]) );
5184 _PROTOTYP(static int jpnxkn, (int[], int[]) );
5185
5186 static int jpncnt;                      /* Byte count for Japanese */
5187 static int jpnlst;                      /* Last status (for JIS7) */
5188
5189 static int
5190 jpnxas(a, obuf) int a; int obuf[]; { /* Translate ASCII to local file code */
5191     int r;
5192
5193     r = 0;
5194     if (fcharset == FC_JIS7) {
5195         switch (jpnlst) {
5196           case 1:
5197             obuf[0] = 0x0f;
5198             obuf[1] = a;
5199             r = 2;
5200             break;
5201           case 2:
5202             obuf[0] = 0x1b;
5203             obuf[1] = 0x28;
5204             obuf[2] = 0x4a;
5205             obuf[3] = a;
5206             r = 4;
5207             break;
5208           default:
5209             obuf[0] = a;
5210             r = 1;
5211             break;
5212         }
5213     } else {
5214         obuf[0] = a;
5215         r = 1;
5216     }
5217     return(r);
5218 }
5219
5220 static int
5221 jpnxkt(a, obuf) int a; int obuf[]; {
5222 /* Translate JIS X 201 Katakana to local code */
5223
5224     int r;
5225
5226     r = 0;
5227     if (fcharset == FC_JIS7) {
5228         switch (jpnlst) {
5229           case 2:                               /* from Kanji */
5230             obuf[r++] = 0x1b;
5231             obuf[r++] = 0x28;
5232             obuf[r++] = 0x4a;
5233           case 0:                               /* from Roman */
5234             obuf[r++] = 0x0e;
5235           default:
5236             obuf[r++] = (a & 0x7f);
5237           break;
5238         }
5239     } else {
5240         if (fcharset == FC_JEUC)
5241           obuf[r++] = 0x8e;
5242         obuf[r++] = (a | 0x80);
5243     }
5244     return(r);
5245 }
5246
5247 static int
5248 jpnxkn(ibuf, obuf) int ibuf[], obuf[]; {
5249     /* Translate JIS X 0208 Kanji to local code */
5250     int c1, c2;
5251     int r;
5252
5253     c1 = ibuf[0] & 0x7f;
5254     c2 = ibuf[1] & 0x7f;
5255
5256     if (fcharset == FC_SHJIS) {
5257         if (c1 & 1)
5258           c2 += 0x1f;
5259         else
5260           c2 += 0x7d;
5261
5262         if (c2 >= 0x7f) c2++;
5263
5264         c1 = ((c1 - 0x21) >> 1) + 0x81;
5265         if (c1 > 0x9f) c1 += 0x40;
5266
5267         obuf[0] = c1;
5268         obuf[1] = c2;
5269         r = 2;
5270     } else if (fcharset == FC_JIS7) {
5271         r = 0;
5272         switch (jpnlst) {
5273           case 1:
5274             obuf[r++] = 0x0f; /* From Katakana */
5275           case 0:
5276             obuf[r++] = 0x1b;
5277             obuf[r++] = 0x24;
5278             obuf[r++] = 0x42;
5279           default:
5280             obuf[r++] = c1;
5281             obuf[r++] = c2;
5282             break;
5283         }
5284     } else {
5285         obuf[0] = (c1 | 0x80);
5286         obuf[1] = (c2 | 0x80);
5287         r = 2;
5288     }
5289     return(r);
5290 }
5291
5292 int
5293 xkanjf() {
5294 /* Initialize parameters for xkanji */
5295 /* This function should be called when F/X-packet is received */
5296     jpncnt = jpnlst = 0;
5297     return(0);
5298 }
5299
5300 int
5301 #ifdef CK_ANSIC
5302 xkanjz(int (*fn)(char))
5303 #else
5304 xkanjz(fn) int (*fn)();
5305 #endif /* CK_ANSIC */
5306 { /* xkanjz */
5307 /*
5308   Terminate xkanji
5309   This function must be called when Z-packet is received
5310   (before closing the file).
5311 */
5312     static int obuf[6];
5313     int r, i, c;
5314
5315     if (fcharset == FC_JIS7) {
5316         c = 'A';                        /* Dummy Roman character */
5317         r = jpnxas(c, obuf) - 1;        /* -1 removes Dummy character */
5318         if (r > 0) {
5319             for (i = 0; i < r; i++)
5320               if (((*fn)((char) obuf[i])) < 0)
5321                 return(-1);
5322         }
5323     }
5324     return(0);
5325 }
5326
5327 int
5328 #ifdef CK_ANSIC
5329 xkanji(int a, int (*fn)(char))
5330 #else
5331 xkanji(a, fn) int a; int (*fn)();
5332 #endif /* CK_ANSIC */
5333 { /* xkanji */
5334     static int xbuf[2];
5335     static int obuf[8];
5336
5337     int i, r;
5338     int c7;
5339     int state=0;
5340
5341     r = 0;
5342     if (jpncnt == 0) {
5343         /* 1st byte */
5344         if ((a & 0x80) == 0) {
5345             /* 8th bit is 0, i.e., single-byte code */
5346             r = jpnxas(a, obuf);
5347             state = 0;
5348         } else {
5349             /* 8th bit is 1, check the range */
5350             c7 = a & 0x7f;
5351             if (((c7 > 0x20) && (c7 < 0x7f)) || (c7 == 0x0e)) {
5352                 /* double byte code */
5353                 xbuf[jpncnt++] = a;
5354             } else {
5355                 /* single byte code */
5356                 r = jpnxas(a, obuf);
5357                 state = 0;
5358             }
5359         }
5360     } else {
5361         /* not the 1st byte */
5362         xbuf[jpncnt++] = a;
5363         if (xbuf[0] == 0x8e) {
5364             r = jpnxkt(xbuf[1], obuf);
5365             state = 1;
5366         } else {
5367             r = jpnxkn(xbuf, obuf);
5368             state = 2;
5369         }
5370     }
5371     if (r > 0) {
5372         for (i = 0; i < r; i++ )
5373           if (((*fn)((char) obuf[i])) < 0)
5374             return(-1);
5375         jpnlst = state;
5376         jpncnt = 0;
5377     }
5378     return(0);
5379 }
5380
5381 /*
5382   Function for translating from Japanese file character set
5383   to Japanese EUC transfer character set.
5384   Returns a pointer to a string containing 0, 1, or 2 bytes.
5385 */
5386
5387 /* zkanji */
5388 static int jpnstz;                      /* status for JIS-7 */
5389 static int jpnpnd;                      /* number of pending bytes */
5390 static int jpnpnt;                      /* pending buffer index */
5391 static int jpnpbf[8];                   /* pending buffer */
5392
5393 /* There is some duplication here between the old and new JIS-7 parsers */
5394 /* to be cleaned up later... */
5395
5396 VOID
5397 j7init() {                              /* Initialize JIS-7 parser */
5398     jpnstz = 0;
5399     jpnpnd = 0;
5400     jpnpnt = 0;
5401 }
5402
5403 int
5404 getj7() {                               /* Reads JIS-7 returns next EUC byte */
5405     int x;
5406
5407     if (jpnpnd > 0) {                   /* If something is pending */
5408         x = (unsigned) jpnpbf[jpnpnt++]; /* Get it */
5409         jpnpnd--;
5410         if (jpnpnd < 0) jpnpnd = 0;
5411         return((unsigned)x);
5412     }
5413     jpnpnt = 0;
5414
5415     if ((x = zminchar()) < 0) return(x);
5416     while (jpnpnd == 0) {               /* While something is pending... */
5417         if ((x > 0x20) && (x < 0x7f)) { /* 7-bit graphic character */
5418             switch (jpnstz) {
5419               case 1:                    /* Katakana */
5420 #ifdef COMMENT
5421                 /* This can't be right... */
5422                 jpnpbf[jpnpnd++] = 0x80; /* Insert flag (NOT SS2???) */
5423 #else
5424                 jpnpbf[jpnpnd++] = 0x8e; /* Insert SS2 */
5425 #endif /* COMMENT */
5426                 jpnpbf[jpnpnd++] = (x | 0x80); /* Insert Kana + 8th bit */
5427                 break;
5428               case 2:                   /* Kanji */
5429                 jpnpbf[jpnpnd++] = (x | 0x80); /* Get another byte */
5430                 if ((x = zminchar()) < 0) return(x);
5431                 jpnpbf[jpnpnd++] = (x | 0x80);
5432                 break;
5433               default:                  /* ASCII / JIS Roman */
5434                 jpnpbf[jpnpnd++] = x;
5435                 break;
5436             }
5437         } else if (x == 0x0e) {         /* ^N = SO */
5438             jpnstz = 1;                 /* Katakana */
5439             if ((x = zminchar()) < 0) return(x);
5440         } else if (x == 0x0f) {         /* ^O = SI */
5441             jpnstz = 0;                 /* ASCII / JIS Roman */
5442             if ((x = zminchar()) < 0) return(x);
5443         } else if (x == 0x1b) {         /* Escape */
5444             jpnpbf[jpnpnd++] = x;       /* Save in buffer */
5445             if ((x = zminchar()) < 0) return(x);
5446             jpnpbf[jpnpnd++] = x;       /* Save in buffer */
5447             if (x == '$') {             /* <ESC>$ */
5448                 if ((x = zminchar()) < 0) return(x);
5449                 jpnpbf[jpnpnd++] = x;
5450                 if ((x == '@') || (x == 'B')) { /* Kanji */
5451                     jpnstz = 2;
5452                     jpnpnt = jpnpnd = 0;
5453                     if ((x = zminchar()) < 0) return(x);
5454                 }
5455             } else if (x == '(') {      /* <ESC>( == 94-byte single-byte set */
5456                 if ((x = zminchar()) < 0) return(x);
5457                 jpnpbf[jpnpnd++] = x;
5458                 if ((x == 'B') || (x == 'J')) { /* ASCII or JIS Roman */
5459                     jpnstz = 0;                 /* Set state */
5460                     jpnpnt = jpnpnd = 0;        /* Reset pointers */
5461                     if ((x = zminchar()) < 0) return(x);
5462                 }
5463             } else if (x == 0x1b) {     /* <ESC><ESC> */
5464                 jpnpnt = jpnpnd = 0;    /* Reset pointers, stay in state */
5465                 if ((x = zminchar()) < 0) return(x);
5466             }
5467         } else {                        /* Not <ESC> - just save it */
5468             jpnpbf[jpnpnd++] = x;
5469         }
5470     }
5471     jpnpnt = 0;
5472     x = (unsigned)jpnpbf[jpnpnt++];
5473     jpnpnd--;
5474     return((unsigned)x);
5475 }
5476
5477 USHORT
5478 #ifdef CK_ANSIC
5479 eu_to_sj(USHORT eu)                     /* EUC-JP to Shift-JIS */
5480 #else
5481 eu_to_sj(eu) USHORT eu;
5482 #endif /* CK_ANSIC */
5483 {
5484     int c1, c2;
5485     union ck_short jcode,scode;
5486
5487     jcode.x_short = eu;
5488     c1 = (jcode.x_char[byteorder] & 0x7f);
5489     c2 = (jcode.x_char[1-byteorder] & 0x7f);
5490
5491     if (c1 & 1)
5492       c2 += 0x1f;
5493     else
5494       c2 += 0x7d;
5495     if (c2 >= 0x7f)
5496       c2++;
5497     c1 = ((c1 - 0x21) >> 1) + 0x81;
5498     if (c1 > 0x9f)
5499       c1 += 0x40;
5500
5501     scode.x_char[byteorder] = c1;
5502     scode.x_char[1-byteorder] = c2;
5503     return(scode.x_short);
5504 }
5505
5506
5507 USHORT
5508 #ifdef CK_ANSIC
5509 sj_to_eu(USHORT sj)                     /* Shift-JIS to EUC-JP */
5510 #else
5511 sj_to_eu(sj) USHORT sj;
5512 #endif /* CK_ANSIC */
5513 {
5514     union ck_short jcode, scode;
5515     int c0, c1;
5516
5517     scode.x_short = sj;
5518     c0 = scode.x_char[byteorder];       /* Left (hi order) byte */
5519     c1 = scode.x_char[1-byteorder];     /* Right (lo order) byte */
5520
5521     if (((c0 >= 0x81) && (c0 <= 0x9f)) || /* High order byte has 8th bit set */
5522         ((c0 >= 0xe0) && (c0 <= 0xfc))) { /* Kanji */
5523         if (c0 <= 0x9f)                   /* Two bytes in */
5524           c0 -= 0x71;                     /* Do the shifting... */
5525         else
5526           c0 -= 0xb1;
5527         c0 = c0 * 2 + 1;
5528         if (c1 > 0x7f) c1 -= 1;
5529         if (c1 >= 0x9e) {
5530             c1 -= 0x7d;
5531             c0 += 1;
5532         } else {
5533             c1 -= 0x1f;
5534         }
5535         jcode.x_char[byteorder] = (c0 | 0x80); /* Two bytes out */
5536         jcode.x_char[1-byteorder] = (c1 | 0x80);
5537
5538     } else if (c0 == 0) {               /* Single byte */
5539         if (c1 >= 0xa1 && c1 <= 0xdf) { /* Katakana */
5540             jcode.x_char[byteorder] = 0x8e; /* SS2 */
5541             jcode.x_char[1-byteorder] = c1; /* Kana code */
5542         } else {                        /* ASCII or C0 */
5543             jcode.x_short = c1;
5544         }
5545     } else {                            /* Something bad */
5546         debug(F001,"sj_to_eu bad sj","",sj);
5547         jcode.x_short = 0xffff;
5548     }
5549     return(jcode.x_short);
5550 }
5551
5552 int
5553 zkanjf() {                              /* Initialize */
5554     jpnstz = jpnpnd = jpnpnt = 0;
5555     return(0);
5556 }
5557
5558 int
5559 zkanjz() {
5560     return(0);
5561 }
5562
5563 int
5564 #ifdef CK_ANSIC
5565 zkanji(int (*fn)(void))
5566 #else
5567 zkanji(fn) int (*fn)();
5568 #endif /* CK_ANSIC */
5569 { /* zkanji */
5570     /* Read Japanese local code and translate to Japanese EUC */
5571     int a;
5572     int sc[3];
5573
5574     /* No pending characters */
5575     if (fcharset == FC_SHJIS) {         /* Translating from Shift-JIS */
5576         if (jpnpnd) {
5577             jpnpnd--;
5578             return(jpnpbf[jpnpnt++]);
5579         }
5580         a = (*fn)();
5581         jpnpnd = jpnpnt = 0;
5582         if (((a >= 0x81) && (a <= 0x9f)) ||
5583             ((a >= 0xe0) && (a <= 0xfc))) { /* 2-byte Kanji code */
5584             sc[0] = a;
5585             if ((sc[1] = (*fn)()) < 0)  /* Get second byte */
5586               return(sc[1]);
5587             if (sc[0] <= 0x9f)
5588               sc[0] -= 0x71;
5589             else
5590               sc[0] -= 0xb1;
5591             sc[0] = sc[0] * 2 + 1;
5592             if (sc[1] > 0x7f)
5593               sc[1]--;
5594             if (sc[1] >= 0x9e) {
5595                 sc[1] -= 0x7d;
5596                 sc[0]++;
5597             } else {
5598                 sc[1] -= 0x1f;
5599             }
5600             a = (sc[0] | 0x80);
5601             jpnpbf[0] = (sc[1] | 0x80);
5602             jpnpnd = 1;
5603             jpnpnt = 0;
5604         } else if ((a >= 0xa1) && (a <= 0xdf)) { /* Katakana */
5605             jpnpbf[0] = a;
5606             jpnpnd = 1;
5607             jpnpnt = 0;
5608             a = 0x8e;
5609         }
5610         return(a);
5611     } else if (fcharset == FC_JIS7 ) {  /* 7-bit JIS X 0208 */
5612         if (jpnpnd) {
5613             a = jpnpbf[jpnpnt++];
5614             jpnpnd--;
5615             return(a);
5616         }
5617         jpnpnt = 0;
5618         if ((a = (*fn)()) < 0)
5619           return(a);
5620         while (jpnpnd == 0) {
5621             if ((a > 0x20) && (a < 0x7f)) {
5622                 switch (jpnstz) {
5623                   case 1:
5624                     jpnpbf[jpnpnd++] = 0x80; /* Katakana */
5625                     jpnpbf[jpnpnd++] = (a | 0x80);
5626                     break;
5627                   case 2:
5628                     jpnpbf[jpnpnd++] = (a | 0x80); /* Kanji */
5629                     if ((a = (*fn)()) < 0)
5630                       return(a);
5631                     jpnpbf[jpnpnd++] = (a | 0x80);
5632                     break;
5633                   default:
5634                     jpnpbf[jpnpnd++] = a; /* Single byte */
5635                     break;
5636                 }
5637             } else if (a == 0x0e) {
5638                 jpnstz = 1;
5639                 if ((a = (*fn)()) < 0)
5640                   return(a);
5641             } else if (a == 0x0f) {
5642                 jpnstz = 0;
5643                 if ((a = (*fn)()) < 0)
5644                   return(a);
5645             } else if (a == 0x1b) {
5646                 jpnpbf[jpnpnd++] = a;   /* Escape */
5647                 if ((a = (*fn)()) < 0)
5648                   return(a);
5649                 jpnpbf[jpnpnd++] = a;
5650                 if (a == '$') {
5651                     if ((a = (*fn)()) < 0)
5652                       return(a);
5653                     jpnpbf[jpnpnd++] = a;
5654                     if ((a == '@') || (a == 'B')) {
5655                         jpnstz = 2;
5656                         jpnpnt = jpnpnd = 0;
5657                         if ((a = (*fn)()) < 0)
5658                           return(a);
5659                     }
5660                 } else if (a == '(') {
5661                     if ((a = (*fn)()) < 0)
5662                       return(a);
5663                     jpnpbf[jpnpnd++] = a;
5664                     if ((a == 'B') || (a == 'J')) {
5665                         jpnstz = 0;
5666                         jpnpnt = jpnpnd = 0;
5667                         if ((a = (*fn)()) < 0)
5668                           return(a);
5669                     }
5670                 } else if (a == 0x1b) {
5671                     jpnpnt = jpnpnd = 0;
5672                     if ((a = (*fn)()) < 0)
5673                       return(a);
5674                 }
5675             } else {
5676                 jpnpbf[jpnpnd++] = a;
5677             }
5678         }
5679         jpnpnt = 0;
5680         a = jpnpbf[jpnpnt++];
5681         jpnpnd--;
5682         return(a);
5683     } else {
5684         a = (*fn)();
5685         return(a);
5686     }
5687 }
5688 #endif /* KANJI */
5689
5690 /* Euro functions */
5691
5692 #ifdef LATIN2
5693 CHAR
5694 #ifdef CK_ANSIC
5695 xl2l9(CHAR c)
5696 #else
5697 xl2l9(c) CHAR c;
5698 #endif /* CK_ANSIC */
5699 { /* xl2l9 */                           /* Latin-2 to Latin-9... */
5700     switch (c) {
5701       case 169: return((CHAR)166);      /* S caron */
5702       case 185: return((CHAR)168);      /* s caron */
5703       case 174: return((CHAR)180);      /* Z caron */
5704       case 190: return((CHAR)184);      /* z caron */
5705       default:
5706         return(yl2l1[c]);
5707     }
5708
5709 }
5710
5711 _PROTOTYP( CHAR xl258, ( CHAR ) );
5712 CHAR
5713 #ifdef CK_ANSIC
5714 xl258(CHAR c)
5715 #else
5716 xl258(c) CHAR c;
5717 #endif /* CK_ANSIC */
5718 { /* xl258 */                           /* Latin-2 to CP858... */
5719     return(c);
5720 }
5721 #else
5722 #define xl2l9 NULL
5723 #define xl258 NULL
5724 #endif /* LATIN2 */
5725
5726 CHAR
5727 #ifdef CK_ANSIC
5728 zl9as(CHAR c)
5729 #else
5730 zl9as(c) CHAR c;
5731 #endif /* CK_ANSIC */
5732 { /* zl9as */                           /* Latin-9 to US ASCII... */
5733     if (c < (CHAR)0x80) return(c);      /* Save a function call */
5734     switch (c) {
5735       case 0xa4: return(UNK);           /* Euro */
5736       case 0xa6: return('S');           /* S Caron */
5737       case 0xa8: return('s');           /* s Caron */
5738       case 0xb4: return('Z');           /* Z Caron */
5739       case 0xbc: return('O');           /* OE digraph */
5740       case 0xbd: return('o');           /* oe digraph */
5741       case 0xbe: return('Y');           /* Y diaeresis */
5742       default:   return(zl1as(c));      /* The rest is like Latin-1 */
5743     }
5744 }
5745
5746 _PROTOTYP( CHAR xl9as, ( CHAR ) );
5747 CHAR
5748 #ifdef CK_ANSIC
5749 xl9as(CHAR c)
5750 #else
5751 xl9as(c) CHAR c;
5752 #endif /* CK_ANSIC */
5753 { /* xl9as */                           /* Latin-9 to US ASCII... */
5754     if (c < (CHAR)0x80) return(c);      /* Save a function call */
5755     switch (c) {
5756       case 0xa4: return(UNK);           /* Euro */
5757       case 0xa6: return('S');           /* S Caron */
5758       case 0xa8: return('s');           /* s Caron */
5759       case 0xb4: return('Z');           /* Z Caron */
5760       case 0xb8: return('z');           /* z Caron */
5761       case 0xbc: return('O');           /* OE digraph */
5762       case 0xbd: return('o');           /* oe digraph */
5763       case 0xbe: return('Y');           /* Y diaeresis */
5764       default:   return(xl1as(c));      /* The rest is like Latin-1 */
5765     }
5766 }
5767
5768 CHAR                                    /* CP1252 to Latin-9 */
5769 #ifdef CK_ANSIC
5770 xw1l9(CHAR c)
5771 #else
5772 xw1l9(c) CHAR c;
5773 #endif /* CK_ANSIC */
5774 { /* xw1l9 */
5775     switch (c) {
5776       case 0x80: return(0xa4);          /* Euro sign */
5777       case 0x8a: return(0xa6);          /* S caron */
5778       case 0x8c: return(0xbc);          /* OE */
5779       case 0x8e: return(0xb4);          /* Z caron */
5780       case 0x9a: return(0xa8);          /* s caron */
5781       case 0x9c: return(0xbd);          /* oe */
5782       case 0x9e: return(0xb8);          /* z caron */
5783       case 0x9f: return(0xbe);          /* Y diaeresis */
5784       case 0xa4:                        /* Currency sign */
5785       case 0xa6:                        /* Broken vertical bar */
5786       case 0xa8:                        /* Diaeresis */
5787       case 0xb4:                        /* Acute accent */
5788       case 0xb8:                        /* Cedilla */
5789       case 0xbc:                        /* 1/4 */
5790       case 0xbd:                        /* 1/2 */
5791       case 0xbe: return('?');           /* 3/4 */
5792       default: return((c < 160) ? xw1as(c) : c);
5793     }
5794 }
5795
5796 #ifdef LATIN2
5797 CHAR
5798 #ifdef CK_ANSIC
5799 xl9l2(CHAR c)
5800 #else
5801 xl9l2(c) CHAR c;
5802 #endif /* CK_ANSIC */
5803 { /* xl9l2 */                           /* Latin-9 to Latin-2... */
5804     if (c < (CHAR)0x80) return(c);      /* Save a function call */
5805     switch (c) {
5806       case 0xa4: return(UNK);           /* Euro */
5807       case 0xa6: return((CHAR)0xa9);    /* S Caron */
5808       case 0xa8: return((CHAR)0xb9);    /* s Caron */
5809       case 0xb4: return((CHAR)0xae);    /* Z Caron */
5810       case 0xb8: return((CHAR)0xaf);    /* z Caron */
5811       case 0xbc: return('O');           /* OE digraph */
5812       case 0xbd: return('o');           /* oe digraph */
5813       case 0xbe: return('Y');           /* Y diaeresis */
5814       default:   return(xl1l2(c));      /* The rest is like Latin-1 */
5815     }
5816 }
5817 #else
5818 #define xl9l2 NULL
5819 #endif /* LATIN2 */
5820
5821 CHAR
5822 #ifdef CK_ANSIC
5823 xl958(CHAR c)
5824 #else
5825 xl958(c) CHAR c;
5826 #endif /* CK_ANSIC */
5827 { /* xl958 */                           /* Latin-9 to CP858... */
5828     if (c == 0xa4)                      /* Euro Symbol */
5829       return((CHAR)0xd5);
5830     else if (c == 0x9e)                 /* This was currency symbol */
5831       return((CHAR)0xcf);
5832     c = yl185[c];
5833     return(c);
5834 }
5835
5836 CHAR
5837 #ifdef CK_ANSIC
5838 x58as(CHAR c)
5839 #else
5840 x58as(c) CHAR c;
5841 #endif /* CK_ANSIC */
5842 { /* x58as */                           /* CP858 to US ASCII... */
5843     if (c == 0xd5)                      /* Euro rather than dotless i */
5844       return(UNK);
5845     else
5846       return(x85as(c));                 /* The rest is like CP850 */
5847 }
5848
5849 CHAR
5850 #ifdef CK_ANSIC
5851 x58l1(CHAR c)
5852 #else
5853 x58l1(c) CHAR c;
5854 #endif /* CK_ANSIC */
5855 { /* x58l1 */                           /* CP858 to Latin-1... */
5856     if (c == 0xd5)                      /* Euro rather than dotless i */
5857       return((CHAR)0xa4);               /* Return currency symbol */
5858     else if (c == 0xcf)                 /* This keeps it invertible */
5859       return((CHAR)0x9e);
5860     else
5861       return(x85l1(c));
5862 }
5863
5864 #ifdef LATIN2
5865 CHAR
5866 #ifdef CK_ANSIC
5867 x58l2(CHAR c)
5868 #else
5869 x58l2(c) CHAR c;
5870 #endif /* CK_ANSIC */
5871 { /* x58l2 */                           /* CP858 to Latin-2... */
5872     if (c == 0xd5)                      /* Euro rather than dotless i */
5873       return((CHAR)0xa4);               /* Return currency symbol */
5874     else if (c == 0xcf)                 /* This keeps it invertible */
5875       return((CHAR)0x9e);               /* (if it ever was...) */
5876     else                                /* Otherwise like CP850 */
5877       return(x85l2(c));
5878 }
5879 #else
5880 #define x58l2 NULL
5881 #endif /* LATIN2 */
5882
5883 CHAR
5884 #ifdef CK_ANSIC
5885 x58l9(CHAR c)
5886 #else
5887 x58l9(c) CHAR c;
5888 #endif /* CK_ANSIC */
5889 { /* x58l9 */                           /* CP-858 to Latin-9... */
5890     if (c == 0xd5)                      /* Euro rather than dotless i */
5891       return((CHAR)0xa4);               /* Return currency symbol */
5892     else if (c == 0xcf)                 /* This keeps it invertible */
5893       return((CHAR)0x9e);               /* (if it ever was...) */
5894     else                                /* Otherwise like CP850 */
5895       return(x85l1(c));                 /* to Latin-1 */
5896 }
5897
5898 /* End Euro functions */
5899
5900
5901 /*  TABLES OF TRANSLATION FUNCTIONS */
5902
5903 /*
5904   First, the table of translation functions for RECEIVING files.  That is,
5905   *from* the TRANSFER character set *to* the FILE character set, an array of
5906   pointers to functions.  The first index is the TRANSFER CHARACTER-SET
5907   number, the second index is the FILE CHARACTER-SET number.
5908
5909   These arrays must be fully populated, even if (as is the case with Kanji
5910   character sets), all the entries are NULL.  Otherwise, subscript
5911   calculations will be wrong and we'll use the wrong functions.
5912 */
5913
5914 /* Pointers to byte-for-byte translation functions */
5915
5916 _PROTOTYP( CHAR (*rx), (CHAR) );
5917 _PROTOTYP( CHAR (*sx), (CHAR) );
5918
5919 #ifdef UNICODE
5920 _PROTOTYP( int (*xut), (USHORT) );      /* Translation function UCS to TCS */
5921 _PROTOTYP( int (*xuf), (USHORT) );      /* Translation function UCS to FCS */
5922 _PROTOTYP( USHORT (*xtu), (CHAR) );     /* Translation function TCS to UCS */
5923 _PROTOTYP( USHORT (*xfu), (CHAR) );     /* Translation function FCS to UCS */
5924 #endif /* UNICODE */
5925
5926 #ifdef CK_ANSIC
5927 CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
5928 #else
5929 CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])() =
5930 #endif /* CK_ANSIC */
5931 {
5932     NULL,                       /* 0,0 transparent to us ascii */
5933     NULL,                       /* 0,1 transparent to uk ascii */
5934     NULL,                       /* 0,2 transparent to dutch nrc */
5935     NULL,                       /* 0,3 transparent to finnish nrc */
5936     NULL,                       /* 0,4 transparent to french nrc */
5937     NULL,                       /* 0,5 transparent to fr-canadian nrc */
5938     NULL,                       /* 0,6 transparent to german nrc */
5939     NULL,                       /* 0,7 transparent to hungarian nrc */
5940     NULL,                       /* 0,8 transparent to italian nrc */
5941     NULL,                       /* 0,9 transparent to norge/danish nrc */
5942     NULL,                       /* 0,10 transparent to portuguese nrc */
5943     NULL,                       /* 0,11 transparent to spanish nrc */
5944     NULL,                       /* 0,12 transparent to swedish nrc */
5945     NULL,                       /* 0,13 transparent to swiss nrc */
5946     NULL,                       /* 0,14 transparent to latin-1 */
5947     NULL,                       /* 0,15 transparent to latin-2 */
5948     NULL,                       /* 0,16 transparent to DEC MCS */
5949     NULL,                       /* 0,17 transparent to NeXT */
5950     NULL,                       /* 0,18 transparent to CP437 */
5951     NULL,                       /* 0,19 transparent to CP850 */
5952     NULL,                       /* 0,20 transparent to CP852 */
5953     NULL,                       /* 0,21 transparent to Macintosh Latin */
5954     NULL,                       /* 0,22 transparent to DGI */
5955     NULL,                       /* 0,23 transparent to HP */
5956     NULL,                       /* 0,24 transparent to Latin/Cyrillic */
5957     NULL,                       /* 0,25 transparent to CP866 */
5958     NULL,                       /* 0,26 transparent to Short KOI-7 */
5959     NULL,                       /* 0,27 transparent to Old KOI-8 Cyrillic */
5960     NULL,                       /* 0,28 transparent to JIS-7 */
5961     NULL,                       /* 0,29 transparent to Shift-JIS */
5962     NULL,                       /* 0,30 transparent to J-EUC */
5963     NULL,                       /* 0,31 transparent to DEC Kanji */
5964     NULL,                       /* 0,32 transparent to Hebrew-7 */
5965     NULL,                       /* 0,33 transparent to Latin/Hebrew */
5966     NULL,                       /* 0,34 transparent to CP862 Hebrew */
5967     NULL,                       /* 0,35 transparent to ELOT 927 Greek */
5968     NULL,                       /* 0,36 transparent to Latin/Greek */
5969     NULL,                       /* 0,37 transparent to CP869 */
5970     NULL,                       /* 0,38 transparent to Latin-9 */
5971     NULL,                       /* 0,39 transparent to CP858 */
5972     NULL,                       /* 0,40 transparent to CP855 */
5973     NULL,                       /* 0,41 transparent to CP1251 */
5974     NULL,                       /* 0,42 transparent to Bulgarian */
5975     NULL,                       /* 0,43 transparent to CP1250 */
5976     NULL,                       /* 0,44 transparent to Mazovia */
5977     NULL,                       /* 0,45 transparent to UCS-2 */
5978     NULL,                       /* 0,46 transparent to UTF-8 */
5979     NULL,                       /* 0,47 transparent to KOI8R */
5980     NULL,                       /* 0,48 transparent to KOI8U */
5981     NULL,                       /* 0,49 transparent to CP1252 */
5982     NULL,                       /* 1,0 ascii to us ascii */
5983     NULL,                       /* 1,1 ascii to uk ascii */
5984     NULL,                       /* 1,2 ascii to dutch nrc */
5985     NULL,                       /* 1,3 ascii to finnish nrc */
5986     NULL,                       /* 1,4 ascii to french nrc */
5987     NULL,                       /* 1,5 ascii to fr-canadian nrc */
5988     NULL,                       /* 1,6 ascii to german nrc */
5989     NULL,                       /* 1,7 ascii to hungarian nrc */
5990     NULL,                       /* 1,8 ascii to italian nrc */
5991     NULL,                       /* 1,9 ascii to norge/danish nrc */
5992     NULL,                       /* 1,10 ascii to portuguese nrc */
5993     NULL,                       /* 1,11 ascii to spanish nrc */
5994     NULL,                       /* 1,12 ascii to swedish nrc */
5995     NULL,                       /* 1,13 ascii to swiss nrc */
5996     NULL,                       /* 1,14 ascii to latin-1 */
5997     NULL,                       /* 1,15 ascii to latin-2 */
5998     NULL,                       /* 1,16 ascii to DEC MCS */
5999     NULL,                       /* 1,17 ascii to NeXT */
6000     NULL,                       /* 1,18 ascii to CP437 */
6001     NULL,                       /* 1,19 ascii to CP850 */
6002     NULL,                       /* 1,20 ascii to CP852 */
6003     NULL,                       /* 1,21 ascii to Macintosh Latin */
6004     NULL,                       /* 1,22 ascii to DGI */
6005     NULL,                       /* 1,23 ascii to HP */
6006     xaslc,                      /* 1,24 ascii to Latin/Cyrillic */
6007     xasac,                      /* 1,25 ascii to CP866 */
6008     xassk,                      /* 1,26 ascii to Short KOI */
6009     xask8,                      /* 1,27 ascii to Old KOI-8 Cyrillic */
6010     NULL,                       /* 1,28 ascii to JIS-7 */
6011     NULL,                       /* 1,29 ascii to Shift-JIS */
6012     NULL,                       /* 1,30 ascii to J-EUC */
6013     NULL,                       /* 1,31 ascii to DEC Kanji */
6014     xash7,                      /* 1,32 ascii to Hebrew-7 */
6015     NULL,                       /* 1,33 ascii to Latin/Hebrew */
6016     NULL,                       /* 1,34 ascii to CP862 Hebrew */
6017     xaseg,                      /* 1,35 ascii to ELOT 927 Greek */
6018     NULL,                       /* 1,36 ascii to Latin/Greek */
6019     NULL,                       /* 1,37 ascii to CP869 */
6020     NULL,                       /* 1,38 ascii to Latin-9 */
6021     NULL,                       /* 1,39 ascii to CP858 */
6022     xas55,                      /* 1,40 ascii to CP855 */
6023     xas1251,                    /* 1,41 ascii to CP1251 */
6024     xleft128,                   /* 1,42 ascii to bulgarian */
6025     xleft128,                   /* 1,43 ascii to CP1250 */
6026     xleft128,                   /* 1,44 ascii to Mazovia */
6027     NULL,                       /* 1,45 ascii to UCS-2 */
6028     NULL,                       /* 1,46 ascii to UTF-8 */
6029     NULL,                       /* 1,47 ascii to KOI8-R */
6030     NULL,                       /* 1,48 ascii to KOI8-U */
6031     NULL,                       /* 1,49 ascii to CP1252 */
6032     zl1as,                      /* 2,0 latin-1 to us ascii */
6033     xl1uk,                      /* 2,1 latin-1 to uk ascii */
6034     xl1du,                      /* 2,2 latin-1 to dutch nrc */
6035     xl1fi,                      /* 2,3 latin-1 to finnish nrc */
6036     xl1fr,                      /* 2,4 latin-1 to french nrc */
6037     xl1fc,                      /* 2,5 latin-1 to fr-canadian nrc */
6038     xl1ge,                      /* 2,6 latin-1 to german nrc */
6039     xl1it,                      /* 2,7 latin-1 to italian nrc */
6040     xl1hu,                      /* 2,8 latin-1 to hungarian nrc */
6041     xl1no,                      /* 2,9 latin-1 to norge/danish nrc */
6042     xl1po,                      /* 2,10 latin-1 to portuguese nrc */
6043     xl1sp,                      /* 2,11 latin-1 to spanish nrc */
6044     xl1sw,                      /* 2,12 latin-1 to swedish nrc */
6045     xl1ch,                      /* 2,13 latin-1 to swiss nrc */
6046     NULL,                       /* 2,14 latin-1 to latin-1 */
6047     xl1l2,                      /* 2,15 latin-1 to latin-2 */
6048     xl1dm,                      /* 2,16 latin-1 to DEC MCS */
6049     xl1ne,                      /* 2,17 latin-1 to NeXT */
6050     xl143,                      /* 2,18 latin-1 to CP437 */
6051     xl185,                      /* 2,19 latin-1 to CP850 */
6052     xl152,                      /* 2,20 latin-1 to CP852 */
6053     xl1aq,                      /* 2,21 latin-1 to Macintosh Latin */
6054     xl1dg,                      /* 2,22 latin-1 to DGI */
6055     xl1r8,                      /* 2,23 latin-1 to HP Roman8 */
6056     zl1as,                      /* 2,24 latin-1 to Latin/Cyrillic */
6057     zl1as,                      /* 2,25 latin-1 to CP866 */
6058     xl1sk,                      /* 2,26 latin-1 to Short KOI */
6059     zl1as,                      /* 2,27 latin-1 to Old KOI-8 Cyrillic */
6060     NULL,                       /* 2,28 latin-1 to JIS-7 */
6061     NULL,                       /* 2,29 latin-1 to Shift-JIS */
6062     NULL,                       /* 2,30 latin-1 to J-EUC */
6063     NULL,                       /* 2,31 latin-1 to DEC Kanji */
6064     xl1h7,                      /* 2,32 latin-1 to Hebrew-7 */
6065     xl1lh,                      /* 2,33 latin-1 to Latin/Hebrew */
6066     xl162,                      /* 2,34 latin-1 to CP862 Hebrew */
6067     xl1eg,                      /* 2,35 latin-1 to ELOT 927 Greek */
6068     xl1lg,                      /* 2,36 latin-1 to Latin/Greek */
6069     xl169,                      /* 2,37 latin-1 to CP869 */
6070     NULL,                       /* 2,38 latin-1 to Latin9 */
6071     xl185,                      /* 2,39 latin-1 to CP858 */
6072     zl1as,                      /* 2,40 latin-1 to CP855 */
6073     zl1as,                      /* 2,41 latin-1 to CP1251 */
6074     zl1as,                      /* 2,42 latin-1 to Bulgarian */
6075     xl11250,                    /* 2,43 latin-1 to CP1250 */
6076     xl1mz,                      /* 2,44 latin-1 to Mazovia */
6077     NULL,                       /* 2,45 latin-1 to UCS-2 */
6078     NULL,                       /* 2,46 latin-1 to UTF-8 */
6079     zl1as,                      /* 2,47 latin-1 to KOI8R */
6080     zl1as,                      /* 2,48 latin-1 to KOI8U */
6081     xl1w1,                      /* 2,49 latin-1 to CP1252 */
6082     xl2as,                      /* 3,0 latin-2 to us ascii */
6083     xl2as,                      /* 3,1 latin-2 to uk ascii */
6084     xl2as,                      /* 3,2 latin-2 to dutch nrc */
6085     xl2as,                      /* 3,3 latin-2 to finnish nrc */
6086     xl2as,                      /* 3,4 latin-2 to french nrc */
6087     xl2as,                      /* 3,5 latin-2 to fr-canadian nrc */
6088     xl2as,                      /* 3,6 latin-2 to german nrc */
6089     xl2as,                      /* 3,7 latin-2 to italian nrc */
6090     xl2as,                      /* 3,8 latin-2 to hungarian nrc */
6091     xl2as,                      /* 3,9 latin-2 to norge/danish nrc */
6092     xl2as,                      /* 3,10 latin-2 to portuguese nrc */
6093     xl2as,                      /* 3,11 latin-2 to spanish nrc */
6094     xl2as,                      /* 3,12 latin-2 to swedish nrc */
6095     xl2as,                      /* 3,13 latin-2 to swiss nrc */
6096     xl2l1,                      /* 3,14 latin-2 to latin-1 */
6097     NULL,                       /* 3,15 latin-2 to latin-2 */
6098     xl2l1,                      /* 3,16 latin-2 to DEC MCS */
6099     xl2ne,                      /* 3,17 latin-2 to NeXT */
6100     xl243,                      /* 3,18 latin-2 to CP437 */
6101     xl285,                      /* 3,19 latin-2 to CP850 */
6102     xl252,                      /* 3,20 latin-2 to CP852 */
6103     xl2aq,                      /* 3,21 latin-2 to Macintosh Latin */
6104     xl2dg,                      /* 3,22 latin-2 to DGI */
6105     xl2r8,                      /* 3,23 latin-2 to HP */
6106     xl2as,                      /* 3,24 latin-2 to Latin/Cyrillic */
6107     xl2as,                      /* 3,25 latin-2 to CP866 */
6108     xl2sk,                      /* 3,26 latin-2 to Short KOI */
6109     xl2as,                      /* 3,27 latin-2 to Old KOI-8 Cyrillic */
6110     NULL,                       /* 3,28 latin-2 to JIS-7 */
6111     NULL,                       /* 3,29 latin-2 to Shift-JIS */
6112     NULL,                       /* 3,30 latin-2 to J-EUC */
6113     NULL,                       /* 3,31 latin-2 to DEC Kanji */
6114     xl2h7,                      /* 3,32 latin-2 to Hebrew-7 */
6115     xl2as,                      /* 3,33 latin-2 to Latin/Hebrew */
6116     xl2as,                      /* 3,34 latin-2 to CP862 Hebrew */
6117     xassk,                      /* 3,35 latin-2 to ELOT 927 Greek */
6118     xl2as,                      /* 3,36 latin-2 to Latin/Greek */
6119     xl2as,                      /* 3,37 latin-2 to CP869 */
6120     xl2l9,                      /* 3,38 latin-2 to Latin-9 */
6121     xl258,                      /* 3,39 latin-2 to CP858 */
6122     xl2as,                      /* 3,40 latin-2 to CP855 */
6123     xl2as,                      /* 3,41 latin-2 to CP1251 */
6124     xl2as,                      /* 3,42 latin-2 to Bulgarian */
6125     xl21250,                    /* 3,43 latin-2 to CP1250 */
6126     xl2mz,                      /* 3,44 latin-2 to Mazovia */
6127     NULL,                       /* 3,45 latin-2 to UCS-2 */
6128     NULL,                       /* 3,46 latin-2 to UTF-8 */
6129     xl2as,                      /* 3,47 latin-2 to KOI8R */
6130     xl2as,                      /* 3,48 latin-2 to KOI8U */
6131     xl2w1,                      /* 3,49 latin-2 to CP1252 */
6132     xlcas,                      /* 4,0 latin/cyrillic to us ascii */
6133     xlcas,                      /* 4,1 latin/cyrillic to uk ascii */
6134     xlcas,                      /* 4,2 latin/cyrillic to dutch nrc */
6135     xlcas,                      /* 4,3 latin/cyrillic to finnish ascii */
6136     xlcas,                      /* 4,4 latin/cyrillic to french nrc */
6137     xlcas,                      /* 4,5 latin/cyrillic to fr-canadian nrc */
6138     xlcas,                      /* 4,6 latin/cyrillic to german nrc */
6139     xlcas,                      /* 4,7 latin/cyrillic to italian nrc */
6140     xlcas,                      /* 4,8 latin/cyrillic to hungarian nrc */
6141     xlcas,                      /* 4,9 latin/cyrillic to norge/danish nrc */
6142     xlcas,                      /* 4,10 latin/cyrillic to portuguese nrc */
6143     xlcas,                      /* 4,11 latin/cyrillic to spanish nrc */
6144     xlcas,                      /* 4,12 latin/cyrillic to swedish nrc */
6145     xlcas,                      /* 4,13 latin/cyrillic to swiss nrc */
6146     xlcas,                      /* 4,14 latin/cyrillic to latin-1 */
6147     xlcas,                      /* 4,15 latin/cyrillic to latin-2 */
6148     xlcas,                      /* 4,16 latin/cyrillic to DEC MCS */
6149     xlcas,                      /* 4,17 latin/cyrillic to NeXT */
6150     xlcas,                      /* 4,18 latin/cyrillic to CP437 */
6151     xlcas,                      /* 4,19 latin/cyrillic to CP850 */
6152     xlcas,                      /* 4,20 latin/cyrillic to CP852 */
6153     xlcas,                      /* 4,21 latin/cyrillic to Macintosh Latin */
6154     xlcas,                      /* 4,22 latin/cyrillic to DGI */
6155     xlcas,                      /* 4,23 latin/cyrillic to HP */
6156     NULL,                       /* 4,24 latin/cyrillic to Latin/Cyrillic */
6157     xlcac,                      /* 4,25 latin/cyrillic to CP866 */
6158     xlcsk,                      /* 4,26 latin/cyrillic to Short KOI */
6159     xlck8,                      /* 4,27 latin/cyrillic to Old KOI-8 Cyrillic */
6160     NULL,                       /* 4,28 latin/cyril to JIS-7 */
6161     NULL,                       /* 4,29 latin/cyril to Shift-JIS */
6162     NULL,                       /* 4,30 latin/cyril to J-EUC */
6163     NULL,                       /* 4,31 latin/cyril to DEC Kanji */
6164     xlch7,                      /* 4,32 latin/cyril to Hebrew-7 */
6165     xlcas,                      /* 4,33 latin/cyril to Latin/Hebrew */
6166     xlcas,                      /* 4,34 latin/cyril to CP862 Hebrew */
6167     xassk,                      /* 4,35 latin/cyril to ELOT 927 Greek */
6168     xleft160,                   /* 4,36 latin/cyril to Latin/Greek */
6169     xleft128,                   /* 4,37 latin/cyril to CP869 */
6170     xlcas,                      /* 4,38 latin/cyril to latin-9 */
6171     xlcas,                      /* 4,39 latin/cyril to CP858 */
6172     xlc55,                      /* 4,40 latin/cyril to CP855 */
6173     xlc1251,                    /* 4,41 latin/cyril to CP1251 */
6174     xlcbu,                      /* 4,42 latin/cyril to Bulgarian */
6175     xlcas,                      /* 4,43 latin/cyril to CP1250 */
6176     xlcas,                      /* 4,44 latin/cyril to Mazovia */
6177     NULL,                       /* 4,45 latin/cyril to UCS-2 */
6178     NULL,                       /* 4,46 latin/cyril to UTF-8 */
6179     xlckr,                      /* 4,47 latin/cyril to KOI8R */
6180     xlcku,                      /* 4,48 latin/cyril to KOI8U */
6181     xlcas,                      /* 4,49 latin/cyril to CP1252 */
6182     NULL,                       /* 5,00 */
6183     NULL,                       /* 5,01 */
6184     NULL,                       /* 5,02 */
6185     NULL,                       /* 5,03 */
6186     NULL,                       /* 5,04 */
6187     NULL,                       /* 5,05 */
6188     NULL,                       /* 5,06 */
6189     NULL,                       /* 5,07 */
6190     NULL,                       /* 5,08 */
6191     NULL,                       /* 5,09 */
6192     NULL,                       /* 5,10 */
6193     NULL,                       /* 5,11 */
6194     NULL,                       /* 5,12 */
6195     NULL,                       /* 5,13 */
6196     NULL,                       /* 5,14 */
6197     NULL,                       /* 5,15 */
6198     NULL,                       /* 5,16 */
6199     NULL,                       /* 5,17 */
6200     NULL,                       /* 5,18 */
6201     NULL,                       /* 5,19 */
6202     NULL,                       /* 5,20 */
6203     NULL,                       /* 5,21 */
6204     NULL,                       /* 5,22 */
6205     NULL,                       /* 5,23 */
6206     NULL,                       /* 5,24 */
6207     NULL,                       /* 5,25 */
6208     NULL,                       /* 5,26 */
6209     NULL,                       /* 5,27 */
6210     NULL,                       /* 5,28 */
6211     NULL,                       /* 5,29 */
6212     NULL,                       /* 5,30 */
6213     NULL,                       /* 5,31 */
6214     NULL,                       /* 5,32 */
6215     NULL,                       /* 5,33 */
6216     NULL,                       /* 5,34 */
6217     NULL,                       /* 5,35 */
6218     NULL,                       /* 5,36 */
6219     NULL,                       /* 5,37 */
6220     NULL,                       /* 5,38 */
6221     NULL,                       /* 5,39 */
6222     NULL,                       /* 5,40 */
6223     NULL,                       /* 5,41 */
6224     NULL,                       /* 5,42 */
6225     NULL,                       /* 5,43 */
6226     NULL,                       /* 5,44 */
6227     NULL,                       /* 5,45 */
6228     NULL,                       /* 5,46 */
6229     NULL,                       /* 5,47 */
6230     NULL,                       /* 5,48 */
6231     NULL,                       /* 5,49 */
6232     xlhas,                      /* 6,0 latin/hebrew to us ascii */
6233     xlhas,                      /* 6,1 latin/hebrew to uk ascii */
6234     xlhas,                      /* 6,2 latin/hebrew to dutch nrc */
6235     xlhas,                      /* 6,3 latin/hebrew to finnish ascii */
6236     xlhas,                      /* 6,4 latin/hebrew to french nrc */
6237     xlhas,                      /* 6,5 latin/hebrew to fr-canadian nrc */
6238     xlhas,                      /* 6,6 latin/hebrew to german nrc */
6239     xlhas,                      /* 6,7 latin/hebrew to italian nrc */
6240     xlhas,                      /* 6,8 latin/hebrew to hungarian nrc */
6241     xlhas,                      /* 6,9 latin/hebrew to norge/danish nrc */
6242     xlhas,                      /* 6,10 latin/hebrew to portuguese nrc */
6243     xlhas,                      /* 6,11 latin/hebrew to spanish nrc */
6244     xlhas,                      /* 6,12 latin/hebrew to swedish nrc */
6245     xlhas,                      /* 6,13 latin/hebrew to swiss nrc */
6246     xlhl1,                      /* 6,14 latin/hebrew to latin-1 */
6247     xlhas,                      /* 6,15 latin/hebrew to latin-2 */
6248     xlhl1,                      /* 6,16 latin/hebrew to DEC MCS */
6249     xlhas,                      /* 6,17 latin/hebrew to NeXT */
6250     xlhas,                      /* 6,18 latin/hebrew to CP437 */
6251     xlhas,                      /* 6,19 latin/hebrew to CP850 */
6252     xlhas,                      /* 6,20 latin/hebrew to CP852 */
6253     xlhas,                      /* 6,21 latin/hebrew to Macintosh Latin */
6254     xlhas,                      /* 6,22 latin/hebrew to DGI */
6255     xlhas,                      /* 6,23 latin/hebrew to HP */
6256     xlhas,                      /* 6,24 latin/hebrew to Latin/Cyrillic */
6257     xlhas,                      /* 6,25 latin/hebrew to CP866 */
6258     NULL,                       /* 6,26 latin/hebrew to Short KOI */
6259     xlhas,                      /* 6,27 latin/hebrew to Old KOI-8 Cyrillic */
6260     NULL,                       /* 6,28 latin/hebrew to JIS-7 */
6261     NULL,                       /* 6,29 latin/hebrew to Shift-JIS */
6262     NULL,                       /* 6,30 latin/hebrew to J-EUC */
6263     NULL,                       /* 6,31 latin/hebrew to DEC Kanji */
6264     xlhh7,                      /* 6,32 latin/hebrew to Hebrew-7 */
6265     NULL,                       /* 6,33 latin/hebrew to Latin/Hebrew */
6266     xlh62,                      /* 6,34 latin/hebrew to CP862 Hebrew */
6267     NULL,                       /* 6,35 latin/hebrew to ELOT 927 Greek */
6268     xlhas,                      /* 6,36 latin/hebrew to Latin/Greek */
6269     xlhas,                      /* 6,37 latin/hebrew to CP869 */
6270     xlhas,                      /* 6,38 latin/hebrew to Latin-9 */
6271     xlhas,                      /* 6,39 latin/hebrew to CP858 */
6272     xlhas,                      /* 6,40 latin/hebrew to CP855 */
6273     xlhas,                      /* 6,41 latin/hebrew to CP1251 */
6274     xlhas,                      /* 6,42 latin/hebrew to Bulgarian */
6275     xlhas,                      /* 6,43 latin/hebrew to CP1250 */
6276     xlhas,                      /* 6,44 latin/hebrew to Mazovia */
6277     NULL,                       /* 6,45 latin/hebrew to UCS-2 */
6278     NULL,                       /* 6,46 latin/hebrew to UTF-8 */
6279     NULL,                       /* 6,47 latin/hebrew to KOI8R */
6280     NULL,                       /* 6,48 latin/hebrew to KOI8U */
6281     xlhw1,                      /* 6,49 latin/hebrew to CP1252 */
6282     xlgas,                      /* 7,0 latin/greek to us ascii */
6283     xlgas,                      /* 7,1 latin/greek to uk ascii */
6284     xlgas,                      /* 7,2 latin/greek to dutch nrc */
6285     xlgas,                      /* 7,3 latin/greek to finnish ascii */
6286     xlgas,                      /* 7,4 latin/greek to french nrc */
6287     xlgas,                      /* 7,5 latin/greek to fr-canadian nrc */
6288     xlgas,                      /* 7,6 latin/greek to german nrc */
6289     xlgas,                      /* 7,7 latin/greek to italian nrc */
6290     xlgas,                      /* 7,8 latin/greek to hungarian nrc */
6291     xlgas,                      /* 7,9 latin/greek to norge/danish nrc */
6292     xlgas,                      /* 7,10 latin/greek to portuguese nrc */
6293     xlgas,                      /* 7,11 latin/greek to spanish nrc */
6294     xlgas,                      /* 7,12 latin/greek to swedish nrc */
6295     xlgas,                      /* 7,13 latin/greek to swiss nrc */
6296     xlgas,                      /* 7,14 latin/greek to latin-1 */
6297     xlgas,                      /* 7,15 latin/greek to latin-2 */
6298     xlgas,                      /* 7,16 latin/greek to DEC MCS */
6299     xlgas,                      /* 7,17 latin/greek to NeXT */
6300     xlgas,                      /* 7,18 latin/greek to CP437 */
6301     xlgas,                      /* 7,19 latin/greek to CP850 */
6302     xlgas,                      /* 7,20 latin/greek to CP852 */
6303     xlgas,                      /* 7,21 latin/greek to Macintosh Latin */
6304     xlgas,                      /* 7,22 latin/greek to DGI */
6305     xlgas,                      /* 7,23 latin/greek to HP */
6306     xleft160,                   /* 7,24 latin/greek to Latin/Cyrillic */
6307     xleft128,                   /* 7,25 latin/greek to CP866 */
6308     xassk,                      /* 7,26 latin/greek to Short KOI */
6309     xleft160,                   /* 7,27 latin/greek to Old KOI-8 Greek */
6310     NULL,                       /* 7,28 latin/greek to JIS-7 */
6311     NULL,                       /* 7,29 latin/greek to Shift-JIS */
6312     NULL,                       /* 7,30 latin/greek to J-EUC */
6313     NULL,                       /* 7,31 latin/greek to DEC Kanji */
6314     NULL,                       /* 7,32 latin/greek to Hebrew-7 */
6315     xlgas,                      /* 7,33 latin/greek to Latin/Hebrew */
6316     xlgas,                      /* 7,34 latin/greek to CP862 Hebrew */
6317     xlgeg,                      /* 7,35 latin/greek to ELOT 927 Greek */
6318     NULL,                       /* 7,36 latin/greek to Latin/Greek */
6319     xlg69,                      /* 7,37 latin/greek to CP869 */
6320     xlgas,                      /* 7,38 latin/greek to Latin-9 */
6321     xlgas,                      /* 7,39 latin/greek to CP858 */
6322     xleft128,                   /* 7,40 latin/greek to CP855 */
6323     xleft128,                   /* 7,41 latin/greek to CP1251 */
6324     xleft128,                   /* 7,42 latin/greek to Bulgarian */
6325     xleft128,                   /* 7,43 latin/greek to CP1250 */
6326     xleft128,                   /* 7,44 latin/greek to Mazovia */
6327     NULL,                       /* 7,45 latin/greek to UCS-2 */
6328     NULL,                       /* 7,46 latin/greek to UTF-8 */
6329     NULL,                       /* 7,47 latin/greek to KOI8R */
6330     NULL,                       /* 7,48 latin/greek to KOI8U */
6331     xlgw1,                      /* 7,49 latin/greek to CP1252 */
6332     zl9as,                      /* 8,0 latin-9 to us ascii */
6333     xl1uk,                      /* 8,1 latin-9 to uk ascii */
6334     xl1du,                      /* 8,2 latin-9 to dutch nrc */
6335     xl1fi,                      /* 8,3 latin-9 to finnish nrc */
6336     xl1fr,                      /* 8,4 latin-9 to french nrc */
6337     xl1fc,                      /* 8,5 latin-9 to fr-canadian nrc */
6338     xl1ge,                      /* 8,6 latin-9 to german nrc */
6339     xl1it,                      /* 8,7 latin-9 to italian nrc */
6340     xl1hu,                      /* 8,8 latin-9 to hungarian nrc */
6341     xl1no,                      /* 8,9 latin-9 to norge/danish nrc */
6342     xl1po,                      /* 8,10 latin-9 to portuguese nrc */
6343     xl1sp,                      /* 8,11 latin-9 to spanish nrc */
6344     xl1sw,                      /* 8,12 latin-9 to swedish nrc */
6345     xl1ch,                      /* 8,13 latin-9 to swiss nrc */
6346     NULL,                       /* 8,14 latin-9 to latin-1 */
6347     xl1l2,                      /* 8,15 latin-9 to latin-2 */
6348     xl9dm,                      /* 8,16 latin-9 to DEC MCS */
6349     xl9ne,                      /* 8,17 latin-9 to NeXT */
6350     xl143,                      /* 8,18 latin-9 to CP437 */
6351     xl185,                      /* 8,19 latin-9 to CP850 */
6352     xl152,                      /* 8,20 latin-9 to CP852 */
6353     xl1aq,                      /* 8,21 latin-9 to Macintosh Latin */
6354     xl1dg,                      /* 8,22 latin-9 to DGI */
6355     xl1r8,                      /* 8,23 latin-9 to HP Roman8 */
6356     zl1as,                      /* 8,24 latin-9 to Latin/Cyrillic */
6357     zl1as,                      /* 8,25 latin-9 to CP866 */
6358     xl1sk,                      /* 8,26 latin-9 to Short KOI */
6359     zl1as,                      /* 8,27 latin-9 to Old KOI-8 Cyrillic */
6360     NULL,                       /* 8,28 latin-9 to JIS-7 */
6361     NULL,                       /* 8,29 latin-9 to Shift-JIS */
6362     NULL,                       /* 8,30 latin-9 to J-EUC */
6363     NULL,                       /* 8,31 latin-9 to DEC Kanji */
6364     xl1h7,                      /* 8,32 latin-9 to Hebrew-7 */
6365     xl1lh,                      /* 8,33 latin-9 to Latin/Hebrew */
6366     xl162,                      /* 8,34 latin-9 to CP862 Hebrew */
6367     xl1eg,                      /* 8,35 latin-9 to ELOT 927 Greek */
6368     xl1lg,                      /* 8,36 latin-9 to Latin/Greek */
6369     xl169,                      /* 8,37 latin-9 to CP869 */
6370     NULL,                       /* 8,38 latin-9 to Latin9 */
6371     xl958,                      /* 8,39 latin-9 to CP858 */
6372     zl1as,                      /* 8,40 latin-9 to CP855 */
6373     zl1as,                      /* 8,41 latin-9 to CP1251 */
6374     xl1as,                      /* 8,42 latin-9 to Bulgarian */
6375     xl91250,                    /* 8,43 latin-9 to CP1250 */
6376     xl9mz,                      /* 8,44 latin-9 to Mazovia */
6377     NULL,                       /* 8,45 latin-9 to UCS-2 */
6378     NULL,                       /* 8,46 latin-9 to UTF-8 */
6379     zl1as,                      /* 8,47 latin-9 to KOI8-R */
6380     zl1as,                      /* 8,48 latin-9 to KOI8-U */
6381     xl9w1,                      /* 8,49 latin-9 to CP1252 */
6382     NULL,                       /* 9,00 Unicode... */
6383     NULL,                       /* 9,01 */
6384     NULL,                       /* 9,02 */
6385     NULL,                       /* 9,03 */
6386     NULL,                       /* 9,04 */
6387     NULL,                       /* 9,05 */
6388     NULL,                       /* 9,06 */
6389     NULL,                       /* 9,07 */
6390     NULL,                       /* 9,08 */
6391     NULL,                       /* 9,09 */
6392     NULL,                       /* 9,10 */
6393     NULL,                       /* 9,11 */
6394     NULL,                       /* 9,12 */
6395     NULL,                       /* 9,13 */
6396     NULL,                       /* 9,14 */
6397     NULL,                       /* 9,15 */
6398     NULL,                       /* 9,16 */
6399     NULL,                       /* 9,17 */
6400     NULL,                       /* 9,18 */
6401     NULL,                       /* 9,19 */
6402     NULL,                       /* 9,20 */
6403     NULL,                       /* 9,21 */
6404     NULL,                       /* 9,22 */
6405     NULL,                       /* 9,23 */
6406     NULL,                       /* 9,24 */
6407     NULL,                       /* 9,25 */
6408     NULL,                       /* 9,26 */
6409     NULL,                       /* 9,27 */
6410     NULL,                       /* 9,28 */
6411     NULL,                       /* 9,29 */
6412     NULL,                       /* 9,30 */
6413     NULL,                       /* 9,31 */
6414     NULL,                       /* 9,32 */
6415     NULL,                       /* 9,33 */
6416     NULL,                       /* 9,34 */
6417     NULL,                       /* 9,35 */
6418     NULL,                       /* 9,36 */
6419     NULL,                       /* 9,37 */
6420     NULL,                       /* 9,38 */
6421     NULL,                       /* 9,39 */
6422     NULL,                       /* 9,40 */
6423     NULL,                       /* 9,41 */
6424     NULL,                       /* 9,42 */
6425     NULL,                       /* 9,43 */
6426     NULL,                       /* 9,44 */
6427     NULL,                       /* 9,45 */
6428     NULL,                       /* 9,46 */
6429     NULL,                       /* 9,47 */
6430     NULL,                       /* 9,48 */
6431     NULL,                       /* 9,49 */
6432     NULL,                       /* 10,00 */
6433     NULL,                       /* 10,01 */
6434     NULL,                       /* 10,02 */
6435     NULL,                       /* 10,03 */
6436     NULL,                       /* 10,04 */
6437     NULL,                       /* 10,05 */
6438     NULL,                       /* 10,06 */
6439     NULL,                       /* 10,07 */
6440     NULL,                       /* 10,08 */
6441     NULL,                       /* 10,09 */
6442     NULL,                       /* 10,10 */
6443     NULL,                       /* 10,11 */
6444     NULL,                       /* 10,12 */
6445     NULL,                       /* 10,13 */
6446     NULL,                       /* 10,14 */
6447     NULL,                       /* 10,15 */
6448     NULL,                       /* 10,16 */
6449     NULL,                       /* 10,17 */
6450     NULL,                       /* 10,18 */
6451     NULL,                       /* 10,19 */
6452     NULL,                       /* 10,20 */
6453     NULL,                       /* 10,21 */
6454     NULL,                       /* 10,22 */
6455     NULL,                       /* 10,23 */
6456     NULL,                       /* 10,24 */
6457     NULL,                       /* 10,25 */
6458     NULL,                       /* 10,26 */
6459     NULL,                       /* 10,27 */
6460     NULL,                       /* 10,28 */
6461     NULL,                       /* 10,29 */
6462     NULL,                       /* 10,30 */
6463     NULL,                       /* 10,31 */
6464     NULL,                       /* 10,32 */
6465     NULL,                       /* 10,33 */
6466     NULL,                       /* 10,34 */
6467     NULL,                       /* 10,35 */
6468     NULL,                       /* 10,36 */
6469     NULL,                       /* 10,37 */
6470     NULL,                       /* 10,38 */
6471     NULL,                       /* 10,39 */
6472     NULL,                       /* 10,40 */
6473     NULL,                       /* 10,41 */
6474     NULL,                       /* 10,42 */
6475     NULL,                       /* 10,43 */
6476     NULL,                       /* 10,44 */
6477     NULL,                       /* 10,45 */
6478     NULL,                       /* 10,46 */
6479     NULL,                       /* 10,47 */
6480     NULL,                       /* 10,48 */
6481     NULL                        /* 10,49 */
6482 };
6483 int nxlr = (sizeof(xlr) / sizeof(CHAR *));
6484
6485 /*
6486   Translation function table for sending files.
6487   Array of pointers to functions for translating from the local file
6488   character set to the transfer character set.  Indexed in the same
6489   way as the xlr array above, but with the indices reversed.
6490 */
6491 #ifdef CK_ANSIC
6492 CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
6493 #else
6494 CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])() =
6495 #endif /* CK_ANSIC */
6496 {
6497     NULL,                       /* 0,0 us ascii to transparent */
6498     NULL,                       /* 0,1 uk ascii to transparent */
6499     NULL,                       /* 0,2 dutch nrc to transparent */
6500     NULL,                       /* 0,3 finnish nrc to transparent */
6501     NULL,                       /* 0,4 french nrc to transparent */
6502     NULL,                       /* 0,5 fr-canadian nrc to transparent */
6503     NULL,                       /* 0,6 german nrc to transparent */
6504     NULL,                       /* 0,7 hungarian nrc to transparent */
6505     NULL,                       /* 0,8 italian nrc to transparent */
6506     NULL,                       /* 0,9 norge/danish nrc to transparent */
6507     NULL,                       /* 0,10 portuguese nrc to transparent */
6508     NULL,                       /* 0,11 spanish nrc to transparent */
6509     NULL,                       /* 0,12 swedish nrc to transparent */
6510     NULL,                       /* 0,13 swiss nrc to transparent */
6511     NULL,                       /* 0,14 latin-1 to transparent */
6512     NULL,                       /* 0,15 latin-2 to transparent */
6513     NULL,                       /* 0,16 DEC MCS to transparent */
6514     NULL,                       /* 0,17 NeXT to transparent */
6515     NULL,                       /* 0,18 CP437 to transparent */
6516     NULL,                       /* 0,19 CP850 to transparent */
6517     NULL,                       /* 0,20 CP852 to transparent */
6518     NULL,                       /* 0,21 Macintosh Latin to transparent */
6519     NULL,                       /* 0,22 DGI to transparent */
6520     NULL,                       /* 0,23 HP to transparent */
6521     NULL,                       /* 0,24 Latin/Cyrillic to transparent */
6522     NULL,                       /* 0,25 CP866 to transparent */
6523     NULL,                       /* 0,26 Short KOI to transparent */
6524     NULL,                       /* 0,27 Old KOI-8 to transparent */
6525     NULL,                       /* 0,28 JIS-7 to transparent */
6526     NULL,                       /* 0,29 Shift JIS to transparent */
6527     NULL,                       /* 0,30 Japanese EUC to transparent */
6528     NULL,                       /* 0,31 DEC Kanji to transparent */
6529     NULL,                       /* 0,32 Hebrew-7 to transparent */
6530     NULL,                       /* 0,33 Latin/Hebrew to transparent */
6531     NULL,                       /* 0,34 CP862 Hebrew to transparent */
6532     NULL,                       /* 0,35 ELOT 927 Greek to transparent */
6533     NULL,                       /* 0,36 Latin/Greek to transparent */
6534     NULL,                       /* 0,37 CP869 to transparent */
6535     NULL,                       /* 0,38 Latin-9 to transparent */
6536     NULL,                       /* 0,39 CP858 to transparent */
6537     NULL,                       /* 0,40 CP855 to transparent */
6538     NULL,                       /* 0,41 CP1251 to transparent */
6539     NULL,                       /* 0,42 Bulgarian to transparent */
6540     NULL,                       /* 0,43 CP1250 to transparent */
6541     NULL,                       /* 0,44 Mazovia to transparent */
6542     NULL,                       /* 0,45 UCS-2 to transparent */
6543     NULL,                       /* 0,46 UTF-8 to transparent */
6544     NULL,                       /* 0,47 KOI8R to transparent */
6545     NULL,                       /* 0,48 KOI8U to transparent */
6546     NULL,                       /* 0,49 CP1252 to transparent */
6547     NULL,                       /* 1,0 us ascii to ascii */
6548     NULL,                       /* 1,1 uk ascii to ascii */
6549     xduas,                      /* 1,2 dutch nrc to ascii */
6550     xfias,                      /* 1,3 finnish nrc to ascii */
6551     xfras,                      /* 1,4 french nrc to ascii */
6552     xfcas,                      /* 1,5 french canadian nrc to ascii */
6553     xgeas,                      /* 1,6 german nrc to ascii */
6554     xhuas,                      /* 1,7 hungarian nrc to ascii */
6555     xitas,                      /* 1,8 italian nrc to ascii */
6556     xnoas,                      /* 1,9 norwegian/danish nrc to ascii */
6557     xpoas,                      /* 1,10 portuguese nrc to ascii */
6558     xspas,                      /* 1,11 spanish nrc to ascii */
6559     xswas,                      /* 1,12 swedish nrc to ascii */
6560     xchas,                      /* 1,13 swiss nrc to ascii */
6561     xl1as,                      /* 1,14 latin-1 to ascii */
6562     xl2as,                      /* 1,15 latin-2 to ascii */
6563     xdmas,                      /* 1,16 dec mcs to ascii */
6564     xneas,                      /* 1,17 NeXT to ascii */
6565     x43as,                      /* 1,18 CP437 to ascii */
6566     x85as,                      /* 1,19 CP850 to ascii */
6567     x52as,                      /* 1,20 CP850 to ascii */
6568     xaqas,                      /* 1,21 Macintosh Latin to ascii */
6569     xdgas,                      /* 1,22 DGI to ascii */
6570     xr8as,                      /* 1,23 HP to ASCII */
6571     xlcas,                      /* 1,24 Latin/Cyrillic to ASCII */
6572     xacas,                      /* 1,25 CP866 to ASCII */
6573     xskas,                      /* 1,26 Short KOI to ASCII */
6574     xk8as,                      /* 1,27 Old KOI-8 Cyrillic to ASCII */
6575     NULL,                       /* 1,28 */
6576     NULL,                       /* 1,29 */
6577     NULL,                       /* 1,30 */
6578     NULL,                       /* 1,31 */
6579     xh7as,                      /* 1,32 Hebrew-7 to ASCII */
6580     xlhas,                      /* 1,33 Latin/Hebrew to ASCII */
6581     x62as,                      /* 1,34 CP862 Hebrew to ASCII */
6582     xegas,                      /* 1,35 ELOT 927 Greek to ASCII */
6583     xlgas,                      /* 1,36 Latin/Greek to ASCII */
6584     x69as,                      /* 1,37 CP869 to ASCII */
6585     xl9as,                      /* 1,38 Latin-9 to ASCII */
6586     x58as,                      /* 1,39 CP858 to ASCII */
6587     x55as,                      /* 1,40 CP855 to ASCII */
6588     x1251as,                    /* 1,41 CP1251 to ASCII */
6589     xleft128,                   /* 1,42 Bulgarian to ASCII */
6590     x1250as,                    /* 1,43 CP1250 to ASCII */
6591     xmzas,                      /* 1,44 Mazovia to ASCII */
6592     NULL,                       /* 1,45 UCS-2 to ASCII */
6593     NULL,                       /* 1,46 UTF-8 to ASCII */
6594     xk8as,                      /* 1,47 KOI8R to ASCII */
6595     xk8as,                      /* 1,48 KOI8U to ASCII */
6596     xw1as,                      /* 1,49 CP1252 to ASCII */
6597     NULL,                       /* 2,0 us ascii to latin-1 */
6598     xukl1,                      /* 2,1 uk ascii to latin-1 */
6599     xdul1,                      /* 2,2 dutch nrc to latin-1 */
6600     xfil1,                      /* 2,3 finnish nrc to latin-1 */
6601     xfrl1,                      /* 2,4 french nrc to latin-1 */
6602     xfcl1,                      /* 2,5 french canadian nrc to latin-1 */
6603     xgel1,                      /* 2,6 german nrc to latin-1 */
6604     xhul1,                      /* 2,7 hungarian nrc to latin-1 */
6605     xitl1,                      /* 2,8 italian nrc to latin-1 */
6606     xnol1,                      /* 2,9 norwegian/danish nrc to latin-1 */
6607     xpol1,                      /* 2,10 portuguese nrc to latin-1 */
6608     xspl1,                      /* 2,11 spanish nrc to latin-1 */
6609     xswl1,                      /* 2,12 swedish nrc to latin-1 */
6610     xchl1,                      /* 2,13 swiss nrc to latin-1 */
6611     NULL,                       /* 2,14 latin-1 to latin-1 */
6612     xl2l1,                      /* 2,15 latin-2 to latin-1 */
6613     xdml1,                      /* 2,16 dec mcs to latin-1 */
6614     xnel1,                      /* 2,17 NeXT to Latin-1 */
6615     x43l1,                      /* 2,18 CP437 to Latin-1 */
6616     x85l1,                      /* 2,19 CP850 to Latin-1 */
6617     x52l1,                      /* 2,20 CP852 to Latin-1 */
6618     xaql1,                      /* 2,21 Macintosh Latin to Latin-1 */
6619     xdgl1,                      /* 2,22 DGI to Latin-1 */
6620     xr8l1,                      /* 2,23 HP to Latin-1 */
6621     xlcas,                      /* 2,24 Latin/Cyrillic to Latin-1 */
6622     xacas,                      /* 2,25 CP866 to Latin-1 */
6623     xskas,                      /* 2,26 Short KOI to Latin-1 */
6624     xk8as,                      /* 2,27 Old KOI-8 Cyrillic to Latin-1 */
6625     NULL,                       /* 2,28 Kanji ... */
6626     NULL,                       /* 2,29 */
6627     NULL,                       /* 2,30 */
6628     NULL,                       /* 2,31 */
6629     xh7as,                      /* 2,32 Hebrew-7 to Latin-1 */
6630     xlhl1,                      /* 2,33 Latin/Hebrew to Latin-1 */
6631     x62l1,                      /* 2,34 CP862 Hebrew to Latin-1 */
6632     xegas,                      /* 2,35 ELOT 927 Greek to Latin-1 */
6633     xlgl1,                      /* 2,36 Latin/Greek to Latin-1 */
6634     NULL,                       /* 2,37 CP869 to Latin-1 */
6635     NULL,                       /* 2,38 Latin-9 to Latin-1 */
6636     x58l1,                      /* 2,39 CP858 to Latin-1 */
6637     x55as,                      /* 2,40 CP855 to Latin-1 */
6638     x1251as,                    /* 2,41 CP1251 to Latin-1 */
6639     xleft128,                   /* 2,42 Bulgarian to Latin-1 */
6640     x1250l1,                    /* 2,43 CP1250 to Latin-1 */
6641     xmzl1,                      /* 2,44 Mazovia to Latin-1 */
6642     NULL,                       /* 2,45 UCS-2 to Latin-1 */
6643     NULL,                       /* 2,46 UTF-8 to Latin-1 */
6644     xk8as,                      /* 2,47 KOI8R to Latin-1 */
6645     xk8as,                      /* 2,48 KOI8U to Latin-1 */
6646     xw1l1,                      /* 2,49 CP1252 to Latin-1 */
6647     NULL,                       /* 3,0 us ascii to latin-2 */
6648     NULL,                       /* 3,1 uk ascii to latin-2 */
6649     xduas,                      /* 3,2 dutch nrc to latin-2 */
6650     xfias,                      /* 3,3 finnish nrc to latin-2 */
6651     xfras,                      /* 3,4 french nrc to latin-2 */
6652     xfcas,                      /* 3,5 french canadian nrc to latin-2 */
6653     xgel2,                      /* 3,6 german nrc to latin-2 */
6654     xhul2,                      /* 3,7 hungarian nrc to latin-2 */
6655     xitas,                      /* 3,8 italian nrc to latin-2 */
6656     xnoas,                      /* 3,9 norwegian/danish nrc to latin-2 */
6657     xpoas,                      /* 3,10 portuguese nrc to latin-2 */
6658     xspas,                      /* 3,11 spanish nrc to latin-2 */
6659     xswas,                      /* 3,12 swedish nrc to latin-2 */
6660     xchas,                      /* 3,13 swiss nrc to latin-2 */
6661     xl1l2,                      /* 3,14 latin-1 to latin-2 */
6662     NULL,                       /* 3,15 latin-2 to latin-2 */
6663     xl1l2,                      /* 3,16 dec mcs to latin-2 */
6664     xnel2,                      /* 3,17 NeXT to Latin-2 */
6665     x43l2,                      /* 3,18 CP437 to Latin-2 */
6666     x85l2,                      /* 3,19 CP850 to Latin-2 */
6667     x52l2,                      /* 3,20 CP852 to Latin-2 */
6668     xaql2,                      /* 3,21 Macintosh Latin to Latin-2 */
6669     xdgl2,                      /* 3,22 DGI to Latin-2 */
6670     xr8l2,                      /* 3,23 HP to Latin-2 */
6671     xlcas,                      /* 3,24 Latin/Cyrillic to Latin-2 */
6672     xacas,                      /* 3,25 CP866 to Latin-2 */
6673     xskas,                      /* 3,26 Short KOI to Latin-2 */
6674     xk8as,                      /* 3,27 Old KOI-8 Cyrillic to Latin-2 */
6675     NULL,                       /* 3,28 Kanji ... */
6676     NULL,                       /* 3,29 */
6677     NULL,                       /* 3,30 */
6678     NULL,                       /* 3,31 */
6679     xh7as,                      /* 3,32 Hebrew-7 to Latin-2 */
6680     xlhas,                      /* 3,33 Latin/Hebrew to Latin-2 */
6681     x62as,                      /* 3,34 CP862 Hebrew to Latin-2 */
6682     xegas,                      /* 3,35 ELOT 927 Greek to Latin-2 */
6683     xl2lg,                      /* 3,36 Latin/Greek to Latin-2 */
6684     xleft128,                   /* 3,37 CP869 to Latin-2 */
6685     xl9l2,                      /* 3,38 Latin-9 to Latin-2 */
6686     x58l2,                      /* 3,39 CP858 to Latin-2 */
6687     x55as,                      /* 3,40 CP855 to Latin-2 */
6688     x1251as,                    /* 3,41 CP1251 to Latin-2 */
6689     xleft128,                   /* 3,42 Bulgarian to Latin-2 */
6690     x1250l2,                    /* 3,43 CP1250 to Latin-2 */
6691     xmzl2,                      /* 3,44 Mazovia to Latin-2 */
6692     NULL,                       /* 3,45 UCS-2 to Latin-2 */
6693     NULL,                       /* 3,46 UTF-8 to Latin-2 */
6694     xk8as,                      /* 3,47 KOI8R to Latin-2 */
6695     xk8as,                      /* 3,48 KOI8U to Latin-2 */
6696     xw1l2,                      /* 3,49 CP1252 to latin-2 */
6697     xaslc,                      /* 4,0 us ascii to latin/cyrillic */
6698     xaslc,                      /* 4,1 uk ascii to latin/cyrillic */
6699     xduas,                      /* 4,2 dutch nrc to latin/cyrillic */
6700     xfias,                      /* 4,3 finnish nrc to latin/cyrillic */
6701     xfras,                      /* 4,4 french nrc to latin/cyrillic */
6702     xfcas,                      /* 4,5 french canadian nrc to latin/cyrillic */
6703     xgeas,                      /* 4,6 german nrc to latin/cyrillic */
6704     xhuas,                      /* 4,7 hungarian nrc to latin/cyrillic */
6705     xitas,                      /* 4,8 italian nrc to latin/cyrillic */
6706     xnoas,                      /* 4,9 norge/danish nrc to latin/cyrillic */
6707     xpoas,                      /* 4,10 portuguese nrc to latin/cyrillic */
6708     xspas,                      /* 4,11 spanish nrc to latin/cyrillic */
6709     xswas,                      /* 4,12 swedish nrc to latin/cyrillic */
6710     xchas,                      /* 4,13 swiss nrc to latin/cyrillic */
6711     xl1as,                      /* 4,14 latin-1 to latin/cyrillic */
6712     xl2as,                      /* 4,15 latin-2 to latin/cyrillic */
6713     xdmas,                      /* 4,16 dec mcs to latin/cyrillic */
6714     xneas,                      /* 4,17 NeXT to latin/cyrillic */
6715     x43as,                      /* 4,18 CP437 to latin/cyrillic */
6716     x85as,                      /* 4,19 CP850 to latin/cyrillic */
6717     x52as,                      /* 4,20 CP852 to latin/cyrillic */
6718     xaqas,                      /* 4,21 Macintosh Latin to latin/cyrillic */
6719     xdgas,                      /* 4,22 DGI to Latin/Cyrillic */
6720     xr8as,                      /* 4,23 HP to Latin/Cyrillic */
6721     NULL,                       /* 4,24 Latin/Cyrillic to Latin/Cyrillic */
6722     xaclc,                      /* 4,25 CP866 to Latin/Cyrillic */
6723     xskcy,                      /* 4,26 Short KOI to Latin/Cyrillic */
6724     xk8lc,                      /* 4,27 Old KOI-8 Cyrillic to Latin/Cyrillic */
6725     NULL,                       /* 4,28 Kanji... */
6726     NULL,                       /* 4,29 */
6727     NULL,                       /* 4,30 */
6728     NULL,                       /* 4,31 */
6729     xh7as,                      /* 4,32 Hebrew-7 to Latin/Cyrillic */
6730     xlhas,                      /* 4,33 Latin/Hebrew to Latin/Cyrillic */
6731     x62as,                      /* 4,34 CP862 Hebrew to Latin/Cyrillic */
6732     xegas,                      /* 4,35 ELOT 927 Greek to Latin/Cyrillic */
6733     xleft160,                   /* 4,36 Latin/Greek to Latin/Cyrillic */
6734     xleft128,                   /* 4,37 CP869 to Latin/Cyrillic */
6735     xl1as,                      /* 4,38 latin-9 to latin/cyrillic */
6736     xleft128,                   /* 4,39 CP858 to Latin/Cyrillic */
6737     x55lc,                      /* 4,40 CP855 to Latin/Cyrillic */
6738     x1251lc,                    /* 4,41 CP1251 to Latin/Cyrillic */
6739     xbulc,                      /* 4,42 Bulgarian to Latin/Cyrillic */
6740     x1250as,                    /* 4,43 CP1250 to Latin/Cyrillic */
6741     xmzas,                      /* 4,44 Mazovia to Latin/Cyrillic */
6742     NULL,                       /* 4,45 UCS-2 to Latin/Cyrillic */
6743     NULL,                       /* 4,46 UTF-8 to Latin/Cyrillic */
6744     xkrlc,                      /* 4,47 KOI8R to Latin/Cyrillic */
6745     xkulc,                      /* 4,48 KOI8U to Latin/Cyrillic */
6746     xw1lc,                      /* 4,49 CP1252 to Latin/Cyrillic */
6747     NULL,                       /* 5,00 */
6748     NULL,                       /* 5,01 */
6749     NULL,                       /* 5,02 */
6750     NULL,                       /* 5,03 */
6751     NULL,                       /* 5,04 */
6752     NULL,                       /* 5,05 */
6753     NULL,                       /* 5,06 */
6754     NULL,                       /* 4.07 */
6755     NULL,                       /* 5,08 */
6756     NULL,                       /* 5,09 */
6757     NULL,                       /* 5,10 */
6758     NULL,                       /* 5,11 */
6759     NULL,                       /* 5,12 */
6760     NULL,                       /* 5,13 */
6761     NULL,                       /* 5,14 */
6762     NULL,                       /* 5,15 */
6763     NULL,                       /* 5,16 */
6764     NULL,                       /* 5,17 */
6765     NULL,                       /* 5,18 */
6766     NULL,                       /* 5,19 */
6767     NULL,                       /* 5,20 */
6768     NULL,                       /* 5,21 */
6769     NULL,                       /* 5,22 */
6770     NULL,                       /* 5,23 */
6771     NULL,                       /* 5,24 */
6772     NULL,                       /* 5,25 */
6773     NULL,                       /* 5,26 */
6774     NULL,                       /* 5,27 */
6775     NULL,                       /* 5,28 */
6776     NULL,                       /* 5,29 */
6777     NULL,                       /* 5,30 */
6778     NULL,                       /* 5,31 */
6779     NULL,                       /* 5,32 */
6780     NULL,                       /* 5,33 */
6781     NULL,                       /* 5,34 */
6782     NULL,                       /* 5,35 */
6783     NULL,                       /* 5,36 */
6784     NULL,                       /* 5,37 */
6785     NULL,                       /* 5,38 */
6786     NULL,                       /* 5,39 */
6787     NULL,                       /* 5,40 */
6788     NULL,                       /* 5,41 */
6789     NULL,                       /* 5,42 */
6790     NULL,                       /* 5,43 */
6791     NULL,                       /* 5,44 */
6792     NULL,                       /* 5,45 */
6793     NULL,                       /* 5,46 */
6794     NULL,                       /* 5,47 */
6795     NULL,                       /* 5,48 */
6796     NULL,                       /* 5,49 */
6797     NULL,                       /* 6,0 us ascii to Latin/Hebrew */
6798     NULL,                       /* 6,1 uk ascii to Latin/Hebrew */
6799     xduas,                      /* 6,2 dutch nrc to Latin/Hebrew */
6800     xfias,                      /* 6,3 finnish nrc to Latin/Hebrew */
6801     xfras,                      /* 6,4 french nrc to Latin/Hebrew */
6802     xfcas,                      /* 6,5 french canadian nrc to Latin/Hebrew */
6803     xgeas,                      /* 6,6 german nrc to Latin/Hebrew */
6804     xhuas,                      /* 6,7 hungarian nrc to Latin/Hebrew */
6805     xitas,                      /* 6,8 italian nrc to Latin/Hebrew */
6806     xnoas,                      /* 6,9 norge/danish nrc to Latin/Hebrew */
6807     xpoas,                      /* 6,10 portuguese nrc to Latin/Hebrew */
6808     xspas,                      /* 6,11 spanish nrc to Latin/Hebrew */
6809     xswas,                      /* 6,12 swedish nrc to Latin/Hebrew */
6810     xchas,                      /* 6,13 swiss nrc to Latin/Hebrew */
6811     xl1lh,                      /* 6,14 latin-1 to Latin/Hebrew */
6812     xl2as,                      /* 6,15 latin-2 to Latin/Hebrew */
6813     xdmas,                      /* 6,16 dec mcs to Latin/Hebrew */
6814     xneas,                      /* 6,17 NeXT to Latin/Hebrew */
6815     x43as,                      /* 6,18 CP437 to Latin/Hebrew */
6816     x85as,                      /* 6,19 CP850 to Latin/Hebrew */
6817     x52as,                      /* 6,20 CP852 to Latin/Hebrew */
6818     xaqas,                      /* 6,21 Macintosh Latin to Latin/Hebrew */
6819     xdgas,                      /* 6,22 DGI to Latin/Hebrew */
6820     xr8as,                      /* 6,23 HP to Latin/Hebrew */
6821     xlcas,                      /* 6,24 Latin/Cyrillic to Latin/Hebrew */
6822     xacas,                      /* 6,25 CP866 to Latin/Hebrew */
6823     xskas,                      /* 6,26 Short KOI to Latin/Hebrew */
6824     xk8as,                      /* 6,27 Old KOI-8 Cyrillic to Latin/Hebrew */
6825     NULL,                       /* 6,28 Kanji... */
6826     NULL,                       /* 6,29 */
6827     NULL,                       /* 6,30 */
6828     NULL,                       /* 6,31 */
6829     xh7lh,                      /* 6,32 Hebrew-7 to Latin/Hebrew */
6830     NULL,                       /* 6,33 Latin/Hebrew to Latin/Hebrew */
6831     x62lh,                      /* 6,34 CP862 Hebrew to Latin/Hebrew */
6832     xegas,                      /* 6,35 ELOT 927 Greek to Latin/Hebrew */
6833     xlgas,                      /* 6,36 Latin/Greek to Latin/Hebrew */
6834     x69as,                      /* 6,37 CP869 to Latin/Hebrew */
6835     xl1as,                      /* 6,38 latin-9 to Latin/Hebrew */
6836     x58as,                      /* 6,39 CP858 to Latin/Hebrew */
6837     x55as,                      /* 6,40 CP855 to Latin/Hebrew */
6838     x1251as,                    /* 6,41 CP1251 to Latin/Hebrew */
6839     xleft128,                   /* 6,42 Bulgarian to Latin/Hebrew */
6840     x1250as,                    /* 6,43 CP1250 to Latin/Hebrew */
6841     xmzas,                      /* 6,44 Mazovia to Latin/Hebrew */
6842     NULL,                       /* 6,45 UCS-2 to Latin/Hebrew */
6843     NULL,                       /* 6,46 UTF-8 to Latin/Hebrew */
6844     NULL,                       /* 6,47 KOI8R to Latin/Hebrew */
6845     NULL,                       /* 6,48 KOI8U to Latin/Hebrew */
6846     xw1lh,                      /* 6,49 CP1252 to Latin/Hebrew */
6847     NULL,                       /* 7,0 us ascii to Latin/Greek */
6848     NULL,                       /* 7,1 uk ascii to Latin/Greek */
6849     xduas,                      /* 7,2 dutch nrc to Latin/Greek */
6850     xfias,                      /* 7,3 finnish nrc to Latin/Greek */
6851     xfras,                      /* 7,4 french nrc to Latin/Greek */
6852     xfcas,                      /* 7,5 french canadian nrc to Latin/Greek */
6853     xgeas,                      /* 7,6 german nrc to Latin/Greek */
6854     xhuas,                      /* 7,7 hungarian nrc to Latin/Greek */
6855     xitas,                      /* 7,8 italian nrc to Latin/Greek */
6856     xnoas,                      /* 7,9 norge/danish nrc to Latin/Greek */
6857     xpoas,                      /* 7,10 portuguese nrc to Latin/Greek */
6858     xspas,                      /* 7,11 spanish nrc to Latin/Greek */
6859     xswas,                      /* 7,12 swedish nrc to Latin/Greek */
6860     xchas,                      /* 7,13 swiss nrc to Latin/Greek */
6861     xl1lg,                      /* 7,14 latin-1 to Latin/Greek */
6862     xl2lg,                      /* 7,15 latin-2 to Latin/Greek */
6863     xl1lg,                      /* 7,16 dec mcs to Latin/Greek */
6864     xneas,                      /* 7,17 NeXT to Latin/Greek */
6865     xleft128,                   /* 7,18 CP437 to Latin/Greek */
6866     x85as,                      /* 7,19 CP850 to Latin/Greek */
6867     x52as,                      /* 7,20 CP852 to Latin/Greek */
6868     xaqas,                      /* 7,21 Macintosh Latin to Latin/Greek */
6869     xdgas,                      /* 7,22 DGI to Latin/Greek */
6870     xr8as,                      /* 7,23 HP to Latin/Greek */
6871     xleft160,                   /* 7,24 Latin/Cyrillic to Latin/Greek */
6872     xleft128,                   /* 7,25 CP866 to Latin/Greek */
6873     xskas,                      /* 7,26 Short KOI to Latin/Greek */
6874     xk8as,                      /* 7,27 Old KOI-8 Cyrillic to Latin/Greek */
6875     NULL,                       /* 7,28 Kanji... */
6876     NULL,                       /* 7,29 */
6877     NULL,                       /* 7,30 */
6878     NULL,                       /* 7,31 */
6879     xh7as,                      /* 7,32 Hebrew-7 to Latin/Greek */
6880     NULL,                       /* 7,33 Latin/Hebrew to Latin/Greek */
6881     x62as,                      /* 7,34 CP862 Hebrew to Latin/Greek */
6882     xeglg,                      /* 7,35 ELOT 927 Greek to Latin/Greek */
6883     NULL,                       /* 7,36 Latin/Greek to Latin/Greek */
6884     x69lg,                      /* 7,37 CP869 to Latin/Greek */
6885     xl1as,                      /* 7,38 latin-9 to Latin/Greek */
6886     xl1as,                      /* 7,39 latin-9 to Latin/Hebrew*/
6887     xleft128,                   /* 7,40 CP855 to Latin/Greek */
6888     xleft128,                   /* 7,41 CP1251 to Latin/Greek */
6889     xleft128,                   /* 7,42 Bulgarian to Latin/Greek */
6890     x1250as,                    /* 7,43 CP1250 to Latin/Greek */
6891     xmzas,                      /* 7,44 Mazovia to Latin/Greek */
6892     NULL,                       /* 7,45 UCS-2 to Latin/Greek */
6893     NULL,                       /* 7,46 UTF-8 to Latin/Greek */
6894     NULL,                       /* 7,47 KOI8R to Latin/Greek */
6895     NULL,                       /* 7,48 KOI8U to Latin/Greek */
6896     xw1lg,                      /* 7,49 CP1252 to Latin/Greek */
6897     NULL,                       /* 8,0 us ascii to latin-9 */
6898     xukl1,                      /* 8,1 uk ascii to latin-9 */
6899     xdul1,                      /* 8,2 dutch nrc to latin-9 */
6900     xfil1,                      /* 8,3 finnish nrc to latin-9 */
6901     xfrl1,                      /* 8,4 french nrc to latin-9 */
6902     xfcl1,                      /* 8,5 french canadian nrc to latin-9 */
6903     xgel1,                      /* 8,6 german nrc to latin-9 */
6904     xhul1,                      /* 8,7 hungarian nrc to latin-9 */
6905     xitl1,                      /* 8,8 italian nrc to latin-9 */
6906     xnol1,                      /* 8,9 norwegian/danish nrc to latin-9 */
6907     xpol1,                      /* 8,10 portuguese nrc to latin-9 */
6908     xspl1,                      /* 8,11 spanish nrc to latin-9 */
6909     xswl1,                      /* 8,12 swedish nrc to latin-9 */
6910     xchl1,                      /* 8,13 swiss nrc to latin-9 */
6911     NULL,                       /* 8,14 latin-1 to latin-9 */
6912     xl2l9,                      /* 8,15 latin-2 to latin-9 */
6913     xdml9,                      /* 8,16 dec mcs to latin-9 */
6914     xnel9,                      /* 8,17 NeXT To Latin-9 */
6915     x43l1,                      /* 8,18 CP437 To Latin-9 */
6916     x85l1,                      /* 8,19 CP850 To Latin-9 */
6917     x52l1,                      /* 8,20 CP852 To Latin-9 */
6918     xaql1,                      /* 8,21 Macintosh Latin To Latin-9 */
6919     xdgl1,                      /* 8,22 DGI To Latin-9 */
6920     xr8l1,                      /* 8,23 HP To Latin-9 */
6921     xlcas,                      /* 8,24 Latin/Cyrillic To Latin-9 */
6922     xacas,                      /* 8,25 CP866 To Latin-9 */
6923     xskas,                      /* 8,26 Short KOI To Latin-9 */
6924     xk8as,                      /* 8,27 Old KOI-8 Cyrillic To Latin-9 */
6925     NULL,                       /* 8,28 Kanji ... */
6926     NULL,                       /* 8,29 */
6927     NULL,                       /* 8,30 */
6928     NULL,                       /* 8,31 */
6929     xh7as,                      /* 8,32 Hebrew-7 To Latin-9 */
6930     xlhl1,                      /* 8,33 Latin/Hebrew To Latin-9 */
6931     x62l1,                      /* 8,34 CP862 Hebrew To Latin-9 */
6932     xegas,                      /* 8,35 ELOT 927 Greek To Latin-9 */
6933     xlgl1,                      /* 8,36 Latin/Greek To Latin-9 */
6934     xl169,                      /* 8,37 CP869 To Latin-9 */
6935     NULL,                       /* 8,38 Latin-9 To Latin-9 */
6936     x58l9,                      /* 8,39 cp858 To Latin-9 */
6937     x55as,                      /* 8,40 cp855 To Latin-9 */
6938     x55as,                      /* 8,41 cp1251 To Latin-9 */
6939     xleft128,                   /* 8,42 Bulgarian To Latin-9 */
6940     x1250l9,                    /* 8,43 CP1250 To Latin-9 */
6941     xmzl9,                      /* 8,44 Mazovia To Latin-9 */
6942     NULL,                       /* 8,45 UCS-2 to Latin-9 */
6943     NULL,                       /* 8,46 UTF-8 to Latin-9 */
6944     NULL,                       /* 8,47 KOI8R to Latin-9 */
6945     NULL,                       /* 8,48 KOI8U to Latin-9 */
6946     xw1l9,                      /* 8,49 CP1252 to Latin-9 */
6947     NULL,                       /* 9,00 Unicode... */
6948     NULL,                       /* 9,01 */
6949     NULL,                       /* 9,02 */
6950     NULL,                       /* 9,03 */
6951     NULL,                       /* 9,04 */
6952     NULL,                       /* 9,05 */
6953     NULL,                       /* 9,06 */
6954     NULL,                       /* 9,07 */
6955     NULL,                       /* 9,08 */
6956     NULL,                       /* 9,09 */
6957     NULL,                       /* 9,10 */
6958     NULL,                       /* 9,11 */
6959     NULL,                       /* 9,12 */
6960     NULL,                       /* 9,13 */
6961     NULL,                       /* 9,14 */
6962     NULL,                       /* 9,15 */
6963     NULL,                       /* 9,16 */
6964     NULL,                       /* 9,17 */
6965     NULL,                       /* 9,18 */
6966     NULL,                       /* 9,19 */
6967     NULL,                       /* 9,20 */
6968     NULL,                       /* 9,21 */
6969     NULL,                       /* 9,22 */
6970     NULL,                       /* 9,23 */
6971     NULL,                       /* 9,24 */
6972     NULL,                       /* 9,25 */
6973     NULL,                       /* 9,26 */
6974     NULL,                       /* 9,27 */
6975     NULL,                       /* 9,28 */
6976     NULL,                       /* 9,29 */
6977     NULL,                       /* 9,30 */
6978     NULL,                       /* 9,31 */
6979     NULL,                       /* 9,32 */
6980     NULL,                       /* 9,33 */
6981     NULL,                       /* 9,34 */
6982     NULL,                       /* 9,35 */
6983     NULL,                       /* 9,36 */
6984     NULL,                       /* 9,37 */
6985     NULL,                       /* 9,38 */
6986     NULL,                       /* 9,39 */
6987     NULL,                       /* 9,40 */
6988     NULL,                       /* 9,41 */
6989     NULL,                       /* 9,42 */
6990     NULL,                       /* 9,43 */
6991     NULL,                       /* 9,44 */
6992     NULL,                       /* 9,45 */
6993     NULL,                       /* 9,46 */
6994     NULL,                       /* 9,47 */
6995     NULL,                       /* 9,48 */
6996     NULL,                       /* 9,49 */
6997     NULL,                       /* 10,00 */
6998     NULL,                       /* 10,01 */
6999     NULL,                       /* 10,02 */
7000     NULL,                       /* 10,03 */
7001     NULL,                       /* 10,04 */
7002     NULL,                       /* 10,05 */
7003     NULL,                       /* 10,06 */
7004     NULL,                       /* 10,07 */
7005     NULL,                       /* 10,08 */
7006     NULL,                       /* 10,09 */
7007     NULL,                       /* 10,10 */
7008     NULL,                       /* 10,11 */
7009     NULL,                       /* 10,12 */
7010     NULL,                       /* 10,13 */
7011     NULL,                       /* 10,14 */
7012     NULL,                       /* 10,15 */
7013     NULL,                       /* 10,16 */
7014     NULL,                       /* 10,17 */
7015     NULL,                       /* 10,18 */
7016     NULL,                       /* 10,19 */
7017     NULL,                       /* 10,20 */
7018     NULL,                       /* 10,21 */
7019     NULL,                       /* 10,22 */
7020     NULL,                       /* 10,23 */
7021     NULL,                       /* 10,24 */
7022     NULL,                       /* 10,25 */
7023     NULL,                       /* 10,26 */
7024     NULL,                       /* 10,27 */
7025     NULL,                       /* 10,28 */
7026     NULL,                       /* 10,29 */
7027     NULL,                       /* 10,30 */
7028     NULL,                       /* 10,31 */
7029     NULL,                       /* 10,32 */
7030     NULL,                       /* 10,33 */
7031     NULL,                       /* 10,34 */
7032     NULL,                       /* 10,35 */
7033     NULL,                       /* 10,36 */
7034     NULL,                       /* 10,37 */
7035     NULL,                       /* 10,38 */
7036     NULL,                       /* 10,39 */
7037     NULL,                       /* 10,40 */
7038     NULL,                       /* 10,41 */
7039     NULL,                       /* 10,42 */
7040     NULL,                       /* 10,43 */
7041     NULL,                       /* 10,44 */
7042     NULL,                       /* 10,45 */
7043     NULL,                       /* 10,46 */
7044     NULL,                       /* 10,47 */
7045     NULL,                       /* 10,48 */
7046     NULL                        /* 10,49 */
7047 };
7048 int nxls = (sizeof(xls) / sizeof(CHAR *));
7049
7050 #ifndef NOLOCAL
7051 /*
7052   The following routines are useful only for terminal character sets, and so
7053   ifdef'd out for NOLOCAL compilations.
7054 */
7055
7056 /*
7057   C S _ I S _ N R C
7058
7059   Returns nonzero if argument indicates a 7-bit national character set,
7060   zero otherwise.
7061 */
7062 int
7063 cs_is_nrc(x) int x; {
7064 #ifdef UNICODE
7065     if (x == TX_J201R || x == TX_DECSPEC || x == TX_DECTECH
7066         || txrinfo[x] == NULL)
7067       return(0);
7068     else
7069       return(txrinfo[x]->flags & X2U_STD && txrinfo[x]->size == 94);
7070 #else /* UNICODE */
7071     if ((cs_size(x) == 94))
7072       return(1);
7073     else
7074       return(0);
7075 #endif /* UNICODE */
7076 }
7077
7078 /*
7079   C S _ I S _ S T D
7080
7081   Returns nonzero if argument indicates an ISO 4873-standard-format
7082   character set, i.e. one in which the control region is NOT used for
7083   graphics; zero otherwise.
7084 */
7085 int
7086 cs_is_std(x) int x; {
7087 #ifdef UNICODE
7088     if (!txrinfo[x])                    /* Even more safety */
7089       return(0);
7090     else if (txrinfo[x]->size == 128)   /* Just for safety */
7091       return(0);
7092     else
7093       return(txrinfo[x]->flags & X2U_STD); /* Only this should be needed */
7094 #else
7095     switch (x) {
7096       case FC_CP437:                    /* Code pages use C1 graphics */
7097       case FC_CP850:
7098       case FC_CP852:
7099       case FC_CP862:
7100       case FC_CP866:
7101       case FC_CP869:
7102       case FC_CP858:
7103       case FC_APPQD:                    /* So do Apple and NeXTSTEP */
7104       case FC_NEXT:
7105         return(0);
7106       default:                          /* Others behave */
7107         return(1);
7108     }
7109 #endif /* CKOUINI */
7110 }
7111
7112 int
7113 cs_size(x) int x; {
7114 #ifdef UNICODE
7115     if (!txrinfo[x])
7116       return(128);
7117     return(txrinfo[x]->size);
7118 #else
7119     switch(x) {
7120       case FC_USASCII:
7121       case FC_UKASCII:
7122       case FC_DUASCII:
7123       case FC_FIASCII:
7124       case FC_FRASCII:
7125       case FC_FCASCII:
7126       case FC_GEASCII:
7127       case FC_HUASCII:
7128       case FC_ITASCII:
7129       case FC_NOASCII:
7130       case FC_POASCII:
7131       case FC_SPASCII:
7132       case FC_SWASCII:
7133       case FC_CHASCII:
7134       case FC_KOI7:
7135       case FC_HE7:
7136       case FC_ELOT:
7137         return(94);
7138
7139       case FC_1LATIN:
7140       case FC_2LATIN:
7141       case FC_DECMCS:
7142       case FC_DGMCS:
7143       case FC_HPR8:
7144       case FC_CYRILL:
7145       case FC_KOI8:
7146       case FC_HEBREW:
7147       case FC_GREEK:
7148       case FC_9LATIN:
7149         return(96);
7150
7151       case FC_NEXT:
7152       case FC_CP437:
7153       case FC_CP850:
7154       case FC_CP852:
7155       case FC_CP855:
7156       case FC_CP862:
7157       case FC_CP866:
7158       case FC_CP1251:
7159       case FC_APPQD:
7160         return(128);
7161 #ifdef KANJI
7162       case FC_JIS7:
7163         return(-94);
7164       case FC_SHJIS:
7165         return(-128);
7166       case FC_JEUC:
7167       case FC_JDEC:
7168         return(-96);
7169 #endif /* KANJI */
7170       case FC_CP858:
7171       default:
7172         return(-1);
7173     }
7174 #endif /* UNICODE */
7175 }
7176 #endif /* NOLOCAL */
7177
7178 /*
7179   S E T X L A T Y P E  --  Set Translation Type
7180
7181   Sets global xlatype to indicate which kind of translation:
7182
7183     XLA_NONE      No translation
7184     XLA_BYTE      Byte-for-Byte translation
7185     XLA_JAPAN     Japanese Kanji translation
7186     XLA_UNICODE   Unicode translations
7187
7188   And sets up the appropriate translation function pointers as follows:
7189
7190   For no translation:
7191     All function pointers are NULL.
7192
7193   For Byte-for-Byte transation:
7194     rx  = TCS to FCS (these functions are in this module...)
7195     sx  = FCS to TCS
7196
7197   For Unicode translations:
7198     xfu = FCS to UCS (these functions are in ckcuni.c...)
7199     xtu = TCS to UCS
7200     xuf = UCS to FCS
7201     xut = UCS to TCS
7202 */
7203 VOID
7204 setxlatype(tcs, fcs) int tcs, fcs; {
7205 #ifdef UNICODE
7206     xfu = NULL;                         /* Unicode <-> TCS/FCS functions */
7207     xtu = NULL;
7208     xuf = NULL;
7209     xut = NULL;
7210 #endif /* UNICODE */
7211     rx = sx = NULL;
7212     debug(F101,"setxlatype fcs","",fcs);
7213     debug(F101,"setxlatype tcs","",tcs);
7214
7215     if (tcs < 0 || tcs > MAXTCSETS) {
7216         debug(F101,"setxlatype bad tcs","",tcs);
7217         return;
7218     }
7219     if (fcs < 0 || fcs > MAXFCSETS) {
7220         debug(F101,"setxlatype bad fcs","",fcs);
7221         return;
7222     }
7223     if (tcs == TC_TRANSP || xfrxla == 0) { /* Transfer charset TRANSPARENT */
7224         debug(F101,"setxlatype transparent because TCS==Transparent","",tcs);
7225         xlatype = XLA_NONE;             /* Translation type is None */
7226 #ifdef UNICODE
7227     /* If any of our charsets is Unicode we use Unicode functions */
7228     /* even if TCS and FCS are the same because of BOM and byte swapping */
7229     } else if (tcs == TC_UCS2 || tcs == TC_UTF8 ||
7230                fcs == FC_UCS2 || fcs == FC_UTF8) {
7231         debug(F101,"setxlatype Unicode tcs","",tcs);
7232         debug(F101,"setxlatype Unicode fcs","",fcs);
7233         /* Unicode <-> TCS/FCS functions */
7234         xfu = xl_fcu[fcs];              /* FCS -> UCS */
7235         xtu = xl_tcu[tcs];              /* TCS -> UCS */
7236         xuf = xl_ufc[fcs];              /* UCS -> FCS */
7237         xut = xl_utc[tcs];              /* UCS -> TCS */
7238         xlatype = XLA_UNICODE;          /* Translation type is Unicode */
7239 #ifdef COMMENT
7240         /* These make trouble in 64-bit land */
7241         debug(F001,"setxlatype Unicode xfu","",(unsigned)xfu);
7242         debug(F001,"setxlatype Unicode xuf","",(unsigned)xuf);
7243 #endif /* COMMENT */
7244 #endif /* UNICODE */
7245     } else if (cseqtab[tcs] == fcs) {   /* Or if TCS == FCS */
7246         debug(F101,"setxlatype transparent because TCS==FCS","",tcs);
7247         xlatype = XLA_NONE;             /* translation type is also None */
7248 #ifdef KANJI
7249     /* Otherwise if any of them is Japanese, we use Kanji functions */
7250     } else if (tcs == TC_JEUC || fcsinfo[fcs].alphabet == AL_JAPAN) {
7251         debug(F101,"setxlatype Japanese tcs","",tcs);
7252         debug(F101,"setxlatype Japanese fcs","",fcs);
7253         xlatype = XLA_JAPAN;            /* Translation type is Japanese */
7254 #endif /* KANJI */
7255     /* Otherwise we use byte functions */
7256     } else {                            /* Otherwise... */
7257         rx = xlr[tcs][fcs];             /* Input translation function */
7258         sx = xls[tcs][fcs];             /* Output translation function */
7259         debug(F101,"setxlatype Byte tcs","",tcs);
7260         debug(F101,"setxlatype Byte fcs","",fcs);
7261         xlatype = XLA_BYTE;             /* Translation type is Byte */
7262     }
7263     debug(F101,"setxlatype xlatype","",xlatype);
7264 }
7265
7266 /* Set up translation between two file character sets with UCS intermediate */
7267
7268 #ifdef UNICODE
7269 VOID
7270 initxlate(csin, csout) int csin, csout; {
7271     xfu = NULL;
7272     xtu = NULL;
7273     xuf = NULL;
7274     xut = NULL;
7275
7276     debug(F101,"initxlate csin","",csin);
7277     debug(F101,"initxlate csout","",csout);
7278
7279     if (csin < 0 || csin > MAXFCSETS) {
7280         debug(F101,"initxlate bad csin","",csin);
7281         return;
7282     }
7283     if (csout < 0 || csout > MAXFCSETS) {
7284         debug(F101,"initxlate bad csout","",csout);
7285         return;
7286     }
7287     if (csin == csout && csin != FC_UCS2) {
7288         xlatype = XLA_NONE;             /* Translation type is None */
7289         return;
7290     }
7291     xlatype = XLA_UNICODE;              /* Translation type is Unicode */
7292     xfu = xl_fcu[csin];                 /* FCS -> UCS */
7293     xuf = xl_ufc[csout];                /* UCS -> FCS */
7294     xpnbyte(-1,0,0,NULL);               /* Reset UCS-2 */
7295 #ifdef COMMENT
7296     debug(F001,"initxlate Unicode xfu","",(unsigned)xfu);
7297     debug(F001,"initxlate Unicode xuf","",(unsigned)xuf);
7298 #endif /* COMMENT */
7299     debug(F101,"initxlate xlatype","",xlatype);
7300 }
7301 #endif /* UNICODE */
7302
7303 int csetsinited = 0;
7304
7305 VOID
7306 initcsets() {                           /* Routine to reset or initialize */
7307     int i;                              /* character-set associations. */
7308
7309 #ifdef UNICODE
7310     if (ucsorder < 0)                   /* For creating UCS-2 files. */
7311       ucsorder = byteorder;
7312     if (ucsorder < 0)
7313       ucsorder = 0;
7314     if (fileorder < 0)                  /* For reading UCS-2 files. */
7315       fileorder = ucsorder;
7316 #endif /* UNICODE */
7317
7318     debug(F101,"initcsets nxls","",nxls);
7319     debug(F101,"initcsets nxlr","",nxlr);
7320
7321     debug(F101,"initcsets TERM LOCAL CSET","",tcsl);
7322     debug(F101,"initcsets TERM REMOTE CSET","",tcsr);
7323
7324     for (i = 0; i <= MAXFCSETS; i++)    /* First clear them all... */
7325       afcset[i] = -1;
7326     for (i = 0; i <= MAXTCSETS; i++)
7327       axcset[i] = -1;
7328
7329     /* Now set specific defaults for incoming files */
7330
7331     xlatype = XLA_NONE;
7332
7333     axcset[TC_TRANSP]  = FC_TRANSP;
7334     axcset[TC_USASCII] = FC_USASCII;
7335
7336 #ifdef OS2
7337     switch (fcharset) {
7338       case FC_CP850:
7339       case FC_CP858:
7340       case FC_CP437:
7341       case FC_1LATIN:
7342         axcset[TC_1LATIN]  = fcharset;
7343         break;
7344       default:
7345         axcset[TC_1LATIN]  = FC_CP850;
7346     }
7347 #else
7348 #ifdef HPUX
7349     axcset[TC_1LATIN]  = FC_HPR8;
7350 #else
7351 #ifdef VMS
7352     axcset[TC_1LATIN]  = FC_DECMCS;
7353 #else
7354 #ifdef NEXT
7355     axcset[TC_1LATIN]  = FC_NEXT;
7356 #else
7357 #ifdef datageneral
7358     axcset[TC_1LATIN]  = FC_DGMCS;
7359 #else
7360     /* Should we use code pages on some PC based UNIXes? */
7361     axcset[TC_1LATIN]  = FC_1LATIN;
7362 #endif /* datageneral */
7363 #endif /* NEXT */
7364 #endif /* VMS */
7365 #endif /* HPUX */
7366 #endif /* OS2 */
7367
7368 #ifdef OS2
7369     axcset[TC_2LATIN]  = FC_CP852;
7370     axcset[TC_CYRILL]  = FC_CP866;
7371     axcset[TC_JEUC]    = FC_SHJIS;
7372     axcset[TC_HEBREW]  = FC_CP862;
7373     axcset[TC_GREEK]   = FC_CP869;
7374     axcset[TC_9LATIN]  = FC_CP858;
7375     axcset[TC_UCS2]    = FC_UCS2;
7376     axcset[TC_UTF8]    = FC_UCS2;
7377 #else
7378     axcset[TC_2LATIN]  = FC_2LATIN;
7379     axcset[TC_CYRILL]  = FC_CYRILL;
7380     axcset[TC_JEUC]    = FC_JEUC;
7381     axcset[TC_HEBREW]  = FC_HEBREW;
7382     axcset[TC_GREEK]   = FC_GREEK;
7383     axcset[TC_9LATIN]  = FC_9LATIN;
7384     axcset[TC_UCS2]    = FC_UTF8;
7385     axcset[TC_UTF8]    = FC_UTF8;
7386 #endif /* OS2 */
7387
7388     /* And for outbound files */
7389
7390     afcset[FC_USASCII] = TC_USASCII;
7391     afcset[FC_UKASCII] = TC_1LATIN;
7392     afcset[FC_DUASCII] = TC_1LATIN;
7393     afcset[FC_FIASCII] = TC_1LATIN;
7394     afcset[FC_FRASCII] = TC_1LATIN;
7395     afcset[FC_FCASCII] = TC_1LATIN;
7396     afcset[FC_GEASCII] = TC_1LATIN;
7397     afcset[FC_HUASCII] = TC_2LATIN;
7398     afcset[FC_ITASCII] = TC_1LATIN;
7399     afcset[FC_NOASCII] = TC_1LATIN;
7400     afcset[FC_POASCII] = TC_1LATIN;
7401     afcset[FC_SPASCII] = TC_1LATIN;
7402     afcset[FC_SWASCII] = TC_1LATIN;
7403     afcset[FC_CHASCII] = TC_1LATIN;
7404     afcset[FC_1LATIN]  = TC_1LATIN;
7405     afcset[FC_2LATIN]  = TC_2LATIN;
7406     afcset[FC_DECMCS]  = TC_1LATIN;
7407     afcset[FC_NEXT]    = TC_1LATIN;
7408     afcset[FC_CP437]   = TC_1LATIN;
7409     afcset[FC_CP850]   = TC_1LATIN;
7410     afcset[FC_CP852]   = TC_2LATIN;
7411     afcset[FC_APPQD]   = TC_1LATIN;
7412     afcset[FC_DGMCS]   = TC_1LATIN;
7413     afcset[FC_HPR8]    = TC_1LATIN;
7414     afcset[FC_CYRILL]  = TC_CYRILL;
7415     afcset[FC_CP866]   = TC_CYRILL;
7416     afcset[FC_KOI7]    = TC_CYRILL;
7417     afcset[FC_KOI8]    = TC_CYRILL;
7418     afcset[FC_JIS7]    = TC_JEUC;
7419     afcset[FC_SHJIS]   = TC_JEUC;
7420     afcset[FC_JEUC]    = TC_JEUC;
7421     afcset[FC_JDEC]    = TC_JEUC;
7422     afcset[FC_HE7]     = TC_HEBREW;
7423     afcset[FC_HEBREW]  = TC_HEBREW;
7424     afcset[FC_CP862]   = TC_HEBREW;
7425     afcset[FC_ELOT]    = TC_GREEK;
7426     afcset[FC_GREEK]   = TC_GREEK;
7427     afcset[FC_CP869]   = TC_GREEK;
7428     afcset[FC_9LATIN]  = TC_9LATIN;
7429     afcset[FC_CP923]   = TC_9LATIN;
7430     afcset[FC_CP858]   = TC_9LATIN;
7431     afcset[FC_CP855]   = TC_CYRILL;
7432     afcset[FC_CP1251]  = TC_CYRILL;
7433     afcset[FC_BULGAR]  = TC_CYRILL;
7434     afcset[FC_CP1250]  = TC_2LATIN;
7435     afcset[FC_MAZOVIA] = TC_2LATIN;
7436     afcset[FC_UCS2]    = TC_UTF8;
7437     afcset[FC_UTF8]    = TC_UTF8;
7438
7439     afcset[FC_KOI8R]   = TC_CYRILL;
7440     afcset[FC_KOI8U]   = TC_CYRILL;
7441     afcset[FC_CP1252]  = TC_1LATIN;
7442
7443     csetsinited++;
7444     return;
7445 }
7446 #endif /* NOCSETS */