home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / test / tar / x30.tar.Z / x30.tar / ckuxla.c < prev    next >
C/C++ Source or Header  |  2010-04-01  |  276KB  |  7,591 lines

  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 9.0.043, 1 Apr 2010";
  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, 2010,
  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.  
  206. #ifdef UNICODE
  207.     "iso-10646-ucs-2", TC_UCS2,    CM_INV, /* ISO 10646 / Unicode UCS-2 */
  208. #endif /* UNICODE */
  209.     "iso-8859-1",    TC_1LATIN,  CM_INV, /* ISO Latin Alphabet 1 */
  210.     "iso-8859-15",   TC_9LATIN,  CM_INV, /* ISO Latin Alphabet 9 (yes) */
  211.     "iso-8859-2",    TC_2LATIN,  CM_INV, /* ISO Latin Alphabet 2 */
  212. #ifdef CYRILLIC
  213.     "iso-8859-5",    TC_CYRILL,  CM_INV, /* ISO Latin/Cyrillic Alphabet */
  214. #endif /* CYRILLIC */
  215. #ifdef GREEK
  216.     "iso-8859-7",    TC_GREEK,   CM_INV, /* ISO 8859-7 Latin/Greek */
  217. #endif /* GREEK */
  218. #ifdef HEBREW
  219.     "iso-8859-8",    TC_HEBREW,  CM_INV, /* ISO Latin/Hebrew */
  220. #endif /* HEBREW */
  221.  
  222. #ifdef KANJI
  223.     "japanese-euc",  TC_JEUC,    CM_INV,
  224. #endif /* KANJI */
  225.     "l",             TC_1LATIN,  CM_ABR|CM_INV,
  226.     "la",            TC_1LATIN,  CM_ABR|CM_INV,
  227.     "lat",           TC_1LATIN,  CM_ABR|CM_INV,
  228.     "lati",          TC_1LATIN,  CM_ABR|CM_INV,
  229.     "latin",         TC_1LATIN,  CM_ABR|CM_INV,
  230.     "latin1-iso",    TC_1LATIN,  0,
  231. #ifdef LATIN2
  232.     "latin2-iso",    TC_2LATIN,  0,
  233. #endif /* LATIN2 */
  234.     "latin9-iso",    TC_9LATIN,  0,
  235.     "transparent",   TC_TRANSP,  0,
  236. #ifdef UNICODE
  237.     "ucs2",          TC_UCS2,    0,
  238. #endif /* UNICODE */
  239.     "us-ascii",      TC_USASCII, CM_INV,
  240.     "usascii",       TC_USASCII, CM_INV,
  241. #ifdef UNICODE
  242.     "utf-8",         TC_UTF8,    CM_INV,
  243.     "utf8",          TC_UTF8,    0,
  244. #endif /* UNICODE */
  245.     "", 0, 0
  246. };
  247. int ntcs = (sizeof(tcstab) / sizeof(struct keytab)) - 1;
  248.  
  249. /* File character set information structure, indexed by character set code, */
  250. /* as defined in ckuxla.h.  This table must be in order of file character */
  251. /* set number! */
  252.  
  253. struct csinfo fcsinfo[] = { /* File character set information... */
  254.   /* Descriptive Name              Size  Designator */
  255.   "US ASCII",                     128, FC_USASCII, NULL, AL_ROMAN, "ascii",
  256.   "British/UK ISO-646",           128, FC_UKASCII, NULL, AL_ROMAN, "british",
  257.   "Dutch ISO-646",                128, FC_DUASCII, NULL, AL_ROMAN, "dutch",
  258.   "Finnish ISO-646",              128, FC_FIASCII, NULL, AL_ROMAN, "finnish",
  259.   "French ISO-646",               128, FC_FRASCII, NULL, AL_ROMAN, "french",
  260.   "Canadian-French NRC", 128, FC_FCASCII, NULL, AL_ROMAN, "canadian-french",
  261.   "German ISO-646",               128, FC_GEASCII, NULL, AL_ROMAN, "german",
  262.   "Hungarian ISO-646",            128, FC_HUASCII, NULL, AL_ROMAN, "hungarian",
  263.   "Italian ISO-646",              128, FC_ITASCII, NULL, AL_ROMAN, "italian",
  264.   "Norwegian/Danish ISO-646",128,FC_NOASCII,NULL,AL_ROMAN,"norwegian/danish",
  265.   "Portuguese ISO-646",           128, FC_POASCII, NULL, AL_ROMAN,"portuguese",
  266.   "Spanish ISO-646",              128, FC_SPASCII, NULL, AL_ROMAN, "spanish",
  267.   "Swedish ISO-646",              128, FC_SWASCII, NULL, AL_ROMAN, "swedish",
  268.   "Swiss NRC",                    128, FC_CHASCII, NULL, AL_ROMAN, "swiss",
  269.   "ISO 8859-1 Latin-1",           256, FC_1LATIN,  NULL, AL_ROMAN,"latin1-iso",
  270.   "ISO 8859-2 Latin-2",           256, FC_2LATIN,  NULL, AL_ROMAN,"latin2-iso",
  271.   "DEC Multinational", 256,  FC_DECMCS, NULL,AL_ROMAN,"dec-multinational",
  272.   "NeXT Multinational", 256, FC_NEXT,   NULL,AL_ROMAN,"next-multinational",
  273.   "PC Code Page 437",            256, FC_CP437,   NULL, AL_ROMAN,"cp437",
  274.   "PC Code Page 850",            256, FC_CP850,   NULL, AL_ROMAN,"cp850",
  275.   "PC Code Page 852",            256, FC_CP852,   NULL, AL_ROMAN,"cp852",
  276.   "Apple Macintosh Latin", 256, FC_APPQD,   NULL, AL_ROMAN,"macintosh-latin",
  277.   "Data General International",256,FC_DGMCS,NULL,AL_ROMAN,"dg-international",
  278.   "Hewlett Packard Roman8",    256, FC_HPR8,    NULL, AL_ROMAN, "hp-roman8",
  279.   "ISO 8859-5 Latin/Cyrillic", 256, FC_CYRILL,  NULL, AL_CYRIL,"cyrillic-iso",
  280.   "CP866 Cyrillic",           256, FC_CP866,   NULL, AL_CYRIL,"cp866",
  281.   "Short KOI",                 128, FC_KOI7,    NULL, AL_CYRIL,"short-koi",
  282.   "Old KOI-8 Cyrillic",        256, FC_KOI8,    NULL, AL_CYRIL,"koi8-cyrillic",
  283.   "Japanese JIS7",      16384, FC_JIS7,    NULL, AL_JAPAN, "jis7-kanji",
  284.   "Japanese Shift JIS",      16384, FC_SHJIS,   NULL, AL_JAPAN, "shift-jis-kanji",
  285.   "Japanese EUC",      16384, FC_JEUC,    NULL, AL_JAPAN, "euc-jp",
  286.   "Japanese DEC Kanji",      16384, FC_JDEC,    NULL, AL_JAPAN, "dec-kanji",
  287.   "Hebrew-7 DEC",           128, FC_HE7,     NULL, AL_HEBREW, "hebrew-7",
  288.   "ISO 8859-8 Latin/Hebrew",256, FC_HEBREW,  NULL, AL_HEBREW, "hebrew-iso",
  289.   "CP862 Hebrew",           256, FC_CP862,   NULL, AL_HEBREW, "cp862-hebrew",
  290.   "ELOT 927 Greek",         128, FC_ELOT,    NULL, AL_GREEK, "elot927-greek",
  291.   "ISO 8859-7 Latin/Greek", 256, FC_GREEK,   NULL, AL_GREEK, "greek-iso",
  292.   "CP869 Greek",            256, FC_CP869,   NULL, AL_GREEK, "cp869-greek",
  293.   "ISO 8859-15 Latin-9",    256, FC_9LATIN,  NULL, AL_ROMAN, "latin9-iso",
  294.   "PC Code Page 858",       256, FC_CP850,   NULL, AL_ROMAN, "cp858",
  295.   "PC Code Page 855",       256, FC_CP855,   NULL, AL_CYRIL, "cp855-cyrillic",
  296.   "Windows Code Page 1251", 256, FC_CP1251,  NULL, AL_CYRIL, "cp1251-cyrillic",
  297.   "Bulgarian PC Code Page", 256, FC_BULGAR,  NULL, AL_CYRIL, "bulgaria-pc",
  298.   "Windows Code Page 1250", 256, FC_CP1250,  NULL, AL_ROMAN, "cp1250",
  299.   "Polish Mazovia PC Code Page", 256, FC_MAZOVIA, NULL, AL_ROMAN, "mazovia-pc",
  300.   "ISO 10646 / Unicode UCS-2", 64000, FC_UCS2, NULL, AL_UNIV, "ucs2",
  301.   "ISO 10646 / Unicode UTF-8", 64000, FC_UCS2, NULL, AL_UNIV, "utf8",
  302.   "KOI8-R Russian+Boxdrawing",256,  FC_KOI8R, NULL, AL_CYRIL,"koi8r",
  303.   "KOI8-U Ukrainian+Boxdrawing",256,FC_KOI8U, NULL, AL_CYRIL,"koi8u",
  304.   "Windows Code Page 1252", 256, FC_CP1252,  NULL, AL_ROMAN, "cp1252",
  305.   "",0,0,NULL,0,NULL
  306. };
  307.  
  308. /* Local file character sets */
  309. /* Includes 7-bit National Replacement Character Sets of ISO 646 */
  310. /* Plus ISO Latin-1, DEC Multinational Character Set (MCS), NeXT char set, */
  311. /* Various PC and Windows code pages, etc. */
  312. /* As of C-Kermit 9.0 MIME names are included as invisible synomyms for */
  313. /* those character sets that have MIME names. */
  314.  
  315. struct keytab fcstab[] = { /* Keyword table for 'set file character-set' */
  316. /*
  317.   IMPORTANT: This table is replicated below as ttcstab (terminal character
  318.   set table).  The only differences are the addition of TRANSPARENT
  319.   and the removal of the Kanji sets, which are not supported for terminal
  320.   emulation.  If you make changes to this table, also change ttcstab.
  321. */
  322.  
  323. /* Keyword             Value       Flags */
  324.     "apple-quickdraw",    FC_APPQD,   CM_INV, /* Apple Quickdraw */
  325.     "ascii",              FC_USASCII, 0, /* ASCII */
  326.     "british",            FC_UKASCII, 0, /* British NRC */
  327.     "bulgaria-pc",        FC_BULGAR,  0, /* Bulgarian PC Code Page */
  328.     "canadian-french",    FC_FCASCII, 0, /* French Canadian NRC */
  329. #ifdef LATIN2
  330.     "cp1250",             FC_CP1250,  0, /* Windows CP 1250 */
  331. #endif /* LATIN2 */
  332. #ifdef CYRILLIC
  333.     "cp1251-cyrillic",    FC_CP1251,  0, /* Windows CP 1251 */
  334.     "windows-1251",       FC_CP1251,  0, /* Windows CP 1251 */
  335. #endif /* CYRILLIC */
  336.     "cp1252",             FC_CP1252,  0, /* Windows CP 1252 */
  337.     "cp437",              FC_CP437,   0, /* PC CP437 */
  338.     "cp850",              FC_CP850,   0, /* PC CP850 */
  339. #ifdef LATIN2
  340.     "cp852",              FC_CP852,   0, /* PC CP852 */
  341. #endif /* LATIN2 */
  342. #ifdef CYRILLIC
  343.     "cp855-cyrillic",     FC_CP855,   0, /* PC CP855 */
  344. #endif /* CYRILLIC */
  345.     "cp858",              FC_CP858,   0, /* PC CP858 */
  346. #ifdef HEBREW
  347.     "cp862-hebrew",       FC_CP862,   0, /* PC CP862 */
  348. #endif /* HEBREW */
  349. #ifdef CYRILLIC
  350.     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
  351. #endif /* CYRILLIC */
  352. #ifdef GREEK
  353.     "cp869-greek",        FC_CP869,   0, /* CP869 Greek */
  354. #endif /* GREEK */
  355. #ifdef CYRILLIC
  356.     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
  357. #endif /* CYRILLIC */
  358.     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
  359. #ifdef KANJI
  360.     "dec-kanji",          FC_JDEC,    0, /* Japanese DEC Kanji */
  361. #endif /* KANJI */
  362.     "dec-mcs",            FC_DECMCS,  CM_INV, /* DEC multinational char set */
  363.     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
  364.     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
  365.     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
  366. #ifdef GREEK
  367.     "elot927-greek",      FC_ELOT,    0, /* ELOT 927 Greek */
  368.     "elot928-greek",      FC_GREEK,   0, /* Same as ISO 8859-7 Latin/Greek */
  369. #endif /* GREEK */
  370. #ifdef KANJI
  371.     "euc-jp",             FC_JEUC,    0, /* Japanese EUC */
  372. #endif /* KANJI */
  373.     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
  374.     "french",             FC_FRASCII, 0, /* French NRC */
  375.     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
  376.     "german",             FC_GEASCII, 0, /* German NRC */
  377. #ifdef GREEK
  378.     "greek-iso",          FC_GREEK,   0, /* ISO 8859-7 Latin/Greek */
  379. #endif /* GREEK */
  380. #ifdef HEBREW
  381.     "he",                 FC_HEBREW,  CM_ABR|CM_INV,
  382.     "heb",                FC_HEBREW,  CM_ABR|CM_INV,
  383.     "hebr",               FC_HEBREW,  CM_ABR|CM_INV,
  384.     "hebre",              FC_HEBREW,  CM_ABR|CM_INV,
  385.     "hebrew",             FC_HEBREW,  CM_ABR|CM_INV,
  386.     "hebrew-7",           FC_HE7,     0, /* DEC 7-Bit Hebrew */
  387.     "hebrew-iso",         FC_HEBREW,  0, /* ISO Latin/Hebrew */
  388. #endif /* HEBREW */
  389.     "hp-roman8",          FC_HPR8,    0, /* Hewlett Packard Roman8 */
  390.     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
  391.  
  392.     "ibm437",             FC_CP437,   CM_INV, /* PC CP437 */
  393.     "ibm850",             FC_CP850,   CM_INV, /* PC CP850 (not in MIME) */
  394. #ifdef LATIN2
  395.     "ibm852",             FC_CP852,   CM_INV, /* PC CP852 */
  396. #endif /* LATIN2 */
  397. #ifdef CYRILLIC
  398.     "ibm855",             FC_CP855,   CM_INV, /* PC CP855 */
  399. #endif /* CYRILLIC */
  400.     "ibm858",             FC_CP858,   CM_INV, /* PC CP858 (not in MIME) */
  401. #ifdef HEBREW
  402.     "ibm862",             FC_CP862,   CM_INV, /* PC CP862 (not in MIME) */
  403. #endif /* HEBREW */
  404. #ifdef CYRILLIC
  405.     "ibm866",             FC_CP866,   CM_INV, /* CP866 Cyrillic */
  406. #endif /* CYRILLIC */
  407. #ifdef GREEK
  408.     "ibm869",             FC_CP869,   CM_INV, /* CP869 Greek */
  409. #endif /* GREEK */
  410.  
  411. #ifdef UNICODE
  412.     "iso-10646-ucs-2",    FC_UCS2,    CM_INV, /* ISO 10646 / Unicode UCS-2 */
  413. #endif /* UNICODE */
  414.     "iso-8859-1",         FC_1LATIN,  CM_INV, /* ISO Latin Alphabet 1 */
  415.     "iso-8859-15",        FC_9LATIN,  CM_INV, /* ISO Latin Alphabet 9 (yes) */
  416.     "iso-8859-2",         FC_2LATIN,  CM_INV, /* ISO Latin Alphabet 2 */
  417. #ifdef CYRILLIC
  418.     "iso-8859-5",         FC_CYRILL,  CM_INV, /* ISO Latin/Cyrillic Alphabet */
  419. #endif /* CYRILLIC */
  420. #ifdef GREEK
  421.     "iso-8859-7",         FC_GREEK,   CM_INV, /* ISO 8859-7 Latin/Greek */
  422. #endif /* GREEK */
  423. #ifdef HEBREW
  424.     "iso-8859-8",         FC_HEBREW,  CM_INV, /* ISO Latin/Hebrew */
  425. #endif /* HEBREW */
  426. #ifdef KANJI
  427.     "iso2022jp-kanji",    FC_JIS7,    CM_INV, /* Synonym for JIS-7 */
  428. #endif /* KANJI */
  429.  
  430.     "iso646-gb",          FC_UKASCII, CM_INV, /* British NRC */
  431.     "iso646-ca",          FC_FCASCII, CM_INV, /* French Canadian NRC */
  432.     "iso646-de",          FC_GEASCII, CM_INV, /* German NRC */
  433.     "iso646-dk",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  434.     "iso646-es",          FC_SPASCII, CM_INV, /* Spanish NRC */
  435.     "iso646-fi",          FC_FIASCII, CM_INV, /* Finnish NRC */
  436.     "iso646-fr",          FC_FRASCII, CM_INV, /* French NRC */
  437.     "iso646-hu",          FC_HUASCII, CM_INV, /* Hungarian NRC */
  438.     "iso646-it",          FC_ITASCII, CM_INV, /* Italian NRC */
  439.     "iso646-no",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  440.     "iso646-po",          FC_POASCII, CM_INV, /* Portuguese NRC */
  441.     "iso646-se",          FC_SWASCII, CM_INV, /* Swedish NRC */
  442.  
  443.     "italian",            FC_ITASCII, CM_INV, /* Italian NRC */
  444. #ifdef KANJI
  445.     "japanese-euc",       FC_JEUC,    CM_INV, /* Japanese EUC */
  446.     "jis7-kanji",         FC_JIS7,    0, /* Japanese JIS7 7bit code */
  447. #endif /* KANJI */
  448. #ifdef CYRILLIC
  449.     "k",                  FC_KOI8,    CM_ABR|CM_INV,
  450.     "ko",                 FC_KOI8,    CM_ABR|CM_INV,
  451.     "koi",                FC_KOI8,    CM_ABR|CM_INV,
  452.     "koi7",               FC_KOI7,    0, /* Short KOI Cyrillic */
  453.     "koi8",               FC_KOI8,    0, /* Old KOI-8 Cyrillic */
  454.     "koi8-e",             FC_KOI8,    CM_INV, /* Old KOI-8 Cyrillic */
  455.     "koi8-cyrillic",      FC_KOI8,    CM_INV,
  456.     "koi8-r",             FC_KOI8R,   CM_INV, /* KOI8-R RFC1489 */
  457.     "koi8-u",             FC_KOI8U,   CM_INV, /* KOI8-U RFC2319 */
  458.     "koi8r",              FC_KOI8R,   0, /* KOI8-R RFC1489 */
  459.     "koi8u",              FC_KOI8U,   0, /* KOI8-U RFC2319 */
  460. #endif /* CYRILLIC */
  461.     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
  462.     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
  463.     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
  464.     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
  465.     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
  466.     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
  467. #ifdef LATIN2
  468.     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
  469. #endif /* LATIN2 */
  470.     "latin9-iso",         FC_9LATIN,  0, /* ISO Latin Alphabet 9 */
  471.     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin" */
  472. #ifdef LATIN2
  473.     "mazovia-pc",         FC_MAZOVIA, 0, /* Polish Mazovia PC code page */
  474. #endif /* LATIN2 */
  475.     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
  476.     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
  477.     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
  478. #ifdef KANJI
  479.     "shift-jis-kanji",    FC_SHJIS,   0, /* Japanese Kanji Shift-JIS */
  480.     "shift_jis",          FC_SHJIS,   CM_INV, /* Japanese Kanji Shift-JIS */
  481. #endif /* KANJI */
  482. #ifdef CYRILLIC
  483.     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
  484. #endif /* CYRILLIC */
  485.     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
  486.     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
  487.     "swiss",              FC_CHASCII, 0, /* Swiss NRC */
  488. #ifdef UNICODE
  489.     "ucs2",               FC_UCS2,    0, /* ISO 10646 / Unicode UCS-2 */
  490. #endif /* UNICODE */
  491.     "us-ascii",           FC_USASCII, CM_INV, /* MIME */
  492.     "usascii",            FC_USASCII, CM_INV,
  493. #ifdef UNICODE
  494.     "utf-8",              FC_UTF8,    CM_INV, /* ISO 10646 / Unicode UTF-8 */
  495.     "utf8",               FC_UTF8,    0, /* ISO 10646 / Unicode UTF-8 */
  496. #endif /* UNICODE */
  497. #ifdef LATIN2
  498.     "windows-1250",       FC_CP1250,  CM_INV, /* Windows CP 1250 */
  499. #endif /* LATIN2 */
  500. #ifdef CYRILLIC
  501.     "windows-1251",       FC_CP1251,  CM_INV, /* Windows CP 1251 */
  502. #endif /* CYRILLIC */
  503.     "windows-1252",       FC_CP1252,  CM_INV, /* Windows CP 1252 */
  504.     "", 0, 0
  505. };
  506. int nfilc = (sizeof(fcstab) / sizeof(struct keytab)) - 1;
  507.  
  508. struct keytab ttcstab[] = { /* Keyword table for SET TERMINAL CHARACTER-SET */
  509. /*
  510.   IMPORTANT: This table is a replica of fcstab, immediately above, with the
  511.   addition of TRANSPARENT and deletion of the Japanese sets.  If you make
  512.   changes to this table, make the corresponding changes to fcstab.
  513. */
  514. /* Keyword             Value       Flags */
  515.     "apple-quickdraw",    FC_APPQD,   CM_INV, /* Apple Quickdraw */
  516.     "ascii",              FC_USASCII, 0, /* ASCII */
  517.     "british",            FC_UKASCII, 0, /* British NRC */
  518.     "bulgaria-pc",        FC_BULGAR,  0, /* Bulgarian PC Code Page */
  519.     "canadian-french",    FC_FCASCII, 0, /* French Canadian NRC */
  520. #ifdef LATIN2
  521.     "cp1250",             FC_CP1250,  0, /* Windows CP 1250 */
  522. #endif /* LATIN2 */
  523. #ifdef CYRILLIC
  524.     "cp1251-cyrillic",    FC_CP1251,  0, /* Windows CP 1251 */
  525.     "windows-1251",       FC_CP1251,  0, /* Windows CP 1251 */
  526. #endif /* CYRILLIC */
  527.     "cp1252",             FC_CP1252,  0, /* Windows CP 1252 */
  528.     "cp437",              FC_CP437,   0, /* PC CP437 */
  529.     "cp850",              FC_CP850,   0, /* PC CP850 */
  530. #ifdef LATIN2
  531.     "cp852",              FC_CP852,   0, /* PC CP852 */
  532. #endif /* LATIN2 */
  533. #ifdef CYRILLIC
  534.     "cp855-cyrillic",     FC_CP855,   0, /* PC CP855 */
  535. #endif /* CYRILLIC */
  536.     "cp858",              FC_CP858,   0, /* PC CP858 */
  537. #ifdef HEBREW
  538.     "cp862-hebrew",       FC_CP862,   0, /* PC CP862 */
  539. #endif /* HEBREW */
  540. #ifdef CYRILLIC
  541.     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
  542. #endif /* CYRILLIC */
  543. #ifdef GREEK
  544.     "cp869-greek",        FC_CP869,   0, /* CP869 Greek */
  545. #endif /* GREEK */
  546. #ifdef CYRILLIC
  547.     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
  548. #endif /* CYRILLIC */
  549.     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
  550.     "dec-mcs",            FC_DECMCS,  CM_INV, /* DEC multinational char set */
  551.     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
  552.     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
  553.     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
  554. #ifdef GREEK
  555.     "elot927-greek",      FC_ELOT,    0, /* ELOT 927 Greek */
  556.     "elot928-greek",      FC_GREEK,   0, /* Same as ISO 8859-7 Latin/Greek */
  557. #endif /* GREEK */
  558.     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
  559.     "french",             FC_FRASCII, 0, /* French NRC */
  560.     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
  561.     "german",             FC_GEASCII, 0, /* German NRC */
  562. #ifdef GREEK
  563.     "greek-iso",          FC_GREEK,   0, /* ISO 8859-7 Latin/Greek */
  564. #endif /* GREEK */
  565. #ifdef HEBREW
  566.     "he",                 FC_HEBREW,  CM_ABR|CM_INV,
  567.     "heb",                FC_HEBREW,  CM_ABR|CM_INV,
  568.     "hebr",               FC_HEBREW,  CM_ABR|CM_INV,
  569.     "hebre",              FC_HEBREW,  CM_ABR|CM_INV,
  570.     "hebrew",             FC_HEBREW,  CM_ABR|CM_INV,
  571.     "hebrew-7",           FC_HE7,     0, /* DEC 7-Bit Hebrew */
  572.     "hebrew-iso",         FC_HEBREW,  0, /* ISO Latin/Hebrew */
  573. #endif /* HEBREW */
  574.     "hp-roman8",          FC_HPR8,    0, /* Hewlett Packard Roman8 */
  575.     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
  576.  
  577.     "ibm437",             FC_CP437,   CM_INV, /* PC CP437 */
  578.     "ibm850",             FC_CP850,   CM_INV, /* PC CP850 (not in MIME) */
  579. #ifdef LATIN2
  580.     "ibm852",             FC_CP852,   CM_INV, /* PC CP852 */
  581. #endif /* LATIN2 */
  582. #ifdef CYRILLIC
  583.     "ibm855",             FC_CP855,   CM_INV, /* PC CP855 */
  584. #endif /* CYRILLIC */
  585.     "ibm858",             FC_CP858,   CM_INV, /* PC CP858 (not in MIME) */
  586. #ifdef HEBREW
  587.     "ibm862",             FC_CP862,   CM_INV, /* PC CP862 (not in MIME) */
  588. #endif /* HEBREW */
  589. #ifdef CYRILLIC
  590.     "ibm866",             FC_CP866,   CM_INV, /* CP866 Cyrillic */
  591. #endif /* CYRILLIC */
  592. #ifdef GREEK
  593.     "ibm869",             FC_CP869,   CM_INV, /* CP869 Greek */
  594. #endif /* GREEK */
  595.  
  596. #ifdef UNICODE
  597.     "iso-10646-ucs-2",    FC_UCS2,    CM_INV, /* ISO 10646 / Unicode UCS-2 */
  598. #endif /* UNICODE */
  599.     "iso-8859-1",         FC_1LATIN,  CM_INV, /* ISO Latin Alphabet 1 */
  600.     "iso-8859-15",        FC_9LATIN,  CM_INV, /* ISO Latin Alphabet 9 (yes) */
  601.     "iso-8859-2",         FC_2LATIN,  CM_INV, /* ISO Latin Alphabet 2 */
  602. #ifdef CYRILLIC
  603.     "iso-8859-5",         FC_CYRILL,  CM_INV, /* ISO Latin/Cyrillic Alphabet */
  604. #endif /* CYRILLIC */
  605. #ifdef GREEK
  606.     "iso-8859-7",         FC_GREEK,   CM_INV, /* ISO 8859-7 Latin/Greek */
  607. #endif /* GREEK */
  608. #ifdef HEBREW
  609.     "iso-8859-8",         FC_HEBREW,  CM_INV, /* ISO Latin/Hebrew */
  610. #endif /* HEBREW */
  611.  
  612.     "iso646-gb",          FC_UKASCII, CM_INV, /* British NRC */
  613.     "iso646-ca",          FC_FCASCII, CM_INV, /* French Canadian NRC */
  614.     "iso646-de",          FC_GEASCII, CM_INV, /* German NRC */
  615.     "iso646-dk",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  616.     "iso646-es",          FC_SPASCII, CM_INV, /* Spanish NRC */
  617.     "iso646-fi",          FC_FIASCII, CM_INV, /* Finnish NRC */
  618.     "iso646-fr",          FC_FRASCII, CM_INV, /* French NRC */
  619.     "iso646-hu",          FC_HUASCII, CM_INV, /* Hungarian NRC */
  620.     "iso646-it",          FC_ITASCII, CM_INV, /* Italian NRC */
  621.     "iso646-no",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  622.     "iso646-po",          FC_POASCII, CM_INV, /* Portuguese NRC */
  623.     "iso646-se",          FC_SWASCII, CM_INV, /* Swedish NRC */
  624.  
  625.     "italian",            FC_ITASCII, CM_INV, /* Italian NRC */
  626.  
  627. #ifdef CYRILLIC
  628.     "k",                  FC_KOI8,    CM_ABR|CM_INV,
  629.     "ko",                 FC_KOI8,    CM_ABR|CM_INV,
  630.     "koi",                FC_KOI8,    CM_ABR|CM_INV,
  631.     "koi7",               FC_KOI7,    0, /* Short KOI Cyrillic */
  632.     "koi8",               FC_KOI8,    0, /* Old KOI-8 Cyrillic */
  633.     "koi8-e",             FC_KOI8,    CM_INV, /* Old KOI-8 Cyrillic */
  634.     "koi8-cyrillic",      FC_KOI8,    CM_INV,
  635.     "koi8-r",             FC_KOI8R,   CM_INV, /* KOI8-R RFC1489 */
  636.     "koi8-u",             FC_KOI8U,   CM_INV, /* KOI8-U RFC2319 */
  637.     "koi8r",              FC_KOI8R,   0, /* KOI8-R RFC1489 */
  638.     "koi8u",              FC_KOI8U,   0, /* KOI8-U RFC2319 */
  639. #endif /* CYRILLIC */
  640.     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
  641.     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
  642.     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
  643.     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
  644.     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
  645.     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
  646. #ifdef LATIN2
  647.     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
  648. #endif /* LATIN2 */
  649.     "latin9-iso",         FC_9LATIN,  0, /* ISO Latin Alphabet 9 */
  650.     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin" */
  651. #ifdef LATIN2
  652.     "mazovia-pc",         FC_MAZOVIA, 0, /* Polish Mazovia PC code page */
  653. #endif /* LATIN2 */
  654.     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
  655.     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
  656.     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
  657.  
  658. #ifdef CYRILLIC
  659.     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
  660. #endif /* CYRILLIC */
  661.     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
  662.     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
  663.     "swiss",              FC_CHASCII, 0, /* Swiss NRC */
  664.     "transparent",        FC_TRANSP,  0, /* Transparent */
  665. #ifdef UNICODE
  666.     "ucs2",               FC_UCS2,    0, /* ISO 10646 / Unicode UCS-2 */
  667. #endif /* UNICODE */
  668.     "us-ascii",           FC_USASCII, CM_INV, /* MIME */
  669.     "usascii",            FC_USASCII, CM_INV,
  670. #ifdef UNICODE
  671.     "utf-8",              FC_UTF8,    CM_INV, /* ISO 10646 / Unicode UTF-8 */
  672.     "utf8",               FC_UTF8,    0, /* ISO 10646 / Unicode UTF-8 */
  673. #endif /* UNICODE */
  674. #ifdef LATIN2
  675.     "windows-1250",       FC_CP1250,  CM_INV, /* Windows CP 1250 */
  676. #endif /* LATIN2 */
  677. #ifdef CYRILLIC
  678.     "windows-1251",       FC_CP1251,  CM_INV, /* Windows CP 1251 */
  679. #endif /* CYRILLIC */
  680.     "windows-1252",       FC_CP1252,  CM_INV, /* Windows CP 1252 */
  681.     "", 0, 0
  682. };
  683. int ntermc = (sizeof(ttcstab) / sizeof(struct keytab)) - 1;
  684.  
  685. /* This table contains the equivalent FCS number for each TCS. */
  686. /* If the TC_xxx symbol definitions are ever changed, fix this table. */
  687. /* Ditto if another TCS is added. */
  688.  
  689. int
  690. cseqtab[MAXTCSETS+1] = {        /* TCS/FCS equivalency table */
  691.     -1,                    /*  0 = Transparent */
  692.     FC_USASCII,                /*  1 = ASCII */
  693.     FC_1LATIN,                /*  2 = Latin-1 */
  694.     FC_2LATIN,                /*  3 = Latin-2 */
  695.     FC_CYRILL,                /*  4 = Latin/Cyrillic */
  696.     FC_JEUC,                /*  5 = Japanese EUC */
  697.     FC_HEBREW,                /*  6 = Latin/Hebrew */
  698.     FC_GREEK,                /*  7 = Latin/Greek */
  699.     FC_9LATIN,                /*  8 = Latin-9 */
  700.     FC_UCS2,                /*  9 = UCS-2 */
  701.     FC_UTF8                /* 10 = UTF-8 */
  702. };
  703.  
  704. /*
  705.  Languages:
  706.  
  707.  This table allows C-Kermit to have a SET LANGUAGE command to apply special
  708.  language-specific rules when translating from a character set that contains
  709.  national characters into plain ASCII, like German umlaut-a becomes ae.
  710.  
  711.  Originally, I thought it would be a good idea to let SET LANGUAGE also select
  712.  an appropriate FILE CHARACTER-SET and TRANSFER CHARACTER-SET automatically,
  713.  and these are included in the langinfo structure.  Later I realized that this
  714.  was a bad idea.  Any particular language (e.g. Dutch) can be represented by
  715.  many different and incompatible character sets.
  716.  
  717.  (But we could use the new (1998) ASSOCIATE command for this...)
  718. */
  719.  
  720. struct langinfo langs[] = {
  721. /*  Language code   File Charset Xfer Charset Name */
  722.     L_USASCII,      FC_USASCII,  TC_USASCII,  "ASCII (American English)",
  723.     L_DANISH,       FC_NOASCII,  TC_1LATIN,   "Danish",
  724.     L_DUTCH,        FC_DUASCII,  TC_1LATIN,   "Dutch",
  725.     L_FINNISH,      FC_FIASCII,  TC_1LATIN,   "Finnish",
  726.     L_FRENCH,       FC_FRASCII,  TC_1LATIN,   "French",
  727.     L_GERMAN,       FC_GEASCII,  TC_1LATIN,   "German",
  728. #ifdef GREEK
  729.     L_GREEK,        FC_GREEK,    TC_GREEK,    "Greek",
  730. #endif /* GREEK */
  731. #ifdef HEBREW
  732.     L_HEBREW,       FC_HEBREW,   TC_HEBREW,   "Hebrew",
  733. #endif /* HEBREW */
  734.     L_HUNGARIAN,    FC_HUASCII,  TC_2LATIN,   "Hungarian",
  735.     L_ICELANDIC,    FC_USASCII,  TC_1LATIN,   "Icelandic",
  736.     L_ITALIAN,      FC_ITASCII,  TC_1LATIN,   "Italian",
  737. #ifdef KANJI
  738.     L_JAPANESE,     FC_JEUC,     TC_JEUC,     "Japanese",
  739. #endif /* KANJI */
  740.     L_NORWEGIAN,    FC_NOASCII,  TC_1LATIN,   "Norwegian",
  741.     L_PORTUGUESE,   FC_POASCII,  TC_1LATIN,   "Portuguese",
  742. #ifdef CYRILLIC
  743.     L_RUSSIAN,      FC_CP866,    TC_CYRILL,   "Russian",
  744. #endif /* CYRILLIC */
  745.     L_SPANISH,      FC_SPASCII,  TC_1LATIN,   "Spanish",
  746.     L_SWEDISH,      FC_SWASCII,  TC_1LATIN,   "Swedish",
  747.     L_SWISS,        FC_CHASCII,  TC_1LATIN,   "Swiss"
  748. };
  749. int nlangs = (sizeof(langs) / sizeof(struct langinfo));
  750.  
  751. /*
  752.   Keyword table for the SET LANGUAGE command.
  753.   Only a few of these (German, Scandinavian, etc) actually do anything.
  754.   The language is used to invoke special translation rules when converting
  755.   from an 8-bit character set to ASCII; for example, German u-diaeresis
  756.   becomes "ue", Dutch y-diaeresis becomes "ij".  Languages without associated
  757.   rules are invisible (CM_INV).
  758. */
  759. struct keytab lngtab[] = {
  760.     "ascii",            L_USASCII,    CM_INV,
  761.     "danish",           L_DANISH,     0,
  762.     "dutch",            L_DUTCH,      0,
  763.     "english",          L_USASCII,    CM_INV,
  764.     "finnish",          L_FINNISH,    0,
  765.     "french",           L_FRENCH,     0,
  766.     "german",           L_GERMAN,     0,
  767. #ifdef GREEK
  768.     "greek",            L_GREEK,      CM_INV,
  769. #endif /* GREEK */
  770. #ifdef HEBREW
  771.     "hebrew",           L_HEBREW,     CM_INV,
  772. #endif /* HEBREW */
  773.     "hungarian",        L_HUNGARIAN,  CM_INV,
  774.     "icelandic",        L_ICELANDIC,  0,
  775.     "italian",          L_ITALIAN,    CM_INV,
  776. #ifdef KANJI
  777.     "japanese",         L_JAPANESE,   CM_INV,
  778. #endif /* KANJI */
  779.     "norwegian",        L_NORWEGIAN,  0,
  780.     "none",             L_USASCII,    0,
  781.     "portuguese",       L_PORTUGUESE, CM_INV,
  782. #ifdef CYRILLIC
  783.     "russian",          L_RUSSIAN,    0,
  784. #endif /* CYRILLIC */
  785.     "spanish",          L_SPANISH,    CM_INV,
  786.     "swedish",          L_SWEDISH,    0,
  787. #ifdef CYRILLIC
  788.     "ukrainian",        L_RUSSIAN,    0,
  789. #endif /* CYRILLIC */
  790.     "", 0, 0
  791. };
  792. int nlng = (sizeof(lngtab) / sizeof(struct keytab)) - 1; /* how many */
  793.  
  794.  
  795. /* Translation tables ... */
  796.  
  797. /*
  798.   For each pair of (transfer,file) character sets, we need two translation
  799.   functions, one for sending, one for receiving.
  800. */
  801.  
  802. /*
  803.   Here is the first table, Latin-1 to ASCII, fully annotated...
  804.   This one is absolutely NOT invertible, since we're going from an 8-bit
  805.   set to a 7-bit set.  Accented letters are mapped to unaccented
  806.   equivalents, C1 control characters are all translated to "?", etc.
  807. */
  808. CONST CHAR
  809. yl1as[] = {  /* ISO 8859-1 Latin Alphabet 1 to US ASCII */
  810.       /*  Source character    Description               => Translation */
  811.       /*  Dec row/col Set                                           */
  812.   0,  /*  000  00/00  C0 NUL  Ctrl-@                    =>  (self)  */
  813.   1,  /*  001  00/01  C0 SOH  Ctrl-A                    =>  (self)  */
  814.   2,  /*  002  00/02  C0 STX  Ctrl-B                    =>  (self)  */
  815.   3,  /*  003  00/03  C0 ETX  Ctrl-C                    =>  (self)  */
  816.   4,  /*  004  00/04  C0 EOT  Ctrl-D                    =>  (self)  */
  817.   5,  /*  005  00/05  C0 ENQ  Ctrl-E                    =>  (self)  */
  818.   6,  /*  006  00/06  C0 ACK  Ctrl-F                    =>  (self)  */
  819.   7,  /*  007  00/07  C0 BEL  Ctrl-G                    =>  (self)  */
  820.   8,  /*  008  00/08  C0 BS   Ctrl-H                    =>  (self)  */
  821.   9,  /*  009  00/09  C0 HT   Ctrl-I                    =>  (self)  */
  822.  10,  /*  010  00/10  C0 LF   Ctrl-J                    =>  (self)  */
  823.  11,  /*  011  00/11  C0 VT   Ctrl-K                    =>  (self)  */
  824.  12,  /*  012  00/12  C0 FF   Ctrl-L                    =>  (self)  */
  825.  13,  /*  013  00/13  C0 CR   Ctrl-M                    =>  (self)  */
  826.  14,  /*  014  00/14  C0 SO   Ctrl-N                    =>  (self)  */
  827.  15,  /*  015  00/15  C0 SI   Ctrl-O                    =>  (self)  */
  828.  16,  /*  016  01/00  C0 DLE  Ctrl-P                    =>  (self)  */
  829.  17,  /*  017  01/01  C0 DC1  Ctrl-Q                    =>  (self)  */
  830.  18,  /*  018  01/02  C0 DC2  Ctrl-R                    =>  (self)  */
  831.  19,  /*  019  01/03  C0 DC3  Ctrl-S                    =>  (self)  */
  832.  20,  /*  020  01/04  C0 DC4  Ctrl-T                    =>  (self)  */
  833.  21,  /*  021  01/05  C0 NAK  Ctrl-U                    =>  (self)  */
  834.  22,  /*  022  01/06  C0 SYN  Ctrl-V                    =>  (self)  */
  835.  23,  /*  023  01/07  C0 ETB  Ctrl-W                    =>  (self)  */
  836.  24,  /*  024  01/08  C0 CAN  Ctrl-X                    =>  (self)  */
  837.  25,  /*  025  01/09  C0 EM   Ctrl-Y                    =>  (self)  */
  838.  26,  /*  026  01/10  C0 SUB  Ctrl-Z                    =>  (self)  */
  839.  27,  /*  027  01/11  C0 ESC  Ctrl-[                    =>  (self)  */
  840.  28,  /*  028  01/12  C0 FS   Ctrl-\                    =>  (self)  */
  841.  29,  /*  029  01/13  C0 GS   Ctrl-]                    =>  (self)  */
  842.  30,  /*  030  01/14  C0 RS   Ctrl-^                    =>  (self)  */
  843.  31,  /*  031  01/15  C0 US   Ctrl-_                    =>  (self)  */
  844.  32,  /*  032  02/00     SP   Space                     =>  (self)  */
  845.  33,  /*  033  02/01  G0 !    Exclamation mark          =>  (self)  */
  846.  34,  /*  034  02/02  G0 "    Doublequote               =>  (self)  */
  847.  35,  /*  035  02/03  G0 #    Number sign               =>  (self)  */
  848.  36,  /*  036  02/04  G0 $    Dollar sign               =>  (self)  */
  849.  37,  /*  037  02/05  G0 %    Percent sign              =>  (self)  */
  850.  38,  /*  038  02/06  G0 &    Ampersand                 =>  (self)  */
  851.  39,  /*  039  02/07  G0 '    Apostrophe                =>  (self)  */
  852.  40,  /*  040  02/08  G0 (    Left parenthesis          =>  (self)  */
  853.  41,  /*  041  02/09  G0 )    Right parenthesis         =>  (self)  */
  854.  42,  /*  042  02/10  G0 *    Asterisk                  =>  (self)  */
  855.  43,  /*  043  02/11  G0 +    Plus sign                 =>  (self)  */
  856.  44,  /*  044  02/12  G0 ,    Comma                     =>  (self)  */
  857.  45,  /*  045  02/13  G0 -    Hyphen, minus sign        =>  (self)  */
  858.  46,  /*  046  02/14  G0 .    Period, full stop         =>  (self)  */
  859.  47,  /*  047  02/15  G0 /    Slash, solidus            =>  (self)  */
  860.  48,  /*  048  03/00  G0 0    Digit 0                   =>  (self)  */
  861.  49,  /*  049  03/01  G0 1    Digit 1                   =>  (self)  */
  862.  50,  /*  050  03/02  G0 2    Digit 2                   =>  (self)  */
  863.  51,  /*  051  03/03  G0 3    Digit 3                   =>  (self)  */
  864.  52,  /*  052  03/04  G0 4    Digit 4                   =>  (self)  */
  865.  53,  /*  053  03/05  G0 5    Digit 5                   =>  (self)  */
  866.  54,  /*  054  03/06  G0 6    Digit 6                   =>  (self)  */
  867.  55,  /*  055  03/07  G0 7    Digit 7                   =>  (self)  */
  868.  56,  /*  056  03/08  G0 8    Digit 8                   =>  (self)  */
  869.  57,  /*  057  03/09  G0 9    Digit 9                   =>  (self)  */
  870.  58,  /*  058  03/10  G0 :    Colon                     =>  (self)  */
  871.  59,  /*  059  03/11  G0 ;    Semicolon                 =>  (self)  */
  872.  60,  /*  060  03/12  G0 <    Less-than sign            =>  (self)  */
  873.  61,  /*  061  03/13  G0 =    Equals sign               =>  (self)  */
  874.  62,  /*  062  03/14  G0 >    Greater-than sign         =>  (self)  */
  875.  63,  /*  063  03/15  G0 ?    Question mark             =>  (self)  */
  876.  64,  /*  064  04/00  G0 @    Commercial at sign        =>  (self)  */
  877.  65,  /*  065  04/01  G0 A    Letter A                  =>  (self)  */
  878.  66,  /*  066  04/02  G0 B    Letter B                  =>  (self)  */
  879.  67,  /*  067  04/03  G0 C    Letter C                  =>  (self)  */
  880.  68,  /*  068  04/04  G0 D    Letter D                  =>  (self)  */
  881.  69,  /*  069  04/05  G0 E    Letter E                  =>  (self)  */
  882.  70,  /*  070  04/06  G0 F    Letter F                  =>  (self)  */
  883.  71,  /*  071  04/07  G0 G    Letter G                  =>  (self)  */
  884.  72,  /*  072  04/08  G0 H    Letter H                  =>  (self)  */
  885.  73,  /*  073  04/09  G0 I    Letter I                  =>  (self)  */
  886.  74,  /*  074  04/10  G0 J    Letter J                  =>  (self)  */
  887.  75,  /*  075  04/11  G0 K    Letter K                  =>  (self)  */
  888.  76,  /*  076  04/12  G0 L    Letter L                  =>  (self)  */
  889.  77,  /*  077  04/13  G0 M    Letter M                  =>  (self)  */
  890.  78,  /*  078  04/14  G0 N    Letter N                  =>  (self)  */
  891.  79,  /*  079  04/15  G0 O    Letter O                  =>  (self)  */
  892.  80,  /*  080  05/00  G0 P    Letter P                  =>  (self)  */
  893.  81,  /*  081  05/01  G0 Q    Letter Q                  =>  (self)  */
  894.  82,  /*  082  05/02  G0 R    Letter R                  =>  (self)  */
  895.  83,  /*  083  05/03  G0 S    Letter S                  =>  (self)  */
  896.  84,  /*  084  05/04  G0 T    Letter T                  =>  (self)  */
  897.  85,  /*  085  05/05  G0 U    Letter U                  =>  (self)  */
  898.  86,  /*  086  05/06  G0 V    Letter V                  =>  (self)  */
  899.  87,  /*  087  05/07  G0 W    Letter W                  =>  (self)  */
  900.  88,  /*  088  05/08  G0 X    Letter X                  =>  (self)  */
  901.  89,  /*  089  05/09  G0 Y    Letter Y                  =>  (self)  */
  902.  90,  /*  090  05/10  G0 Z    Letter Z                  =>  (self)  */
  903.  91,  /*  091  05/11  G0 [    Left square bracket       =>  (self)  */
  904.  92,  /*  092  05/12  G0 \    Reverse slash             =>  (self)  */
  905.  93,  /*  093  05/13  G0 ]    Right square bracket      =>  (self)  */
  906.  94,  /*  094  05/14  G0 ^    Circumflex accent         =>  (self)  */
  907.  95,  /*  095  05/15  G0 _    Underline, low line       =>  (self)  */
  908.  96,  /*  096  06/00  G0 `    Grave accent              =>  (self)  */
  909.  97,  /*  097  06/01  G0 a    Letter a                  =>  (self)  */
  910.  98,  /*  098  06/02  G0 b    Letter b                  =>  (self)  */
  911.  99,  /*  099  06/03  G0 c    Letter c                  =>  (self)  */
  912. 100,  /*  100  06/04  G0 d    Letter d                  =>  (self)  */
  913. 101,  /*  101  06/05  G0 e    Letter e                  =>  (self)  */
  914. 102,  /*  102  06/06  G0 f    Letter f                  =>  (self)  */
  915. 103,  /*  103  06/07  G0 g    Letter g                  =>  (self)  */
  916. 104,  /*  104  06/08  G0 h    Letter h                  =>  (self)  */
  917. 105,  /*  105  06/09  G0 i    Letter i                  =>  (self)  */
  918. 106,  /*  106  06/10  G0 j    Letter j                  =>  (self)  */
  919. 107,  /*  107  06/11  G0 k    Letter k                  =>  (self)  */
  920. 108,  /*  108  06/12  G0 l    Letter l                  =>  (self)  */
  921. 109,  /*  109  06/13  G0 m    Letter m                  =>  (self)  */
  922. 110,  /*  110  06/14  G0 n    Letter n                  =>  (self)  */
  923. 111,  /*  111  06/15  G0 o    Letter o                  =>  (self)  */
  924. 112,  /*  112  07/00  G0 p    Letter p                  =>  (self)  */
  925. 113,  /*  113  07/01  G0 q    Letter q                  =>  (self)  */
  926. 114,  /*  114  07/02  G0 r    Letter r                  =>  (self)  */
  927. 115,  /*  115  07/03  G0 s    Letter s                  =>  (self)  */
  928. 116,  /*  116  07/04  G0 t    Letter t                  =>  (self)  */
  929. 117,  /*  117  07/05  G0 u    Letter u                  =>  (self)  */
  930. 118,  /*  118  07/06  G0 v    Letter v                  =>  (self)  */
  931. 119,  /*  119  07/07  G0 w    Letter w                  =>  (self)  */
  932. 120,  /*  120  07/08  G0 x    Letter x                  =>  (self)  */
  933. 121,  /*  121  07/09  G0 y    Letter y                  =>  (self)  */
  934. 122,  /*  122  07/10  G0 z    Letter z                  =>  (self)  */
  935. 123,  /*  123  07/11  G0 {    Left curly bracket        =>  (self)  */
  936. 124,  /*  124  07/12  G0 |    Vertical bar              =>  (self)  */
  937. 125,  /*  125  07/13  G0 }    Right curly bracket       =>  (self)  */
  938. 126,  /*  126  07/14  G0 ~    Tilde                     =>  (self)  */
  939. 127,  /*  127  07/15     DEL  Delete, Rubout            =>  (self)  */
  940. UNK,  /*  128  08/00  C1                                =>  UNK     */
  941. UNK,  /*  129  08/01  C1                                =>  UNK     */
  942. UNK,  /*  130  08/02  C1                                =>  UNK     */
  943. UNK,  /*  131  08/03  C1                                =>  UNK     */
  944. UNK,  /*  132  08/04  C1 IND                            =>  UNK     */
  945. UNK,  /*  133  08/05  C1 NEL                            =>  UNK     */
  946. UNK,  /*  134  08/06  C1 SSA                            =>  UNK     */
  947. UNK,  /*  135  08/07  C1 ESA                            =>  UNK     */
  948. UNK,  /*  136  08/08  C1 HTS                            =>  UNK     */
  949. UNK,  /*  137  08/09  C1                                =>  UNK     */
  950. UNK,  /*  138  08/10  C1                                =>  UNK     */
  951. UNK,  /*  139  08/11  C1                                =>  UNK     */
  952. UNK,  /*  140  08/12  C1                                =>  UNK     */
  953. UNK,  /*  141  08/13  C1 RI                             =>  UNK     */
  954. UNK,  /*  142  08/14  C1 SS2                            =>  UNK     */
  955. UNK,  /*  143  08/15  C1 SS3                            =>  UNK     */
  956. UNK,  /*  144  09/00  C1 DCS                            =>  UNK     */
  957. UNK,  /*  145  09/01  C1                                =>  UNK     */
  958. UNK,  /*  146  09/02  C1                                =>  UNK     */
  959. UNK,  /*  147  09/03  C1 STS                            =>  UNK     */
  960. UNK,  /*  148  09/04  C1                                =>  UNK     */
  961. UNK,  /*  149  09/05  C1                                =>  UNK     */
  962. UNK,  /*  150  09/06  C1 SPA                            =>  UNK     */
  963. UNK,  /*  151  09/07  C1 EPA                            =>  UNK     */
  964. UNK,  /*  152  09/08  C1                                =>  UNK     */
  965. UNK,  /*  153  09/09  C1                                =>  UNK     */
  966. UNK,  /*  154  09/10  C1                                =>  UNK     */
  967. UNK,  /*  155  09/11  C1 CSI                            =>  UNK     */
  968. UNK,  /*  156  09/12  C1 ST                             =>  UNK     */
  969. UNK,  /*  157  09/13  C1 OSC                            =>  UNK     */
  970. UNK,  /*  158  09/14  C1 PM                             =>  UNK     */
  971. UNK,  /*  159  09/15  C1 APC                            =>  UNK     */
  972.  32,  /*  160  10/00  G1      No-break space            =>  SP      */
  973.  33,  /*  161  10/01  G1      Inverted exclamation      =>  !       */
  974.  99,  /*  162  10/02  G1      Cent sign                 =>  c       */
  975.  35,  /*  163  10/03  G1      Pound sign                =>  #       */
  976.  36,  /*  164  10/04  G1      Currency sign             =>  $       */
  977.  89,  /*  165  10/05  G1      Yen sign                  =>  Y       */
  978. 124,  /*  166  10/06  G1      Broken bar                =>  |       */
  979.  80,  /*  167  10/07  G1      Paragraph sign            =>  P       */
  980.  34,  /*  168  10/08  G1      Diaeresis                 =>  "       */
  981.  67,  /*  169  10/09  G1      Copyright sign            =>  C       */
  982.  97,  /*  170  10/10  G1      Feminine ordinal          =>  a       */
  983.  34,  /*  171  10/11  G1      Left angle quotation      =>  "       */
  984. 126,  /*  172  10/12  G1      Not sign                  =>  ~       */
  985.  45,  /*  173  10/13  G1      Soft hyphen               =>  -       */
  986.  82,  /*  174  10/14  G1      Registered trade mark     =>  R       */
  987.  95,  /*  175  10/15  G1      Macron                    =>  _       */
  988. 111,  /*  176  11/00  G1      Degree sign, ring above   =>  o       */
  989. UNK,  /*  177  11/01  G1      Plus-minus sign           =>  UNK     */
  990.  50,  /*  178  11/02  G1      Superscript two           =>  2       */
  991.  51,  /*  179  11/03  G1      Superscript three         =>  3       */
  992.  39,  /*  180  11/04  G1      Acute accent              =>  '       */
  993. 117,  /*  181  11/05  G1      Micro sign                =>  u       */
  994.  45,  /*  182  11/06  G1      Pilcrow sign              =>  -       */
  995.  45,  /*  183  11/07  G1      Middle dot                =>  -       */
  996.  44,  /*  184  11/08  G1      Cedilla                   =>  ,       */
  997.  49,  /*  185  11/09  G1      Superscript one           =>  1       */
  998. 111,  /*  186  11/10  G1      Masculine ordinal         =>  o       */
  999.  34,  /*  187  11/11  G1      Right angle quotation     =>  "       */
  1000. UNK,  /*  188  11/12  G1      One quarter               =>  UNK     */
  1001. UNK,  /*  189  11/13  G1      One half                  =>  UNK     */
  1002. UNK,  /*  190  11/14  G1      Three quarters            =>  UNK     */
  1003.  63,  /*  191  11/15  G1      Inverted question mark    =>  ?       */
  1004.  65,  /*  192  12/00  G1      A grave                   =>  A       */
  1005.  65,  /*  193  12/01  G1      A acute                   =>  A       */
  1006.  65,  /*  194  12/02  G1      A circumflex              =>  A       */
  1007.  65,  /*  195  12/03  G1      A tilde                   =>  A       */
  1008.  65,  /*  196  12/04  G1      A diaeresis               =>  A       */
  1009.  65,  /*  197  12/05  G1      A ring above              =>  A       */
  1010.  65,  /*  198  12/06  G1      A with E                  =>  A       */
  1011.  67,  /*  199  12/07  G1      C Cedilla                 =>  C       */
  1012.  69,  /*  200  12/08  G1      E grave                   =>  E       */
  1013.  69,  /*  201  12/09  G1      E acute                   =>  E       */
  1014.  69,  /*  202  12/10  G1      E circumflex              =>  E       */
  1015.  69,  /*  203  12/11  G1      E diaeresis               =>  E       */
  1016.  73,  /*  204  12/12  G1      I grave                   =>  I       */
  1017.  73,  /*  205  12/13  G1      I acute                   =>  I       */
  1018.  73,  /*  206  12/14  G1      I circumflex              =>  I       */
  1019.  73,  /*  207  12/15  G1      I diaeresis               =>  I       */
  1020.  68,  /*  208  13/00  G1      Icelandic Eth             =>  D       */
  1021.  78,  /*  209  13/01  G1      N tilde                   =>  N       */
  1022.  79,  /*  210  13/02  G1      O grave                   =>  O       */
  1023.  79,  /*  211  13/03  G1      O acute                   =>  O       */
  1024.  79,  /*  212  13/04  G1      O circumflex              =>  O       */
  1025.  79,  /*  213  13/05  G1      O tilde                   =>  O       */
  1026.  79,  /*  214  13/06  G1      O diaeresis               =>  O       */
  1027. 120,  /*  215  13/07  G1      Multiplication sign       =>  x       */
  1028.  79,  /*  216  13/08  G1      O oblique stroke          =>  O       */
  1029.  85,  /*  217  13/09  G1      U grave                   =>  U       */
  1030.  85,  /*  218  13/10  G1      U acute                   =>  U       */
  1031.  85,  /*  219  13/11  G1      U circumflex              =>  U       */
  1032.  85,  /*  220  13/12  G1      U diaeresis               =>  U       */
  1033.  89,  /*  221  13/13  G1      Y acute                   =>  Y       */
  1034.  84,  /*  222  13/14  G1      Icelandic Thorn           =>  T       */
  1035. 115,  /*  223  13/15  G1      German sharp s            =>  s       */
  1036.  97,  /*  224  14/00  G1      a grave                   =>  a       */
  1037.  97,  /*  225  14/01  G1      a acute                   =>  a       */
  1038.  97,  /*  226  14/02  G1      a circumflex              =>  a       */
  1039.  97,  /*  227  14/03  G1      a tilde                   =>  a       */
  1040.  97,  /*  228  14/04  G1      a diaeresis               =>  a       */
  1041.  97,  /*  229  14/05  G1      a ring above              =>  a       */
  1042.  97,  /*  230  14/06  G1      a with e                  =>  a       */
  1043.  99,  /*  231  14/07  G1      c cedilla                 =>  c       */
  1044. 101,  /*  232  14/08  G1      e grave                   =>  e       */
  1045. 101,  /*  233  14/09  G1      e acute                   =>  e       */
  1046. 101,  /*  234  14/10  G1      e circumflex              =>  e       */
  1047. 101,  /*  235  14/11  G1      e diaeresis               =>  e       */
  1048. 105,  /*  236  14/12  G1      i grave                   =>  i       */
  1049. 105,  /*  237  14/13  G1      i acute                   =>  i       */
  1050. 105,  /*  238  14/14  G1      i circumflex              =>  i       */
  1051. 105,  /*  239  14/15  G1      i diaeresis               =>  i       */
  1052. 100,  /*  240  15/00  G1      Icelandic eth             =>  d       */
  1053. 110,  /*  241  15/01  G1      n tilde                   =>  n       */
  1054. 111,  /*  242  15/02  G1      o grave                   =>  o       */
  1055. 111,  /*  243  15/03  G1      o acute                   =>  o       */
  1056. 111,  /*  244  15/04  G1      o circumflex              =>  o       */
  1057. 111,  /*  245  15/05  G1      o tilde                   =>  o       */
  1058. 111,  /*  246  15/06  G1      o diaeresis               =>  o       */
  1059.  47,  /*  247  15/07  G1      Division sign             =>  /       */
  1060. 111,  /*  248  15/08  G1      o oblique stroke          =>  o       */
  1061. 117,  /*  249  15/09  G1      u grave                   =>  u       */
  1062. 117,  /*  250  15/10  G1      u acute                   =>  u       */
  1063. 117,  /*  251  15/11  G1      u circumflex              =>  u       */
  1064. 117,  /*  252  15/12  G1      u diaeresis               =>  u       */
  1065. 121,  /*  253  15/13  G1      y acute                   =>  y       */
  1066. 116,  /*  254  15/14  G1      Icelandic thorn           =>  t       */
  1067. 121   /*  255  15/15  G1      y diaeresis               =>  y       */
  1068. };
  1069.  
  1070.  
  1071. /* Translation tables for ISO Latin Alphabet 1 to local file character sets */
  1072.  
  1073. /*
  1074.   Most of the remaining tables are not annotated like the one above, because
  1075.   the size of the resulting source file would be ridiculous.  Each row in the
  1076.   following tables corresponds to a column of ISO 8859-1.
  1077. */
  1078.  
  1079. CONST CHAR
  1080. yl185[] = {  /* ISO 8859-1 Latin Alphabet 1 (Latin-1) to IBM Code Page 850 */
  1081. /*
  1082.   This is based on IBM's official invertible translation.  Reference: IBM
  1083.   Character Data Representation Architecture (CDRA), Level 1, Registry,
  1084.   SC09-1291-00 (1990), p.152.  (Note: Latin-1 is IBM Code Page 00819.)  Note:
  1085.   IBM's bizarre rearrangement of C0 controls and DEL has been undone in this
  1086.   table.
  1087. */
  1088.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1089.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1090.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1091.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1092.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1093.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1094.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1095. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1096. 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
  1097. 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
  1098. 255, 173, 189, 156, 207, 190, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
  1099. 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
  1100. 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
  1101. 209, 165, 227, 224, 226, 229, 153, 158, 157, 235, 233, 234, 154, 237, 232, 225,
  1102. 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
  1103. 208, 164, 149, 162, 147, 228, 148, 246, 155, 151, 163, 150, 129, 236, 231, 152
  1104. };
  1105.  
  1106. CONST CHAR
  1107. y85l1[] = {  /* IBM Code Page 850 to Latin-1 */
  1108. /*
  1109.   This is from IBM CDRA page 153.  It is the inverse of yl185[].
  1110.   As of edit 183, this table is no longer pure CDRA.  The translations
  1111.   involving C0 controls and DEL have been removed.
  1112. */
  1113.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1114.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1115.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1116.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1117.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1118.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1119.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1120. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1121. 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
  1122. 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 248, 163, 216, 215, 159,
  1123. 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
  1124. 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 162, 165, 147,
  1125. 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
  1126. 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
  1127. 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
  1128. 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
  1129. };
  1130.  
  1131. #ifdef COMMENT
  1132. CONST CHAR
  1133. yl1r8[] = {  /* Latin-1 to Hewlett Packard Roman8 */
  1134. /* This is HP's official translation, straight from iconv */
  1135. /* It is NOT invertible. */
  1136.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1137.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1138.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1139.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1140.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1141.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1142.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1143. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1144. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1145. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1146. 160, 184, 191, 187, 186, 188, 124, 189, 171,  99, 249, 251, 126,  45,  82, 176,
  1147. 179, 254,  50,  51, 168, 243, 244, 242,  44,  49, 250, 253, 247, 248, 245, 185,
  1148. 161, 224, 162, 225, 216, 208, 211, 180, 163, 220, 164, 165, 230, 229, 166, 167,
  1149. 227, 182, 232, 231, 223, 233, 218, 120, 210, 173, 237, 174, 219, 177, 240, 222,
  1150. 200, 196, 192, 226, 204, 212, 215, 181, 201, 197, 193, 205, 217, 213, 209, 221,
  1151. 228, 183, 202, 198, 194, 234, 206,  47, 214, 203, 199, 195, 207, 178, 241, 239
  1152. };
  1153. CONST CHAR
  1154. yr8l1[] = {  /* Hewlett Packard Roman8 to Latin-1 */
  1155. /* This is HP's official translation, straight from iconv */
  1156. /* It is NOT invertible. */
  1157.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1158.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1159.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1160.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1161.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1162.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1163.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1164. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1165. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1166. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1167. 160, 192, 194, 200, 202, 203, 206, 207, 180,  96,  94, 168, 126, 217, 219, 163,
  1168. 175, 221, 253, 176, 199, 231, 209, 241, 161, 191, 164, 163, 165, 167, 102, 162,
  1169. 226, 234, 244, 251, 225, 233, 243, 250, 224, 232, 242, 249, 228, 235, 246, 252,
  1170. 197, 238, 216, 198, 229, 237, 248, 230, 196, 236, 214, 220, 201, 239, 223, 212,
  1171. 193, 195, 227, 208, 240, 205, 204, 211, 210, 213, 245,  83, 115, 218,  89, 255,
  1172. 222, 254, 183, 181, 182, 190,  45, 188, 189, 170, 186, 171,  42, 187, 177, 160
  1173. };
  1174. #else /* !COMMENT */
  1175. /* This is an invertible mapping, approved by HP in January 1994. */
  1176. CONST CHAR
  1177. yl1r8[] = {  /* ISO Latin-1 to HP Roman8, Invertible */
  1178.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1179.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1180.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1181.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1182.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1183.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1184.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1185. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1186. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1187. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1188. 160, 184, 191, 187, 186, 188, 169, 189, 171, 170, 249, 251, 172, 175, 190, 176,
  1189. 179, 254, 235, 236, 168, 243, 244, 242, 238, 246, 250, 253, 247, 248, 245, 185,
  1190. 161, 224, 162, 225, 216, 208, 211, 180, 163, 220, 164, 165, 230, 229, 166, 167,
  1191. 227, 182, 232, 231, 223, 233, 218, 252, 210, 173, 237, 174, 219, 177, 240, 222,
  1192. 200, 196, 192, 226, 204, 212, 215, 181, 201, 197, 193, 205, 217, 213, 209, 221,
  1193. 228, 183, 202, 198, 194, 234, 206, 255, 214, 203, 199, 195, 207, 178, 241, 239
  1194. };
  1195.  
  1196. CONST CHAR
  1197. yr8l1[] = { /* HP Roman8 to ISO Latin-1, Invertible */
  1198.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1199.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1200.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1201.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1202.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1203.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1204.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1205. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1206. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1207. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1208. 160, 192, 194, 200, 202, 203, 206, 207, 180, 166, 169, 168, 172, 217, 219, 173,
  1209. 175, 221, 253, 176, 199, 231, 209, 241, 161, 191, 164, 163, 165, 167, 174, 162,
  1210. 226, 234, 244, 251, 225, 233, 243, 250, 224, 232, 242, 249, 228, 235, 246, 252,
  1211. 197, 238, 216, 198, 229, 237, 248, 230, 196, 236, 214, 220, 201, 239, 223, 212,
  1212. 193, 195, 227, 208, 240, 205, 204, 211, 210, 213, 245, 178, 179, 218, 184, 255,
  1213. 222, 254, 183, 181, 182, 190, 185, 188, 189, 170, 186, 171, 215, 187, 177, 247
  1214. };
  1215. #endif /* COMMENT */
  1216.  
  1217. CONST CHAR
  1218. yl143[] = {  /* Latin-1 to IBM Code Page 437 */
  1219. /*
  1220.   Although the IBM CDRA does not include an official translation between CP437
  1221.   and ISO Latin Alphabet 1, it does include an official, invertible
  1222.   translation between CP437 and CP850 (page 196), and another from CP850 to
  1223.   Latin-1 (CP819) (page 153).  This translation was obtained with a two-step
  1224.   process based on those tables.
  1225.   As of edit 183, the translation is modified to leave C0 controls alone.
  1226. */
  1227.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1228.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1229.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1230.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1231.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1232.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1233.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1234. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1235. 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
  1236. 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
  1237. 255, 173, 155, 156, 207, 157, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
  1238. 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
  1239. 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
  1240. 209, 165, 227, 224, 226, 229, 153, 158, 190, 235, 233, 234, 154, 237, 232, 225,
  1241. 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
  1242. 208, 164, 149, 162, 147, 228, 148, 246, 189, 151, 163, 150, 129, 236, 231, 152
  1243. };
  1244.  
  1245. CONST CHAR
  1246. y43l1[] = {  /* IBM Code Page 437 to Latin-1 */
  1247. /*
  1248.   This table is the inverse of yl143[].
  1249. */
  1250.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1251.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1252.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1253.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1254.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1255.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1256.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1257. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1258. 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
  1259. 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 215, 159,
  1260. 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
  1261. 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 248, 216, 147,
  1262. 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
  1263. 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
  1264. 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
  1265. 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
  1266. };
  1267.  
  1268. CONST CHAR
  1269. yl1aq[] = {  /* Latin-1 to Extended Mac Latin (based on Apple QuickDraw) */
  1270.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1271.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1272.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1273.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1274.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1275.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1276.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1277. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1278. 182, 183, 184, 185, 189, 196, 197, 198, 206, 207, 210, 211, 217, 218, 195, 212,
  1279. 209, 215, 213, 226, 227, 228, 240, 245, 246, 247, 249, 250, 251, 253, 254, 255,
  1280. 202, 193, 162, 163, 219, 180, 201, 164, 172, 169, 187, 199, 194, 208, 168, 248,
  1281. 161, 177, 170, 173, 171, 181, 166, 225, 252, 176, 188, 200, 178, 179, 186, 192,
  1282. 203, 231, 229, 204, 128, 129, 174, 130, 233, 131, 230, 232, 237, 234, 235, 236,
  1283. 220, 132, 241, 238, 239, 205, 133, 165, 175, 244, 242, 243, 134, 160, 222, 167,
  1284. 136, 135, 137, 139, 138, 140, 190, 141, 143, 142, 144, 145, 147, 146, 148, 149,
  1285. 221, 150, 152, 151, 153, 155, 154, 214, 191, 157, 156, 158, 159, 224, 223, 216
  1286. };
  1287.  
  1288. CONST CHAR
  1289. yl1du[] = {  /* Latin-1 to Dutch ISO 646 */
  1290.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1291.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1292.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1293.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1294. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1295.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1296.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1297. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK,  39, 127,
  1298. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1299. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1300.  32,  33, UNK,  35, 124, UNK, UNK,  93, 123,  67, UNK,  34, UNK,  45,  82, UNK,
  1301.  91, UNK, UNK, UNK, 126, 117, UNK, UNK,  44, UNK, UNK,  34, 125,  92,  64,  63,
  1302.  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1303. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1304.  97,  97,  97,  97,  97,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  1305. UNK, 110, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK,  91
  1306. };
  1307.  
  1308. CONST CHAR
  1309. yl1fi[] = {  /* Latin-1 to Finnish ISO NRC (*not* ISO 646) */
  1310.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1311.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1312.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1313.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1314.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1315.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  1316. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1317. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1318. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1319. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1320.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1321. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1322.  65,  65,  65,  65,  91,  93,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1323. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
  1324.  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
  1325. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
  1326. };
  1327.  
  1328. CONST CHAR
  1329. yl1fr[] = {  /* Latin-1 to French ISO 646 */
  1330.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1331.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1332.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1333.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1334. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1335.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1336.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1337. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1338. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1339. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1340.  32,  33, UNK,  35, UNK, UNK, UNK,  93,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1341.  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1342.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1343. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1344.  64,  97,  97,  97,  97,  97,  97,  92, 125, 123, 101, 101, 105, 105, 105, 105,
  1345. UNK, 110, 111, 111, 111, 111, 111,  47, 111, 124, 117, 117, 117, 121, UNK, 121
  1346. };
  1347.  
  1348. CONST CHAR
  1349. yl1fc[] = {  /* Latin-1 to French-Canadian ISO 646 */
  1350.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1351.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1352.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1353.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1354. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1355.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  1356. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1357. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1358. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1359. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1360.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1361. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1362.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1363. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1364.  64,  97,  91,  97,  97,  97,  97,  92, 125, 123,  93, 101, 105, 105,  94, 105,
  1365. UNK, 110, 111, 111,  96, 111, 111,  47, 111, 124, 117, 126, 117, 121, UNK, 121
  1366. };
  1367.  
  1368. CONST CHAR
  1369. yl1ge[] = {  /* Latin-1 to German ISO 646 */
  1370.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1371.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1372.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1373.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1374. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1375.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1376.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1377. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1378. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1379. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1380.  32,  33, UNK, UNK, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1381. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1382.  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1383. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 126,
  1384.  97,  97,  97,  97, 123,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  1385. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
  1386. };
  1387.  
  1388. CONST CHAR
  1389. yl1hu[] = {  /* Latin-1 to Hungarian ISO-646 */
  1390.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1391.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1392.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1393.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1394.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1395.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1396.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1397. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1398. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1399. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1400.  32,  33, UNK, UNK,  36, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1401. UNK,  64, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1402.  65,  65,  65,  65,  65,  65,  65,  67,  69,  91,  69,  69,  73,  73,  73,  73,
  1403. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 115,
  1404.  97,  96,  97,  97,  97,  97,  97,  99, 101, 123, 101, 101, 105, 105, 105, 105,
  1405. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
  1406. };
  1407.  
  1408. CONST CHAR
  1409. yl1it[] = {  /* Latin-1 to Italian ISO 646 */
  1410.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1411.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1412.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1413.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1414. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1415.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1416. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1417. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1418. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1419. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1420.  32,  33, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1421.  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1422.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1423. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1424. 123,  97,  97,  97,  97,  97,  97,  92, 125,  93, 101, 101, 126, 105, 105, 105,
  1425. UNK, 110, 124, 111, 111, 111, 111,  47, 111,  96, 117, 117, 117, 121, UNK, 121
  1426. };
  1427.  
  1428. CONST CHAR
  1429. yl1ne[] = {  /* Latin-1 to NeXT */
  1430. /* NEED TO MAKE THIS ONE INVERTIBLE, LIKE CP850 */
  1431. /*
  1432.   Which means finding all the graphic characters in the NeXT set that have
  1433.   no equivalent in Latin-1 and assigning them to the UNK positions (mostly
  1434.   Latin-1 C1 controls).  Then make the ynel1[] table be the inverse of this
  1435.   one.  But first we should try to get an official Latin-1/NeXT translation
  1436.   table from NeXT, Inc.
  1437. */
  1438.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1439.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1440.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1441.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1442.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1443.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1444.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1445. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1446. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1447. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1448.  32, 161, 162, 163, 168, 165, 181, 167, 200, 160, 227, 171, 190, UNK, 176, 197,
  1449. 202, 209, 201, 204, 194, 157, 182, 183, 203, 192, 235, 187, 210, 211, 212, 191,
  1450. 129, 130, 131, 132, 133, 134, 225, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1451. 144, 145, 146, 147, 148, 149, 150, 158, 233, 151, 152, 153, 154, 155, 156, 251,
  1452. 213, 214, 215, 216, 217, 218, 241, 219, 220, 221, 222, 223, 224, 226, 228, 229,
  1453. 230, 231, 236, 237, 238, 239, 240, 159, 249, 242, 243, 244, 246, 247, 252, 253
  1454. };
  1455.  
  1456. CONST CHAR
  1457. yl1no[] = {  /* Latin-1 to Norwegian/Danish ISO 646 */
  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, UNK, UNK, UNK,  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, UNK, UNK, UNK, 126, 127,
  1466. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1467. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1468.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1469. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1470.  65,  65,  65,  65,  65,  93,  91,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1471. UNK,  78,  79,  79,  79,  79,  79, 120,  92,  85,  85,  85,  85,  89, UNK, 115,
  1472.  97,  97,  97,  97,  97, 125, 123,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  1473. UNK, 110, 111, 111, 111, 111, 111,  47, 124, 117, 117, 117, 117, 121, UNK, 121
  1474. };
  1475.  
  1476. CONST CHAR
  1477. yl1po[] = {  /* Latin-1 to Portuguese ISO 646 */
  1478.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1479.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1480.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1481.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1482.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1483.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1484.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1485. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, 126, 127,
  1486. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1487. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1488.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1489. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1490.  65,  65,  65,  91,  65,  65,  65,  92,  69,  69,  69,  69,  73,  73,  73,  73,
  1491. UNK,  78,  79,  79,  79,  93,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1492.  97,  97,  97, 123,  97,  97,  97, 124, 101, 101, 101, 101, 105, 105, 105, 105,
  1493. UNK, 110, 111, 111, 111, 125, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
  1494. };
  1495.  
  1496. CONST CHAR
  1497. yl1sp[] = {  /* Latin-1 to Spanish ISO 646 */
  1498.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1499.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1500.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1501.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1502. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1503.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1504.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1505. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,  96, UNK, UNK, 126, 127,
  1506. 126, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1507. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1508.  32,  91, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1509. 123, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  93,
  1510.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1511. UNK,  92,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1512. 124,  97,  97,  97,  97,  97,  97, 125, 101, 101, 101, 101, 105, 105, 105, 105,
  1513. UNK, 124, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
  1514. };
  1515.  
  1516. CONST CHAR
  1517. yl1sw[] = {  /* Latin-1 to Swedish ISO 646 */
  1518.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1519.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1520.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1521.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1522. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1523.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  1524. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1525. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1526. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1527. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1528.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1529. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1530.  65,  65,  65,  65,  91,  93,  65,  67,  69,  64,  69,  69,  73,  73,  73,  73,
  1531. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
  1532.  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
  1533. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
  1534. };
  1535.  
  1536. CONST CHAR
  1537. yl1ch[] = {  /* Latin-1 to Swiss ISO 646 */
  1538.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1539.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1540.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1541.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1542. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1543.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK, UNK,
  1544.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1545. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1546. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1547. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1548.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1549. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1550.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1551. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1552.  64,  97,  97,  97, 123,  97,  97,  92,  95,  91,  93, 101, 105, 105,  94, 105,
  1553. UNK, 110, 111, 111,  96, 111, 124,  47, 111,  35, 117, 126, 125, 121, UNK, 121
  1554. };
  1555.  
  1556. CONST CHAR
  1557. yl1dm[] = {  /* Latin-1 to DEC Multinational Character Set */
  1558.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1559.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1560.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1561.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1562.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1563.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1564.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1565. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1566. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1567. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1568.  32, 161, 162, 163, 168, 165, 124, 167,  34, 169, 170, 171, 126, UNK,  82, UNK,
  1569. 176, 177, 178, 179,  39, 181, 182, 183,  44, 185, 186, 187, 188, 189, UNK, 191,
  1570. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1571. UNK, 209, 210, 211, 212, 213, 214, 120, 216, 217, 218, 219, 220, 221, UNK, 223,
  1572. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1573. UNK, 241, 242, 243, 244, 245, 246,  47, 248, 249, 250, 251, 252, UNK, UNK, 253
  1574. };
  1575.  
  1576. CONST CHAR
  1577. yl1dg[] = {  /* Latin-1 to Data General International Character Set */
  1578.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1579.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1580.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1581.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1582.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1583.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1584.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1585. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1586. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1587. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1588. 160, 171, 167, 168, 166, 181, 191, 187, 189, 173, 169, 177, 161, 255, 174, 175,
  1589. 188, 182, 164, 165, 190, 163, 178, 185, 186, 179, 170, 176, 223, 162, 220, 172,
  1590. 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
  1591. 184, 208, 210, 209, 211, 213, 212, 215, 214, 217, 216, 218, 219, 221, 222, 252,
  1592. 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
  1593. 183, 240, 242, 241, 243, 245, 244, 247, 246, 249, 248, 250, 251, 180, 254, 253
  1594. };
  1595.  
  1596.  
  1597. /* Local file character sets to ISO Latin Alphabet 1 */
  1598.  
  1599. #ifdef NOTUSED
  1600. CONST CHAR
  1601. yasl1[] = {  /* ASCII to Latin-1 */
  1602.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1603.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1604.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1605.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1606.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1607.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1608.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1609. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127
  1610. };
  1611. #endif /* NOTUSED */
  1612.  
  1613. CONST CHAR
  1614. yaql1[] = {  /* Extended Mac Latin (based on Apple Quickdraw) to Latin-1 */
  1615.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1616.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1617.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1618.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1619.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1620.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1621.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1622. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1623. 196, 197, 199, 201, 209, 214, 220, 225, 224, 226, 228, 227, 229, 231, 233, 232,
  1624. 234, 235, 237, 236, 238, 239, 241, 243, 242, 244, 246, 245, 250, 249, 251, 252,
  1625. 221, 176, 162, 163, 167, 215, 182, 223, 174, 169, 178, 180, 168, 179, 198, 216,
  1626. 185, 177, 188, 189, 165, 181, 128, 129, 130, 131, 190, 170, 186, 132, 230, 248,
  1627. 191, 161, 172, 142, 133, 134, 135, 171, 187, 166, 160, 192, 195, 213, 136, 137,
  1628. 173, 144, 138, 139, 143, 146, 247, 145, 255, 140, 141, 164, 208, 240, 222, 254,
  1629. 253, 183, 147, 148, 149, 194, 202, 193, 203, 200, 205, 206, 207, 204, 211, 212,
  1630. 150, 210, 218, 219, 217, 151, 152, 153, 175, 154, 155, 156, 184, 157, 158, 159
  1631. };
  1632.  
  1633. CONST CHAR
  1634. ydul1[] = {  /* Dutch ISO 646 to Latin-1 */
  1635.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1636.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1637.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1638.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1639. 190,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1640.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 255, 189, 124,  94,  95,
  1641.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1642. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 168, 164, 188,  39, 127
  1643. };
  1644.  
  1645. CONST CHAR
  1646. yfil1[] = {  /* Finnish NRC (*not* ISO-646) to Latin-1 */
  1647.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1648.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1649.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1650.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1651.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1652.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
  1653. 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1654. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
  1655. };
  1656.  
  1657. CONST CHAR
  1658. yfrl1[] = {  /* French ISO 646 to Latin-1 */
  1659.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1660.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1661.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1662.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1663. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1664.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 167,  94,  95,
  1665.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1666. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 168, 127
  1667. };
  1668.  
  1669. CONST CHAR
  1670. yfcl1[] = {  /* French-Canadian ISO 646 to Latin-1 */
  1671.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1672.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1673.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1674.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1675. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1676.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 226, 231, 234, 238,  95,
  1677. 244,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1678. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 251, 127
  1679. };
  1680.  
  1681. CONST CHAR
  1682. ygel1[] = {  /* German ISO 646 to Latin-1 */
  1683.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1684.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1685.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1686.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1687. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1688.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 220,  94,  95,
  1689.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1690. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 252, 223, 127
  1691. };
  1692.  
  1693. CONST CHAR
  1694. yitl1[] = {  /* Italian ISO 646 to Latin-1 */
  1695.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1696.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1697.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1698.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1699. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1700.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 233,  94,  95,
  1701. 249,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1702. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 224, 242, 232, 236, 127
  1703. };
  1704.  
  1705. CONST CHAR
  1706. ynel1[] = {  /* NeXT to Latin-1 */
  1707. /* NEED TO MAKE THIS ONE INVERTIBLE */
  1708.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1709.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1710.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1711.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1712.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1713.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1714.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1715. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1716. 160, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1717. 208, 209, 210, 211, 212, 213, 214, 217, 218, 219, 220, 221, 222, 181, 215, 247,
  1718. 169, 161, 162, 163, UNK, 165, UNK, 167, 164, UNK, UNK, 171, UNK, UNK, UNK, UNK,
  1719. 174, UNK, UNK, UNK, 183, 166, 182, UNK, UNK, UNK, UNK, 187, UNK, UNK, 172, 191,
  1720. 185,  96, 180,  94, 126, 175, UNK, UNK, 168, 178, 176, 184, 179, UNK, UNK, UNK,
  1721. UNK, 177, 188, 189, 190, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235,
  1722. 236, 198, 237, 170, 238, 239, 240, 241, UNK, 216, UNK, 186, 242, 243, 244, 245,
  1723. 246, 230, 249, 250, 251, UNK, 252, 253, UNK, 248, UNK, 223, 254, 255, UNK, UNK
  1724. };
  1725.  
  1726. CONST CHAR
  1727. ynol1[] = {  /* Norwegian/Danish ISO 646 to Latin-1 */
  1728.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1729.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1730.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1731.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1732.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1733.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 198, 216, 197,  94,  95,
  1734.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1735. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 230, 248, 229, 126, 127
  1736. };
  1737.  
  1738. CONST CHAR
  1739. ypol1[] = {  /* Portuguese ISO 646 to Latin-1 */
  1740.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1741.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1742.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1743.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1744.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1745.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 195, 199, 213,  94,  95,
  1746.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1747. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 227, 231, 245, 126, 127
  1748. };
  1749.  
  1750. CONST CHAR
  1751. yspl1[] = {  /* Spanish ISO 646 to Latin-1 */
  1752.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1753.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1754.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1755.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1756. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1757.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 161, 209, 191,  94,  95,
  1758.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1759. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 176, 241, 231, 126, 127
  1760. };
  1761.  
  1762. CONST CHAR
  1763. yswl1[] = {  /* Swedish ISO 646 to Latin-1 */
  1764.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1765.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1766.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1767.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1768. 201,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1769.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
  1770. 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1771. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
  1772. };
  1773.  
  1774. CONST CHAR
  1775. ychl1[] = {  /* Swiss ISO 646 to Latin-1 */
  1776.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1777.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1778.  32,  33,  34, 249,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1779.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1780. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1781.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 233, 231, 234, 238, 232,
  1782. 244,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1783. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 252, 251, 127
  1784. };
  1785.  
  1786. CONST CHAR
  1787. yhul1[] = {  /* Hungarian ISO 646 to Latin-1 */
  1788.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1789.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1790.  32,  33,  34,  35, 164,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1791.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1792. 193,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1793.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 201, 214, 220,  94,  95,
  1794. 225,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1795. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 246, 252,  34, 127
  1796. };
  1797.  
  1798. CONST CHAR
  1799. ydml1[] = {  /* DEC Multinational Character Set to Latin-1 */
  1800. /* Note: This is a null translation */
  1801.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1802.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1803.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1804.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1805.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1806.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1807.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1808. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1809. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1810. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1811. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1812. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1813. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1814. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1815. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1816. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  1817. };
  1818.  
  1819. CONST CHAR
  1820. ydgl1[] = {  /* Data General International to Latin-1 */
  1821.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1822.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1823.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1824.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1825.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1826.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1827.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1828. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1829. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1830. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1831. 160, 172, 189, 181, 178, 179, 164, 162, 163, 170, 186, 161, 191, 169, 174, 175,
  1832. 187, 171, 182, 185, 253, 165, 177, 240, 208, 183, 184, 167, 176, 168, 180, 166,
  1833. 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
  1834. 209, 211, 210, 212, 214, 213, 216, 215, 218, 217, 219, 220, 190, 221, 222, 188,
  1835. 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
  1836. 241, 243, 242, 244, 246, 245, 248, 247, 250, 249, 251, 252, 223, 255, 254, 173
  1837. };
  1838.  
  1839.  
  1840. /* Translation tables for Cyrillic character sets */
  1841.  
  1842. #ifdef CYRILLIC
  1843. CONST CHAR
  1844. ylcac[] = {  /* Latin/Cyrillic to CP866 */
  1845.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1846.  16,  17,  18,  19, 208, 209,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1847.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1848.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1849.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1850.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1851.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1852. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1853. 196, 179, 192, 217, 191, 218, 195, 193, 180, 194, 197, 176, 177, 178, 211, 216,
  1854. 205, 186, 200, 188, 187, 201, 204, 202, 185, 203, 206, 223, 220, 219, 254, UNK,
  1855. 255, 240, 132, 131, 242,  83,  73, 244,  74, 139, 141, 151, 138,  45, 246, 135,
  1856. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1857. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1858. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1859. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1860. 252, 241, 164, 163, 243, 115, 105, 245, 106, 171, 173, 231, 170,  21, 247, 167
  1861. };
  1862.  
  1863. CONST CHAR
  1864. ylc55[] = {  /* Latin/Cyrillic to CP855 (inverse of y55lc) */
  1865.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1866.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1867.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1868.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1869.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1870.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1871.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1872. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1873. 174, 175, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194, 195,
  1874. 196, 197, 200, 201, 202, 203, 204, 205, 206, 207, 217, 218, 219, 220, 223, 254,
  1875. 255, 133, 129, 131, 135, 137, 139, 141, 143, 145, 147, 149, 151, 240, 153, 155,
  1876. 161, 163, 236, 173, 167, 169, 234, 244, 184, 190, 199, 209, 211, 213, 215, 221,
  1877. 226, 228, 230, 232, 171, 182, 165, 252, 246, 250, 159, 242, 238, 248, 157, 224,
  1878. 160, 162, 235, 172, 166, 168, 233, 243, 183, 189, 198, 208, 210, 212, 214, 216,
  1879. 225, 227, 229, 231, 170, 181, 164, 251, 245, 249, 158, 241, 237, 247, 156, 222,
  1880. 239, 132, 128, 130, 134, 136, 138, 140, 142, 144, 146, 148, 150, 253, 152, 154
  1881. };
  1882.  
  1883. CONST CHAR
  1884. ylc1251[] = {  /* Latin/Cyrillic to CP1251 (inverse of y1251lc) */
  1885.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1886.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1887.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1888.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1889.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1890.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1891.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1892. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1893. 130, 132, 133, 134, 135, 136, 137, 139, 145, 146, 147, 148, 149, 150, 151, 152,
  1894. 153, 155, 164, 165, 166, 169, 171, 172, 174, 176, 177, 180, 181, 182, 183, 187,
  1895. 160, 168, 128, 129, 170, 189, 178, 175, 163, 138, 140, 142, 141, 173, 161, 143,
  1896. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1897. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1898. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1899. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
  1900. 185, 184, 144, 131, 186, 190, 179, 191, 188, 154, 156, 158, 157, 167, 162, 159
  1901. };
  1902.  
  1903. CONST CHAR
  1904. ylcbu[] = {  /* Latin/Cyrillic to Bulgarian PC Code Page */
  1905.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1906.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1907.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1908.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1909.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1910.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1911.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1912. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1913. 255, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
  1914. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1915. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1916. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1917. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1918. 213, 207, 208, 209, 210, 211, 212, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1919. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1920. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 214, 253, 254
  1921. };
  1922.  
  1923. CONST CHAR
  1924. ylck8[] = {  /* Latin/Cyrillic to Old KOI-8 Cyrillic */
  1925.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1926.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1927.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1928.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1929.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1930.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1931.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1932. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1933. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1934. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1935. UNK, 229, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 235, UNK, 245, UNK,
  1936. 225, 226, 247, 231, 228, 229, 246, 250, 233, 234, 235, 236, 237, 238, 239, 240,
  1937. 242, 243, 244, 245, 230, 232, 227, 254, 251, 253, 255, 249, 248, 252, 224, 241,
  1938. 193, 194, 215, 199, 196, 197, 214, 218, 201, 202, 203, 204, 205, 206, 207, 208,
  1939. 210, 211, 212, 213, 198, 200, 195, 222, 219, 221, 223, 217, 216, 220, 192, 209,
  1940. UNK, 197, UNK, UNK, UNK, 115, 105, 105, 106, UNK, UNK, UNK, 203, UNK, 213, UNK
  1941. };
  1942.  
  1943. CONST CHAR
  1944. yaclc[] = {  /* CP866 to Latin/Cyrillic */
  1945. /* NEED TO MAKE THIS ONE INVERTIBLE */
  1946.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1947.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1948.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1949.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1950.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1951.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1952.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1953. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1954. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1955. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1956. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1957. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1958. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1959. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1960. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1961. 161, 241, 164, 244, 167, 247, 174, 254, UNK, UNK, UNK, UNK, 240, UNK, UNK, UNK
  1962. };
  1963.  
  1964. CONST CHAR
  1965. y55lc[] = {  /* CP855 to Latin/Cyrillic (inverse of ylc55) */
  1966.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1967.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1968.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1969.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1970.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1971.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1972.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1973. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1974. 242, 162, 243, 163, 241, 161, 244, 164, 245, 165, 246, 166, 247, 167, 248, 168,
  1975. 249, 169, 250, 170, 251, 171, 252, 172, 254, 174, 255, 175, 238, 206, 234, 202,
  1976. 208, 176, 209, 177, 230, 198, 212, 180, 213, 181, 228, 196, 211, 179, 128, 129,
  1977. 130, 131, 132, 133, 134, 229, 197, 216, 184, 135, 136, 137, 138, 217, 185, 139,
  1978. 140, 141, 142, 143, 144, 145, 218, 186, 146, 147, 148, 149, 150, 151, 152, 153,
  1979. 219, 187, 220, 188, 221, 189, 222, 190, 223, 154, 155, 156, 157, 191, 239, 158,
  1980. 207, 224, 192, 225, 193, 226, 194, 227, 195, 214, 182, 210, 178, 236, 204, 240,
  1981. 173, 235, 203, 215, 183, 232, 200, 237, 205, 233, 201, 231, 199, 253, 159, 160
  1982. };
  1983.  
  1984. CONST CHAR
  1985. y1251lc[] = {  /* CP1251 to Latin/Cyrillic (inverse of ylc1251) */
  1986.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1987.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1988.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1989.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1990.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1991.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1992.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1993. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1994. 162, 163, 128, 243, 129, 130, 131, 132, 133, 134, 169, 135, 170, 172, 171, 175,
  1995. 242, 136, 137, 138, 139, 140, 141, 142, 143, 144, 249, 145, 250, 252, 251, 255,
  1996. 160, 174, 254, 168, 146, 147, 148, 253, 161, 149, 164, 150, 151, 173, 152, 167,
  1997. 153, 154, 166, 246, 155, 156, 157, 158, 241, 240, 244, 159, 248, 165, 245, 247,
  1998. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1999. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2000. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2001. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239
  2002. };
  2003.  
  2004. CONST CHAR
  2005. ybulc[] = {  /* Bulgarian PC Code Page to Latin/Cyrillic */
  2006.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2007.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2008.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2009.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2010.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2011.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2012.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2013. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2014. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2015. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  2016. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  2017. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2018. 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 209,
  2019. 210, 211, 212, 213, 214, 208, 253, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2020. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2021. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 254, 255, 128
  2022. };
  2023.  
  2024. CONST CHAR
  2025. yk8lc[] = {  /* Old KOI-8 Cyrillic to Latin/Cyrillic */
  2026.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2027.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2028.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2029.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2030.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2031.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2032.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2033. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2034. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2035. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2036. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2037. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2038. 238, 208, 209, 230, 212, 213, 228, 211, 229, 216, 217, 218, 219, 220, 221, 222,
  2039. 223, 239, 224, 225, 226, 227, 214, 210, 236, 235, 215, 232, 237, 233, 231, 234,
  2040. 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
  2041. 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
  2042. };
  2043.  
  2044. CONST CHAR
  2045. ylcsk[] = {  /* Latin/Cyrillic to Short KOI */
  2046.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2047.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2048.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2049.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2050.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2051.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2052.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2053.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94, 127,
  2054.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2055.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2056.  32, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107,  45, 117, UNK,
  2057.  97,  98, 119, 103, 100, 101, 118, 122, 105, 106, 107, 108, 109, 110, 111, 112,
  2058. 114, 115, 116, 117, 102, 104,  99, 126, 123, 125,  39, 121, 120, 124,  96, 113,
  2059.  97,  98, 119, 103, 100, 101, 118, 122, 105, 106, 107, 108, 109, 110, 111, 112,
  2060. 114, 115, 116, 117, 102, 104,  99, 126, 123, 125,  39, 121, 120, 124,  96, 113,
  2061. UNK, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107, UNK, 117, UNK
  2062. };
  2063.  
  2064. CONST CHAR yskcy[] = {  /* Short KOI to Latin/Cyrillic */
  2065.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2066.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2067.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2068.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2069.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2070.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2071. 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
  2072. 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
  2073. };
  2074. #endif /* CYRILLIC */
  2075.  
  2076. #ifdef LATIN2
  2077.  
  2078. /* Latin-2 tables */
  2079.  
  2080. CONST CHAR
  2081. yl252[] = {                /* Latin-2 to Code Page 852 */
  2082.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2083.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2084.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2085.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2086.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2087.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2088.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2089. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2090. 174, 175, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194, 195,
  2091. 196, 197, 200, 201, 202, 203, 204, 205, 206, 217, 218, 219, 220, 223, 240, 254,
  2092. 255, 164, 244, 157, 207, 149, 151, 245, 249, 230, 184, 155, 141, 170, 166, 189,
  2093. 248, 165, 242, 136, 239, 150, 152, 243, 247, 231, 173, 156, 171, 241, 167, 190,
  2094. 232, 181, 182, 198, 142, 145, 143, 128, 172, 144, 168, 211, 183, 214, 215, 210,
  2095. 209, 227, 213, 224, 226, 138, 153, 158, 252, 222, 233, 235, 154, 237, 221, 225,
  2096. 234, 160, 131, 199, 132, 146, 134, 135, 159, 130, 169, 137, 216, 161, 140, 212,
  2097. 208, 228, 229, 162, 147, 139, 148, 246, 253, 133, 163, 251, 129, 236, 238, 250
  2098. };
  2099.  
  2100. CONST CHAR
  2101. y52l2[] = {                /* Code Page 852 to Latin-2 */
  2102.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2103.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2104.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2105.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2106.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2107.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2108.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2109. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2110. 199, 252, 233, 226, 228, 249, 230, 231, 179, 235, 213, 245, 238, 172, 196, 198,
  2111. 201, 197, 229, 244, 246, 165, 181, 166, 182, 214, 220, 171, 187, 163, 215, 232,
  2112. 225, 237, 243, 250, 161, 177, 174, 190, 202, 234, 173, 188, 200, 186, 128, 129,
  2113. 130, 131, 132, 133, 134, 193, 194, 204, 170, 135, 136, 137, 138, 175, 191, 139,
  2114. 140, 141, 142, 143, 144, 145, 195, 227, 146, 147, 148, 149, 150, 151, 152, 164,
  2115. 240, 208, 207, 203, 239, 210, 205, 206, 236, 153, 154, 155, 156, 222, 217, 157,
  2116. 211, 223, 212, 209, 241, 242, 169, 185, 192, 218, 224, 219, 253, 221, 254, 180,
  2117. 158, 189, 178, 183, 162, 167, 247, 184, 176, 168, 255, 251, 216, 248, 159, 160
  2118. };
  2119.  
  2120. CONST CHAR
  2121. yl21250[] = {                /* Latin-2 to Code Page 1250 */
  2122.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2123.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2124.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2125.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2126.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2127.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2128.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2129. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2130. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 139, 144, 145, 146, 147, 148,
  2131. 149, 150, 151, 152, 153, 155, 166, 169, 171, 172, 174, 177, 181, 182, 183, 187,
  2132. 160, 165, 162, 163, 164, 188, 140, 167, 168, 138, 170, 141, 143, 173, 142, 175,
  2133. 176, 185, 178, 179, 180, 190, 156, 161, 184, 154, 186, 157, 159, 189, 158, 191,
  2134. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2135. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2136. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2137. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  2138. };
  2139.  
  2140. CONST CHAR
  2141. y1250l2[] = {                /* Code Page 1250 to Latin-2 */
  2142.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2143.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2144.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2145.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2146.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2147.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2148.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2149. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2150. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 169, 138, 166, 171, 174, 172,
  2151. 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 185, 149, 182, 187, 190, 188,
  2152. 160, 183, 162, 163, 164, 161, 150, 167, 168, 151, 170, 152, 153, 173, 154, 175,
  2153. 176, 155, 178, 179, 180, 156, 157, 158, 184, 177, 186, 159, 165, 189, 181, 191,
  2154. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2155. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2156. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2157. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  2158. };
  2159.  
  2160. CONST CHAR
  2161. yl2mz[] = {                 /* Latin-2 to Mazovia (NOT invertible) */
  2162.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2163.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2164.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2165.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2166.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2167.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2168.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2169. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2170. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2171. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2172. 255, 143, UNK, 156, 155,  76, 152,  21,  34,  83,  83,  84, 160,  45,  90, 161,
  2173. 248, 134,  44, 146,  39, 108, 158, UNK,  44, 115, 115, 116, 166,  34, 122, 167,
  2174.  82,  65,  65,  65, 142,  76, 149, 128,  67,  69, 144,  69,  69,  73,  73,  68,
  2175.  68, 165,  78, 163,  79, 153, 153, 250,  82,  85,  85, 154, 154,  89,  84, 225,
  2176. 114,  97, 131,  97, 132, 108, 141, 135,  99, 130, 145, 137, 101, 105, 140, 101,
  2177. 100, 164, 110, 162, 147, 148, 148, 246, 114, 117, 117, 129, 129, 121, 116, 249
  2178. };
  2179.  
  2180. CONST CHAR
  2181. ymzl2[] = {                 /* Mazovia to Latin-2 (NOT INVERTIBLE) */
  2182.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2183.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2184.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2185.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2186.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2187.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2188.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2189. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2190. 128, 252, 233, 226, 228,  97, 177, 231, 101, 235, 101, 105, 238, 230, 196, 161,
  2191. 202, 234, 179, 244, 246, 198, 117, 117, 166, 214, 220, 164, 163,  89, 182, 102,
  2192. 172, 175, 243, 211, 242, 210, 188, 191,  63, UNK, UNK, UNK, UNK,  33,  34,  34,
  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. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2196. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2197. UNK, UNK, UNK, UNK, UNK, UNK, 247, UNK, 176, 255, 215, UNK, UNK, UNK, UNK, 160
  2198. };
  2199.  
  2200. CONST CHAR
  2201. yl2l1[] = {                /* Latin-2 to Latin-1 */
  2202.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2203.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2204.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2205.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2206.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2207.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2208.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2209. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2210. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2211. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2212. 160, 'A', UNK, 'L', 164, 'L', 'S', 167, 168, 'S', 'S', 'T', 'Z', 173, 'Z', 'Z',
  2213. 176, 'a', UNK, 'l', 180, 'l', 's', UNK, 184, 's', 's', 't', 'z', UNK, 'z', 'z',
  2214. 'R', 193, 194, 'A', 196, 'L', 'C', 199, 'C', 201, 'E', 203, 'E', 205, 'I', 'D',
  2215. 208, 'N', 'N', 211, 212, 'O', 214, 215, 'R', 'U', 218, 'U', 220, 221, 'T', 223,
  2216. 'r', 225, 226, 'a', 228, 'l', 'c', 231, 'c', 233, 'e', 235, 'e', 237, 'i', 'd',
  2217. 240, 'n', 'n', 243, 244, 'o', 246, 247, 'r', 'u', 250, 'u', 252, 253, 't', '.'
  2218. };
  2219.  
  2220. CONST CHAR
  2221. yl1l2[] = {                /* Latin-1 to Latin-2 */
  2222.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2223.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2224.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2225.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2226.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2227.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2228.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2229. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2230. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2231. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2232. 160, 'A', UNK, 'L', 164, UNK, UNK, 167, 168, 'C', 'a', '<', '>', 173, 'R', UNK,
  2233. 176, UNK, UNK, UNK, 180, UNK, UNK, UNK, 184, UNK, 'o', '>', UNK, UNK, UNK, UNK,
  2234. 'A', 193, 194, 'A', 196, 'A', 'A', 199, 'E', 201, 'E', 203, 'I', 205, 'I', 'I',
  2235. 208, 'N', 'O', 211, 212, 'O', 214, 215, 'O', 'U', 218, 'U', 220, 221, UNK, 223,
  2236. 'a', 225, 226, 'a', 228, 'a', 'a', 231, 'e', 233, 'e', 235, 'i', 237, 'i', 'i',
  2237. 240, 'n', 'o', 243, 244, 'o', 246, 247, 'o', 'u', 250, 'u', 252, 253, UNK, 'y'
  2238. };
  2239.  
  2240. CONST CHAR
  2241. yl2as[] = {                /* Latin-2 to ASCII */
  2242.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2243.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2244.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2245.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2246.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2247.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2248.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2249. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2250. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2251. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2252.  32, 'A', UNK, 'L', UNK, 'L', 'S', UNK,  34, 'S', 'S', 'T', 'Z', '-', 'Z', 'Z',
  2253. UNK, 'a', UNK, 'l',  39, 'l', 's', UNK,  44, 's', 's', 't', 'z', UNK, 'z', 'z',
  2254. 'R', 'A', 'A', 'A', 'A', 'L', 'C', 'C', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'D',
  2255. 'D', 'N', 'N', 'O', 'O', 'O', 'O', 'x', 'R', 'U', 'U', 'U', 'U', 'Y', 'T', 's',
  2256. 'r', 'a', 'a', 'a', 'a', 'l', 'c', 'c', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'd',
  2257. 'd', 'n', 'n', 'o', 'o', 'o', 'o', '/', 'r', 'u', 'u', 'u', 'u', 'y', 't', '.'
  2258. };
  2259. #endif /* LATIN2 */
  2260.  
  2261. #ifdef HEBREW
  2262. /*
  2263.   8-bit Tables providing invertible translation between Latin/Hebrew and CP862.
  2264. */
  2265. CONST CHAR
  2266. y62lh[] = {  /* PC Code Page 862 to ISO 8859-8 Latin/Hebrew */
  2267.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2268.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2269.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2270.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2271.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2272.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2273.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2274. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2275. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2276. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 162, 163, 165, 128, 129,
  2277. 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 172, 189, 188, 140, 171, 187,
  2278. 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
  2279. 157, 158, 159, 161, 164, 166, 167, 168, 169, 170, 173, 174, 175, 223, 179, 180,
  2280. 182, 184, 185, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
  2281. 203, 204, 205, 206, 207, 208, 181, 209, 210, 211, 212, 213, 214, 215, 216, 217,
  2282. 218, 177, 219, 220, 221, 222, 186, 251, 176, 183, 252, 253, 254, 178, 255, 160
  2283. };
  2284.  
  2285. CONST CHAR
  2286. ylh62[] = {  /* ISO 8859-8 Latin/Hebrew to PC Code Page 862 */
  2287.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2288.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2289.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2290.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2291.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2292.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2293.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2294. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2295. 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 173, 176, 177, 178,
  2296. 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
  2297. 255, 195, 155, 156, 196, 157, 197, 198, 199, 200, 201, 174, 170, 202, 203, 204,
  2298. 248, 241, 253, 206, 207, 230, 208, 249, 209, 210, 246, 175, 172, 171, 211, 212,
  2299. 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
  2300. 229, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 205,
  2301. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2302. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 247, 250, 251, 252, 254
  2303. };
  2304. /*
  2305.   7-bit table providing readable translation from DEC Hebrew-7 to CP862.
  2306. */
  2307. CONST CHAR
  2308. yh762[] = {
  2309.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2310.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2311.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2312.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2313.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2314.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2315. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2316.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127
  2317. };
  2318. /*
  2319.   8-bit table providing readable translation from CP862 to Hebrew-7.
  2320. */
  2321. CONST CHAR
  2322. y62h7[] = {  /* PC Code Page 862 to Hebrew-7 */
  2323.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2324.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2325.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2326.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2327.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2328.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2329.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2330.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
  2331.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2332. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, UNK,
  2333. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2334. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2335. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2336. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2337. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2338. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK
  2339. };
  2340. /*
  2341.   7-bit table providing readable translation from Hebrew-7 to ISO Latin/Hebrew.
  2342. */
  2343. CONST CHAR
  2344. yh7lh[] = {
  2345.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2346.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2347.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2348.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2349.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2350.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2351. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2352. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 123, 124, 125, 126, 127
  2353. };
  2354. /*
  2355.   8-bit table providing readable translation from ISO Latin/Hebrew to Hebrew-7.
  2356. */
  2357. CONST CHAR
  2358. ylhh7[] = {  /* Latin/Hebrew to Hebrew-7 */
  2359.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2360.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2361.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2362.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2363.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2364.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2365.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2366.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
  2367. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2368. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2369. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2370. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2371. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2372. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2373.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2374. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, UNK
  2375. };
  2376. #endif /* HEBREW */
  2377.  
  2378. #ifdef GREEK
  2379. /*
  2380.   8-bit Tables providing invertible translation between Latin/Greek and CP869.
  2381. */
  2382. CONST CHAR
  2383. ylg69[] = {  /* ISO 8859-7 Latin/Greek to PC Code Page 869 */
  2384.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2385.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2386.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2387.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2388.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2389.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2390.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2391. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2392. 135, 147, 148, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194,
  2393. 195, 196, 197, 200, 201, 202, 203, 204, 205, 206, 217, 218, 219, 220, 223, 254,
  2394. 255, 139, 140, 156, 128, 129, 138, 245, 249, 151, 130, 174, 137, 240, 131, 142,
  2395. 248, 241, 153, 154, 239, 247, 134, 136, 141, 143, 144, 175, 146, 171, 149, 152,
  2396. 161, 164, 165, 166, 167, 168, 169, 170, 172, 173, 181, 182, 183, 184, 189, 190,
  2397. 198, 199, 132, 207, 208, 209, 210, 211, 212, 213, 145, 150, 155, 157, 158, 159,
  2398. 252, 214, 215, 216, 221, 222, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
  2399. 234, 235, 237, 236, 238, 242, 243, 244, 246, 250, 160, 251, 162, 163, 253, 133
  2400. };
  2401.  
  2402. CONST CHAR
  2403. y69lg[] = {  /* PC Code Page 869 to ISO 8859-7 Latin/Greek */
  2404.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2405.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2406.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2407.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2408.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2409.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2410.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2411. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2412. 164, 165, 170, 174, 210, 255, 182, 128, 183, 172, 166, 161, 162, 184, 175, 185,
  2413. 186, 218, 188, 129, 130, 190, 219, 169, 191, 178, 179, 220, 163, 221, 222, 223,
  2414. 250, 192, 252, 253, 193, 194, 195, 196, 197, 198, 199, 189, 200, 201, 171, 187,
  2415. 131, 132, 133, 134, 135, 202, 203, 204, 205, 136, 137, 138, 139, 206, 207, 140,
  2416. 141, 142, 143, 144, 145, 146, 208, 209, 147, 148, 149, 150, 151, 152, 153, 211,
  2417. 212, 213, 214, 215, 216, 217, 225, 226, 227, 154, 155, 156, 157, 228, 229, 158,
  2418. 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 243, 242, 244, 180,
  2419. 173, 177, 245, 246, 247, 167, 248, 181, 176, 168, 249, 251, 224, 254, 159, 160
  2420. };
  2421. /*
  2422.   7-bit table providing readable translation from ELOT 927 to CP869.
  2423. */
  2424. CONST CHAR
  2425. yeg69[] = {
  2426.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2427.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2428.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2429.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2430.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2431.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2432.  96, 164, 165, 166, 167, 168, 169, 170, 172, 173, 181, 182, 183, 184, 189, 190,
  2433. 198, 199, 207, 208, 209, 210, 211, 212, 213,  32,  32,  23, 124, 125, 126, 127
  2434. };
  2435. /*
  2436.   8-bit table providing readable translation from CP869 to ELOT 927.
  2437. */
  2438. CONST CHAR
  2439. y69eg[] = {  /* PC Code Page 869 to ELOT 927 */
  2440.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2441.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2442.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2443.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2444.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2445.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2446.  96,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2447.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
  2448. UNK, UNK, UNK, UNK, UNK, UNK,  97, UNK,  46, UNK, 124,  39,  39, 101,  45, 103,
  2449. 105, 105, 111, UNK, UNK, 116, 116, UNK, 120,  50,  51,  97, UNK, 101, 103, 105,
  2450. 105, 105, 111, 116,  97,  98,  99, 100, 101, 102, 103, UNK, 104, 105,  34,  34,
  2451. UNK, UNK, UNK, UNK, UNK, 106, 107, 108, 109, UNK, UNK, UNK, UNK, 110, 111, UNK,
  2452. UNK, UNK, UNK, UNK, UNK, UNK, 112, 113, UNK, UNK, UNK, UNK, UNK, UNK, UNK, 114,
  2453. 115, 116, 117, 118, 119, 120,  97,  98,  99, UNK, UNK, UNK, UNK, 100, 101, UNK,
  2454. 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115,  39,
  2455.  45, UNK, 116, 117, 118, UNK, 119, UNK, UNK, UNK, 120, 116, 116, 120, UNK,  32
  2456.  
  2457. };
  2458. /*
  2459.   7-bit table providing readable translation from ELOT 927 to ISO Latin/Greek.
  2460. */
  2461. CONST CHAR
  2462. yeglg[] = {
  2463.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2464.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2465.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2466.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2467.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2468.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2469.  96, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2470. 208, 209, 211, 212, 213, 214, 215, 216, 217,  32,  32, 123, 124, 125, 126, 127
  2471. };
  2472. /*
  2473.   8-bit table providing readable translation from ISO Latin/Greek to ELOT 927.
  2474. */
  2475. CONST CHAR
  2476. ylgeg[] = {  /* Latin/Greek to ELOT 927 */
  2477.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2478.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2479.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2480.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2481.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2482.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2483.  96,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2484.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 123, 124, 125, 126, 127,
  2485. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2486. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2487.  32,  39,  39, UNK, UNK, UNK, 124, UNK,  34, UNK, UNK,  34, UNK,  45, UNK,  45,
  2488. UNK, UNK,  50,  51,  39, UNK,  97,  46, 101, 103, 105,  34, 111, UNK, 116, 120,
  2489. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2490. 112, 113, UNK, 114, 115, 116, 117, 118, 119, 120, 105, 116,  97, 101, 103, 105,
  2491. 116,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2492. 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 105, 116, 111, 116, 120, UNK
  2493. };
  2494. #endif /* GREEK */
  2495.  
  2496. /* Translation functions ... */
  2497.  
  2498. CHAR                    /* The identity function... */
  2499. #ifdef CK_ANSIC
  2500. ident(CHAR c)                /* (no longer used) */
  2501. #else
  2502. ident(c) CHAR c;
  2503. #endif /* CK_ANSIC */
  2504. { /* ident */
  2505.     return(c);                /* Instead, enter NULL in the  */
  2506. }                    /* table of functions to avoid */
  2507.                     /* needless function calls.    */
  2508.  
  2509. CHAR
  2510. #ifdef CK_ANSIC
  2511. xleft128(CHAR c)
  2512. #else
  2513. xleft128(c) CHAR c;
  2514. #endif /* CK_ANSIC */
  2515. { /* xleft128 */
  2516.     return((c < 128) ? c : '?');
  2517. }
  2518.  
  2519. CHAR
  2520. #ifdef CK_ANSIC
  2521. xleft160(CHAR c)
  2522. #else
  2523. xleft160(c) CHAR c;
  2524. #endif /* CK_ANSIC */
  2525. { /* xleft160 */
  2526.     return((c < 160) ? c : '?');
  2527. }
  2528.  
  2529.  
  2530. CHAR
  2531. #ifdef CK_ANSIC
  2532. xl1as(CHAR c)
  2533. #else
  2534. xl1as(c) CHAR c;
  2535. #endif /* CK_ANSIC */
  2536. { /* xl1as */                 /* Latin-1 to US ASCII... */
  2537.     switch(langs[language].id) {
  2538.  
  2539.       case L_DUTCH:
  2540.     if (c == 255) {            /* Dutch umlaut-y */
  2541.         zmstuff('j');        /* becomes ij */
  2542.         return('i');
  2543.     } else return(yl1as[c]);    /* all others by the book */
  2544.  
  2545.       case L_GERMAN:
  2546.     switch (c) {            /* German, special rules. */
  2547.       case 196:            /* umlaut-A -> Ae */
  2548.         zmstuff('e');
  2549.         return('A');
  2550.       case 214:            /* umlaut-O -> Oe */
  2551.         zmstuff('e');
  2552.         return('O');
  2553.       case 220:            /* umlaut-U -> Ue */
  2554.         zmstuff('e');
  2555.         return('U');
  2556.       case 228:            /* umlaut-a -> ae */
  2557.         zmstuff('e');
  2558.         return('a');
  2559.       case 246:            /* umlaut-o -> oe */
  2560.         zmstuff('e');
  2561.         return('o');
  2562.       case 252:            /* umlaut-u -> ue */
  2563.         zmstuff('e');
  2564.         return('u');
  2565.       case 223:            /* ess-zet -> ss */
  2566.         zmstuff('s');
  2567.         return('s');
  2568.       default: return(yl1as[c]);    /* all others by the book */
  2569.     }
  2570.       case L_DANISH:
  2571.       case L_FINNISH:
  2572.       case L_NORWEGIAN:
  2573.       case L_SWEDISH:
  2574.     switch (c) {            /* Scandanavian languages. */
  2575.       case 196:            /* umlaut-A -> Ae */
  2576.           case 198:            /* AE ligature also -> Ae */
  2577.         zmstuff('e');
  2578.         return('A');
  2579.       case 214:            /* umlaut-O -> Oe */
  2580.       case 216:            /* O-slash -> Oe */
  2581.         zmstuff('e');
  2582.         return('O');
  2583.       case 220:            /* umlaut-U -> Ue */
  2584.       /*  return('Y'); replaced by "Ue" by popular demand. */
  2585.           /*  Y for Umlaut-U is only used in German names. */
  2586.         zmstuff('e');
  2587.         return('U');
  2588.       case 228:            /* umlaut-a -> ae */
  2589.           case 230:            /* ditto for ae ligature */
  2590.         zmstuff('e');
  2591.         return('a');
  2592.       case 246:            /* umlaut-o -> oe */
  2593.       case 248:            /* o-slash -> oe */
  2594.         zmstuff('e');
  2595.         return('o');
  2596.       case 252:            /* umlaut-u -> ue */
  2597.       /*  return('y'); replaced by "ue" by popular demand. */
  2598.         zmstuff('e');
  2599.         return('u');
  2600.       case 197:            /* A-ring -> Aa */
  2601.         zmstuff('a');
  2602.         return('A');
  2603.           case 229:            /* a-ring -> aa */
  2604.         zmstuff('a');
  2605.         return('a');
  2606.       default: return(yl1as[c]);    /* All others by the book */
  2607.     }
  2608.       case L_ICELANDIC:            /* Icelandic. */
  2609.     switch (c) {
  2610.       case 198:            /* uppercase AE -> AE */
  2611.         zmstuff('e');
  2612.         return('A');
  2613.       case 208:            /* uppercase Eth -> D */
  2614.         return('D');
  2615.       case 214:            /* uppercase O-diaeresis -> Oe */
  2616.         zmstuff('e');
  2617.         return('O');
  2618.       case 222:            /* uppercase Thorn -> Th */
  2619.         zmstuff('h');
  2620.         return('T');
  2621.       case 230:            /* lowercase ae -> ae */
  2622.         zmstuff('e');
  2623.         return('a');
  2624.       case 240:            /* lowercase Eth -> d */
  2625.         return('d');
  2626.       case 246:            /* lowercase O-diaeresis -> oe */
  2627.         zmstuff('e');
  2628.         return('o');
  2629.       case 254:            /* lowercase Thorn -> th */
  2630.         zmstuff('h');
  2631.         return('t');
  2632.       default: return(yl1as[c]);    /* All others by the book */
  2633.     }
  2634.       default:
  2635.     return(yl1as[c]);        /* None of the above, by the table. */
  2636.     }
  2637. }
  2638.  
  2639. CHAR                    /* CP1252 to ASCII */
  2640. #ifdef CK_ANSIC
  2641. xw1as(CHAR c)
  2642. #else
  2643. xw1as(c) CHAR c;
  2644. #endif /* CK_ANSIC */
  2645. { /* xw1as */
  2646.     switch(c) {                /* Microsoft name... */
  2647.       case 0x80: return('?');        /* Euro Sign */
  2648.       case 0x82: return('\047');    /* Single Low-9 Quotation Mark */
  2649.       case 0x83: return('f');        /* Latin Small Letter f with Hook */
  2650.       case 0x84: return('"');        /* Double low-9 Quotation Mark */
  2651.       case 0x85: return('-');        /* Horizontal Ellipsis */
  2652.       case 0x86: return('+');        /* Dagger */
  2653.       case 0x87: return('+');        /* Double Dagger */
  2654.       case 0x88: return('^');        /* Modifier Letter Circumflex Accent */
  2655.       case 0x89: return('?');        /* Per Mille Sign */
  2656.       case 0x8A: return('S');        /* Latin Capital Letter S with Caron */
  2657.       case 0x8B: return('<');        /* Single Left Angle Quotation Mark */
  2658.       case 0x8C: return('O');        /* Latin Capital Ligature OE */
  2659.       case 0x8E: return('Z');        /* Latin Capital Letter Z with Caron */
  2660.       case 0x91: return('\047');    /* Left Single Quotation Mark */
  2661.       case 0x92: return('\047');    /* Right Single Quotation Mark */
  2662.       case 0x93: return('"');        /* Left Double Quotation Mark */
  2663.       case 0x94: return('"');        /* Right Double Quotation Mark */
  2664.       case 0x95: return('.');        /* Bullet */
  2665.       case 0x96: return('-');        /* En Dash */
  2666.       case 0x97: return('-');        /* Em Dash */
  2667.       case 0x98: return('~');        /* Small Tilde */
  2668.       case 0x99: return('T');        /* Trade Mark Sign */
  2669.       case 0x9A: return('s');        /* Latin Small Letter s with Caron */
  2670.       case 0x9B: return('>');        /* Single Right Angle Quotation Mark */
  2671.       case 0x9C: return('o');        /* Latin Small Ligature OE */
  2672.       case 0x9E: return('z');        /* Latin Small Letter z with Caron */
  2673.       case 0x9F: return('Y');        /* Latin Capital Letter Y Diaeresis */
  2674.       default:
  2675.     if (c > 0x80 && c < 0xa0)
  2676.       return('?');
  2677.     else
  2678.       return(yl1as[c]);
  2679.     }
  2680. }
  2681.  
  2682. CHAR                    /* CP1252 to Latin-1 */
  2683. #ifdef CK_ANSIC
  2684. xw1l1(CHAR c)
  2685. #else
  2686. xw1l1(c) CHAR c;
  2687. #endif /* CK_ANSIC */
  2688. { /* xw1l1 */
  2689.     if (c == 0x95) return(0xb7);    /* Middle dot */
  2690.     return((c < 160) ? xw1as(c) : c);
  2691. }
  2692.  
  2693. CHAR                    /* Latin-1 to German */
  2694. #ifdef CK_ANSIC
  2695. xl1ge(CHAR c)
  2696. #else
  2697. xl1ge(c) CHAR c;
  2698. #endif /* CK_ANSIC */
  2699. { /* xl1ge */
  2700.     return(yl1ge[c]);
  2701. }
  2702.  
  2703. CHAR                    /* German to Latin-1 */
  2704. #ifdef CK_ANSIC
  2705. xgel1(CHAR c)
  2706. #else
  2707. xgel1(c) CHAR c;
  2708. #endif /* CK_ANSIC */
  2709. { /* xgel1 */
  2710.     if (c & 0x80)
  2711.       return(UNK);
  2712.     return(ygel1[c]);
  2713. }
  2714.  
  2715. CHAR
  2716. #ifdef CK_ANSIC
  2717. xgeas(CHAR c)
  2718. #else
  2719. xgeas(c) CHAR c;
  2720. #endif /* CK_ANSIC */
  2721. { /* xgeas */                /* German ISO 646 to ASCII */
  2722.     if (c & 0x80)
  2723.       return(UNK);
  2724.     switch (c) {
  2725.       case 91:                /* umlaut-A -> Ae */
  2726.     zmstuff('e');
  2727.     return('A');
  2728.       case 92:                /* umlaut-O -> Oe */
  2729.     zmstuff('e');
  2730.     return('O');
  2731.       case 93:                /* umlaut-U -> Ue */
  2732.     zmstuff('e');
  2733.     return('U');
  2734.       case 123:                /* umlaut-a -> ae */
  2735.     zmstuff('e');
  2736.     return('a');
  2737.       case 124:                /* umlaut-o -> oe */
  2738.     zmstuff('e');
  2739.     return('o');
  2740.       case 125:                /* umlaut-u -> ue */
  2741.     zmstuff('e');
  2742.     return('u');
  2743.       case 126:                /* ess-zet -> ss */
  2744.     zmstuff('s');
  2745.     return('s');
  2746.       default:  return(c);        /* all others stay the same */
  2747.     }
  2748. }
  2749.  
  2750. CHAR
  2751. #ifdef CK_ANSIC
  2752. xl1w1(CHAR c)
  2753. #else
  2754. xl1w1(c) CHAR c;
  2755. #endif /* CK_ANSIC */
  2756. { /* xl1w1 */                /* Latin-1 to CP1252 (Windows L1) */
  2757.     if (c > 127 && c < 160)
  2758.       return(UNK);
  2759.     else
  2760.       return(c);
  2761. }
  2762.  
  2763. CHAR
  2764. #ifdef CK_ANSIC
  2765. xduas(CHAR c)
  2766. #else
  2767. xduas(c) CHAR c;
  2768. #endif /* CK_ANSIC */
  2769. { /* xduas */                /* Dutch ISO 646 to US ASCII */
  2770.     if (c & 0x80)
  2771.       return(UNK);
  2772.     switch (c) {
  2773.       case 64:  return(UNK);        /* 3/4 */
  2774.       case 91:                /* y-diaeresis */
  2775.     zmstuff('j');
  2776.     return('i');
  2777.       case 92:  return(UNK);        /* 1/2 */
  2778.       case 93:  return(124);        /* vertical bar */
  2779.       case 123: return(34);        /* diaeresis */
  2780.       case 124: return(UNK);        /* Florin */
  2781.       case 125: return(UNK);        /* 1/4 */
  2782.       case 126: return(39);        /* Apostrophe */
  2783.       default:  return(c);
  2784.     }
  2785. }
  2786.  
  2787. CHAR
  2788. #ifdef CK_ANSIC
  2789. xfias(CHAR c)
  2790. #else
  2791. xfias(c) CHAR c;
  2792. #endif /* CK_ANSIC */
  2793. { /* xfias */                /* Finnish ISO 646 to US ASCII */
  2794.     if (c & 0x80)
  2795.       return(UNK);
  2796.     switch (c) {
  2797.       case 91:                /* A-diaeresis */
  2798.     zmstuff('e');
  2799.     return('A');
  2800.       case 92:                /* O-diaeresis */
  2801.     zmstuff('e');
  2802.     return('O');
  2803.       case 93:                /* A-ring */
  2804.     zmstuff('a');
  2805.     return('A');
  2806.       case 94:                /* U-diaeresis */
  2807.     /* return('Y'); */
  2808.     zmstuff('e');
  2809.     return('U');
  2810.       case 96:                /* e-acute */
  2811.     return('e');
  2812.       case 123:                /* a-diaeresis */
  2813.     zmstuff('e');
  2814.     return('a');
  2815.       case 124:                /* o-diaeresis */
  2816.     zmstuff('e');
  2817.     return('o');
  2818.       case 125:                /* a-ring */
  2819.     zmstuff('a');
  2820.     return('a');
  2821.       case 126:                /* u-diaeresis */
  2822.     /* return('y'); */
  2823.     zmstuff('e');
  2824.     return('U');
  2825.       default:
  2826.     return(c);
  2827.     }
  2828. }
  2829.  
  2830. CHAR
  2831. #ifdef CK_ANSIC
  2832. xfras(CHAR c)
  2833. #else
  2834. xfras(c) CHAR c;
  2835. #endif /* CK_ANSIC */
  2836. { /* xfras */                /* French ISO 646 to US ASCII */
  2837.     if (c & 0x80)
  2838.       return(UNK);
  2839.     switch (c) {
  2840.       case 64:  return(97);        /* a grave */
  2841.       case 91:  return(UNK);        /* degree sign */
  2842.       case 92:  return(99);        /* c cedilla */
  2843.       case 93:  return(UNK);        /* paragraph sign */
  2844.       case 123: return(101);        /* e acute */
  2845.       case 124: return(117);        /* u grave */
  2846.       case 125: return(101);        /* e grave */
  2847.       case 126: return(34);        /* diaeresis */
  2848.       default:  return(c);
  2849.     }
  2850. }
  2851.  
  2852. CHAR
  2853. #ifdef CK_ANSIC
  2854. xfcas(CHAR c)
  2855. #else
  2856. xfcas(c) CHAR c;
  2857. #endif /* CK_ANSIC */
  2858. { /* xfcas */                /* French Canadian ISO 646 to ASCII */
  2859.     if (c & 0x80)
  2860.       return(UNK);
  2861.     switch (c) {
  2862.       case 64:  return('a');        /* a grave */
  2863.       case 91:  return('a');        /* a circumflex */
  2864.       case 92:  return('c');        /* c cedilla */
  2865.       case 93:  return('e');        /* e circumflex */
  2866.       case 94:  return('i');        /* i circumflex */
  2867.       case 96:  return('o');        /* o circumflex */
  2868.       case 123: return('e');        /* e acute */
  2869.       case 124: return('u');        /* u grave */
  2870.       case 125: return('e');        /* e grave */
  2871.       case 126: return('u');        /* u circumflex */
  2872.       default:  return(c);
  2873.     }
  2874. }
  2875.  
  2876. CHAR
  2877. #ifdef CK_ANSIC
  2878. xitas(CHAR c)
  2879. #else
  2880. xitas(c) CHAR c;
  2881. #endif /* CK_ANSIC */
  2882. { /* xitas */                /* Italian ISO 646 to ASCII */
  2883.     if (c & 0x80)
  2884.       return(UNK);
  2885.     switch (c) {
  2886.       case 91:  return(UNK);        /* degree */
  2887.       case 92:  return('c');        /* c cedilla */
  2888.       case 93:  return('e');        /* e acute */
  2889.       case 96:  return('u');        /* u grave */
  2890.       case 123: return('a');        /* a grave */
  2891.       case 124: return('o');        /* o grave */
  2892.       case 125: return('e');        /* e grave */
  2893.       case 126: return('i');        /* i grave */
  2894.       default:  return(c);
  2895.     }
  2896. }
  2897.  
  2898. CHAR
  2899. #ifdef CK_ANSIC
  2900. xneas(CHAR c)
  2901. #else
  2902. xneas(c) CHAR c;
  2903. #endif /* CK_ANSIC */
  2904. { /* xneas */                /* NeXT to ASCII */
  2905.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2906.     if (c == 234) {            /* handle OE digraph. */
  2907.         zmstuff('E');
  2908.         return('O');
  2909.     } else if (c == 250) {        /* Also lowercase oe. */
  2910.         zmstuff('e');
  2911.         return('o');
  2912.     }
  2913.     }
  2914.     c = xnel1(c);            /* Convert to Latin-1 */
  2915.     return(yl1as[c]);            /* Convert Latin-1 to ASCII */
  2916. }
  2917.  
  2918. CHAR
  2919. #ifdef CK_ANSIC
  2920. xnoas(CHAR c)
  2921. #else
  2922. xnoas(c) CHAR c;
  2923. #endif /* CK_ANSIC */
  2924. { /* xnoas */                /* Norge/Danish ISO 646 to ASCII */
  2925.     if (c & 0x80)
  2926.       return(UNK);
  2927.     switch (c) {
  2928.       case 91:
  2929.     zmstuff('E');            /* AE digraph */
  2930.     return('A');
  2931.       case 92: return('O');        /* O slash */
  2932.       case 93:                /* A ring */
  2933.     zmstuff('a');
  2934.     return('A');
  2935.       case 123:                /* ae digraph */
  2936.     zmstuff('e');
  2937.     return('a');
  2938.       case 124: return('o');        /* o slash */
  2939.       case 125:                /* a ring */
  2940.     zmstuff('a');
  2941.     return('a');
  2942.       default:  return(c);
  2943.     }
  2944. }
  2945.  
  2946. CHAR
  2947. #ifdef CK_ANSIC
  2948. xpoas(CHAR c)
  2949. #else
  2950. xpoas(c) CHAR c;
  2951. #endif /* CK_ANSIC */
  2952. { /* xpoas */                /* Portuguese ISO 646 to ASCII */
  2953.     if (c & 0x80)
  2954.       return(UNK);
  2955.     switch (c) {
  2956.       case 91:  return('A');        /* A tilde */
  2957.       case 92:  return('C');        /* C cedilla */
  2958.       case 93:  return('O');        /* O tilde */
  2959.       case 123: return('a');        /* a tilde */
  2960.       case 124: return('c');        /* c cedilla */
  2961.       case 125: return('o');        /* o tilde */
  2962.       default:  return(c);
  2963.     }
  2964. }
  2965.  
  2966. CHAR
  2967. #ifdef CK_ANSIC
  2968. xspas(CHAR c)
  2969. #else
  2970. xspas(c) CHAR c;
  2971. #endif /* CK_ANSIC */
  2972. { /* xspas */                /* Spanish ISO 646 to ASCII */
  2973.     if (c & 0x80)
  2974.       return(UNK);
  2975.     switch (c) {
  2976.       case 91:  return(33);        /* Inverted exclamation */
  2977.       case 92:  return('N');        /* N tilde */
  2978.       case 93:  return(63);        /* Inverted question mark */
  2979.       case 123: return(UNK);        /* degree */
  2980.       case 124: return('n');        /* n tilde */
  2981.       case 125: return('c');        /* c cedilla */
  2982.       default:  return(c);
  2983.     }
  2984. }
  2985.  
  2986. CHAR
  2987. #ifdef CK_ANSIC
  2988. xswas(CHAR c)
  2989. #else
  2990. xswas(c) CHAR c;
  2991. #endif /* CK_ANSIC */
  2992. { /* xswas */                /* Swedish ISO 646 to ASCII */
  2993.     if (c & 0x80)
  2994.       return(UNK);
  2995.     switch (c) {
  2996.       case 64:  return('E');        /* E acute */
  2997.       case 91:                /* A diaeresis */
  2998.     zmstuff('e');
  2999.     return('A');
  3000.       case 92:                /* O diaeresis */
  3001.     zmstuff('e');
  3002.     return('O');
  3003.       case 93:                /* A ring */
  3004.     zmstuff('a');
  3005.     return('A');
  3006.       case 94:                /* U diaeresis */
  3007.     /* return('Y'); */
  3008.     zmstuff('e');
  3009.     return('U');
  3010.       case 96:  return('e');        /* e acute */
  3011.       case 123:                /* a diaeresis */
  3012.     zmstuff('e');
  3013.     return('a');
  3014.       case 124:                /* o diaeresis */
  3015.     zmstuff('e');
  3016.     return('o');
  3017.       case 125:                /* a ring */
  3018.     zmstuff('a');
  3019.     return('a');
  3020.       case 126:                /* u diaeresis */
  3021.     /* return('y'); */
  3022.     zmstuff('e');
  3023.     return('u');
  3024.       default:  return(c);
  3025.     }
  3026. }
  3027.  
  3028. CHAR
  3029. #ifdef CK_ANSIC
  3030. xchas(CHAR c)
  3031. #else
  3032. xchas(c) CHAR c;
  3033. #endif /* CK_ANSIC */
  3034. { /* xchas */                /* Swiss ISO 646 to ASCII */
  3035.     if (c & 0x80)
  3036.       return(UNK);
  3037.     switch (c) {
  3038.       case 35:  return('u');        /* u grave */
  3039.       case 64:  return('a');        /* a grave */
  3040.       case 91:  return('e');        /* e acute */
  3041.       case 92:  return('c');        /* c cedilla */
  3042.       case 93:  return('e');        /* e circumflex */
  3043.       case 94:  return('i');        /* i circumflex */
  3044.       case 95:  return('e');        /* e grave */
  3045.       case 96:  return('o');        /* o circumflex */
  3046.       case 123:                /* a diaeresis */
  3047.     zmstuff('e');
  3048.     return('a');
  3049.       case 124:                /* o diaeresis */
  3050.     zmstuff('e');
  3051.     return('o');
  3052.       case 125:                /* u diaeresis */
  3053.     zmstuff('e');
  3054.     return('u');
  3055.       case 126: return('u');        /* u circumflex */
  3056.       default:  return(c);
  3057.     }
  3058. }
  3059.  
  3060. CHAR
  3061. #ifdef CK_ANSIC
  3062. xhuas(CHAR c)
  3063. #else
  3064. xhuas(c) CHAR c;
  3065. #endif /* CK_ANSIC */
  3066. { /* xhuas */                /* Hungarian ISO 646 to ASCII */
  3067.     if (c & 0x80)
  3068.       return(UNK);
  3069.     switch (c) {
  3070.       case 64:  return('A');        /* A acute */
  3071.       case 91:  return('E');        /* E acute */
  3072.       case 92:  return('O');        /* O diaeresis */
  3073.       case 93:  return('U');        /* U diaeresis */
  3074.       case 96:  return('a');        /* a acute */
  3075.       case 123: return('e');        /* e acute */
  3076.       case 124: return('o');        /* o acute */
  3077.       case 125: return('u');        /* u acute */
  3078.       case 126: return(34);        /* double acute accent */
  3079.       default:  return(c);
  3080.     }
  3081. }
  3082.  
  3083. CHAR
  3084. #ifdef CK_ANSIC
  3085. xdmas(CHAR c)
  3086. #else
  3087. xdmas(c) CHAR c;
  3088. #endif /* CK_ANSIC */
  3089. { /* xdmas */                /* DEC MCS to ASCII */
  3090.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3091.     if (c == 215) {            /* handle OE digraph. */
  3092.         zmstuff('E');
  3093.         return('O');
  3094.     } else if (c == 247) {        /* Also lowercase oe. */
  3095.         zmstuff('e');
  3096.         return('o');
  3097.     }
  3098.     }
  3099.     return(yl1as[c]);            /* Otherwise treat like Latin-1 */
  3100. }
  3101.  
  3102. CHAR
  3103. #ifdef CK_ANSIC
  3104. xdgas(CHAR c)
  3105. #else
  3106. xdgas(c) CHAR c;
  3107. #endif /* CK_ANSIC */
  3108. { /*  xdgas */                /* Data General to ASCII */
  3109.     switch(c) {
  3110.       case 180: return('f');        /* Florin */
  3111.       case 183: return('<');        /* Less-equal */
  3112.       case 184: return('>');        /* Greater-equal */
  3113.       case 186: return(96);        /* Grave accent */
  3114.       case 191: return('^');        /* Uparrow */
  3115.       case 215:
  3116.     if (langs[language].id == L_FRENCH) { /* OE digraph */
  3117.         zmstuff('E');
  3118.         return('O');
  3119.     } else return('O');
  3120.       case 247:
  3121.     if (langs[language].id == L_FRENCH) { /* oe digraph */
  3122.         zmstuff('e');
  3123.         return('o');
  3124.     } else return('o');
  3125.       case 175: case 179: case 220: case 222:
  3126.       case 223: case 254: case 255:
  3127.     return(UNK);
  3128.       default:                /* The rest, convert to Latin-1 */
  3129.     return(yl1as[ydgl1[c]]);    /* and from there to ASCII */
  3130.     }
  3131. }
  3132.  
  3133. CHAR
  3134. #ifdef CK_ANSIC
  3135. xr8as(CHAR c)
  3136. #else
  3137. xr8as(c) CHAR c;
  3138. #endif /* CK_ANSIC */
  3139. { /*  xr8as */                /* Hewlett Packard Roman8 to ASCII */
  3140.     switch(c) {
  3141.       case 175: return('L');        /* Lira */
  3142.       case 190: return('f');        /* Florin */
  3143.       case 235: return('S');        /* S caron */
  3144.       case 236: return('s');        /* s caron */
  3145.       case 246: return('-');        /* Horizontal bar */
  3146.       case 252: return('*');        /* Solid box */
  3147.       default:                /* The rest, convert to Latin-1 */
  3148.     return(yl1as[yr8l1[c]]);    /* and from there to ASCII */
  3149.     }
  3150. }
  3151.  
  3152. CHAR
  3153. #ifdef CK_ANSIC
  3154. xukl1(CHAR c)
  3155. #else
  3156. xukl1(c) CHAR c;
  3157. #endif /* CK_ANSIC */
  3158. { /* xukl1 */                /* UK ASCII to Latin-1 */
  3159.     if (c & 0x80)
  3160.       return(UNK);
  3161.     if (c == 35)
  3162.       return(163);
  3163.     else return(c);
  3164. }
  3165.  
  3166. CHAR
  3167. #ifdef CK_ANSIC
  3168. xl1uk(CHAR c)
  3169. #else
  3170. xl1uk(c) CHAR c;
  3171. #endif /* CK_ANSIC */
  3172. { /* xl1uk */                /* Latin-1 to UK ASCII */
  3173.     if (c == 163)
  3174.       return(35);
  3175.     else return(yl1as[c]);
  3176. }
  3177.  
  3178. CHAR                    /* Latin-1 to French ISO 646 */
  3179. #ifdef CK_ANSIC
  3180. xl1fr(CHAR c)
  3181. #else
  3182. xl1fr(c) CHAR c;
  3183. #endif /* CK_ANSIC */
  3184. { /* xl1fr */
  3185.     return(yl1fr[c]);
  3186. }
  3187.  
  3188.  
  3189. CHAR                    /* French ISO 646 to Latin-1 */
  3190. #ifdef CK_ANSIC
  3191. xfrl1(CHAR c)
  3192. #else
  3193. xfrl1(c) CHAR c;
  3194. #endif /* CK_ANSIC */
  3195. { /* xfrl1 */
  3196.     if (c & 0x80)
  3197.       return(UNK);
  3198.     return(yfrl1[c]);
  3199. }
  3200.  
  3201. CHAR                    /* Latin-1 to Dutch ASCII */
  3202. #ifdef CK_ANSIC
  3203. xl1du(CHAR c)
  3204. #else
  3205. xl1du(c) CHAR c;
  3206. #endif /* CK_ANSIC */
  3207. { /* xl1du */
  3208.     return(yl1du[c]);
  3209. }
  3210.  
  3211. CHAR
  3212. #ifdef CK_ANSIC
  3213. xdul1(CHAR c)
  3214. #else
  3215. xdul1(c) CHAR c;
  3216. #endif /* CK_ANSIC */
  3217. { /* xdul1 */                /* Dutch ISO 646 to Latin-1 */
  3218.     if (c & 0x80)
  3219.       return(UNK);
  3220.     return(ydul1[c]);
  3221. }
  3222.  
  3223. CHAR
  3224. #ifdef CK_ANSIC
  3225. xfil1(CHAR c)
  3226. #else
  3227. xfil1(c) CHAR c;
  3228. #endif /* CK_ANSIC */
  3229. { /* xfil1 */                /* Finnish ISO 646 to Latin-1 */
  3230.     if (c & 0x80)
  3231.       return(UNK);
  3232.     return(yfil1[c]);
  3233. }
  3234.  
  3235. CHAR
  3236. #ifdef CK_ANSIC
  3237. xl1fi(CHAR c)
  3238. #else
  3239. xl1fi(c) CHAR c;
  3240. #endif /* CK_ANSIC */
  3241. { /* xl1fi */                /* Latin-1 to Finnish ISO 646 */
  3242.     return(yl1fi[c]);
  3243. }
  3244.  
  3245. CHAR
  3246. #ifdef CK_ANSIC
  3247. xfcl1(CHAR c)
  3248. #else
  3249. xfcl1(c) CHAR c;
  3250. #endif /* CK_ANSIC */
  3251. { /* xfcl1 */                /* French Canadian ISO646 to Latin-1 */
  3252.     if (c & 0x80)
  3253.       return(UNK);
  3254.     return(yfcl1[c]);
  3255. }
  3256.  
  3257. CHAR
  3258. #ifdef CK_ANSIC
  3259. xl1fc(CHAR c)
  3260. #else
  3261. xl1fc(c) CHAR c;
  3262. #endif /* CK_ANSIC */
  3263. { /* xl1fc */                /* Latin-1 to French Canadian ISO646 */
  3264.     return(yl1fc[c]);
  3265. }
  3266.  
  3267. CHAR
  3268. #ifdef CK_ANSIC
  3269. xitl1(CHAR c)
  3270. #else
  3271. xitl1(c) CHAR c;
  3272. #endif /* CK_ANSIC */
  3273. { /* xitl1 */                /* Italian ISO 646 to Latin-1 */
  3274.     if (c & 0x80)
  3275.       return(UNK);
  3276.     return(yitl1[c]);
  3277. }
  3278.  
  3279. CHAR
  3280. #ifdef CK_ANSIC
  3281. xl1it(CHAR c)
  3282. #else
  3283. xl1it(c) CHAR c;
  3284. #endif /* CK_ANSIC */
  3285. { /* xl1it */                /* Latin-1 to Italian ISO 646 */
  3286.     return(yl1it[c]);
  3287. }
  3288.  
  3289. CHAR
  3290. #ifdef CK_ANSIC
  3291. xnel1(CHAR c)
  3292. #else
  3293. xnel1(c) CHAR c;
  3294. #endif /* CK_ANSIC */
  3295. { /* xnel1 */                 /* NeXT to Latin-1 */
  3296.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3297.     if (c == 234) {            /* handle OE digraph. */
  3298.         zmstuff('E');
  3299.         return('O');
  3300.     } else if (c == 250) {        /* Also lowercase oe. */
  3301.         zmstuff('e');
  3302.         return('o');
  3303.     }
  3304.     }
  3305.     return(ynel1[c]);
  3306. }
  3307.  
  3308. CHAR
  3309. #ifdef CK_ANSIC
  3310. xnel9(CHAR c)
  3311. #else
  3312. xnel9(c) CHAR c;
  3313. #endif /* CK_ANSIC */
  3314. { /* xnel9 */                 /* NeXT to Latin-9 */
  3315.     switch (c) {
  3316.       case 234: return(188);        /* OE */
  3317.       case 250: return(189);        /* oe */
  3318.       case 188: return(234);        /* keep it invertible... */
  3319.       case 189: return(250);        /* oe */
  3320.       default:
  3321.     return(ynel1[c]);
  3322.     }
  3323. }
  3324.  
  3325. CHAR
  3326. #ifdef CK_ANSIC
  3327. xl1ne(CHAR c)
  3328. #else
  3329. xl1ne(c) CHAR c;
  3330. #endif /* CK_ANSIC */
  3331. { /* xl1ne */                 /* Latin-1 to NeXT */
  3332.     return(yl1ne[c]);
  3333. }
  3334.  
  3335. CHAR
  3336. #ifdef CK_ANSIC
  3337. xl9ne(CHAR c)
  3338. #else
  3339. xl9ne(c) CHAR c;
  3340. #endif /* CK_ANSIC */
  3341. { /* xl9ne */                 /* Latin-9 to NeXT */
  3342.     switch (c) {
  3343.       case 188: return(234);        /* OE */
  3344.       case 189: return(250);        /* oe */
  3345.       case 234: return(188);        /* OE */
  3346.       case 250: return(189);        /* oe */
  3347.       default:
  3348.     return(yl1ne[c]);
  3349.     }
  3350. }
  3351.  
  3352. CHAR
  3353. #ifdef CK_ANSIC
  3354. xnol1(CHAR c)
  3355. #else
  3356. xnol1(c) CHAR c;
  3357. #endif /* CK_ANSIC */
  3358. { /* xnol1 */                 /* Norway/Denmark ISO 646 to Latin-1 */
  3359.     if (c & 0x80)
  3360.       return(UNK);
  3361.     return(ynol1[c]);
  3362. }
  3363.  
  3364. CHAR
  3365. #ifdef CK_ANSIC
  3366. xl1no(CHAR c)
  3367. #else
  3368. xl1no(c) CHAR c;
  3369. #endif /* CK_ANSIC */
  3370. { /* xl1no */                 /* Latin-1 to Norway/Denmark ISO 646 */
  3371.     return(yl1no[c]);
  3372. }
  3373.  
  3374. CHAR
  3375. #ifdef CK_ANSIC
  3376. xpol1(CHAR c)
  3377. #else
  3378. xpol1(c) CHAR c;
  3379. #endif /* CK_ANSIC */
  3380. { /* xpol1 */                /* Portuguese ISO 646 to Latin-1 */
  3381.     if (c & 0x80)
  3382.       return(UNK);
  3383.     return(ypol1[c]);
  3384. }
  3385.  
  3386. CHAR
  3387. #ifdef CK_ANSIC
  3388. xl1po(CHAR c)
  3389. #else
  3390. xl1po(c) CHAR c;
  3391. #endif /* CK_ANSIC */
  3392. { /* xl1po */                /* Latin-1 to Portuguese ISO 646 */
  3393.     return(yl1po[c]);
  3394. }
  3395.  
  3396. CHAR
  3397. #ifdef CK_ANSIC
  3398. xspl1(CHAR c)
  3399. #else
  3400. xspl1(c) CHAR c;
  3401. #endif /* CK_ANSIC */
  3402. { /* xspl1 */                /* Spanish ISO 646 to Latin-1 */
  3403.     if (c & 0x80)
  3404.       return(UNK);
  3405.     return(yspl1[c]);
  3406. }
  3407.  
  3408. CHAR
  3409. #ifdef CK_ANSIC
  3410. xl1sp(CHAR c)
  3411. #else
  3412. xl1sp(c) CHAR c;
  3413. #endif /* CK_ANSIC */
  3414. { /* xl1sp */                /* Latin-1 to Spanish ISO 646 */
  3415.     return(yl1sp[c]);
  3416. }
  3417.  
  3418. CHAR
  3419. #ifdef CK_ANSIC
  3420. xswl1(CHAR c)
  3421. #else
  3422. xswl1(c) CHAR c;
  3423. #endif /* CK_ANSIC */
  3424. { /* xswl1 */                /* Swedish ISO 646 to Latin-1 */
  3425.     if (c & 0x80)
  3426.       return(UNK);
  3427.     return(yswl1[c]);
  3428. }
  3429.  
  3430. CHAR
  3431. #ifdef CK_ANSIC
  3432. xl1sw(CHAR c)
  3433. #else
  3434. xl1sw(c) CHAR c;
  3435. #endif /* CK_ANSIC */
  3436. { /* xl1sw */                /* Latin-1 to Swedish ISO 646 */
  3437.     return(yl1sw[c]);
  3438. }
  3439.  
  3440. CHAR
  3441. #ifdef CK_ANSIC
  3442. xchl1(CHAR c)
  3443. #else
  3444. xchl1(c) CHAR c;
  3445. #endif /* CK_ANSIC */
  3446. { /* xchl1 */                /* Swiss ISO 646 to Latin-1 */
  3447.     if (c & 0x80)
  3448.       return(UNK);
  3449.     return(ychl1[c]);
  3450. }
  3451.  
  3452. CHAR
  3453. #ifdef CK_ANSIC
  3454. xl1ch(CHAR c)
  3455. #else
  3456. xl1ch(c) CHAR c;
  3457. #endif /* CK_ANSIC */
  3458. { /* xl1ch */                /* Latin-1 to Swiss ISO 646 */
  3459.     return(yl1ch[c]);
  3460. }
  3461.  
  3462. CHAR
  3463. #ifdef CK_ANSIC
  3464. xhul1(CHAR c)
  3465. #else
  3466. xhul1(c) CHAR c;
  3467. #endif /* CK_ANSIC */
  3468. { /* xhul1 */                /* Hungarian ISO 646 to Latin-1 */
  3469.     if (c & 0x80)
  3470.       return(UNK);
  3471.     return(yhul1[c]);
  3472. }
  3473.  
  3474. CHAR
  3475. #ifdef CK_ANSIC
  3476. xl1hu(CHAR c)
  3477. #else
  3478. xl1hu(c) CHAR c;
  3479. #endif /* CK_ANSIC */
  3480. { /* xl1hu */                /* Latin-1 to Hungarian ISO 646 */
  3481.     return(yl1hu[c]);
  3482. }
  3483.  
  3484. CHAR
  3485. #ifdef CK_ANSIC
  3486. xl1dm(CHAR c)
  3487. #else
  3488. xl1dm(c) CHAR c;
  3489. #endif /* CK_ANSIC */
  3490. { /* xl1dm */                /* Latin-1 to DEC MCS */
  3491.     return(yl1dm[c]);
  3492. }
  3493.  
  3494. CHAR
  3495. #ifdef CK_ANSIC
  3496. xl9dm(CHAR c)
  3497. #else
  3498. xl9dm(c) CHAR c;
  3499. #endif /* CK_ANSIC */
  3500. { /* xl9dm */                /* Latin-9 to DEC MCS */
  3501.     switch (c) {
  3502.       case 188: return(215);
  3503.       case 189: return(247);
  3504.       case 215: return(188);
  3505.       case 247: return(189);
  3506.       default:
  3507.     return(yl1dm[c]);
  3508.     }
  3509. }
  3510.  
  3511. CHAR
  3512. #ifdef CK_ANSIC
  3513. xl9w1(CHAR c)
  3514. #else
  3515. xl9w1(c) CHAR c;
  3516. #endif /* CK_ANSIC */
  3517. { /* xl9w1 */                /* Latin-9 to CP1252 */
  3518.     if (c < 128)
  3519.       return(c);
  3520.     else if (c < 160)
  3521.       return('?');
  3522.     switch (c) {
  3523.       case 0xa4: return(0x80);        /* Euro */
  3524.       case 0xa6: return(0x8a);        /* S-caron */
  3525.       case 0xa8: return(0x9a);        /* s-caron */
  3526.       case 0xb4: return(0x8e);        /* Z-caron */
  3527.       case 0xb8: return(0x9e);        /* z-caron */
  3528.       case 0xbc: return(0x8c);        /* OE */
  3529.       case 0xbd: return(0x9c);        /* oe */
  3530.       case 0xbe: return(0x9f);        /* Y-diaeresis */
  3531.       default:
  3532.     return(c);
  3533.     }
  3534. }
  3535.  
  3536. CHAR
  3537. #ifdef CK_ANSIC
  3538. xl1dg(CHAR c)
  3539. #else
  3540. xl1dg(c) CHAR c;
  3541. #endif /* CK_ANSIC */
  3542. { /* xl1dg */                /* Latin-1 to DG ICS */
  3543.     return(yl1dg[c]);
  3544. }
  3545.  
  3546. CHAR
  3547. #ifdef CK_ANSIC
  3548. xdml1(CHAR c)
  3549. #else
  3550. xdml1(c) CHAR c;
  3551. #endif /* CK_ANSIC */
  3552. { /* xdml1 */                /* DEC MCS to Latin-1 */
  3553.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3554.     if (c == 215) {            /* handle OE digraph. */
  3555.         zmstuff('E');
  3556.         return('O');
  3557.     } else if (c == 247) {        /* Also lowercase oe. */
  3558.         zmstuff('e');
  3559.         return('o');
  3560.     }
  3561.     }
  3562.     return(ydml1[c]);
  3563. }
  3564.  
  3565. CHAR
  3566. #ifdef CK_ANSIC
  3567. xdml9(CHAR c)
  3568. #else
  3569. xdml9(c) CHAR c;
  3570. #endif /* CK_ANSIC */
  3571. { /* xdml9 */                /* DEC MCS to Latin-9 */
  3572.     switch (c) {
  3573.       case 215: return(188);        /* OE */
  3574.       case 247: return(189);        /* oe */
  3575.       case 188: return(215);        /* and swap the other two... */
  3576.       case 189: return(247);        /* (1/4 and 1/2) */
  3577.       default:                /* to keep it invertible */
  3578.     return(ydml1[c]);
  3579.     }
  3580. }
  3581.  
  3582. CHAR
  3583. #ifdef CK_ANSIC
  3584. xdgl1(CHAR c)
  3585. #else
  3586. xdgl1(c) CHAR c;
  3587. #endif /* CK_ANSIC */
  3588. { /* xdgl1 */                /* DG International CS to Latin-1 */
  3589.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3590.     if (c == 215) {            /* handle OE digraph. */
  3591.         zmstuff('E');
  3592.         return('O');
  3593.     } else if (c == 247) {        /* Also lowercase oe. */
  3594.         zmstuff('e');
  3595.         return('o');
  3596.     }
  3597.     }
  3598.     return(ydgl1[c]);
  3599. }
  3600.  
  3601. CHAR
  3602. #ifdef CK_ANSIC
  3603. xr8l1(CHAR c)
  3604. #else
  3605. xr8l1(c) CHAR c;
  3606. #endif /* CK_ANSIC */
  3607. { /* xr8l1 */                /* Hewlett Packard Roman8 to Latin-1 */
  3608.     return(yr8l1[c]);
  3609. }
  3610.  
  3611. CHAR
  3612. #ifdef CK_ANSIC
  3613. xl1r8(CHAR c)
  3614. #else
  3615. xl1r8(c) CHAR c;
  3616. #endif /* CK_ANSIC */
  3617. { /* xl1r8 */                /* Latin-1 to Hewlett Packard Roman8 */
  3618.     return(yl1r8[c]);
  3619. }
  3620.  
  3621. /* Translation functions for receiving files and translating them into ASCII */
  3622.  
  3623. CHAR
  3624. #ifdef CK_ANSIC
  3625. zl1as(CHAR c)
  3626. #else
  3627. zl1as(c) CHAR c;
  3628. #endif /* CK_ANSIC */
  3629. { /* zl1as */
  3630.     switch(langs[language].id) {
  3631.  
  3632.       case L_DUTCH:
  3633.     if (c == 255) {            /* Dutch umlaut-y */
  3634.         zdstuff('j');        /* becomes ij */
  3635.         return('i');
  3636.     } else return(yl1as[c]);    /* all others by the book */
  3637.  
  3638.       case L_GERMAN:
  3639.     switch (c) {            /* German, special rules. */
  3640.       case 196:            /* umlaut-A -> Ae */
  3641.         zdstuff('e');
  3642.         return('A');
  3643.       case 214:            /* umlaut-O -> Oe */
  3644.         zdstuff('e');
  3645.         return('O');
  3646.       case 220:            /* umlaut-U -> Ue */
  3647.         zdstuff('e');
  3648.         return('U');
  3649.       case 228:            /* umlaut-a -> ae */
  3650.         zdstuff('e');
  3651.         return('a');
  3652.       case 246:            /* umlaut-o -> oe */
  3653.         zdstuff('e');
  3654.         return('o');
  3655.       case 252:            /* umlaut-u -> ue */
  3656.         zdstuff('e');
  3657.         return('u');
  3658.       case 223:            /* ess-zet -> ss */
  3659.         zdstuff('s');
  3660.         return('s');
  3661.       default: return(yl1as[c]);    /* all others by the book */
  3662.     }
  3663.       case L_DANISH:
  3664.       case L_FINNISH:
  3665.       case L_NORWEGIAN:
  3666.       case L_SWEDISH:
  3667.     switch (c) {            /* Scandanavian languages. */
  3668.       case 196:            /* umlaut-A -> Ae */
  3669.         zdstuff('e');
  3670.         return('A');
  3671.       case 214:            /* umlaut-O -> Oe */
  3672.       case 216:            /* O-slash -> Oe */
  3673.         zdstuff('e');
  3674.         return('O');
  3675.       case 220:            /* umlaut-U -> Y */
  3676.         /* return('Y'); */
  3677.         zdstuff('e');
  3678.         return('U');
  3679.       case 228:            /* umlaut-a -> ae */
  3680.         zdstuff('e');
  3681.         return('a');
  3682.       case 246:            /* umlaut-o -> oe */
  3683.       case 248:            /* o-slash -> oe */
  3684.         zdstuff('e');
  3685.         return('o');
  3686.       case 252:            /* umlaut-u -> y */
  3687.         /* return('y'); */
  3688.         zdstuff('e');
  3689.         return('u');
  3690.       case 197:            /* A-ring -> Aa */
  3691.         zdstuff('a');
  3692.         return('A');
  3693.           case 229:            /* a-ring -> aa */
  3694.         zdstuff('a');
  3695.         return('a');
  3696.       default: return(yl1as[c]);    /* All others by the book */
  3697.     }
  3698.       default:
  3699.     return(yl1as[c]);        /* No language, go by the table. */
  3700.     }
  3701. }
  3702.  
  3703. CHAR                    /* IBM CP437 to Latin-1 */
  3704. #ifdef CK_ANSIC
  3705. x43l1(CHAR c)
  3706. #else
  3707. x43l1(c) CHAR c;
  3708. #endif /* CK_ANSIC */
  3709. { /* x43l1 */
  3710.     return(y43l1[c]);
  3711. }
  3712.  
  3713. CHAR                    /* IBM CP850 to Latin-1 */
  3714. #ifdef CK_ANSIC
  3715. x85l1(CHAR c)
  3716. #else
  3717. x85l1(c) CHAR c;
  3718. #endif /* CK_ANSIC */
  3719. { /* x85l1 */
  3720.     return(y85l1[c]);
  3721. }
  3722.  
  3723. CHAR                    /* Latin-1 to IBM CP437 */
  3724. #ifdef CK_ANSIC
  3725. xl143(CHAR c)
  3726. #else
  3727. xl143(c) CHAR c;
  3728. #endif /* CK_ANSIC */
  3729. { /* xl143 */
  3730.     return(yl143[c]);
  3731. }
  3732.  
  3733. CHAR                    /* Latin-1 to CP850 */
  3734. #ifdef CK_ANSIC
  3735. xl185(CHAR c)
  3736. #else
  3737. xl185(c) CHAR c;
  3738. #endif /* CK_ANSIC */
  3739. { /* xl185 */
  3740.     return(yl185[c]);
  3741. }
  3742.  
  3743. CHAR
  3744. #ifdef CK_ANSIC
  3745. x43as(CHAR c)
  3746. #else
  3747. x43as(c) CHAR c;
  3748. #endif /* CK_ANSIC */
  3749. { /* x43as */                /* CP437 to ASCII */
  3750.     c = y43l1[c];            /* Translate to Latin-1 */
  3751.     return(xl143(c));            /* and from Latin-1 to ASCII. */
  3752. }
  3753.  
  3754. CHAR
  3755. #ifdef CK_ANSIC
  3756. x85as(CHAR c)
  3757. #else
  3758. x85as(c) CHAR c;
  3759. #endif /* CK_ANSIC */
  3760. { /* x85as */                /* CP850 to ASCII */
  3761.     c = y85l1[c];            /* Translate to Latin-1 */
  3762.     return(xl1as(c));            /* and from Latin-1 to ASCII. */
  3763. }
  3764.  
  3765. CHAR                    /* Macintosh Latin to Latin-1 */
  3766. #ifdef CK_ANSIC
  3767. xaql1(CHAR c)
  3768. #else
  3769. xaql1(c) CHAR c;
  3770. #endif /* CK_ANSIC */
  3771. { /* xaql1 */
  3772.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3773.     if (c == 206) {            /* handle OE digraph. */
  3774.         zmstuff('E');
  3775.         return('O');
  3776.     } else if (c == 207) {        /* Also lowercase oe. */
  3777.         zmstuff('e');
  3778.         return('o');
  3779.     }
  3780.     }
  3781.     return(yaql1[c]);
  3782. }
  3783.  
  3784. CHAR                    /* Macintosh Latin to ASCII */
  3785. #ifdef CK_ANSIC
  3786. xaqas(CHAR c)
  3787. #else
  3788. xaqas(c) CHAR c;
  3789. #endif /* CK_ANSIC */
  3790. { /* xaqas */
  3791.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3792.     if (c == 206) {            /* handle OE digraph. */
  3793.         zmstuff('E');
  3794.         return('O');
  3795.     } else if (c == 207) {        /* Also lowercase oe. */
  3796.         zmstuff('e');
  3797.         return('o');
  3798.     }
  3799.     }
  3800.     c = yaql1[c];            /* Translate to Latin-1 */
  3801.     return(xl1as(c));            /* then to ASCII. */
  3802. }
  3803.  
  3804. CHAR                    /* Latin-1 to Macintosh Latin */
  3805. #ifdef CK_ANSIC
  3806. xl1aq(CHAR c)
  3807. #else
  3808. xl1aq(c) CHAR c;
  3809. #endif /* CK_ANSIC */
  3810. { /* xl1aq */
  3811.     return(yl1aq[c]);
  3812. }
  3813.  
  3814. #ifdef LATIN2
  3815.  
  3816. /* Translation functions for Latin Alphabet 2 */
  3817.  
  3818. CHAR                    /* Latin-2 to Latin-1 */
  3819. #ifdef CK_ANSIC
  3820. xl2l1(CHAR c)
  3821. #else
  3822. xl2l1(c) CHAR c;
  3823. #endif /* CK_ANSIC */
  3824. { /* xll2l1 */
  3825.     return(yl2l1[c]);
  3826. }
  3827.  
  3828. CHAR
  3829. #ifdef CK_ANSIC
  3830. xl2w1(CHAR c)
  3831. #else
  3832. xl2w1(c) CHAR c;
  3833. #endif /* CK_ANSIC */
  3834. { /* xl2w1 */                /* Latin-2 to CP1252 (Windows L1) */
  3835.     if (c > 127 && c < 160)
  3836.       return(UNK);
  3837.     else
  3838.       return(yl2l1[c]);
  3839. }
  3840.  
  3841. CHAR                    /* Latin-1 to Latin-2 */
  3842. #ifdef CK_ANSIC
  3843. xl1l2(CHAR c)
  3844. #else
  3845. xl1l2(c) CHAR c;
  3846. #endif /* CK_ANSIC */
  3847. { /* xll1l2 */
  3848.     return(yl1l2[c]);
  3849. }
  3850.  
  3851. CHAR                    /* CP1252 to Latin-1 */
  3852. #ifdef CK_ANSIC
  3853. xw1l2(CHAR c)
  3854. #else
  3855. xw1l2(c) CHAR c;
  3856. #endif /* CK_ANSIC */
  3857. { /* xw1l2 */
  3858.     switch (c) {
  3859.       case 0x8a: return(0xa9);        /* S caron */
  3860.       case 0x8e: return(0xae);        /* Z caron */
  3861.       case 0x9a: return(0xb9);        /* s caron */
  3862.       case 0x9e: return(0xbe);        /* z caron */
  3863.       default:
  3864.     return((c < 160) ? xw1as(c) : xl1l2(c));
  3865.     }
  3866. }
  3867.  
  3868.  
  3869. CHAR                    /* Latin-2 to ASCII */
  3870. #ifdef CK_ANSIC
  3871. xl2as(CHAR c)
  3872. #else
  3873. xl2as(c) CHAR c;
  3874. #endif /* CK_ANSIC */
  3875. { /* xll2as */
  3876.     return(yl2as[c]);
  3877. }
  3878.  
  3879. CHAR                    /* Latin-2 to CP852 */
  3880. #ifdef CK_ANSIC
  3881. xl252(CHAR c)
  3882. #else
  3883. xl252(c) CHAR c;
  3884. #endif /* CK_ANSIC */
  3885. { /* xll252 */
  3886.     return(yl252[c]);
  3887. }
  3888.  
  3889. CHAR                    /* Latin-2 to Mazovia */
  3890. #ifdef CK_ANSIC
  3891. xl2mz(CHAR c)
  3892. #else
  3893. xl2mz(c) CHAR c;
  3894. #endif /* CK_ANSIC */
  3895. { /* xll2mz */
  3896.     return(yl2mz[c]);
  3897. }
  3898.  
  3899. CHAR                    /* Latin-1 to Mazovia */
  3900. #ifdef CK_ANSIC
  3901. xl1mz(CHAR c)
  3902. #else
  3903. xl1mz(c) CHAR c;
  3904. #endif /* CK_ANSIC */
  3905. { /* xll1mz */
  3906.     return(yl2mz[yl1l2[c]]);
  3907. }
  3908.  
  3909. CHAR                    /* Mazovia to Latin-1 */
  3910. #ifdef CK_ANSIC
  3911. xmzl1(CHAR c)
  3912. #else
  3913. xmzl1(c) CHAR c;
  3914. #endif /* CK_ANSIC */
  3915. { /* xmzl1 */
  3916.     return(yl2l1[ymzl2[c]]);
  3917. }
  3918.  
  3919. CHAR                    /* Mazovia to Latin-9 */
  3920. #ifdef CK_ANSIC
  3921. xmzl9(CHAR c)
  3922. #else
  3923. xmzl9(c) CHAR c;
  3924. #endif /* CK_ANSIC */
  3925. { /* xmzl9 */
  3926.     return(xl2l9(ymzl2[c]));
  3927. }
  3928.  
  3929. CHAR                    /* CP852 to Latin-2 */
  3930. #ifdef CK_ANSIC
  3931. x52l2(CHAR c)
  3932. #else
  3933. x52l2(c) CHAR c;
  3934. #endif /* CK_ANSIC */
  3935. { /* x52l2 */
  3936.     return(y52l2[c]);
  3937. }
  3938.  
  3939. CHAR                    /* Mazovia to Latin-2 */
  3940. #ifdef CK_ANSIC
  3941. xmzl2(CHAR c)
  3942. #else
  3943. xmzl2(c) CHAR c;
  3944. #endif /* CK_ANSIC */
  3945. { /* xmzl2 */
  3946.     return(ymzl2[c]);
  3947. }
  3948.  
  3949. CHAR                    /* Latin-2 to CP1250 */
  3950. #ifdef CK_ANSIC
  3951. xl21250(CHAR c)
  3952. #else
  3953. xl21250(c) CHAR c;
  3954. #endif /* CK_ANSIC */
  3955. { /* xll21250 */
  3956.     return(yl21250[c]);
  3957. }
  3958.  
  3959. CHAR                    /* CP1250 to Latin-2 */
  3960. #ifdef CK_ANSIC
  3961. x1250l2(CHAR c)
  3962. #else
  3963. x1250l2(c) CHAR c;
  3964. #endif /* CK_ANSIC */
  3965. { /* x1250l2 */
  3966.     return(y1250l2[c]);
  3967. }
  3968.  
  3969. CHAR                    /* CP852 to ASCII */
  3970. #ifdef CK_ANSIC
  3971. x52as(CHAR c)
  3972. #else
  3973. x52as(c) CHAR c;
  3974. #endif /* CK_ANSIC */
  3975. { /* xl52as */
  3976.     return(yl2as[y52l2[c]]);        /* CP852 -> Latin-2 -> ASCII */
  3977. }
  3978.  
  3979. CHAR                    /* CP1250 to ASCII */
  3980. #ifdef CK_ANSIC
  3981. x1250as(CHAR c)
  3982. #else
  3983. x1250as(c) CHAR c;
  3984. #endif /* CK_ANSIC */
  3985. { /* xl1250as */
  3986.     return(yl2as[y1250l2[c]]);        /* CP81250 -> Latin-2 -> ASCII */
  3987. }
  3988.  
  3989.  
  3990. CHAR                    /* CP852 to Latin-1 */
  3991. #ifdef CK_ANSIC
  3992. x52l1(CHAR c)
  3993. #else
  3994. x52l1(c) CHAR c;
  3995. #endif /* CK_ANSIC */
  3996. { /* xl52l1 */
  3997.     return(yl2l1[y52l2[c]]);        /* CP852 -> Latin-2 -> Latin-1 */
  3998. }
  3999.  
  4000. CHAR                    /* CP1250 to Latin-1 */
  4001. #ifdef CK_ANSIC
  4002. x1250l1(CHAR c)
  4003. #else
  4004. x1250l1(c) CHAR c;
  4005. #endif /* CK_ANSIC */
  4006. { /* xl1250l1 */
  4007.     return(yl2l1[y1250l2[c]]);        /* CP1250 -> Latin-2 -> Latin-1 */
  4008. }
  4009.  
  4010. CHAR                    /* CP1250 to Latin-9 */
  4011. #ifdef CK_ANSIC
  4012. x1250l9(CHAR c)
  4013. #else
  4014. x1250l9(c) CHAR c;
  4015. #endif /* CK_ANSIC */
  4016. { /* x1250l9 */
  4017.     if (c == (CHAR)128)            /* Euro */
  4018.       return((CHAR)164);
  4019.     else
  4020.       return(xl2l9(y1250l2[c]));    /* CP1250 -> Latin-2 -> Latin-9 */
  4021. }
  4022.  
  4023. CHAR                    /* Latin-1 to CP852 */
  4024. #ifdef CK_ANSIC
  4025. xl152(CHAR c)
  4026. #else
  4027. xl152(c) CHAR c;
  4028. #endif /* CK_ANSIC */
  4029. { /* xll152 */
  4030.     return(yl252[yl1l2[c]]);        /* Latin-1 -> Latin-2 -> CP852 */
  4031. }
  4032.  
  4033. CHAR                    /* Latin-1 to CP1250 */
  4034. #ifdef CK_ANSIC
  4035. xl11250(CHAR c)
  4036. #else
  4037. xl11250(c) CHAR c;
  4038. #endif /* CK_ANSIC */
  4039. { /* xll11250 */
  4040.     return(yl21250[yl1l2[c]]);        /* Latin-1 -> Latin-2 -> CP1250 */
  4041. }
  4042.  
  4043. CHAR                    /* Latin-9 to CP1250 */
  4044. #ifdef CK_ANSIC
  4045. xl91250(CHAR c)
  4046. #else
  4047. xl91250(c) CHAR c;
  4048. #endif /* CK_ANSIC */
  4049. { /* xll91250 */
  4050.     if (c == (CHAR)164)            /* Euro */
  4051.       return((CHAR)128);
  4052.     else
  4053.       return(yl21250[xl9l2(c)]);    /* Latin-9 -> Latin-2 -> CP1250 */
  4054. }
  4055.  
  4056. CHAR                    /* Latin-9 to Mazovia */
  4057. #ifdef CK_ANSIC
  4058. xl9mz(CHAR c)
  4059. #else
  4060. xl9mz(c) CHAR c;
  4061. #endif /* CK_ANSIC */
  4062. { /* xll9mz */
  4063.     return(yl2mz[xl9l2(c)]);        /* Latin-9 -> Latin-2 -> Mazovia */
  4064. }
  4065.  
  4066. CHAR                    /* Latin-9 to Mazovia */
  4067. #ifdef CK_ANSIC
  4068. xmzas(CHAR c)
  4069. #else
  4070. xmzas(c) CHAR c;
  4071. #endif /* CK_ANSIC */
  4072. { /* xmzas */
  4073.     return(yl2as[xmzl2(c)]);        /* Mazovia -> Latin-2 -> ASCII */
  4074. }
  4075.  
  4076. CHAR                    /* Latin-2 to NeXT */
  4077. #ifdef CK_ANSIC
  4078. xl2ne(CHAR c)
  4079. #else
  4080. xl2ne(c) CHAR c;
  4081. #endif /* CK_ANSIC */
  4082. { /* xll2ne */
  4083.     switch(c) {
  4084.       case 162: return(198);        /* Breve */
  4085.       case 163: return(232);        /* L with stroke */
  4086.       case 178: return(206);        /* Ogonek */
  4087.       case 179: return(248);        /* l with stroke */
  4088.       case 183: return(207);        /* Caron */
  4089.       case 189: return(205);        /* Double acute */
  4090.       case 208: return(144);        /* D stroke = Eth */
  4091.       case 240: return(230);        /* d stroke = eth */
  4092.       case 255: return(199);        /* Dot above */
  4093.       default:  return(yl1ne[yl2l1[c]]);
  4094.     }
  4095. }
  4096.  
  4097. CHAR                    /* Latin-2 to CP437 */
  4098. #ifdef CK_ANSIC
  4099. xl243(CHAR c)
  4100. #else
  4101. xl243(c) CHAR c;
  4102. #endif /* CK_ANSIC */
  4103. { /* xll243 */
  4104.     return(yl1l2[y43l1[c]]);
  4105. }
  4106.  
  4107. CHAR                    /* Latin-2 to CP850 */
  4108. #ifdef CK_ANSIC
  4109. xl285(CHAR c)
  4110. #else
  4111. xl285(c) CHAR c;
  4112. #endif /* CK_ANSIC */
  4113. { /* xll285 */
  4114.     return(yl1l2[y85l1[c]]);
  4115. }
  4116.  
  4117. CHAR                    /* Latin-2 to Apple */
  4118. #ifdef CK_ANSIC
  4119. xl2aq(CHAR c)
  4120. #else
  4121. xl2aq(c) CHAR c;
  4122. #endif /* CK_ANSIC */
  4123. { /* xl2aq */
  4124.     return(yl1aq[yl2l1[c]]);        /* Could do more... */
  4125. }
  4126.  
  4127. CHAR                    /* Latin-2 to DGI */
  4128. #ifdef CK_ANSIC
  4129. xl2dg(CHAR c)
  4130. #else
  4131. xl2dg(c) CHAR c;
  4132. #endif /* CK_ANSIC */
  4133. { /* xll2dg */
  4134.     return(ydgl1[yl1l2[c]]);
  4135. }
  4136.  
  4137. CHAR                    /* Latin-2 to Short KOI */
  4138. #ifdef CK_ANSIC
  4139. xl2sk(CHAR c)
  4140. #else
  4141. xl2sk(c) CHAR c;
  4142. #endif /* CK_ANSIC */
  4143. { /* xll2sk */
  4144.     return(islower(c) ? toupper(c) : c);
  4145. }
  4146.  
  4147. CHAR                    /* NeXT to Latin-2 */
  4148. #ifdef CK_ANSIC
  4149. xnel2(CHAR c)
  4150. #else
  4151. xnel2(c) CHAR c;
  4152. #endif /* CK_ANSIC */
  4153. { /* xnel2 */
  4154.     switch (c) {
  4155.       case 144: return(208);        /* D stroke = Eth */
  4156.       case 198: return(162);        /* Breve */
  4157.       case 199: return(255);        /* Dot above */
  4158.       case 205: return(189);        /* Double acute */
  4159.       case 206: return(178);        /* Ogonek */
  4160.       case 207: return(183);        /* Caron */
  4161.       case 230: return(240);        /* d stroke = eth */
  4162.       case 232: return(163);        /* L with stroke */
  4163.       case 248: return(179);        /* l with stroke */
  4164.       default:  return(yl1l2[ynel1[c]]); /* Others, go thru Latin-1 */
  4165.     }
  4166. }
  4167.  
  4168. CHAR                    /* CP437 to Latin-2 */
  4169. #ifdef CK_ANSIC
  4170. x43l2(CHAR c)
  4171. #else
  4172. x43l2(c) CHAR c;
  4173. #endif /* CK_ANSIC */
  4174. { /* xl43l2 */
  4175.     return(yl1l2[y43l1[c]]);
  4176. }
  4177.  
  4178. CHAR                    /* CP850 to Latin-2 */
  4179. #ifdef CK_ANSIC
  4180. x85l2(CHAR c)
  4181. #else
  4182. x85l2(c) CHAR c;
  4183. #endif /* CK_ANSIC */
  4184. { /* xl85l2 */
  4185.     return(yl1l2[y85l1[c]]);
  4186. }
  4187.  
  4188. CHAR                    /* Apple to Latin-2 */
  4189. #ifdef CK_ANSIC
  4190. xaql2(CHAR c)
  4191. #else
  4192. xaql2(c) CHAR c;
  4193. #endif /* CK_ANSIC */
  4194. { /* xlaql2 */
  4195.     switch (c) {
  4196.       case 249: return(162);        /* Breve accent */
  4197.       case 250: return(255);        /* Dot accent */
  4198.       case 253: return(189);        /* Double acute */
  4199.       default: return(yl1l2[yaql1[c]]);
  4200.     }
  4201. }
  4202.  
  4203. CHAR                    /* DGI to Latin-2 */
  4204. #ifdef CK_ANSIC
  4205. xdgl2(CHAR c)
  4206. #else
  4207. xdgl2(c) CHAR c;
  4208. #endif /* CK_ANSIC */
  4209. { /* xldgl2 */
  4210.     return(yl1l2[ydgl1[c]]);        /* (for now) */
  4211. }
  4212.  
  4213. CHAR                    /* Short KOI to Latin-2 */
  4214. #ifdef CK_ANSIC
  4215. xskl2(CHAR c)
  4216. #else
  4217. xskl2(c) CHAR c;
  4218. #endif /* CK_ANSIC */
  4219. { /* xlskl2 */
  4220.     return(islower(c) ? toupper(c) : c);
  4221. }
  4222.  
  4223. CHAR                    /* Latin-2 to German */
  4224. #ifdef CK_ANSIC
  4225. xl2ge(CHAR c)
  4226. #else
  4227. xl2ge(c) CHAR c;
  4228. #endif /* CK_ANSIC */
  4229. { /* xll2ge */
  4230.     switch(c) {
  4231.       case 167: return(64);        /* Paragraph sign */
  4232.       case 196: return(91);        /* A-diaeresis */
  4233.       case 214: return(92);        /* O-diaeresis */
  4234.       case 220: return(93);        /* U-diaeresis */
  4235.       case 223: return(126);        /* double-s */
  4236.       case 228: return(123);        /* a-diaeresis */
  4237.       case 246: return(124);        /* o-diaeresis */
  4238.       case 252: return(125);        /* u-diaeresis */
  4239.       default:  return(yl2as[c]);    /* Others */
  4240.     }
  4241. }
  4242.  
  4243. CHAR                    /* German to Latin-2 */
  4244. #ifdef CK_ANSIC
  4245. xgel2(CHAR c)
  4246. #else
  4247. xgel2(c) CHAR c;
  4248. #endif /* CK_ANSIC */
  4249. { /* xlgel2 */
  4250.     if (c & 0x80)
  4251.       return(UNK);
  4252.     switch(c) {
  4253.       case 64:  return(167);        /* Paragraph sign */
  4254.       case 91:  return(196);        /* A-diaeresis */
  4255.       case 92:  return(214);        /* O-diaeresis */
  4256.       case 93:  return(220);        /* U-diaeresis */
  4257.       case 123: return(228);        /* a-diaeresis */
  4258.       case 126: return(223);        /* double-s */
  4259.       case 124: return(246);        /* o-diaeresis */
  4260.       case 125: return(252);        /* u-diaeresis */
  4261.       default:  return(c);        /* Others */
  4262.     }
  4263. }
  4264.  
  4265. CHAR                    /* Latin-2 to Hungarian */
  4266. #ifdef CK_ANSIC
  4267. xl2hu(CHAR c)
  4268. #else
  4269. xl2hu(c) CHAR c;
  4270. #endif /* CK_ANSIC */
  4271. { /* xll2hu */
  4272.     switch(c) {
  4273.       case 164: return(36);        /* Currency symbol */
  4274.       case 189: return(126);        /* Double acute accent */
  4275.       case 193: return(64);        /* A-acute */
  4276.       case 201: return(91);        /* E-acute */
  4277.       case 214: return(92);        /* O-diaeresis */
  4278.       case 220: return(93);        /* U-diaeresis */
  4279.       case 225: return(96);        /* a-acute */
  4280.       case 233: return(123);        /* e-acute */
  4281.       case 246: return(124);        /* o-diaeresis */
  4282.       case 252: return(125);        /* u-diaeresis */
  4283.       default:  return(yl2as[c]);    /* Others */
  4284.     }
  4285. }
  4286.  
  4287. CHAR                    /* Hungarian to Latin-2 */
  4288. #ifdef CK_ANSIC
  4289. xhul2(CHAR c)
  4290. #else
  4291. xhul2(c) CHAR c;
  4292. #endif /* CK_ANSIC */
  4293. { /* xlhul2 */
  4294.     if (c & 0x80)
  4295.       return(UNK);
  4296.     switch(c) {
  4297.       case 36:  return(164);        /* Currency symbol */
  4298.       case 64:  return(193);        /* A-acute */
  4299.       case 91:  return(201);        /* E-acute */
  4300.       case 92:  return(214);        /* O-diaeresis */
  4301.       case 93:  return(220);        /* U-diaeresis */
  4302.       case 96:  return(225);        /* a-acute */
  4303.       case 123: return(233);        /* e-acute */
  4304.       case 124: return(246);        /* o-diaeresis */
  4305.       case 125: return(252);        /* u-diaeresis */
  4306.       case 126: return(189);        /* Double acute accent */
  4307.       default:  return(c);        /* Others */
  4308.     }
  4309. }
  4310.  
  4311. CHAR
  4312. #ifdef CK_ANSIC
  4313. xr8l2(CHAR c)
  4314. #else
  4315. xr8l2(c) CHAR c;
  4316. #endif /* CK_ANSIC */
  4317. { /* xr8l2 */ /* Hewlett Packard Roman8 to Latin-2 */
  4318.     switch (c) {
  4319.       case 235: return(169);        /* S caron */
  4320.       case 236: return(185);        /* s caron */
  4321.       default:  return(yl1l2[yr8l1[c]]);
  4322.     }
  4323. }
  4324.  
  4325. CHAR
  4326. #ifdef CK_ANSIC
  4327. xl2r8(CHAR c)
  4328. #else
  4329. xl2r8(c) CHAR c;
  4330. #endif /* CK_ANSIC */
  4331. { /* xl2r8 */ /* Latin-2 to Hewlett Packard Roman8 Character Set */
  4332.     switch (c) {
  4333.       case 169: return(235);        /* S caron */
  4334.       case 185: return(236);        /* s caron */
  4335.       default:  return(yr8l1[yl1l2[c]]);
  4336.     }
  4337. }
  4338.  
  4339. #else /* NOLATIN2 */
  4340.  
  4341. #define xl1mz NULL
  4342. #define xmzl1 NULL
  4343. #define xl2mz NULL
  4344. #define xmzl2 NULL
  4345. #define xl9mz NULL
  4346. #define xmzl9 NULL
  4347. #define xmzas NULL
  4348.  
  4349. #define xl11250 NULL
  4350. #define xl21250 NULL
  4351. #define xl91250 NULL
  4352.  
  4353. #define x1250as NULL
  4354. #define x1250l1 NULL
  4355. #define x1250l2 NULL
  4356. #define x1250l9 NULL
  4357.  
  4358. #define xl2l1 NULL
  4359. #define xl2w1 NULL
  4360. #define xl1l2 NULL
  4361. #define xw1l2 NULL
  4362. #define xl2as NULL
  4363. #define xl252 NULL
  4364. #define x52l2 NULL
  4365. #define x52as NULL
  4366. #define x52l1 NULL
  4367. #define xl152 NULL
  4368. #define xl2ne NULL
  4369. #define xl243 NULL
  4370. #define xl285 NULL
  4371. #define xl2aq NULL
  4372. #define xl2dg NULL
  4373. #define xl2sk NULL
  4374. #define xnel2 NULL
  4375. #define x43l2 NULL
  4376. #define x85l2 NULL
  4377. #define xaql2 NULL
  4378. #define xdgl2 NULL
  4379. #define xskl2 NULL
  4380. #define xl2ge NULL
  4381. #define xgel2 NULL
  4382. #define xl2hu NULL
  4383. #define xhul2 NULL
  4384. #define xl2r8 NULL
  4385. #define xr8l2 NULL
  4386. #endif /* LATIN2 */
  4387.  
  4388. /* This one can also be used for ELOT 927, Hebrew 7, etc */
  4389.  
  4390. CHAR
  4391. #ifdef CK_ANSIC
  4392. xassk(CHAR c)
  4393. #else
  4394. xassk(c) CHAR c;
  4395. #endif /* CK_ANSIC */
  4396. { /* xassk */                /* ASCII to Short KOI */
  4397.     if (c & 0x80)
  4398.       return(UNK);
  4399.     return((c > 95) ? (c - 32) : c);    /* Fold columns 6-7 to 4-5 */
  4400. }
  4401.  
  4402. #ifdef CYRILLIC
  4403. /* Translation functions for Cyrillic character sets */
  4404.  
  4405. CHAR                    /* Latin/Cyrillic to CP866 */
  4406. #ifdef CK_ANSIC
  4407. xlcac(CHAR c)
  4408. #else
  4409. xlcac(c) CHAR c;
  4410. #endif /* CK_ANSIC */
  4411. { /* xlcac */                /* PC Code Page 866 */
  4412.     return(ylcac[c]);
  4413. }
  4414.  
  4415. CHAR                    /* Latin/Cyrillic to */
  4416. #ifdef CK_ANSIC
  4417. xlc55(CHAR c)
  4418. #else
  4419. xlc55(c) CHAR c;
  4420. #endif /* CK_ANSIC */
  4421. { /* xlc55 */                /* PC Code Page 855 */
  4422.     return(ylc55[c]);
  4423. }
  4424.  
  4425. CHAR                    /* Latin/Cyrillic to */
  4426. #ifdef CK_ANSIC
  4427. xlc1251(CHAR c)
  4428. #else
  4429. xlc1251(c) CHAR c;
  4430. #endif /* CK_ANSIC */
  4431. { /* xlc1251 */                /* PC Code Page 1251 */
  4432.     return(ylc1251[c]);
  4433. }
  4434.  
  4435. CHAR                    /* Latin/Cyrillic to... */
  4436. #ifdef CK_ANSIC
  4437. xlcbu(CHAR c)
  4438. #else
  4439. xlcbu(c) CHAR c;
  4440. #endif /* CK_ANSIC */
  4441. { /* xlcbu */                /* Bulgarian PC Code Page */
  4442.     return(ylcbu[c]);
  4443. }
  4444.  
  4445. CHAR                    /* Latin/Cyrillic to Old KOI-8 */
  4446. #ifdef CK_ANSIC
  4447. xlck8(CHAR c)
  4448. #else
  4449. xlck8(c) CHAR c;
  4450. #endif /* CK_ANSIC */
  4451. { /* xlck8 */
  4452.     return(ylck8[c]);
  4453. }
  4454.  
  4455. CHAR                    /* Latin/Cyrillic to KOI8-R */
  4456. #ifdef CK_ANSIC
  4457. xlckr(CHAR c)
  4458. #else
  4459. xlckr(c) CHAR c;
  4460. #endif /* CK_ANSIC */
  4461. { /* xlckr */
  4462.     switch(c) {
  4463.       case 0xa1: return(0xb3);        /* Io */
  4464.       case 0xf1: return(0xa3);        /* io */
  4465.       default:
  4466.     if (c > 0x7f && c < 0xc0)
  4467.       return(UNK);
  4468.     return(ylck8[c]);
  4469.     }
  4470. }
  4471.  
  4472. CHAR                    /* Latin/Cyrillic to  KOI8-U */
  4473. #ifdef CK_ANSIC
  4474. xlcku(CHAR c)
  4475. #else
  4476. xlcku(c) CHAR c;
  4477. #endif /* CK_ANSIC */
  4478. { /* xlcku */
  4479.     switch(c) {
  4480.       case 0xa1: return(0xb3);        /* Io */
  4481.       case 0xf1: return(0xa3);        /* io */
  4482.       case 0xf4: return(0xa4);        /* Ukrainian ie */
  4483.       case 0xf6: return(0xa6);        /* Ukrainian i */
  4484.       case 0xf7: return(0xa7);        /* Ukrainian yi */
  4485.       case 0xf3: return(0xad);        /* Ukrainian ghe with upturn */
  4486.       case 0xa4: return(0xb4);        /* Ukrainian Ie */
  4487.       case 0xa6: return(0xb6);        /* Ukrainian I */
  4488.       case 0xa7: return(0xb7);        /* Ukrainian Yi */
  4489.       case 0xa3: return(0xbd);        /* Ukrainian Ghe with upturn */
  4490.       default:
  4491.     if (c > 0x7f && c < 0xc0)
  4492.       return(UNK);
  4493.     return(ylck8[c]);
  4494.     }
  4495. }
  4496.  
  4497. CHAR
  4498. #ifdef CK_ANSIC
  4499. xlcsk(CHAR c)
  4500. #else
  4501. xlcsk(c) CHAR c;
  4502. #endif /* CK_ANSIC */
  4503. { /* xlcsk */                /* Latin/Cyrillic to Short KOI */
  4504.     return(ylcsk[c]);
  4505. }
  4506.  
  4507. CHAR
  4508. #ifdef CK_ANSIC
  4509. xlcas(CHAR c)
  4510. #else
  4511. xlcas(c) CHAR c;
  4512. #endif /* CK_ANSIC */
  4513. { /* xlcas */                /* Latin/Cyrillic to ASCII */
  4514.     if (langs[language].id == L_RUSSIAN)
  4515.       return(ylcsk[c]);
  4516.     else
  4517.       return((c > 127) ? '?' : c);
  4518. }
  4519.  
  4520. CHAR                    /* CP866 */
  4521. #ifdef CK_ANSIC
  4522. xaclc(CHAR c)
  4523. #else
  4524. xaclc(c) CHAR c;
  4525. #endif /* CK_ANSIC */
  4526. { /* xaclc */                /* to Latin/Cyrillic */
  4527.     return(yaclc[c]);
  4528. }
  4529.  
  4530. CHAR                    /* CP855 */
  4531. #ifdef CK_ANSIC
  4532. x55lc(CHAR c)
  4533. #else
  4534. x55lc(c) CHAR c;
  4535. #endif /* CK_ANSIC */
  4536. { /* x55lc */                /* to Latin/Cyrillic */
  4537.     return(y55lc[c]);
  4538. }
  4539.  
  4540. CHAR                    /* Bulgarian PC Code Page ... */
  4541. #ifdef CK_ANSIC
  4542. xbulc(CHAR c)
  4543. #else
  4544. xbulc(c) CHAR c;
  4545. #endif /* CK_ANSIC */
  4546. { /* xbulc */                /* to Latin/Cyrillic */
  4547.     return(ybulc[c]);
  4548. }
  4549.  
  4550. CHAR                    /* CP1251 */
  4551. #ifdef CK_ANSIC
  4552. x1251lc(CHAR c)
  4553. #else
  4554. x1251lc(c) CHAR c;
  4555. #endif /* CK_ANSIC */
  4556. { /* x1251lc */                /* to Latin/Cyrillic */
  4557.     return(y1251lc[c]);
  4558. }
  4559.  
  4560. CHAR                    /* Old KOI-8 to Latin/Cyrillic */
  4561. #ifdef CK_ANSIC
  4562. xk8lc(CHAR c)
  4563. #else
  4564. xk8lc(c) CHAR c;
  4565. #endif /* CK_ANSIC */
  4566. { /* xk8lc */
  4567.     return(yk8lc[c]);
  4568. }
  4569.  
  4570. CHAR                    /* KOI8-R to Latin/Cyrillic */
  4571. #ifdef CK_ANSIC
  4572. xkrlc(CHAR c)
  4573. #else
  4574. xkrlc(c) CHAR c;
  4575. #endif /* CK_ANSIC */
  4576. { /* xkrlc */
  4577.     if (c == 0xb3) return(0xa1);
  4578.     else if (c == 0xa3) return(0xf1);
  4579.     else if (c > 0x7f && c < 0xc0)
  4580.       return(UNK);
  4581.     return(yk8lc[c]);
  4582. }
  4583.  
  4584. CHAR                    /* KOI8-U to Latin/Cyrillic */
  4585. #ifdef CK_ANSIC
  4586. xkulc(CHAR c)
  4587. #else
  4588. xkulc(c) CHAR c;
  4589. #endif /* CK_ANSIC */
  4590. { /* xkulc */
  4591.     switch (c) {
  4592.       case 0xb3: return(0xa1);        /* Io */
  4593.       case 0xa3: return(0xf1);        /* io */
  4594.       case 0xa4: return(0xf4);        /* Ukrainian ie */
  4595.       case 0xa6: return(0xf6);        /* Ukrainian i */
  4596.       case 0xa7: return(0xf7);        /* Ukrainian yi */
  4597.       case 0xad: return(0xf3);        /* Ukrainian ghe with upturn */
  4598.       case 0xb4: return(0xa4);        /* Ukrainian Ie */
  4599.       case 0xb6: return(0xa6);        /* Ukrainian I */
  4600.       case 0xb7: return(0xa7);        /* Ukrainian Yi */
  4601.       case 0xbd: return(0xa3);        /* Ukrainian Ghe with upturn */
  4602.       /* Note substitution of Gje for Ghe-Upturn, which is not in 8859-5 */
  4603.       default:
  4604.     if (c > 0x7f && c < 0xc0)
  4605.       return(UNK);
  4606.     return(yk8lc[c]);
  4607.     }
  4608. }
  4609.  
  4610. CHAR
  4611. #ifdef CK_ANSIC
  4612. xskcy(CHAR c)
  4613. #else
  4614. xskcy(c) CHAR c;
  4615. #endif /* CK_ANSIC */
  4616. { /* xskcy */            /* Short KOI to Latin/Cyrillic */
  4617.     return(yskcy[c & 0x7f]);
  4618. }
  4619.  
  4620. CHAR
  4621. #ifdef CK_ANSIC
  4622. xascy(CHAR c)
  4623. #else
  4624. xascy(c) CHAR c;
  4625. #endif /* CK_ANSIC */
  4626. { /* xascy */            /* ASCII to Latin/Cyrillic */
  4627.     if (langs[language].id == L_RUSSIAN) { /* If LANGUAGE == RUSSIAN  */
  4628.     return(yskcy[c & 0x7f]);    /* treat ASCII as Short KOI */
  4629.     } else return((c > 127) ? '?' : c);
  4630. }
  4631.  
  4632. CHAR
  4633. #ifdef CK_ANSIC
  4634. xacas(CHAR c)
  4635. #else
  4636. xacas(c) CHAR c;
  4637. #endif /* CK_ANSIC */
  4638. { /* xacas */            /* CP866 to ASCII */
  4639.     if (langs[language].id == L_RUSSIAN) {
  4640.     c = yaclc[c];            /* First to Latin/Cyrillic */
  4641.     return(ylcsk[c]);        /* Then to Short KOI */
  4642.     } else return((c > 127) ? '?' : c);
  4643. }
  4644.  
  4645. CHAR
  4646. #ifdef CK_ANSIC
  4647. x55as(CHAR c)
  4648. #else
  4649. x55as(c) CHAR c;
  4650. #endif /* CK_ANSIC */
  4651. { /* x55as */            /* CP855 to ASCII */
  4652.     if (langs[language].id == L_RUSSIAN) {
  4653.     c = y55lc[c];            /* First to Latin/Cyrillic */
  4654.     return(ylcsk[c]);        /* Then to Short KOI */
  4655.     } else return((c > 127) ? '?' : c);
  4656. }
  4657.  
  4658. CHAR
  4659. #ifdef CK_ANSIC
  4660. x1251as(CHAR c)
  4661. #else
  4662. x1251as(c) CHAR c;
  4663. #endif /* CK_ANSIC */
  4664. { /* x1251as */            /* CP81251 to ASCII */
  4665.     if (langs[language].id == L_RUSSIAN) {
  4666.     c = y1251lc[c];            /* First to Latin/Cyrillic */
  4667.     return(ylcsk[c]);        /* Then to Short KOI */
  4668.     } else return((c > 127) ? '?' : c);
  4669. }
  4670.  
  4671. CHAR
  4672. #ifdef CK_ANSIC
  4673. xskas(CHAR c)
  4674. #else
  4675. xskas(c) CHAR c;
  4676. #endif /* CK_ANSIC */
  4677. { /* xskas */                /* Short KOI to ASCII */
  4678.     return((c > 95) ? '?' : c);
  4679. }
  4680.  
  4681. CHAR
  4682. #ifdef CK_ANSIC
  4683. xk8as(CHAR c)
  4684. #else
  4685. xk8as(c) CHAR c;
  4686. #endif /* CK_ANSIC */
  4687. { /* xk8as */                /* Old KOI-8 Cyrillic to ASCII */
  4688.     if (langs[language].id == L_RUSSIAN) {
  4689.     c = yk8lc[c];            /* First to Latin/Cyrillic */
  4690.     return(ylcsk[c]);        /* Then to Short KOI */
  4691.     } else return((c > 127) ? '?' : c);
  4692. }
  4693.  
  4694. CHAR
  4695. #ifdef CK_ANSIC
  4696. xl1sk(CHAR c)
  4697. #else
  4698. xl1sk(c) CHAR c;
  4699. #endif /* CK_ANSIC */
  4700. { /* xl1sk */                /* Latin-1 to Short KOI */
  4701.     c = zl1as(c);            /* Convert to ASCII */
  4702.     return(c = xassk(c));        /* Convert ASCII to Short KOI */
  4703. }
  4704.  
  4705. CHAR
  4706. #ifdef CK_ANSIC
  4707. xw1lc(CHAR c)
  4708. #else
  4709. xw1lc(c) CHAR c;
  4710. #endif /* CK_ANSIC */
  4711. { /* xw1lc */                /* CP1252 to Latin/Cyrillic */
  4712.     return((c < 160) ? xw1as(c) : zl1as(c));
  4713. }
  4714.  
  4715. CHAR
  4716. #ifdef CK_ANSIC
  4717. xaslc(CHAR c)
  4718. #else
  4719. xaslc(c) CHAR c;
  4720. #endif /* CK_ANSIC */
  4721. { /* xaslc */            /* ASCII to Latin/Cyrillic */
  4722.     if (langs[language].id == L_RUSSIAN)
  4723.       return(yskcy[c & 0x7f]);
  4724.     else return(c & 0x7f);
  4725. }
  4726.  
  4727. CHAR
  4728. #ifdef CK_ANSIC
  4729. xasac(CHAR c)
  4730. #else
  4731. xasac(c) CHAR c;
  4732. #endif /* CK_ANSIC */
  4733. { /* xasac */            /* ASCII to CP866 */
  4734.     if (c & 0x80)
  4735.       return(UNK);
  4736.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4737.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4738.     return(ylcac[c]);        /* Then to CP866 */
  4739.     } else return(c & 0x7f);
  4740. }
  4741.  
  4742. CHAR
  4743. #ifdef CK_ANSIC
  4744. xas55(CHAR c)
  4745. #else
  4746. xas55(c) CHAR c;
  4747. #endif /* CK_ANSIC */
  4748. { /* xas55 */            /* ASCII to CP855 */
  4749.     if (c & 0x80)
  4750.       return(UNK);
  4751.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4752.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4753.     return(ylc55[c]);        /* Then to CP866 */
  4754.     } else return(c & 0x7f);
  4755. }
  4756.  
  4757. CHAR
  4758. #ifdef CK_ANSIC
  4759. xas1251(CHAR c)
  4760. #else
  4761. xas1251(c) CHAR c;
  4762. #endif /* CK_ANSIC */
  4763. { /* xas1251 */            /* ASCII to CP81251 */
  4764.     if (c & 0x80)
  4765.       return(UNK);
  4766.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4767.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4768.     return(ylc1251[c]);        /* Then to CP866 */
  4769.     } else return(c & 0x7f);
  4770. }
  4771.  
  4772. CHAR
  4773. #ifdef CK_ANSIC
  4774. xask8(CHAR c)
  4775. #else
  4776. xask8(c) CHAR c;
  4777. #endif /* CK_ANSIC */
  4778. { /* xask8 */            /* ASCII to KOI-8 */
  4779.     if (c & 0x80)
  4780.       return(UNK);
  4781.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4782.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4783.     return(ylck8[c]);        /* Then to KOI-8 */
  4784.     } else return(c & 0x7f);
  4785. }
  4786. #else /* No Cyrillic */
  4787. #define xacas NULL
  4788. #define x55as NULL
  4789. #define x1251as NULL
  4790. #define xaclc NULL
  4791. #define x55lc NULL
  4792. #define x1251lc NULL
  4793. #define xasac NULL
  4794. #define xas55 NULL
  4795. #define xas1251 NULL
  4796. #define xascy NULL
  4797. #define xask8 NULL
  4798. #define xaslc NULL
  4799. #define xassk NULL
  4800. #define xk8as NULL
  4801. #define xk8lc NULL
  4802. #define xkrlc NULL
  4803. #define xkulc NULL
  4804. #define xl1sk NULL
  4805. #define xw1lc NULL
  4806. #define xlcac NULL
  4807. #define xlc55 NULL
  4808. #define xlc1251 NULL
  4809. #define xlcas NULL
  4810. #define xlck8 NULL
  4811. #define xlckr NULL
  4812. #define xlcku NULL
  4813. #define xlch7 NULL
  4814. #define xlcsk NULL
  4815. #define xskas NULL
  4816. #define xskcy NULL
  4817. #define xbulc NULL
  4818. #define xlcbu NULL
  4819. #endif /* CYRILLIC */
  4820.  
  4821. /* Translation functions for Hebrew character sets */
  4822.  
  4823. #ifdef HEBREW
  4824.  
  4825. CHAR
  4826. #ifdef CK_ANSIC
  4827. xash7(CHAR c)
  4828. #else
  4829. xash7(c) CHAR c;
  4830. #endif /* CK_ANSIC */
  4831. { /* xash7 */            /* ASCII to Hebrew-7 */
  4832.     if (c & 0x80)
  4833.       return(UNK);
  4834.     if (c == 96) return('?');
  4835.     if (c > 96 && c < 123) return(c - 32);
  4836.     else return(c);
  4837. }
  4838.  
  4839. CHAR
  4840. #ifdef CK_ANSIC
  4841. xl1h7(CHAR c)
  4842. #else
  4843. xl1h7(c) CHAR c;
  4844. #endif /* CK_ANSIC */
  4845. { /* xl1h7 */            /* Latin-1 to Hebrew-7 */
  4846.     return(xash7(xl1as(c)));
  4847. }
  4848.  
  4849. CHAR
  4850. #ifdef CK_ANSIC
  4851. xl1lh(CHAR c)
  4852. #else
  4853. xl1lh(c) CHAR c;
  4854. #endif /* CK_ANSIC */
  4855. { /* xl1lh */                /* Latin-1 to Latin/Hebrew */
  4856.     switch(c) {
  4857.       case 170: return('a');        /* Feminine ordinal */
  4858.       case 186: return('o');        /* Masculine ordinal */
  4859.       case 215: return(170);        /* Times */
  4860.       case 247: return(186);        /* Divide */
  4861.       default:  return( (c > 190) ? xl1as(c) : c );
  4862.     }
  4863. }
  4864.  
  4865. CHAR
  4866. #ifdef CK_ANSIC
  4867. xw1lh(CHAR c)
  4868. #else
  4869. xw1lh(c) CHAR c;
  4870. #endif /* CK_ANSIC */
  4871. { /* xw1lh */                /* CP1252 to Latin/Hebrew */
  4872.     switch(c) {
  4873.       case 170: return('a');        /* Feminine ordinal */
  4874.       case 186: return('o');        /* Masculine ordinal */
  4875.       case 215: return(170);        /* Times */
  4876.       case 247: return(186);        /* Divide */
  4877.       default:
  4878.     if (c < 160)
  4879.       return(xw1as(c));
  4880.     else
  4881.       return((c > 190) ? xl1as(c) : c);
  4882.     }
  4883. }
  4884.  
  4885. #ifdef LATIN2
  4886. CHAR
  4887. #ifdef CK_ANSIC
  4888. xl2h7(CHAR c)
  4889. #else
  4890. xl2h7(c) CHAR c;
  4891. #endif /* CK_ANSIC */
  4892. { /* xl2h7 */                /* Latin-2 to Hebrew-7 */
  4893.     return(xash7(xl2as(c)));
  4894. }
  4895. #else
  4896. #define xl2h7 NULL
  4897. #endif /* LATIN2 */
  4898.  
  4899. #ifndef NOCYRIL
  4900. CHAR
  4901. #ifdef CK_ANSIC
  4902. xlch7(CHAR c)
  4903. #else
  4904. xlch7(c) CHAR c;
  4905. #endif /* CK_ANSIC */
  4906. { /* xlch7 */                /* Latin/Cyrillic to Hebrew-7 */
  4907.     return(xash7(xlcas(c)));
  4908. }
  4909. #endif /* NOCYRIL */
  4910.  
  4911. CHAR
  4912. #ifdef CK_ANSIC
  4913. xlhas(CHAR c)
  4914. #else
  4915. xlhas(c) CHAR c;
  4916. #endif /* CK_ANSIC */
  4917. { /* xlhas */            /* Latin/Hebrew to ASCII */
  4918.     return( (c > 127) ? '?' : c );
  4919. }
  4920.  
  4921. CHAR
  4922. #ifdef CK_ANSIC
  4923. xlhl1(CHAR c)
  4924. #else
  4925. xlhl1(c) CHAR c;
  4926. #endif /* CK_ANSIC */
  4927. { /* xlhl1 */            /* Latin/Hebrew to Latin-1 */
  4928.     switch (c) {
  4929.       case 170: return(215);
  4930.       case 186: return(247);
  4931.       default: return( (c > 190) ? '?' : c );
  4932.     }
  4933. }
  4934.  
  4935. CHAR
  4936. #ifdef CK_ANSIC
  4937. xlhw1(CHAR c)
  4938. #else
  4939. xlhw1(c) CHAR c;
  4940. #endif /* CK_ANSIC */
  4941. { /* xlhw1 */            /* Latin/Hebrew to CP1252 */
  4942.     if (c > 127 && c < 160)
  4943.       return('?');
  4944.     switch (c) {
  4945.       case 170: return(215);
  4946.       case 186: return(247);
  4947.       default: return( (c > 190) ? '?' : c );
  4948.     }
  4949. }
  4950.  
  4951. CHAR
  4952. #ifdef CK_ANSIC
  4953. xlh62(CHAR c)
  4954. #else
  4955. xlh62(c) CHAR c;
  4956. #endif /* CK_ANSIC */
  4957. { /* xlh62 */            /* Latin/Hebrew to CP862 */
  4958.     return(ylh62[c]);
  4959. }
  4960.  
  4961. CHAR
  4962. #ifdef CK_ANSIC
  4963. xl162(CHAR c)
  4964. #else
  4965. xl162(c) CHAR c;
  4966. #endif /* CK_ANSIC */
  4967. { /* xl162 */            /* Latin-1 to CP862 */
  4968.     return(xlh62(xl1lh(c)));    /* Via Latin/Hebrew */
  4969. }
  4970.  
  4971. CHAR
  4972. #ifdef CK_ANSIC
  4973. xlhh7(CHAR c)
  4974. #else
  4975. xlhh7(c) CHAR c;
  4976. #endif /* CK_ANSIC */
  4977. { /* xlhh7 */            /* Latin/Hebrew to Hebrew-7 */
  4978.     return(ylhh7[c]);
  4979. }
  4980.  
  4981. CHAR
  4982. #ifdef CK_ANSIC
  4983. xh7as(CHAR c)
  4984. #else
  4985. xh7as(c) CHAR c;
  4986. #endif /* CK_ANSIC */
  4987. { /* xh7as */            /* Hebrew-7 to ASCII */
  4988.     if (c & 0x80)
  4989.       return(UNK);
  4990.     return( (c > 95 && c < 123) ? '?' : c );
  4991. }
  4992.  
  4993. CHAR
  4994. #ifdef CK_ANSIC
  4995. x62lh(CHAR c)
  4996. #else
  4997. x62lh(c) CHAR c;
  4998. #endif /* CK_ANSIC */
  4999. { /* x62lh */            /* CP862 to Latin/Hebrew */
  5000.     return(y62lh[c]);
  5001. }
  5002.  
  5003. CHAR
  5004. #ifdef CK_ANSIC
  5005. x62as(CHAR c)
  5006. #else
  5007. x62as(c) CHAR c;
  5008. #endif /* CK_ANSIC */
  5009. { /* x62as */            /* CP862 to ASCII */
  5010.     return( xlhas(x62lh(c)) );
  5011. }
  5012.  
  5013. CHAR
  5014. #ifdef CK_ANSIC
  5015. x62l1(CHAR c)
  5016. #else
  5017. x62l1(c) CHAR c;
  5018. #endif /* CK_ANSIC */
  5019. { /* x62l1 */            /* CP862 to Latin-1 */
  5020.     return( xlhl1(x62lh(c)) );
  5021. }
  5022.  
  5023. CHAR
  5024. #ifdef CK_ANSIC
  5025. xh7lh(CHAR c)
  5026. #else
  5027. xh7lh(c) CHAR c;
  5028. #endif /* CK_ANSIC */
  5029. { /* xh7lh */            /* Hebrew-7 to Latin/Hebrew */
  5030.     if (c & 0x80)
  5031.       return(UNK);
  5032.     return(yh7lh[c]);
  5033. }
  5034.  
  5035. #else /* No Hebrew */
  5036.  
  5037. #define xash7 NULL
  5038. #define xl1h7 NULL
  5039. #define xl2h7 NULL
  5040. #define xlch7 NULL
  5041. #define xl1lh NULL
  5042. #define xw1lh NULL
  5043. #define xlhas NULL
  5044. #define xlhl1 NULL
  5045. #define xlhw1 NULL
  5046. #define xl162 NULL
  5047. #define xlhh7 NULL
  5048. #define xlh62 NULL
  5049. #define xh7as NULL
  5050. #define x62as NULL
  5051. #define x62l1 NULL
  5052. #define xh7lh NULL
  5053. #define x62lh NULL
  5054.  
  5055. #endif /* HEBREW */
  5056.  
  5057. /* Translation functions for Greek character sets */
  5058.  
  5059. #ifdef GREEK
  5060.  
  5061. CHAR
  5062. #ifdef CK_ANSIC
  5063. xaseg(CHAR c)
  5064. #else
  5065. xaseg(c) CHAR c;
  5066. #endif /* CK_ANSIC */
  5067. { /* xaseg */            /* ASCII to ELOT 927 */
  5068.     if (c & 0x80)
  5069.       return(UNK);
  5070.     if (c > 96 && c < 123) return(c - 32);
  5071.     else return(c);
  5072. }
  5073.  
  5074. CHAR
  5075. #ifdef CK_ANSIC
  5076. xl1eg(CHAR c)
  5077. #else
  5078. xl1eg(c) CHAR c;
  5079. #endif /* CK_ANSIC */
  5080. { /* xl1ge */            /* Latin-1 to ELOT 927 */
  5081.     return(xaseg(xl1as(c)));
  5082. }
  5083.  
  5084. CHAR
  5085. #ifdef CK_ANSIC
  5086. xl2lg(CHAR c)
  5087. #else
  5088. xl2lg(c) CHAR c;
  5089. #endif /* CK_ANSIC */
  5090. { /* xl2lg */            /* Latin-1 to Latin/Greek */
  5091.     if (c < 160) return(c);
  5092.     else if (c == 160 || c == 168 || c == 173 || c == 174)
  5093.       return(c);
  5094.     else return('?');
  5095. }
  5096.  
  5097. CHAR
  5098. #ifdef CK_ANSIC
  5099. xl1lg(CHAR c)
  5100. #else
  5101. xl1lg(c) CHAR c;
  5102. #endif /* CK_ANSIC */
  5103. { /* xl1lg */            /* Latin-1 to Latin/Greek */
  5104.     if (c < 160) return(c);
  5105.     switch(c) {
  5106.       case 160:                /* Themselves */
  5107.       case 164:
  5108.       case 166:
  5109.       case 167:
  5110.       case 168:
  5111.       case 169:
  5112.       case 171:
  5113.       case 172:
  5114.       case 173:
  5115.       case 176:
  5116.       case 177:
  5117.       case 178:
  5118.       case 179:
  5119.       case 180:
  5120.       case 187:
  5121.       case 189:
  5122.     return(c);
  5123.       case 181:                /* Lowercase mu */
  5124.     return(236);
  5125.       default:
  5126.     return(UNK);
  5127.     }
  5128. }
  5129.  
  5130. CHAR
  5131. #ifdef CK_ANSIC
  5132. xw1lg(CHAR c)
  5133. #else
  5134. xw1lg(c) CHAR c;
  5135. #endif /* CK_ANSIC */
  5136. { /* xw1lg */                /* CP1252 to Latin/Greek */
  5137.     return((c < 160) ? xw1as(c) : xl1lg(c));
  5138. }
  5139.  
  5140.  
  5141. #ifdef LATIN2
  5142. CHAR
  5143. #ifdef CK_ANSIC
  5144. xl2eg(CHAR c)
  5145. #else
  5146. xl2eg(c) CHAR c;
  5147. #endif /* CK_ANSIC */
  5148. { /* xl2eg */                /* Latin-2 to ELOT 927 */
  5149.     return(xaseg(xl2as(c)));
  5150. }
  5151. #else
  5152. #define xl2eg NULL
  5153. #endif /* LATIN2 */
  5154.  
  5155. #ifndef NOCYRIL
  5156. CHAR
  5157. #ifdef CK_ANSIC
  5158. xlceg(CHAR c)
  5159. #else
  5160. xlceg(c) CHAR c;
  5161. #endif /* CK_ANSIC */
  5162. { /* xlceg */            /* Latin/Cyrillic to ELOT 927 */
  5163.     return(xaseg(xlcas(c)));
  5164. }
  5165. #endif /* NOCYRIL */
  5166.  
  5167. CHAR
  5168. #ifdef CK_ANSIC
  5169. xlgas(CHAR c)
  5170. #else
  5171. xlgas(c) CHAR c;
  5172. #endif /* CK_ANSIC */
  5173. { /* xlgas */            /* Latin/Greek to ASCII */
  5174.     return( (c > 127) ? '?' : c );
  5175. }
  5176.  
  5177. CHAR
  5178. #ifdef CK_ANSIC
  5179. xlgl1(CHAR c)
  5180. #else
  5181. xlgl1(c) CHAR c;
  5182. #endif /* CK_ANSIC */
  5183. { /* xlgl1 */            /* Latin/Greek to Latin-1 */
  5184.     if (c == 236)
  5185.       return(181);
  5186.     else
  5187.       return(xl1lg(c));
  5188. }
  5189.  
  5190. CHAR
  5191. #ifdef CK_ANSIC
  5192. xlgw1(CHAR c)
  5193. #else
  5194. xlgw1(c) CHAR c;
  5195. #endif /* CK_ANSIC */
  5196. { /* xlgw1 */            /* Latin/Greek to Latin-1 */
  5197.     if (c > 127 && c < 160)
  5198.       return('?');
  5199.     return(xlgl1(c));
  5200. }
  5201.  
  5202. CHAR
  5203. #ifdef CK_ANSIC
  5204. xlg69(CHAR c)
  5205. #else
  5206. xlg69(c) CHAR c;
  5207. #endif /* CK_ANSIC */
  5208. { /* xlg69 */            /* Latin/Greek to CP869 */
  5209.     return(ylg69[c]);
  5210. }
  5211.  
  5212. CHAR
  5213. #ifdef CK_ANSIC
  5214. xl169(CHAR c)
  5215. #else
  5216. xl169(c) CHAR c;
  5217. #endif /* CK_ANSIC */
  5218. { /* xl169 */            /* Latin-1 to CP869 */
  5219.     return(xlg69(xl1lg(c)));    /* Via Latin/Greek */
  5220. }
  5221.  
  5222. CHAR
  5223. #ifdef CK_ANSIC
  5224. xlgeg(CHAR c)
  5225. #else
  5226. xlgeg(c) CHAR c;
  5227. #endif /* CK_ANSIC */
  5228. { /* xlgeg */            /* Latin/Greek to ELOT 927 */
  5229.     return(ylgeg[c]);
  5230. }
  5231.  
  5232. CHAR
  5233. #ifdef CK_ANSIC
  5234. xegas(CHAR c)
  5235. #else
  5236. xegas(c) CHAR c;
  5237. #endif /* CK_ANSIC */
  5238. { /* xegas */            /* ELOT 927 to ASCII */
  5239.     if (c & 0x80)
  5240.       return(UNK);
  5241.     return( (c > 96 && c < 123) ? '?' : c );
  5242. }
  5243.  
  5244. CHAR
  5245. #ifdef CK_ANSIC
  5246. x69lg(CHAR c)
  5247. #else
  5248. x69lg(c) CHAR c;
  5249. #endif /* CK_ANSIC */
  5250. { /* x69lg */            /* CP869 to Latin/Greek */
  5251.     return(y69lg[c]);
  5252. }
  5253.  
  5254. CHAR
  5255. #ifdef CK_ANSIC
  5256. x69as(CHAR c)
  5257. #else
  5258. x69as(c) CHAR c;
  5259. #endif /* CK_ANSIC */
  5260. { /* x69as */            /* CP869 to ASCII */
  5261.     return( xlgas(x69lg(c)) );
  5262. }
  5263.  
  5264. CHAR
  5265. #ifdef CK_ANSIC
  5266. x69l1(CHAR c)
  5267. #else
  5268. x69l1(c) CHAR c;
  5269. #endif /* CK_ANSIC */
  5270. { /* x69l1 */            /* CP869 to Latin-1 */
  5271.     return( xlgl1(x69lg(c)) );
  5272. }
  5273.  
  5274. CHAR
  5275. #ifdef CK_ANSIC
  5276. xeglg(CHAR c)
  5277. #else
  5278. xeglg(c) CHAR c;
  5279. #endif /* CK_ANSIC */
  5280. { /* xeglg */            /* ELOT 927 to Latin/Greek */
  5281.     return(yeglg[c]);
  5282. }
  5283.  
  5284. #else /* No Greek */
  5285.  
  5286. #define x69as NULL
  5287. #define x69l1 NULL
  5288. #define x69lg NULL
  5289. #define xaseg NULL
  5290. #define xegas NULL
  5291. #define xeglg NULL
  5292. #define xl169 NULL
  5293. #define xl1eg NULL
  5294. #define xl1lg NULL
  5295. #define xw1lg NULL
  5296. #define xl2ge NULL
  5297. #define xl2lg NULL
  5298. #define xlcge NULL
  5299. #define xlg69 NULL
  5300. #define xlgas NULL
  5301. #define xlgeg NULL
  5302. #define xlgge NULL
  5303. #define xlgl1 NULL
  5304. #define xlgw1 NULL
  5305.  
  5306. #endif /* GREEK */
  5307.  
  5308.  
  5309. /* Translation functions for Japanese Kanji character sets */
  5310.  
  5311. #ifdef KANJI
  5312. /*
  5313.   Translate Kanji Transfer Character Set (EUC) to local file character set,
  5314.   contributed by Dr. Hirofumi Fujii, Japan High Energy Research Laboratory
  5315.   (KEK), Tokyo, Japan.
  5316.  
  5317.   a is a byte to be translated, which may be a single-byte character,
  5318.   the Katakana prefix, the first byte of a two-byte Kanji character, or the
  5319.   second byte of 2-byte Kanji character.
  5320.  
  5321.   fn is the output function.
  5322.  
  5323.   Returns 0 on success, -1 on failure.
  5324. */
  5325.  
  5326. _PROTOTYP(static int jpnxas, (int, int[]) );
  5327. _PROTOTYP(static int jpnxkt, (int, int[]) );
  5328. _PROTOTYP(static int jpnxkn, (int[], int[]) );
  5329.  
  5330. static int jpncnt;            /* Byte count for Japanese */
  5331. static int jpnlst;            /* Last status (for JIS7) */
  5332.  
  5333. static int
  5334. jpnxas(a, obuf) int a; int obuf[]; { /* Translate ASCII to local file code */
  5335.     int r;
  5336.  
  5337.     r = 0;
  5338.     if (fcharset == FC_JIS7) {
  5339.     switch (jpnlst) {
  5340.       case 1:
  5341.         obuf[0] = 0x0f;
  5342.         obuf[1] = a;
  5343.         r = 2;
  5344.         break;
  5345.       case 2:
  5346.         obuf[0] = 0x1b;
  5347.         obuf[1] = 0x28;
  5348.         obuf[2] = 0x4a;
  5349.         obuf[3] = a;
  5350.         r = 4;
  5351.         break;
  5352.       default:
  5353.         obuf[0] = a;
  5354.         r = 1;
  5355.         break;
  5356.     }
  5357.     } else {
  5358.     obuf[0] = a;
  5359.     r = 1;
  5360.     }
  5361.     return(r);
  5362. }
  5363.  
  5364. static int
  5365. jpnxkt(a, obuf) int a; int obuf[]; {
  5366. /* Translate JIS X 201 Katakana to local code */
  5367.  
  5368.     int r;
  5369.  
  5370.     r = 0;
  5371.     if (fcharset == FC_JIS7) {
  5372.     switch (jpnlst) {
  5373.       case 2:                /* from Kanji */
  5374.         obuf[r++] = 0x1b;
  5375.         obuf[r++] = 0x28;
  5376.         obuf[r++] = 0x4a;
  5377.       case 0:                /* from Roman */
  5378.         obuf[r++] = 0x0e;
  5379.       default:
  5380.         obuf[r++] = (a & 0x7f);
  5381.       break;
  5382.     }
  5383.     } else {
  5384.     if (fcharset == FC_JEUC)
  5385.       obuf[r++] = 0x8e;
  5386.     obuf[r++] = (a | 0x80);
  5387.     }
  5388.     return(r);
  5389. }
  5390.  
  5391. static int
  5392. jpnxkn(ibuf, obuf) int ibuf[], obuf[]; {
  5393.     /* Translate JIS X 0208 Kanji to local code */
  5394.     int c1, c2;
  5395.     int r;
  5396.  
  5397.     c1 = ibuf[0] & 0x7f;
  5398.     c2 = ibuf[1] & 0x7f;
  5399.  
  5400.     if (fcharset == FC_SHJIS) {
  5401.     if (c1 & 1)
  5402.       c2 += 0x1f;
  5403.     else
  5404.       c2 += 0x7d;
  5405.  
  5406.         if (c2 >= 0x7f) c2++;
  5407.  
  5408.         c1 = ((c1 - 0x21) >> 1) + 0x81;
  5409.         if (c1 > 0x9f) c1 += 0x40;
  5410.  
  5411.         obuf[0] = c1;
  5412.         obuf[1] = c2;
  5413.         r = 2;
  5414.     } else if (fcharset == FC_JIS7) {
  5415.         r = 0;
  5416.         switch (jpnlst) {
  5417.         case 1:
  5418.         obuf[r++] = 0x0f; /* From Katakana */
  5419.         case 0:
  5420.         obuf[r++] = 0x1b;
  5421.         obuf[r++] = 0x24;
  5422.         obuf[r++] = 0x42;
  5423.       default:
  5424.         obuf[r++] = c1;
  5425.         obuf[r++] = c2;
  5426.         break;
  5427.     }
  5428.     } else {
  5429.         obuf[0] = (c1 | 0x80);
  5430.         obuf[1] = (c2 | 0x80);
  5431.         r = 2;
  5432.     }
  5433.     return(r);
  5434. }
  5435.  
  5436. int
  5437. xkanjf() {
  5438. /* Initialize parameters for xkanji */
  5439. /* This function should be called when F/X-packet is received */
  5440.     jpncnt = jpnlst = 0;
  5441.     return(0);
  5442. }
  5443.  
  5444. int
  5445. #ifdef CK_ANSIC
  5446. xkanjz(int (*fn)(char))
  5447. #else
  5448. xkanjz(fn) int (*fn)();
  5449. #endif /* CK_ANSIC */
  5450. { /* xkanjz */
  5451. /*
  5452.   Terminate xkanji
  5453.   This function must be called when Z-packet is received
  5454.   (before closing the file).
  5455. */
  5456.     static int obuf[6];
  5457.     int r, i, c;
  5458.  
  5459.     if (fcharset == FC_JIS7) {
  5460.         c = 'A';            /* Dummy Roman character */
  5461.         r = jpnxas(c, obuf) - 1;    /* -1 removes Dummy character */
  5462.         if (r > 0) {
  5463.         for (i = 0; i < r; i++)
  5464.           if (((*fn)((char) obuf[i])) < 0)
  5465.         return(-1);
  5466.     }
  5467.     }
  5468.     return(0);
  5469. }
  5470.  
  5471. int
  5472. #ifdef CK_ANSIC
  5473. xkanji(int a, int (*fn)(char))
  5474. #else
  5475. xkanji(a, fn) int a; int (*fn)();
  5476. #endif /* CK_ANSIC */
  5477. { /* xkanji */
  5478.     static int xbuf[2];
  5479.     static int obuf[8];
  5480.  
  5481.     int i, r;
  5482.     int c7;
  5483.     int state=0;
  5484.  
  5485.     r = 0;
  5486.     if (jpncnt == 0) {
  5487.     /* 1st byte */
  5488.     if ((a & 0x80) == 0) {
  5489.         /* 8th bit is 0, i.e., single-byte code */
  5490.         r = jpnxas(a, obuf);
  5491.         state = 0;
  5492.     } else {
  5493.         /* 8th bit is 1, check the range */
  5494.         c7 = a & 0x7f;
  5495.         if (((c7 > 0x20) && (c7 < 0x7f)) || (c7 == 0x0e)) {
  5496.             /* double byte code */
  5497.             xbuf[jpncnt++] = a;
  5498.         } else {
  5499.             /* single byte code */
  5500.             r = jpnxas(a, obuf);
  5501.             state = 0;
  5502.         }
  5503.     }
  5504.     } else {
  5505.     /* not the 1st byte */
  5506.     xbuf[jpncnt++] = a;
  5507.     if (xbuf[0] == 0x8e) {
  5508.         r = jpnxkt(xbuf[1], obuf);
  5509.         state = 1;
  5510.     } else {
  5511.         r = jpnxkn(xbuf, obuf);
  5512.         state = 2;
  5513.     }
  5514.     }
  5515.     if (r > 0) {
  5516.         for (i = 0; i < r; i++ )
  5517.       if (((*fn)((char) obuf[i])) < 0)
  5518.         return(-1);
  5519.         jpnlst = state;
  5520.         jpncnt = 0;
  5521.     }
  5522.     return(0);
  5523. }
  5524.  
  5525. /*
  5526.   Function for translating from Japanese file character set
  5527.   to Japanese EUC transfer character set.
  5528.   Returns a pointer to a string containing 0, 1, or 2 bytes.
  5529. */
  5530.  
  5531. /* zkanji */
  5532. static int jpnstz;            /* status for JIS-7 */
  5533. static int jpnpnd;            /* number of pending bytes */
  5534. static int jpnpnt;            /* pending buffer index */
  5535. static int jpnpbf[8];            /* pending buffer */
  5536.  
  5537. /* There is some duplication here between the old and new JIS-7 parsers */
  5538. /* to be cleaned up later... */
  5539.  
  5540. VOID
  5541. j7init() {                /* Initialize JIS-7 parser */
  5542.     jpnstz = 0;
  5543.     jpnpnd = 0;
  5544.     jpnpnt = 0;
  5545. }
  5546.  
  5547. int
  5548. getj7() {                /* Reads JIS-7 returns next EUC byte */
  5549.     int x;
  5550.  
  5551.     if (jpnpnd > 0) {            /* If something is pending */
  5552.     x = (unsigned) jpnpbf[jpnpnt++]; /* Get it */
  5553.     jpnpnd--;
  5554.     if (jpnpnd < 0) jpnpnd = 0;
  5555.     return((unsigned)x);
  5556.     }
  5557.     jpnpnt = 0;
  5558.  
  5559.     if ((x = zminchar()) < 0) return(x);
  5560.     while (jpnpnd == 0) {        /* While something is pending... */
  5561.     if ((x > 0x20) && (x < 0x7f)) {    /* 7-bit graphic character */
  5562.         switch (jpnstz) {
  5563.           case 1:             /* Katakana */
  5564. #ifdef COMMENT
  5565.         /* This can't be right... */
  5566.         jpnpbf[jpnpnd++] = 0x80; /* Insert flag (NOT SS2???) */
  5567. #else
  5568.         jpnpbf[jpnpnd++] = 0x8e; /* Insert SS2 */
  5569. #endif /* COMMENT */
  5570.         jpnpbf[jpnpnd++] = (x | 0x80); /* Insert Kana + 8th bit */
  5571.         break;
  5572.           case 2:            /* Kanji */
  5573.         jpnpbf[jpnpnd++] = (x | 0x80); /* Get another byte */
  5574.         if ((x = zminchar()) < 0) return(x);
  5575.         jpnpbf[jpnpnd++] = (x | 0x80);
  5576.         break;
  5577.           default:            /* ASCII / JIS Roman */
  5578.         jpnpbf[jpnpnd++] = x;
  5579.         break;
  5580.         }
  5581.     } else if (x == 0x0e) {        /* ^N = SO */
  5582.         jpnstz = 1;            /* Katakana */
  5583.         if ((x = zminchar()) < 0) return(x);
  5584.     } else if (x == 0x0f) {        /* ^O = SI */
  5585.         jpnstz = 0;            /* ASCII / JIS Roman */
  5586.         if ((x = zminchar()) < 0) return(x);
  5587.     } else if (x == 0x1b) {        /* Escape */
  5588.         jpnpbf[jpnpnd++] = x;    /* Save in buffer */
  5589.         if ((x = zminchar()) < 0) return(x);
  5590.         jpnpbf[jpnpnd++] = x;    /* Save in buffer */
  5591.         if (x == '$') {        /* <ESC>$ */
  5592.         if ((x = zminchar()) < 0) return(x);
  5593.         jpnpbf[jpnpnd++] = x;
  5594.         if ((x == '@') || (x == 'B')) {    /* Kanji */
  5595.             jpnstz = 2;
  5596.             jpnpnt = jpnpnd = 0;
  5597.             if ((x = zminchar()) < 0) return(x);
  5598.         }
  5599.         } else if (x == '(') {    /* <ESC>( == 94-byte single-byte set */
  5600.         if ((x = zminchar()) < 0) return(x);
  5601.         jpnpbf[jpnpnd++] = x;
  5602.         if ((x == 'B') || (x == 'J')) {    /* ASCII or JIS Roman */
  5603.             jpnstz = 0;                /* Set state */
  5604.             jpnpnt = jpnpnd = 0;        /* Reset pointers */
  5605.             if ((x = zminchar()) < 0) return(x);
  5606.         }
  5607.         } else if (x == 0x1b) {    /* <ESC><ESC> */
  5608.         jpnpnt = jpnpnd = 0;    /* Reset pointers, stay in state */
  5609.         if ((x = zminchar()) < 0) return(x);
  5610.         }
  5611.     } else {            /* Not <ESC> - just save it */
  5612.         jpnpbf[jpnpnd++] = x;
  5613.     }
  5614.     }
  5615.     jpnpnt = 0;
  5616.     x = (unsigned)jpnpbf[jpnpnt++];
  5617.     jpnpnd--;
  5618.     return((unsigned)x);
  5619. }
  5620.  
  5621. USHORT
  5622. #ifdef CK_ANSIC
  5623. eu_to_sj(USHORT eu)            /* EUC-JP to Shift-JIS */
  5624. #else
  5625. eu_to_sj(eu) USHORT eu;
  5626. #endif /* CK_ANSIC */
  5627. {
  5628.     int c1, c2;
  5629.     union ck_short jcode,scode;
  5630.  
  5631.     jcode.x_short = eu;
  5632.     c1 = (jcode.x_char[byteorder] & 0x7f);
  5633.     c2 = (jcode.x_char[1-byteorder] & 0x7f);
  5634.  
  5635.     if (c1 & 1)
  5636.       c2 += 0x1f;
  5637.     else
  5638.       c2 += 0x7d;
  5639.     if (c2 >= 0x7f)
  5640.       c2++;
  5641.     c1 = ((c1 - 0x21) >> 1) + 0x81;
  5642.     if (c1 > 0x9f)
  5643.       c1 += 0x40;
  5644.  
  5645.     scode.x_char[byteorder] = c1;
  5646.     scode.x_char[1-byteorder] = c2;
  5647.     return(scode.x_short);
  5648. }
  5649.  
  5650.  
  5651. USHORT
  5652. #ifdef CK_ANSIC
  5653. sj_to_eu(USHORT sj)            /* Shift-JIS to EUC-JP */
  5654. #else
  5655. sj_to_eu(sj) USHORT sj;
  5656. #endif /* CK_ANSIC */
  5657. {
  5658.     union ck_short jcode, scode;
  5659.     int c0, c1;
  5660.  
  5661.     scode.x_short = sj;
  5662.     c0 = scode.x_char[byteorder];    /* Left (hi order) byte */
  5663.     c1 = scode.x_char[1-byteorder];    /* Right (lo order) byte */
  5664.  
  5665.     if (((c0 >= 0x81) && (c0 <= 0x9f)) || /* High order byte has 8th bit set */
  5666.         ((c0 >= 0xe0) && (c0 <= 0xfc))) { /* Kanji */
  5667.     if (c0 <= 0x9f)              /* Two bytes in */
  5668.       c0 -= 0x71;              /* Do the shifting... */
  5669.     else
  5670.       c0 -= 0xb1;
  5671.     c0 = c0 * 2 + 1;
  5672.     if (c1 > 0x7f) c1 -= 1;
  5673.     if (c1 >= 0x9e) {
  5674.         c1 -= 0x7d;
  5675.         c0 += 1;
  5676.     } else {
  5677.         c1 -= 0x1f;
  5678.     }
  5679.     jcode.x_char[byteorder] = (c0 | 0x80); /* Two bytes out */
  5680.     jcode.x_char[1-byteorder] = (c1 | 0x80);
  5681.  
  5682.     } else if (c0 == 0) {        /* Single byte */
  5683.     if (c1 >= 0xa1 && c1 <= 0xdf) {    /* Katakana */
  5684.         jcode.x_char[byteorder] = 0x8e; /* SS2 */
  5685.         jcode.x_char[1-byteorder] = c1; /* Kana code */
  5686.     } else {            /* ASCII or C0 */
  5687.         jcode.x_short = c1;
  5688.     }
  5689.     } else {                /* Something bad */
  5690.     debug(F001,"sj_to_eu bad sj","",sj);
  5691.     jcode.x_short = 0xffff;
  5692.     }
  5693.     return(jcode.x_short);
  5694. }
  5695.  
  5696. int
  5697. zkanjf() {                /* Initialize */
  5698.     jpnstz = jpnpnd = jpnpnt = 0;
  5699.     return(0);
  5700. }
  5701.  
  5702. int
  5703. zkanjz() {
  5704.     return(0);
  5705. }
  5706.  
  5707. int
  5708. #ifdef CK_ANSIC
  5709. zkanji(int (*fn)(void))
  5710. #else
  5711. zkanji(fn) int (*fn)();
  5712. #endif /* CK_ANSIC */
  5713. { /* zkanji */
  5714.     /* Read Japanese local code and translate to Japanese EUC */
  5715.     int a;
  5716.     int sc[3];
  5717.  
  5718.     /* No pending characters */
  5719.     if (fcharset == FC_SHJIS) {        /* Translating from Shift-JIS */
  5720.         if (jpnpnd) {
  5721.             jpnpnd--;
  5722.             return(jpnpbf[jpnpnt++]);
  5723.         }
  5724.         a = (*fn)();
  5725.     jpnpnd = jpnpnt = 0;
  5726.     if (((a >= 0x81) && (a <= 0x9f)) ||
  5727.         ((a >= 0xe0) && (a <= 0xfc))) { /* 2-byte Kanji code */
  5728.         sc[0] = a;
  5729.         if ((sc[1] = (*fn)()) < 0)    /* Get second byte */
  5730.           return(sc[1]);
  5731.         if (sc[0] <= 0x9f)
  5732.           sc[0] -= 0x71;
  5733.         else
  5734.           sc[0] -= 0xb1;
  5735.         sc[0] = sc[0] * 2 + 1;
  5736.         if (sc[1] > 0x7f)
  5737.           sc[1]--;
  5738.         if (sc[1] >= 0x9e) {
  5739.             sc[1] -= 0x7d;
  5740.             sc[0]++;
  5741.         } else {
  5742.             sc[1] -= 0x1f;
  5743.         }
  5744.         a = (sc[0] | 0x80);
  5745.         jpnpbf[0] = (sc[1] | 0x80);
  5746.         jpnpnd = 1;
  5747.         jpnpnt = 0;
  5748.     } else if ((a >= 0xa1) && (a <= 0xdf)) { /* Katakana */
  5749.         jpnpbf[0] = a;
  5750.         jpnpnd = 1;
  5751.         jpnpnt = 0;
  5752.         a = 0x8e;
  5753.     }
  5754.     return(a);
  5755.     } else if (fcharset == FC_JIS7 ) {    /* 7-bit JIS X 0208 */
  5756.         if (jpnpnd) {
  5757.             a = jpnpbf[jpnpnt++];
  5758.         jpnpnd--;
  5759.             return(a);
  5760.         }
  5761.         jpnpnt = 0;
  5762.         if ((a = (*fn)()) < 0)
  5763.       return(a);
  5764.         while (jpnpnd == 0) {
  5765.             if ((a > 0x20) && (a < 0x7f)) {
  5766.                 switch (jpnstz) {
  5767.           case 1:
  5768.             jpnpbf[jpnpnd++] = 0x80; /* Katakana */
  5769.             jpnpbf[jpnpnd++] = (a | 0x80);
  5770.             break;
  5771.           case 2:
  5772.             jpnpbf[jpnpnd++] = (a | 0x80); /* Kanji */
  5773.             if ((a = (*fn)()) < 0)
  5774.               return(a);
  5775.             jpnpbf[jpnpnd++] = (a | 0x80);
  5776.             break;
  5777.           default:
  5778.             jpnpbf[jpnpnd++] = a; /* Single byte */
  5779.             break;
  5780.                 }
  5781.             } else if (a == 0x0e) {
  5782.                 jpnstz = 1;
  5783.                 if ((a = (*fn)()) < 0)
  5784.           return(a);
  5785.             } else if (a == 0x0f) {
  5786.                 jpnstz = 0;
  5787.                 if ((a = (*fn)()) < 0)
  5788.           return(a);
  5789.             } else if (a == 0x1b) {
  5790.                 jpnpbf[jpnpnd++] = a;    /* Escape */
  5791.                 if ((a = (*fn)()) < 0)
  5792.           return(a);
  5793.                 jpnpbf[jpnpnd++] = a;
  5794.                 if (a == '$') {
  5795.                     if ((a = (*fn)()) < 0)
  5796.               return(a);
  5797.                     jpnpbf[jpnpnd++] = a;
  5798.                     if ((a == '@') || (a == 'B')) {
  5799.                         jpnstz = 2;
  5800.             jpnpnt = jpnpnd = 0;
  5801.                         if ((a = (*fn)()) < 0)
  5802.               return(a);
  5803.                     }
  5804.                 } else if (a == '(') {
  5805.                     if ((a = (*fn)()) < 0)
  5806.               return(a);
  5807.                     jpnpbf[jpnpnd++] = a;
  5808.                     if ((a == 'B') || (a == 'J')) {
  5809.                         jpnstz = 0;
  5810.             jpnpnt = jpnpnd = 0;
  5811.                         if ((a = (*fn)()) < 0)
  5812.               return(a);
  5813.                     }
  5814.                 } else if (a == 0x1b) {
  5815.                     jpnpnt = jpnpnd = 0;
  5816.                     if ((a = (*fn)()) < 0)
  5817.               return(a);
  5818.                 }
  5819.             } else {
  5820.                 jpnpbf[jpnpnd++] = a;
  5821.             }
  5822.         }
  5823.         jpnpnt = 0;
  5824.         a = jpnpbf[jpnpnt++];
  5825.     jpnpnd--;
  5826.         return(a);
  5827.     } else {
  5828.         a = (*fn)();
  5829.         return(a);
  5830.     }
  5831. }
  5832. #endif /* KANJI */
  5833.  
  5834. /* Euro functions */
  5835.  
  5836. #ifdef LATIN2
  5837. CHAR
  5838. #ifdef CK_ANSIC
  5839. xl2l9(CHAR c)
  5840. #else
  5841. xl2l9(c) CHAR c;
  5842. #endif /* CK_ANSIC */
  5843. { /* xl2l9 */                 /* Latin-2 to Latin-9... */
  5844.     switch (c) {
  5845.       case 169: return((CHAR)166);    /* S caron */
  5846.       case 185: return((CHAR)168);    /* s caron */
  5847.       case 174: return((CHAR)180);    /* Z caron */
  5848.       case 190: return((CHAR)184);    /* z caron */
  5849.       default:
  5850.     return(yl2l1[c]);
  5851.     }
  5852.  
  5853. }
  5854.  
  5855. _PROTOTYP( CHAR xl258, ( CHAR ) );
  5856. CHAR
  5857. #ifdef CK_ANSIC
  5858. xl258(CHAR c)
  5859. #else
  5860. xl258(c) CHAR c;
  5861. #endif /* CK_ANSIC */
  5862. { /* xl258 */                 /* Latin-2 to CP858... */
  5863.     return(c);
  5864. }
  5865. #else
  5866. #define xl2l9 NULL
  5867. #define xl258 NULL
  5868. #endif /* LATIN2 */
  5869.  
  5870. CHAR
  5871. #ifdef CK_ANSIC
  5872. zl9as(CHAR c)
  5873. #else
  5874. zl9as(c) CHAR c;
  5875. #endif /* CK_ANSIC */
  5876. { /* zl9as */                 /* Latin-9 to US ASCII... */
  5877.     if (c < (CHAR)0x80) return(c);    /* Save a function call */
  5878.     switch (c) {
  5879.       case 0xa4: return(UNK);        /* Euro */
  5880.       case 0xa6: return('S');        /* S Caron */
  5881.       case 0xa8: return('s');        /* s Caron */
  5882.       case 0xb4: return('Z');        /* Z Caron */
  5883.       case 0xbc: return('O');        /* OE digraph */
  5884.       case 0xbd: return('o');        /* oe digraph */
  5885.       case 0xbe: return('Y');        /* Y diaeresis */
  5886.       default:   return(zl1as(c));    /* The rest is like Latin-1 */
  5887.     }
  5888. }
  5889.  
  5890. _PROTOTYP( CHAR xl9as, ( CHAR ) );
  5891. CHAR
  5892. #ifdef CK_ANSIC
  5893. xl9as(CHAR c)
  5894. #else
  5895. xl9as(c) CHAR c;
  5896. #endif /* CK_ANSIC */
  5897. { /* xl9as */                 /* Latin-9 to US ASCII... */
  5898.     if (c < (CHAR)0x80) return(c);    /* Save a function call */
  5899.     switch (c) {
  5900.       case 0xa4: return(UNK);        /* Euro */
  5901.       case 0xa6: return('S');        /* S Caron */
  5902.       case 0xa8: return('s');        /* s Caron */
  5903.       case 0xb4: return('Z');        /* Z Caron */
  5904.       case 0xb8: return('z');        /* z Caron */
  5905.       case 0xbc: return('O');        /* OE digraph */
  5906.       case 0xbd: return('o');        /* oe digraph */
  5907.       case 0xbe: return('Y');        /* Y diaeresis */
  5908.       default:   return(xl1as(c));    /* The rest is like Latin-1 */
  5909.     }
  5910. }
  5911.  
  5912. CHAR                    /* CP1252 to Latin-9 */
  5913. #ifdef CK_ANSIC
  5914. xw1l9(CHAR c)
  5915. #else
  5916. xw1l9(c) CHAR c;
  5917. #endif /* CK_ANSIC */
  5918. { /* xw1l9 */
  5919.     switch (c) {
  5920.       case 0x80: return(0xa4);        /* Euro sign */
  5921.       case 0x8a: return(0xa6);        /* S caron */
  5922.       case 0x8c: return(0xbc);        /* OE */
  5923.       case 0x8e: return(0xb4);        /* Z caron */
  5924.       case 0x9a: return(0xa8);        /* s caron */
  5925.       case 0x9c: return(0xbd);        /* oe */
  5926.       case 0x9e: return(0xb8);        /* z caron */
  5927.       case 0x9f: return(0xbe);        /* Y diaeresis */
  5928.       case 0xa4:            /* Currency sign */
  5929.       case 0xa6:            /* Broken vertical bar */
  5930.       case 0xa8:            /* Diaeresis */
  5931.       case 0xb4:            /* Acute accent */
  5932.       case 0xb8:            /* Cedilla */
  5933.       case 0xbc:            /* 1/4 */
  5934.       case 0xbd:            /* 1/2 */
  5935.       case 0xbe: return('?');        /* 3/4 */
  5936.       default: return((c < 160) ? xw1as(c) : c);
  5937.     }
  5938. }
  5939.  
  5940. #ifdef LATIN2
  5941. CHAR
  5942. #ifdef CK_ANSIC
  5943. xl9l2(CHAR c)
  5944. #else
  5945. xl9l2(c) CHAR c;
  5946. #endif /* CK_ANSIC */
  5947. { /* xl9l2 */                 /* Latin-9 to Latin-2... */
  5948.     if (c < (CHAR)0x80) return(c);    /* Save a function call */
  5949.     switch (c) {
  5950.       case 0xa4: return(UNK);        /* Euro */
  5951.       case 0xa6: return((CHAR)0xa9);    /* S Caron */
  5952.       case 0xa8: return((CHAR)0xb9);    /* s Caron */
  5953.       case 0xb4: return((CHAR)0xae);    /* Z Caron */
  5954.       case 0xb8: return((CHAR)0xaf);    /* z Caron */
  5955.       case 0xbc: return('O');        /* OE digraph */
  5956.       case 0xbd: return('o');        /* oe digraph */
  5957.       case 0xbe: return('Y');        /* Y diaeresis */
  5958.       default:   return(xl1l2(c));    /* The rest is like Latin-1 */
  5959.     }
  5960. }
  5961. #else
  5962. #define xl9l2 NULL
  5963. #endif /* LATIN2 */
  5964.  
  5965. CHAR
  5966. #ifdef CK_ANSIC
  5967. xl958(CHAR c)
  5968. #else
  5969. xl958(c) CHAR c;
  5970. #endif /* CK_ANSIC */
  5971. { /* xl958 */                 /* Latin-9 to CP858... */
  5972.     if (c == 0xa4)            /* Euro Symbol */
  5973.       return((CHAR)0xd5);
  5974.     else if (c == 0x9e)            /* This was currency symbol */
  5975.       return((CHAR)0xcf);
  5976.     c = yl185[c];
  5977.     return(c);
  5978. }
  5979.  
  5980. CHAR
  5981. #ifdef CK_ANSIC
  5982. x58as(CHAR c)
  5983. #else
  5984. x58as(c) CHAR c;
  5985. #endif /* CK_ANSIC */
  5986. { /* x58as */                 /* CP858 to US ASCII... */
  5987.     if (c == 0xd5)            /* Euro rather than dotless i */
  5988.       return(UNK);
  5989.     else
  5990.       return(x85as(c));            /* The rest is like CP850 */
  5991. }
  5992.  
  5993. CHAR
  5994. #ifdef CK_ANSIC
  5995. x58l1(CHAR c)
  5996. #else
  5997. x58l1(c) CHAR c;
  5998. #endif /* CK_ANSIC */
  5999. { /* x58l1 */                 /* CP858 to Latin-1... */
  6000.     if (c == 0xd5)            /* Euro rather than dotless i */
  6001.       return((CHAR)0xa4);        /* Return currency symbol */
  6002.     else if (c == 0xcf)            /* This keeps it invertible */
  6003.       return((CHAR)0x9e);
  6004.     else
  6005.       return(x85l1(c));
  6006. }
  6007.  
  6008. #ifdef LATIN2
  6009. CHAR
  6010. #ifdef CK_ANSIC
  6011. x58l2(CHAR c)
  6012. #else
  6013. x58l2(c) CHAR c;
  6014. #endif /* CK_ANSIC */
  6015. { /* x58l2 */                 /* CP858 to Latin-2... */
  6016.     if (c == 0xd5)            /* Euro rather than dotless i */
  6017.       return((CHAR)0xa4);        /* Return currency symbol */
  6018.     else if (c == 0xcf)            /* This keeps it invertible */
  6019.       return((CHAR)0x9e);        /* (if it ever was...) */
  6020.     else                /* Otherwise like CP850 */
  6021.       return(x85l2(c));
  6022. }
  6023. #else
  6024. #define x58l2 NULL
  6025. #endif /* LATIN2 */
  6026.  
  6027. CHAR
  6028. #ifdef CK_ANSIC
  6029. x58l9(CHAR c)
  6030. #else
  6031. x58l9(c) CHAR c;
  6032. #endif /* CK_ANSIC */
  6033. { /* x58l9 */                 /* CP-858 to Latin-9... */
  6034.     if (c == 0xd5)            /* Euro rather than dotless i */
  6035.       return((CHAR)0xa4);        /* Return currency symbol */
  6036.     else if (c == 0xcf)            /* This keeps it invertible */
  6037.       return((CHAR)0x9e);        /* (if it ever was...) */
  6038.     else                /* Otherwise like CP850 */
  6039.       return(x85l1(c));            /* to Latin-1 */
  6040. }
  6041.  
  6042. /* End Euro functions */
  6043.  
  6044.  
  6045. /*  TABLES OF TRANSLATION FUNCTIONS */
  6046.  
  6047. /*
  6048.   First, the table of translation functions for RECEIVING files.  That is,
  6049.   *from* the TRANSFER character set *to* the FILE character set, an array of
  6050.   pointers to functions.  The first index is the TRANSFER CHARACTER-SET
  6051.   number, the second index is the FILE CHARACTER-SET number.
  6052.  
  6053.   These arrays must be fully populated, even if (as is the case with Kanji
  6054.   character sets), all the entries are NULL.  Otherwise, subscript
  6055.   calculations will be wrong and we'll use the wrong functions.
  6056. */
  6057.  
  6058. /* Pointers to byte-for-byte translation functions */
  6059.  
  6060. _PROTOTYP( CHAR (*rx), (CHAR) );
  6061. _PROTOTYP( CHAR (*sx), (CHAR) );
  6062.  
  6063. #ifdef UNICODE
  6064. _PROTOTYP( int (*xut), (USHORT) );    /* Translation function UCS to TCS */
  6065. _PROTOTYP( int (*xuf), (USHORT) );    /* Translation function UCS to FCS */
  6066. _PROTOTYP( USHORT (*xtu), (CHAR) );    /* Translation function TCS to UCS */
  6067. _PROTOTYP( USHORT (*xfu), (CHAR) );    /* Translation function FCS to UCS */
  6068. #endif /* UNICODE */
  6069.  
  6070. #ifdef CK_ANSIC
  6071. CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
  6072. #else
  6073. CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])() =
  6074. #endif /* CK_ANSIC */
  6075. {
  6076.     NULL,            /* 0,0 transparent to us ascii */
  6077.     NULL,            /* 0,1 transparent to uk ascii */
  6078.     NULL,            /* 0,2 transparent to dutch nrc */
  6079.     NULL,            /* 0,3 transparent to finnish nrc */
  6080.     NULL,            /* 0,4 transparent to french nrc */
  6081.     NULL,            /* 0,5 transparent to fr-canadian nrc */
  6082.     NULL,            /* 0,6 transparent to german nrc */
  6083.     NULL,            /* 0,7 transparent to hungarian nrc */
  6084.     NULL,            /* 0,8 transparent to italian nrc */
  6085.     NULL,            /* 0,9 transparent to norge/danish nrc */
  6086.     NULL,            /* 0,10 transparent to portuguese nrc */
  6087.     NULL,            /* 0,11 transparent to spanish nrc */
  6088.     NULL,            /* 0,12 transparent to swedish nrc */
  6089.     NULL,            /* 0,13 transparent to swiss nrc */
  6090.     NULL,            /* 0,14 transparent to latin-1 */
  6091.     NULL,            /* 0,15 transparent to latin-2 */
  6092.     NULL,            /* 0,16 transparent to DEC MCS */
  6093.     NULL,            /* 0,17 transparent to NeXT */
  6094.     NULL,            /* 0,18 transparent to CP437 */
  6095.     NULL,            /* 0,19 transparent to CP850 */
  6096.     NULL,            /* 0,20 transparent to CP852 */
  6097.     NULL,            /* 0,21 transparent to Macintosh Latin */
  6098.     NULL,            /* 0,22 transparent to DGI */
  6099.     NULL,            /* 0,23 transparent to HP */
  6100.     NULL,            /* 0,24 transparent to Latin/Cyrillic */
  6101.     NULL,                       /* 0,25 transparent to CP866 */
  6102.     NULL,            /* 0,26 transparent to Short KOI-7 */
  6103.     NULL,                       /* 0,27 transparent to Old KOI-8 Cyrillic */
  6104.     NULL,            /* 0,28 transparent to JIS-7 */
  6105.     NULL,            /* 0,29 transparent to Shift-JIS */
  6106.     NULL,            /* 0,30 transparent to J-EUC */
  6107.     NULL,            /* 0,31 transparent to DEC Kanji */
  6108.     NULL,            /* 0,32 transparent to Hebrew-7 */
  6109.     NULL,            /* 0,33 transparent to Latin/Hebrew */
  6110.     NULL,            /* 0,34 transparent to CP862 Hebrew */
  6111.     NULL,            /* 0,35 transparent to ELOT 927 Greek */
  6112.     NULL,            /* 0,36 transparent to Latin/Greek */
  6113.     NULL,            /* 0,37 transparent to CP869 */
  6114.     NULL,            /* 0,38 transparent to Latin-9 */
  6115.     NULL,            /* 0,39 transparent to CP858 */
  6116.     NULL,            /* 0,40 transparent to CP855 */
  6117.     NULL,            /* 0,41 transparent to CP1251 */
  6118.     NULL,            /* 0,42 transparent to Bulgarian */
  6119.     NULL,            /* 0,43 transparent to CP1250 */
  6120.     NULL,            /* 0,44 transparent to Mazovia */
  6121.     NULL,            /* 0,45 transparent to UCS-2 */
  6122.     NULL,            /* 0,46 transparent to UTF-8 */
  6123.     NULL,            /* 0,47 transparent to KOI8R */
  6124.     NULL,            /* 0,48 transparent to KOI8U */
  6125.     NULL,            /* 0,49 transparent to CP1252 */
  6126.     NULL,            /* 1,0 ascii to us ascii */
  6127.     NULL,            /* 1,1 ascii to uk ascii */
  6128.     NULL,            /* 1,2 ascii to dutch nrc */
  6129.     NULL,            /* 1,3 ascii to finnish nrc */
  6130.     NULL,            /* 1,4 ascii to french nrc */
  6131.     NULL,            /* 1,5 ascii to fr-canadian nrc */
  6132.     NULL,            /* 1,6 ascii to german nrc */
  6133.     NULL,            /* 1,7 ascii to hungarian nrc */
  6134.     NULL,            /* 1,8 ascii to italian nrc */
  6135.     NULL,            /* 1,9 ascii to norge/danish nrc */
  6136.     NULL,            /* 1,10 ascii to portuguese nrc */
  6137.     NULL,            /* 1,11 ascii to spanish nrc */
  6138.     NULL,            /* 1,12 ascii to swedish nrc */
  6139.     NULL,            /* 1,13 ascii to swiss nrc */
  6140.     NULL,            /* 1,14 ascii to latin-1 */
  6141.     NULL,            /* 1,15 ascii to latin-2 */
  6142.     NULL,            /* 1,16 ascii to DEC MCS */
  6143.     NULL,            /* 1,17 ascii to NeXT */
  6144.     NULL,            /* 1,18 ascii to CP437 */
  6145.     NULL,            /* 1,19 ascii to CP850 */
  6146.     NULL,            /* 1,20 ascii to CP852 */
  6147.     NULL,            /* 1,21 ascii to Macintosh Latin */
  6148.     NULL,            /* 1,22 ascii to DGI */
  6149.     NULL,            /* 1,23 ascii to HP */
  6150.     xaslc,                      /* 1,24 ascii to Latin/Cyrillic */
  6151.     xasac,                      /* 1,25 ascii to CP866 */
  6152.     xassk,                      /* 1,26 ascii to Short KOI */
  6153.     xask8,                      /* 1,27 ascii to Old KOI-8 Cyrillic */
  6154.     NULL,            /* 1,28 ascii to JIS-7 */
  6155.     NULL,            /* 1,29 ascii to Shift-JIS */
  6156.     NULL,            /* 1,30 ascii to J-EUC */
  6157.     NULL,            /* 1,31 ascii to DEC Kanji */
  6158.     xash7,            /* 1,32 ascii to Hebrew-7 */
  6159.     NULL,            /* 1,33 ascii to Latin/Hebrew */
  6160.     NULL,            /* 1,34 ascii to CP862 Hebrew */
  6161.     xaseg,            /* 1,35 ascii to ELOT 927 Greek */
  6162.     NULL,            /* 1,36 ascii to Latin/Greek */
  6163.     NULL,            /* 1,37 ascii to CP869 */
  6164.     NULL,            /* 1,38 ascii to Latin-9 */
  6165.     NULL,            /* 1,39 ascii to CP858 */
  6166.     xas55,            /* 1,40 ascii to CP855 */
  6167.     xas1251,            /* 1,41 ascii to CP1251 */
  6168.     xleft128,            /* 1,42 ascii to bulgarian */
  6169.     xleft128,            /* 1,43 ascii to CP1250 */
  6170.     xleft128,            /* 1,44 ascii to Mazovia */
  6171.     NULL,            /* 1,45 ascii to UCS-2 */
  6172.     NULL,            /* 1,46 ascii to UTF-8 */
  6173.     NULL,            /* 1,47 ascii to KOI8-R */
  6174.     NULL,            /* 1,48 ascii to KOI8-U */
  6175.     NULL,            /* 1,49 ascii to CP1252 */
  6176.     zl1as,            /* 2,0 latin-1 to us ascii */
  6177.     xl1uk,            /* 2,1 latin-1 to uk ascii */
  6178.     xl1du,            /* 2,2 latin-1 to dutch nrc */
  6179.     xl1fi,            /* 2,3 latin-1 to finnish nrc */
  6180.     xl1fr,            /* 2,4 latin-1 to french nrc */
  6181.     xl1fc,            /* 2,5 latin-1 to fr-canadian nrc */
  6182.     xl1ge,            /* 2,6 latin-1 to german nrc */
  6183.     xl1it,            /* 2,7 latin-1 to italian nrc */
  6184.     xl1hu,            /* 2,8 latin-1 to hungarian nrc */
  6185.     xl1no,            /* 2,9 latin-1 to norge/danish nrc */
  6186.     xl1po,            /* 2,10 latin-1 to portuguese nrc */
  6187.     xl1sp,            /* 2,11 latin-1 to spanish nrc */
  6188.     xl1sw,            /* 2,12 latin-1 to swedish nrc */
  6189.     xl1ch,            /* 2,13 latin-1 to swiss nrc */
  6190.     NULL,            /* 2,14 latin-1 to latin-1 */
  6191.     xl1l2,            /* 2,15 latin-1 to latin-2 */
  6192.     xl1dm,            /* 2,16 latin-1 to DEC MCS */
  6193.     xl1ne,            /* 2,17 latin-1 to NeXT */
  6194.     xl143,            /* 2,18 latin-1 to CP437 */
  6195.     xl185,            /* 2,19 latin-1 to CP850 */
  6196.     xl152,            /* 2,20 latin-1 to CP852 */
  6197.     xl1aq,            /* 2,21 latin-1 to Macintosh Latin */
  6198.     xl1dg,            /* 2,22 latin-1 to DGI */
  6199.     xl1r8,            /* 2,23 latin-1 to HP Roman8 */
  6200.     zl1as,            /* 2,24 latin-1 to Latin/Cyrillic */
  6201.     zl1as,                      /* 2,25 latin-1 to CP866 */
  6202.     xl1sk,                      /* 2,26 latin-1 to Short KOI */
  6203.     zl1as,                   /* 2,27 latin-1 to Old KOI-8 Cyrillic */
  6204.     NULL,            /* 2,28 latin-1 to JIS-7 */
  6205.     NULL,            /* 2,29 latin-1 to Shift-JIS */
  6206.     NULL,            /* 2,30 latin-1 to J-EUC */
  6207.     NULL,            /* 2,31 latin-1 to DEC Kanji */
  6208.     xl1h7,            /* 2,32 latin-1 to Hebrew-7 */
  6209.     xl1lh,            /* 2,33 latin-1 to Latin/Hebrew */
  6210.     xl162,            /* 2,34 latin-1 to CP862 Hebrew */
  6211.     xl1eg,            /* 2,35 latin-1 to ELOT 927 Greek */
  6212.     xl1lg,            /* 2,36 latin-1 to Latin/Greek */
  6213.     xl169,            /* 2,37 latin-1 to CP869 */
  6214.     NULL,            /* 2,38 latin-1 to Latin9 */
  6215.     xl185,            /* 2,39 latin-1 to CP858 */
  6216.     zl1as,            /* 2,40 latin-1 to CP855 */
  6217.     zl1as,            /* 2,41 latin-1 to CP1251 */
  6218.     zl1as,            /* 2,42 latin-1 to Bulgarian */
  6219.     xl11250,            /* 2,43 latin-1 to CP1250 */
  6220.     xl1mz,            /* 2,44 latin-1 to Mazovia */
  6221.     NULL,            /* 2,45 latin-1 to UCS-2 */
  6222.     NULL,            /* 2,46 latin-1 to UTF-8 */
  6223.     zl1as,            /* 2,47 latin-1 to KOI8R */
  6224.     zl1as,            /* 2,48 latin-1 to KOI8U */
  6225.     xl1w1,            /* 2,49 latin-1 to CP1252 */
  6226.     xl2as,            /* 3,0 latin-2 to us ascii */
  6227.     xl2as,            /* 3,1 latin-2 to uk ascii */
  6228.     xl2as,            /* 3,2 latin-2 to dutch nrc */
  6229.     xl2as,            /* 3,3 latin-2 to finnish nrc */
  6230.     xl2as,            /* 3,4 latin-2 to french nrc */
  6231.     xl2as,            /* 3,5 latin-2 to fr-canadian nrc */
  6232.     xl2as,            /* 3,6 latin-2 to german nrc */
  6233.     xl2as,            /* 3,7 latin-2 to italian nrc */
  6234.     xl2as,            /* 3,8 latin-2 to hungarian nrc */
  6235.     xl2as,            /* 3,9 latin-2 to norge/danish nrc */
  6236.     xl2as,            /* 3,10 latin-2 to portuguese nrc */
  6237.     xl2as,            /* 3,11 latin-2 to spanish nrc */
  6238.     xl2as,            /* 3,12 latin-2 to swedish nrc */
  6239.     xl2as,            /* 3,13 latin-2 to swiss nrc */
  6240.     xl2l1,            /* 3,14 latin-2 to latin-1 */
  6241.     NULL,            /* 3,15 latin-2 to latin-2 */
  6242.     xl2l1,            /* 3,16 latin-2 to DEC MCS */
  6243.     xl2ne,            /* 3,17 latin-2 to NeXT */
  6244.     xl243,            /* 3,18 latin-2 to CP437 */
  6245.     xl285,            /* 3,19 latin-2 to CP850 */
  6246.     xl252,            /* 3,20 latin-2 to CP852 */
  6247.     xl2aq,            /* 3,21 latin-2 to Macintosh Latin */
  6248.     xl2dg,            /* 3,22 latin-2 to DGI */
  6249.     xl2r8,            /* 3,23 latin-2 to HP */
  6250.     xl2as,            /* 3,24 latin-2 to Latin/Cyrillic */
  6251.     xl2as,                      /* 3,25 latin-2 to CP866 */
  6252.     xl2sk,                      /* 3,26 latin-2 to Short KOI */
  6253.     xl2as,                   /* 3,27 latin-2 to Old KOI-8 Cyrillic */
  6254.     NULL,            /* 3,28 latin-2 to JIS-7 */
  6255.     NULL,            /* 3,29 latin-2 to Shift-JIS */
  6256.     NULL,            /* 3,30 latin-2 to J-EUC */
  6257.     NULL,            /* 3,31 latin-2 to DEC Kanji */
  6258.     xl2h7,            /* 3,32 latin-2 to Hebrew-7 */
  6259.     xl2as,            /* 3,33 latin-2 to Latin/Hebrew */
  6260.     xl2as,            /* 3,34 latin-2 to CP862 Hebrew */
  6261.     xassk,            /* 3,35 latin-2 to ELOT 927 Greek */
  6262.     xl2as,            /* 3,36 latin-2 to Latin/Greek */
  6263.     xl2as,            /* 3,37 latin-2 to CP869 */
  6264.     xl2l9,            /* 3,38 latin-2 to Latin-9 */
  6265.     xl258,            /* 3,39 latin-2 to CP858 */
  6266.     xl2as,            /* 3,40 latin-2 to CP855 */
  6267.     xl2as,            /* 3,41 latin-2 to CP1251 */
  6268.     xl2as,            /* 3,42 latin-2 to Bulgarian */
  6269.     xl21250,            /* 3,43 latin-2 to CP1250 */
  6270.     xl2mz,            /* 3,44 latin-2 to Mazovia */
  6271.     NULL,            /* 3,45 latin-2 to UCS-2 */
  6272.     NULL,            /* 3,46 latin-2 to UTF-8 */
  6273.     xl2as,            /* 3,47 latin-2 to KOI8R */
  6274.     xl2as,            /* 3,48 latin-2 to KOI8U */
  6275.     xl2w1,            /* 3,49 latin-2 to CP1252 */
  6276.     xlcas,            /* 4,0 latin/cyrillic to us ascii */
  6277.     xlcas,            /* 4,1 latin/cyrillic to uk ascii */
  6278.     xlcas,                 /* 4,2 latin/cyrillic to dutch nrc */
  6279.     xlcas,            /* 4,3 latin/cyrillic to finnish ascii */
  6280.     xlcas,            /* 4,4 latin/cyrillic to french nrc */
  6281.     xlcas,            /* 4,5 latin/cyrillic to fr-canadian nrc */
  6282.     xlcas,            /* 4,6 latin/cyrillic to german nrc */
  6283.     xlcas,            /* 4,7 latin/cyrillic to italian nrc */
  6284.     xlcas,            /* 4,8 latin/cyrillic to hungarian nrc */
  6285.     xlcas,            /* 4,9 latin/cyrillic to norge/danish nrc */
  6286.     xlcas,            /* 4,10 latin/cyrillic to portuguese nrc */
  6287.     xlcas,            /* 4,11 latin/cyrillic to spanish nrc */
  6288.     xlcas,            /* 4,12 latin/cyrillic to swedish nrc */
  6289.     xlcas,            /* 4,13 latin/cyrillic to swiss nrc */
  6290.     xlcas,            /* 4,14 latin/cyrillic to latin-1 */
  6291.     xlcas,            /* 4,15 latin/cyrillic to latin-2 */
  6292.     xlcas,            /* 4,16 latin/cyrillic to DEC MCS */
  6293.     xlcas,            /* 4,17 latin/cyrillic to NeXT */
  6294.     xlcas,            /* 4,18 latin/cyrillic to CP437 */
  6295.     xlcas,            /* 4,19 latin/cyrillic to CP850 */
  6296.     xlcas,            /* 4,20 latin/cyrillic to CP852 */
  6297.     xlcas,            /* 4,21 latin/cyrillic to Macintosh Latin */
  6298.     xlcas,            /* 4,22 latin/cyrillic to DGI */
  6299.     xlcas,            /* 4,23 latin/cyrillic to HP */
  6300.     NULL,                       /* 4,24 latin/cyrillic to Latin/Cyrillic */
  6301.     xlcac,                      /* 4,25 latin/cyrillic to CP866 */
  6302.     xlcsk,                      /* 4,26 latin/cyrillic to Short KOI */
  6303.     xlck8,                   /* 4,27 latin/cyrillic to Old KOI-8 Cyrillic */
  6304.     NULL,            /* 4,28 latin/cyril to JIS-7 */
  6305.     NULL,            /* 4,29 latin/cyril to Shift-JIS */
  6306.     NULL,            /* 4,30 latin/cyril to J-EUC */
  6307.     NULL,            /* 4,31 latin/cyril to DEC Kanji */
  6308.     xlch7,            /* 4,32 latin/cyril to Hebrew-7 */
  6309.     xlcas,            /* 4,33 latin/cyril to Latin/Hebrew */
  6310.     xlcas,            /* 4,34 latin/cyril to CP862 Hebrew */
  6311.     xassk,            /* 4,35 latin/cyril to ELOT 927 Greek */
  6312.     xleft160,            /* 4,36 latin/cyril to Latin/Greek */
  6313.     xleft128,            /* 4,37 latin/cyril to CP869 */
  6314.     xlcas,            /* 4,38 latin/cyril to latin-9 */
  6315.     xlcas,            /* 4,39 latin/cyril to CP858 */
  6316.     xlc55,            /* 4,40 latin/cyril to CP855 */
  6317.     xlc1251,            /* 4,41 latin/cyril to CP1251 */
  6318.     xlcbu,            /* 4,42 latin/cyril to Bulgarian */
  6319.     xlcas,            /* 4,43 latin/cyril to CP1250 */
  6320.     xlcas,            /* 4,44 latin/cyril to Mazovia */
  6321.     NULL,            /* 4,45 latin/cyril to UCS-2 */
  6322.     NULL,            /* 4,46 latin/cyril to UTF-8 */
  6323.     xlckr,            /* 4,47 latin/cyril to KOI8R */
  6324.     xlcku,            /* 4,48 latin/cyril to KOI8U */
  6325.     xlcas,            /* 4,49 latin/cyril to CP1252 */
  6326.     NULL,            /* 5,00 */
  6327.     NULL,            /* 5,01 */
  6328.     NULL,            /* 5,02 */
  6329.     NULL,            /* 5,03 */
  6330.     NULL,            /* 5,04 */
  6331.     NULL,            /* 5,05 */
  6332.     NULL,            /* 5,06 */
  6333.     NULL,            /* 5,07 */
  6334.     NULL,            /* 5,08 */
  6335.     NULL,            /* 5,09 */
  6336.     NULL,            /* 5,10 */
  6337.     NULL,            /* 5,11 */
  6338.     NULL,            /* 5,12 */
  6339.     NULL,            /* 5,13 */
  6340.     NULL,            /* 5,14 */
  6341.     NULL,            /* 5,15 */
  6342.     NULL,            /* 5,16 */
  6343.     NULL,            /* 5,17 */
  6344.     NULL,            /* 5,18 */
  6345.     NULL,            /* 5,19 */
  6346.     NULL,            /* 5,20 */
  6347.     NULL,            /* 5,21 */
  6348.     NULL,            /* 5,22 */
  6349.     NULL,            /* 5,23 */
  6350.     NULL,            /* 5,24 */
  6351.     NULL,            /* 5,25 */
  6352.     NULL,            /* 5,26 */
  6353.     NULL,            /* 5,27 */
  6354.     NULL,            /* 5,28 */
  6355.     NULL,            /* 5,29 */
  6356.     NULL,            /* 5,30 */
  6357.     NULL,            /* 5,31 */
  6358.     NULL,            /* 5,32 */
  6359.     NULL,            /* 5,33 */
  6360.     NULL,            /* 5,34 */
  6361.     NULL,            /* 5,35 */
  6362.     NULL,            /* 5,36 */
  6363.     NULL,            /* 5,37 */
  6364.     NULL,            /* 5,38 */
  6365.     NULL,            /* 5,39 */
  6366.     NULL,            /* 5,40 */
  6367.     NULL,            /* 5,41 */
  6368.     NULL,            /* 5,42 */
  6369.     NULL,            /* 5,43 */
  6370.     NULL,            /* 5,44 */
  6371.     NULL,            /* 5,45 */
  6372.     NULL,            /* 5,46 */
  6373.     NULL,            /* 5,47 */
  6374.     NULL,            /* 5,48 */
  6375.     NULL,            /* 5,49 */
  6376.     xlhas,            /* 6,0 latin/hebrew to us ascii */
  6377.     xlhas,            /* 6,1 latin/hebrew to uk ascii */
  6378.     xlhas,                 /* 6,2 latin/hebrew to dutch nrc */
  6379.     xlhas,            /* 6,3 latin/hebrew to finnish ascii */
  6380.     xlhas,            /* 6,4 latin/hebrew to french nrc */
  6381.     xlhas,            /* 6,5 latin/hebrew to fr-canadian nrc */
  6382.     xlhas,            /* 6,6 latin/hebrew to german nrc */
  6383.     xlhas,            /* 6,7 latin/hebrew to italian nrc */
  6384.     xlhas,            /* 6,8 latin/hebrew to hungarian nrc */
  6385.     xlhas,            /* 6,9 latin/hebrew to norge/danish nrc */
  6386.     xlhas,            /* 6,10 latin/hebrew to portuguese nrc */
  6387.     xlhas,            /* 6,11 latin/hebrew to spanish nrc */
  6388.     xlhas,            /* 6,12 latin/hebrew to swedish nrc */
  6389.     xlhas,            /* 6,13 latin/hebrew to swiss nrc */
  6390.     xlhl1,            /* 6,14 latin/hebrew to latin-1 */
  6391.     xlhas,            /* 6,15 latin/hebrew to latin-2 */
  6392.     xlhl1,            /* 6,16 latin/hebrew to DEC MCS */
  6393.     xlhas,            /* 6,17 latin/hebrew to NeXT */
  6394.     xlhas,            /* 6,18 latin/hebrew to CP437 */
  6395.     xlhas,            /* 6,19 latin/hebrew to CP850 */
  6396.     xlhas,            /* 6,20 latin/hebrew to CP852 */
  6397.     xlhas,            /* 6,21 latin/hebrew to Macintosh Latin */
  6398.     xlhas,            /* 6,22 latin/hebrew to DGI */
  6399.     xlhas,                      /* 6,23 latin/hebrew to HP */
  6400.     xlhas,                      /* 6,24 latin/hebrew to Latin/Cyrillic */
  6401.     xlhas,                      /* 6,25 latin/hebrew to CP866 */
  6402.     NULL,                       /* 6,26 latin/hebrew to Short KOI */
  6403.     xlhas,                   /* 6,27 latin/hebrew to Old KOI-8 Cyrillic */
  6404.     NULL,            /* 6,28 latin/hebrew to JIS-7 */
  6405.     NULL,            /* 6,29 latin/hebrew to Shift-JIS */
  6406.     NULL,            /* 6,30 latin/hebrew to J-EUC */
  6407.     NULL,            /* 6,31 latin/hebrew to DEC Kanji */
  6408.     xlhh7,            /* 6,32 latin/hebrew to Hebrew-7 */
  6409.     NULL,            /* 6,33 latin/hebrew to Latin/Hebrew */
  6410.     xlh62,            /* 6,34 latin/hebrew to CP862 Hebrew */
  6411.     NULL,            /* 6,35 latin/hebrew to ELOT 927 Greek */
  6412.     xlhas,            /* 6,36 latin/hebrew to Latin/Greek */
  6413.     xlhas,            /* 6,37 latin/hebrew to CP869 */
  6414.     xlhas,            /* 6,38 latin/hebrew to Latin-9 */
  6415.     xlhas,            /* 6,39 latin/hebrew to CP858 */
  6416.     xlhas,            /* 6,40 latin/hebrew to CP855 */
  6417.     xlhas,            /* 6,41 latin/hebrew to CP1251 */
  6418.     xlhas,            /* 6,42 latin/hebrew to Bulgarian */
  6419.     xlhas,            /* 6,43 latin/hebrew to CP1250 */
  6420.     xlhas,            /* 6,44 latin/hebrew to Mazovia */
  6421.     NULL,            /* 6,45 latin/hebrew to UCS-2 */
  6422.     NULL,            /* 6,46 latin/hebrew to UTF-8 */
  6423.     NULL,            /* 6,47 latin/hebrew to KOI8R */
  6424.     NULL,            /* 6,48 latin/hebrew to KOI8U */
  6425.     xlhw1,            /* 6,49 latin/hebrew to CP1252 */
  6426.     xlgas,            /* 7,0 latin/greek to us ascii */
  6427.     xlgas,            /* 7,1 latin/greek to uk ascii */
  6428.     xlgas,                 /* 7,2 latin/greek to dutch nrc */
  6429.     xlgas,            /* 7,3 latin/greek to finnish ascii */
  6430.     xlgas,            /* 7,4 latin/greek to french nrc */
  6431.     xlgas,            /* 7,5 latin/greek to fr-canadian nrc */
  6432.     xlgas,            /* 7,6 latin/greek to german nrc */
  6433.     xlgas,            /* 7,7 latin/greek to italian nrc */
  6434.     xlgas,            /* 7,8 latin/greek to hungarian nrc */
  6435.     xlgas,            /* 7,9 latin/greek to norge/danish nrc */
  6436.     xlgas,            /* 7,10 latin/greek to portuguese nrc */
  6437.     xlgas,            /* 7,11 latin/greek to spanish nrc */
  6438.     xlgas,            /* 7,12 latin/greek to swedish nrc */
  6439.     xlgas,            /* 7,13 latin/greek to swiss nrc */
  6440.     xlgas,            /* 7,14 latin/greek to latin-1 */
  6441.     xlgas,            /* 7,15 latin/greek to latin-2 */
  6442.     xlgas,            /* 7,16 latin/greek to DEC MCS */
  6443.     xlgas,            /* 7,17 latin/greek to NeXT */
  6444.     xlgas,            /* 7,18 latin/greek to CP437 */
  6445.     xlgas,            /* 7,19 latin/greek to CP850 */
  6446.     xlgas,            /* 7,20 latin/greek to CP852 */
  6447.     xlgas,            /* 7,21 latin/greek to Macintosh Latin */
  6448.     xlgas,            /* 7,22 latin/greek to DGI */
  6449.     xlgas,            /* 7,23 latin/greek to HP */
  6450.     xleft160,                   /* 7,24 latin/greek to Latin/Cyrillic */
  6451.     xleft128,                   /* 7,25 latin/greek to CP866 */
  6452.     xassk,                      /* 7,26 latin/greek to Short KOI */
  6453.     xleft160,                   /* 7,27 latin/greek to Old KOI-8 Greek */
  6454.     NULL,            /* 7,28 latin/greek to JIS-7 */
  6455.     NULL,            /* 7,29 latin/greek to Shift-JIS */
  6456.     NULL,            /* 7,30 latin/greek to J-EUC */
  6457.     NULL,            /* 7,31 latin/greek to DEC Kanji */
  6458.     NULL,            /* 7,32 latin/greek to Hebrew-7 */
  6459.     xlgas,            /* 7,33 latin/greek to Latin/Hebrew */
  6460.     xlgas,            /* 7,34 latin/greek to CP862 Hebrew */
  6461.     xlgeg,            /* 7,35 latin/greek to ELOT 927 Greek */
  6462.     NULL,            /* 7,36 latin/greek to Latin/Greek */
  6463.     xlg69,            /* 7,37 latin/greek to CP869 */
  6464.     xlgas,            /* 7,38 latin/greek to Latin-9 */
  6465.     xlgas,            /* 7,39 latin/greek to CP858 */
  6466.     xleft128,            /* 7,40 latin/greek to CP855 */
  6467.     xleft128,            /* 7,41 latin/greek to CP1251 */
  6468.     xleft128,            /* 7,42 latin/greek to Bulgarian */
  6469.     xleft128,            /* 7,43 latin/greek to CP1250 */
  6470.     xleft128,            /* 7,44 latin/greek to Mazovia */
  6471.     NULL,            /* 7,45 latin/greek to UCS-2 */
  6472.     NULL,            /* 7,46 latin/greek to UTF-8 */
  6473.     NULL,            /* 7,47 latin/greek to KOI8R */
  6474.     NULL,            /* 7,48 latin/greek to KOI8U */
  6475.     xlgw1,            /* 7,49 latin/greek to CP1252 */
  6476.     zl9as,            /* 8,0 latin-9 to us ascii */
  6477.     xl1uk,            /* 8,1 latin-9 to uk ascii */
  6478.     xl1du,            /* 8,2 latin-9 to dutch nrc */
  6479.     xl1fi,            /* 8,3 latin-9 to finnish nrc */
  6480.     xl1fr,            /* 8,4 latin-9 to french nrc */
  6481.     xl1fc,            /* 8,5 latin-9 to fr-canadian nrc */
  6482.     xl1ge,            /* 8,6 latin-9 to german nrc */
  6483.     xl1it,            /* 8,7 latin-9 to italian nrc */
  6484.     xl1hu,            /* 8,8 latin-9 to hungarian nrc */
  6485.     xl1no,            /* 8,9 latin-9 to norge/danish nrc */
  6486.     xl1po,            /* 8,10 latin-9 to portuguese nrc */
  6487.     xl1sp,            /* 8,11 latin-9 to spanish nrc */
  6488.     xl1sw,            /* 8,12 latin-9 to swedish nrc */
  6489.     xl1ch,            /* 8,13 latin-9 to swiss nrc */
  6490.     NULL,            /* 8,14 latin-9 to latin-1 */
  6491.     xl1l2,            /* 8,15 latin-9 to latin-2 */
  6492.     xl9dm,            /* 8,16 latin-9 to DEC MCS */
  6493.     xl9ne,            /* 8,17 latin-9 to NeXT */
  6494.     xl143,            /* 8,18 latin-9 to CP437 */
  6495.     xl185,            /* 8,19 latin-9 to CP850 */
  6496.     xl152,            /* 8,20 latin-9 to CP852 */
  6497.     xl1aq,            /* 8,21 latin-9 to Macintosh Latin */
  6498.     xl1dg,            /* 8,22 latin-9 to DGI */
  6499.     xl1r8,            /* 8,23 latin-9 to HP Roman8 */
  6500.     zl1as,            /* 8,24 latin-9 to Latin/Cyrillic */
  6501.     zl1as,                      /* 8,25 latin-9 to CP866 */
  6502.     xl1sk,                      /* 8,26 latin-9 to Short KOI */
  6503.     zl1as,                   /* 8,27 latin-9 to Old KOI-8 Cyrillic */
  6504.     NULL,            /* 8,28 latin-9 to JIS-7 */
  6505.     NULL,            /* 8,29 latin-9 to Shift-JIS */
  6506.     NULL,            /* 8,30 latin-9 to J-EUC */
  6507.     NULL,            /* 8,31 latin-9 to DEC Kanji */
  6508.     xl1h7,            /* 8,32 latin-9 to Hebrew-7 */
  6509.     xl1lh,            /* 8,33 latin-9 to Latin/Hebrew */
  6510.     xl162,            /* 8,34 latin-9 to CP862 Hebrew */
  6511.     xl1eg,            /* 8,35 latin-9 to ELOT 927 Greek */
  6512.     xl1lg,            /* 8,36 latin-9 to Latin/Greek */
  6513.     xl169,            /* 8,37 latin-9 to CP869 */
  6514.     NULL,            /* 8,38 latin-9 to Latin9 */
  6515.     xl958,            /* 8,39 latin-9 to CP858 */
  6516.     zl1as,            /* 8,40 latin-9 to CP855 */
  6517.     zl1as,            /* 8,41 latin-9 to CP1251 */
  6518.     xl1as,            /* 8,42 latin-9 to Bulgarian */
  6519.     xl91250,            /* 8,43 latin-9 to CP1250 */
  6520.     xl9mz,            /* 8,44 latin-9 to Mazovia */
  6521.     NULL,            /* 8,45 latin-9 to UCS-2 */
  6522.     NULL,            /* 8,46 latin-9 to UTF-8 */
  6523.     zl1as,            /* 8,47 latin-9 to KOI8-R */
  6524.     zl1as,            /* 8,48 latin-9 to KOI8-U */
  6525.     xl9w1,            /* 8,49 latin-9 to CP1252 */
  6526.     NULL,            /* 9,00 Unicode... */
  6527.     NULL,            /* 9,01 */
  6528.     NULL,            /* 9,02 */
  6529.     NULL,            /* 9,03 */
  6530.     NULL,            /* 9,04 */
  6531.     NULL,            /* 9,05 */
  6532.     NULL,            /* 9,06 */
  6533.     NULL,            /* 9,07 */
  6534.     NULL,            /* 9,08 */
  6535.     NULL,            /* 9,09 */
  6536.     NULL,            /* 9,10 */
  6537.     NULL,            /* 9,11 */
  6538.     NULL,            /* 9,12 */
  6539.     NULL,            /* 9,13 */
  6540.     NULL,            /* 9,14 */
  6541.     NULL,            /* 9,15 */
  6542.     NULL,            /* 9,16 */
  6543.     NULL,            /* 9,17 */
  6544.     NULL,            /* 9,18 */
  6545.     NULL,            /* 9,19 */
  6546.     NULL,            /* 9,20 */
  6547.     NULL,            /* 9,21 */
  6548.     NULL,            /* 9,22 */
  6549.     NULL,            /* 9,23 */
  6550.     NULL,            /* 9,24 */
  6551.     NULL,            /* 9,25 */
  6552.     NULL,            /* 9,26 */
  6553.     NULL,            /* 9,27 */
  6554.     NULL,            /* 9,28 */
  6555.     NULL,            /* 9,29 */
  6556.     NULL,            /* 9,30 */
  6557.     NULL,            /* 9,31 */
  6558.     NULL,            /* 9,32 */
  6559.     NULL,            /* 9,33 */
  6560.     NULL,            /* 9,34 */
  6561.     NULL,            /* 9,35 */
  6562.     NULL,            /* 9,36 */
  6563.     NULL,            /* 9,37 */
  6564.     NULL,            /* 9,38 */
  6565.     NULL,            /* 9,39 */
  6566.     NULL,            /* 9,40 */
  6567.     NULL,            /* 9,41 */
  6568.     NULL,            /* 9,42 */
  6569.     NULL,            /* 9,43 */
  6570.     NULL,            /* 9,44 */
  6571.     NULL,            /* 9,45 */
  6572.     NULL,            /* 9,46 */
  6573.     NULL,            /* 9,47 */
  6574.     NULL,            /* 9,48 */
  6575.     NULL,            /* 9,49 */
  6576.     NULL,            /* 10,00 */
  6577.     NULL,            /* 10,01 */
  6578.     NULL,            /* 10,02 */
  6579.     NULL,            /* 10,03 */
  6580.     NULL,            /* 10,04 */
  6581.     NULL,            /* 10,05 */
  6582.     NULL,            /* 10,06 */
  6583.     NULL,            /* 10,07 */
  6584.     NULL,            /* 10,08 */
  6585.     NULL,            /* 10,09 */
  6586.     NULL,            /* 10,10 */
  6587.     NULL,            /* 10,11 */
  6588.     NULL,            /* 10,12 */
  6589.     NULL,            /* 10,13 */
  6590.     NULL,            /* 10,14 */
  6591.     NULL,            /* 10,15 */
  6592.     NULL,            /* 10,16 */
  6593.     NULL,            /* 10,17 */
  6594.     NULL,            /* 10,18 */
  6595.     NULL,            /* 10,19 */
  6596.     NULL,            /* 10,20 */
  6597.     NULL,            /* 10,21 */
  6598.     NULL,            /* 10,22 */
  6599.     NULL,            /* 10,23 */
  6600.     NULL,            /* 10,24 */
  6601.     NULL,            /* 10,25 */
  6602.     NULL,            /* 10,26 */
  6603.     NULL,            /* 10,27 */
  6604.     NULL,            /* 10,28 */
  6605.     NULL,            /* 10,29 */
  6606.     NULL,            /* 10,30 */
  6607.     NULL,            /* 10,31 */
  6608.     NULL,            /* 10,32 */
  6609.     NULL,            /* 10,33 */
  6610.     NULL,            /* 10,34 */
  6611.     NULL,            /* 10,35 */
  6612.     NULL,            /* 10,36 */
  6613.     NULL,            /* 10,37 */
  6614.     NULL,            /* 10,38 */
  6615.     NULL,            /* 10,39 */
  6616.     NULL,            /* 10,40 */
  6617.     NULL,            /* 10,41 */
  6618.     NULL,            /* 10,42 */
  6619.     NULL,            /* 10,43 */
  6620.     NULL,            /* 10,44 */
  6621.     NULL,            /* 10,45 */
  6622.     NULL,            /* 10,46 */
  6623.     NULL,            /* 10,47 */
  6624.     NULL,            /* 10,48 */
  6625.     NULL            /* 10,49 */
  6626. };
  6627. int nxlr = (sizeof(xlr) / sizeof(CHAR *));
  6628.  
  6629. /*
  6630.   Translation function table for sending files.
  6631.   Array of pointers to functions for translating from the local file
  6632.   character set to the transfer character set.  Indexed in the same
  6633.   way as the xlr array above, but with the indices reversed.
  6634. */
  6635. #ifdef CK_ANSIC
  6636. CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
  6637. #else
  6638. CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])() =
  6639. #endif /* CK_ANSIC */
  6640. {
  6641.     NULL,            /* 0,0 us ascii to transparent */
  6642.     NULL,            /* 0,1 uk ascii to transparent */
  6643.     NULL,            /* 0,2 dutch nrc to transparent */
  6644.     NULL,            /* 0,3 finnish nrc to transparent */
  6645.     NULL,            /* 0,4 french nrc to transparent */
  6646.     NULL,            /* 0,5 fr-canadian nrc to transparent */
  6647.     NULL,            /* 0,6 german nrc to transparent */
  6648.     NULL,            /* 0,7 hungarian nrc to transparent */
  6649.     NULL,            /* 0,8 italian nrc to transparent */
  6650.     NULL,            /* 0,9 norge/danish nrc to transparent */
  6651.     NULL,            /* 0,10 portuguese nrc to transparent */
  6652.     NULL,            /* 0,11 spanish nrc to transparent */
  6653.     NULL,            /* 0,12 swedish nrc to transparent */
  6654.     NULL,            /* 0,13 swiss nrc to transparent */
  6655.     NULL,            /* 0,14 latin-1 to transparent */
  6656.     NULL,            /* 0,15 latin-2 to transparent */
  6657.     NULL,            /* 0,16 DEC MCS to transparent */
  6658.     NULL,            /* 0,17 NeXT to transparent */
  6659.     NULL,            /* 0,18 CP437 to transparent */
  6660.     NULL,            /* 0,19 CP850 to transparent */
  6661.     NULL,            /* 0,20 CP852 to transparent */
  6662.     NULL,            /* 0,21 Macintosh Latin to transparent */
  6663.     NULL,            /* 0,22 DGI to transparent */
  6664.     NULL,            /* 0,23 HP to transparent */
  6665.     NULL,            /* 0,24 Latin/Cyrillic to transparent */
  6666.     NULL,                       /* 0,25 CP866 to transparent */
  6667.     NULL,                       /* 0,26 Short KOI to transparent */
  6668.     NULL,                       /* 0,27 Old KOI-8 to transparent */
  6669.     NULL,            /* 0,28 JIS-7 to transparent */
  6670.     NULL,            /* 0,29 Shift JIS to transparent */
  6671.     NULL,            /* 0,30 Japanese EUC to transparent */
  6672.     NULL,            /* 0,31 DEC Kanji to transparent */
  6673.     NULL,            /* 0,32 Hebrew-7 to transparent */
  6674.     NULL,            /* 0,33 Latin/Hebrew to transparent */
  6675.     NULL,            /* 0,34 CP862 Hebrew to transparent */
  6676.     NULL,            /* 0,35 ELOT 927 Greek to transparent */
  6677.     NULL,            /* 0,36 Latin/Greek to transparent */
  6678.     NULL,            /* 0,37 CP869 to transparent */
  6679.     NULL,            /* 0,38 Latin-9 to transparent */
  6680.     NULL,            /* 0,39 CP858 to transparent */
  6681.     NULL,            /* 0,40 CP855 to transparent */
  6682.     NULL,            /* 0,41 CP1251 to transparent */
  6683.     NULL,            /* 0,42 Bulgarian to transparent */
  6684.     NULL,            /* 0,43 CP1250 to transparent */
  6685.     NULL,            /* 0,44 Mazovia to transparent */
  6686.     NULL,            /* 0,45 UCS-2 to transparent */
  6687.     NULL,            /* 0,46 UTF-8 to transparent */
  6688.     NULL,            /* 0,47 KOI8R to transparent */
  6689.     NULL,            /* 0,48 KOI8U to transparent */
  6690.     NULL,            /* 0,49 CP1252 to transparent */
  6691.     NULL,            /* 1,0 us ascii to ascii */
  6692.     NULL,            /* 1,1 uk ascii to ascii */
  6693.     xduas,            /* 1,2 dutch nrc to ascii */
  6694.     xfias,            /* 1,3 finnish nrc to ascii */
  6695.     xfras,            /* 1,4 french nrc to ascii */
  6696.     xfcas,            /* 1,5 french canadian nrc to ascii */
  6697.     xgeas,            /* 1,6 german nrc to ascii */
  6698.     xhuas,            /* 1,7 hungarian nrc to ascii */
  6699.     xitas,            /* 1,8 italian nrc to ascii */
  6700.     xnoas,            /* 1,9 norwegian/danish nrc to ascii */
  6701.     xpoas,            /* 1,10 portuguese nrc to ascii */
  6702.     xspas,            /* 1,11 spanish nrc to ascii */
  6703.     xswas,            /* 1,12 swedish nrc to ascii */
  6704.     xchas,            /* 1,13 swiss nrc to ascii */
  6705.     xl1as,            /* 1,14 latin-1 to ascii */
  6706.     xl2as,            /* 1,15 latin-2 to ascii */
  6707.     xdmas,            /* 1,16 dec mcs to ascii */
  6708.     xneas,            /* 1,17 NeXT to ascii */
  6709.     x43as,            /* 1,18 CP437 to ascii */
  6710.     x85as,            /* 1,19 CP850 to ascii */
  6711.     x52as,            /* 1,20 CP850 to ascii */
  6712.     xaqas,            /* 1,21 Macintosh Latin to ascii */
  6713.     xdgas,            /* 1,22 DGI to ascii */
  6714.     xr8as,            /* 1,23 HP to ASCII */
  6715.     xlcas,            /* 1,24 Latin/Cyrillic to ASCII */
  6716.     xacas,                      /* 1,25 CP866 to ASCII */
  6717.     xskas,            /* 1,26 Short KOI to ASCII */
  6718.     xk8as,                      /* 1,27 Old KOI-8 Cyrillic to ASCII */
  6719.     NULL,            /* 1,28 */
  6720.     NULL,            /* 1,29 */
  6721.     NULL,            /* 1,30 */
  6722.     NULL,            /* 1,31 */
  6723.     xh7as,            /* 1,32 Hebrew-7 to ASCII */
  6724.     xlhas,            /* 1,33 Latin/Hebrew to ASCII */
  6725.     x62as,            /* 1,34 CP862 Hebrew to ASCII */
  6726.     xegas,            /* 1,35 ELOT 927 Greek to ASCII */
  6727.     xlgas,            /* 1,36 Latin/Greek to ASCII */
  6728.     x69as,            /* 1,37 CP869 to ASCII */
  6729.     xl9as,            /* 1,38 Latin-9 to ASCII */
  6730.     x58as,            /* 1,39 CP858 to ASCII */
  6731.     x55as,            /* 1,40 CP855 to ASCII */
  6732.     x1251as,            /* 1,41 CP1251 to ASCII */
  6733.     xleft128,            /* 1,42 Bulgarian to ASCII */
  6734.     x1250as,            /* 1,43 CP1250 to ASCII */
  6735.     xmzas,            /* 1,44 Mazovia to ASCII */
  6736.     NULL,            /* 1,45 UCS-2 to ASCII */
  6737.     NULL,            /* 1,46 UTF-8 to ASCII */
  6738.     xk8as,            /* 1,47 KOI8R to ASCII */
  6739.     xk8as,            /* 1,48 KOI8U to ASCII */
  6740.     xw1as,            /* 1,49 CP1252 to ASCII */
  6741.     NULL,            /* 2,0 us ascii to latin-1 */
  6742.     xukl1,            /* 2,1 uk ascii to latin-1 */
  6743.     xdul1,            /* 2,2 dutch nrc to latin-1 */
  6744.     xfil1,            /* 2,3 finnish nrc to latin-1 */
  6745.     xfrl1,            /* 2,4 french nrc to latin-1 */
  6746.     xfcl1,            /* 2,5 french canadian nrc to latin-1 */
  6747.     xgel1,            /* 2,6 german nrc to latin-1 */
  6748.     xhul1,            /* 2,7 hungarian nrc to latin-1 */
  6749.     xitl1,            /* 2,8 italian nrc to latin-1 */
  6750.     xnol1,            /* 2,9 norwegian/danish nrc to latin-1 */
  6751.     xpol1,            /* 2,10 portuguese nrc to latin-1 */
  6752.     xspl1,            /* 2,11 spanish nrc to latin-1 */
  6753.     xswl1,            /* 2,12 swedish nrc to latin-1 */
  6754.     xchl1,            /* 2,13 swiss nrc to latin-1 */
  6755.     NULL,            /* 2,14 latin-1 to latin-1 */
  6756.     xl2l1,            /* 2,15 latin-2 to latin-1 */
  6757.     xdml1,            /* 2,16 dec mcs to latin-1 */
  6758.     xnel1,                      /* 2,17 NeXT to Latin-1 */
  6759.     x43l1,                      /* 2,18 CP437 to Latin-1 */
  6760.     x85l1,                      /* 2,19 CP850 to Latin-1 */
  6761.     x52l1,                      /* 2,20 CP852 to Latin-1 */
  6762.     xaql1,                      /* 2,21 Macintosh Latin to Latin-1 */
  6763.     xdgl1,                      /* 2,22 DGI to Latin-1 */
  6764.     xr8l1,                      /* 2,23 HP to Latin-1 */
  6765.     xlcas,                      /* 2,24 Latin/Cyrillic to Latin-1 */
  6766.     xacas,                      /* 2,25 CP866 to Latin-1 */
  6767.     xskas,                      /* 2,26 Short KOI to Latin-1 */
  6768.     xk8as,                      /* 2,27 Old KOI-8 Cyrillic to Latin-1 */
  6769.     NULL,            /* 2,28 Kanji ... */
  6770.     NULL,            /* 2,29 */
  6771.     NULL,            /* 2,30 */
  6772.     NULL,            /* 2,31 */
  6773.     xh7as,            /* 2,32 Hebrew-7 to Latin-1 */
  6774.     xlhl1,            /* 2,33 Latin/Hebrew to Latin-1 */
  6775.     x62l1,            /* 2,34 CP862 Hebrew to Latin-1 */
  6776.     xegas,            /* 2,35 ELOT 927 Greek to Latin-1 */
  6777.     xlgl1,            /* 2,36 Latin/Greek to Latin-1 */
  6778.     NULL,            /* 2,37 CP869 to Latin-1 */
  6779.     NULL,            /* 2,38 Latin-9 to Latin-1 */
  6780.     x58l1,            /* 2,39 CP858 to Latin-1 */
  6781.     x55as,            /* 2,40 CP855 to Latin-1 */
  6782.     x1251as,            /* 2,41 CP1251 to Latin-1 */
  6783.     xleft128,            /* 2,42 Bulgarian to Latin-1 */
  6784.     x1250l1,            /* 2,43 CP1250 to Latin-1 */
  6785.     xmzl1,            /* 2,44 Mazovia to Latin-1 */
  6786.     NULL,            /* 2,45 UCS-2 to Latin-1 */
  6787.     NULL,            /* 2,46 UTF-8 to Latin-1 */
  6788.     xk8as,            /* 2,47 KOI8R to Latin-1 */
  6789.     xk8as,            /* 2,48 KOI8U to Latin-1 */
  6790.     xw1l1,            /* 2,49 CP1252 to Latin-1 */
  6791.     NULL,            /* 3,0 us ascii to latin-2 */
  6792.     NULL,            /* 3,1 uk ascii to latin-2 */
  6793.     xduas,            /* 3,2 dutch nrc to latin-2 */
  6794.     xfias,            /* 3,3 finnish nrc to latin-2 */
  6795.     xfras,            /* 3,4 french nrc to latin-2 */
  6796.     xfcas,            /* 3,5 french canadian nrc to latin-2 */
  6797.     xgel2,            /* 3,6 german nrc to latin-2 */
  6798.     xhul2,            /* 3,7 hungarian nrc to latin-2 */
  6799.     xitas,            /* 3,8 italian nrc to latin-2 */
  6800.     xnoas,            /* 3,9 norwegian/danish nrc to latin-2 */
  6801.     xpoas,            /* 3,10 portuguese nrc to latin-2 */
  6802.     xspas,            /* 3,11 spanish nrc to latin-2 */
  6803.     xswas,            /* 3,12 swedish nrc to latin-2 */
  6804.     xchas,            /* 3,13 swiss nrc to latin-2 */
  6805.     xl1l2,            /* 3,14 latin-1 to latin-2 */
  6806.     NULL,            /* 3,15 latin-2 to latin-2 */
  6807.     xl1l2,            /* 3,16 dec mcs to latin-2 */
  6808.     xnel2,                      /* 3,17 NeXT to Latin-2 */
  6809.     x43l2,                      /* 3,18 CP437 to Latin-2 */
  6810.     x85l2,                      /* 3,19 CP850 to Latin-2 */
  6811.     x52l2,                      /* 3,20 CP852 to Latin-2 */
  6812.     xaql2,                      /* 3,21 Macintosh Latin to Latin-2 */
  6813.     xdgl2,                      /* 3,22 DGI to Latin-2 */
  6814.     xr8l2,                      /* 3,23 HP to Latin-2 */
  6815.     xlcas,                      /* 3,24 Latin/Cyrillic to Latin-2 */
  6816.     xacas,                      /* 3,25 CP866 to Latin-2 */
  6817.     xskas,                      /* 3,26 Short KOI to Latin-2 */
  6818.     xk8as,                      /* 3,27 Old KOI-8 Cyrillic to Latin-2 */
  6819.     NULL,            /* 3,28 Kanji ... */
  6820.     NULL,            /* 3,29 */
  6821.     NULL,            /* 3,30 */
  6822.     NULL,            /* 3,31 */
  6823.     xh7as,            /* 3,32 Hebrew-7 to Latin-2 */
  6824.     xlhas,            /* 3,33 Latin/Hebrew to Latin-2 */
  6825.     x62as,            /* 3,34 CP862 Hebrew to Latin-2 */
  6826.     xegas,            /* 3,35 ELOT 927 Greek to Latin-2 */
  6827.     xl2lg,            /* 3,36 Latin/Greek to Latin-2 */
  6828.     xleft128,            /* 3,37 CP869 to Latin-2 */
  6829.     xl9l2,            /* 3,38 Latin-9 to Latin-2 */
  6830.     x58l2,            /* 3,39 CP858 to Latin-2 */
  6831.     x55as,            /* 3,40 CP855 to Latin-2 */
  6832.     x1251as,            /* 3,41 CP1251 to Latin-2 */
  6833.     xleft128,            /* 3,42 Bulgarian to Latin-2 */
  6834.     x1250l2,            /* 3,43 CP1250 to Latin-2 */
  6835.     xmzl2,            /* 3,44 Mazovia to Latin-2 */
  6836.     NULL,            /* 3,45 UCS-2 to Latin-2 */
  6837.     NULL,            /* 3,46 UTF-8 to Latin-2 */
  6838.     xk8as,            /* 3,47 KOI8R to Latin-2 */
  6839.     xk8as,            /* 3,48 KOI8U to Latin-2 */
  6840.     xw1l2,            /* 3,49 CP1252 to latin-2 */
  6841.     xaslc,            /* 4,0 us ascii to latin/cyrillic */
  6842.     xaslc,            /* 4,1 uk ascii to latin/cyrillic */
  6843.     xduas,            /* 4,2 dutch nrc to latin/cyrillic */
  6844.     xfias,            /* 4,3 finnish nrc to latin/cyrillic */
  6845.     xfras,            /* 4,4 french nrc to latin/cyrillic */
  6846.     xfcas,            /* 4,5 french canadian nrc to latin/cyrillic */
  6847.     xgeas,            /* 4,6 german nrc to latin/cyrillic */
  6848.     xhuas,            /* 4,7 hungarian nrc to latin/cyrillic */
  6849.     xitas,            /* 4,8 italian nrc to latin/cyrillic */
  6850.     xnoas,            /* 4,9 norge/danish nrc to latin/cyrillic */
  6851.     xpoas,            /* 4,10 portuguese nrc to latin/cyrillic */
  6852.     xspas,            /* 4,11 spanish nrc to latin/cyrillic */
  6853.     xswas,            /* 4,12 swedish nrc to latin/cyrillic */
  6854.     xchas,            /* 4,13 swiss nrc to latin/cyrillic */
  6855.     xl1as,            /* 4,14 latin-1 to latin/cyrillic */
  6856.     xl2as,            /* 4,15 latin-2 to latin/cyrillic */
  6857.     xdmas,            /* 4,16 dec mcs to latin/cyrillic */
  6858.     xneas,            /* 4,17 NeXT to latin/cyrillic */
  6859.     x43as,            /* 4,18 CP437 to latin/cyrillic */
  6860.     x85as,            /* 4,19 CP850 to latin/cyrillic */
  6861.     x52as,            /* 4,20 CP852 to latin/cyrillic */
  6862.     xaqas,            /* 4,21 Macintosh Latin to latin/cyrillic */
  6863.     xdgas,            /* 4,22 DGI to Latin/Cyrillic */
  6864.     xr8as,            /* 4,23 HP to Latin/Cyrillic */
  6865.     NULL,                       /* 4,24 Latin/Cyrillic to Latin/Cyrillic */
  6866.     xaclc,                      /* 4,25 CP866 to Latin/Cyrillic */
  6867.     xskcy,                      /* 4,26 Short KOI to Latin/Cyrillic */
  6868.     xk8lc,                      /* 4,27 Old KOI-8 Cyrillic to Latin/Cyrillic */
  6869.     NULL,            /* 4,28 Kanji... */
  6870.     NULL,            /* 4,29 */
  6871.     NULL,            /* 4,30 */
  6872.     NULL,            /* 4,31 */
  6873.     xh7as,            /* 4,32 Hebrew-7 to Latin/Cyrillic */
  6874.     xlhas,            /* 4,33 Latin/Hebrew to Latin/Cyrillic */
  6875.     x62as,            /* 4,34 CP862 Hebrew to Latin/Cyrillic */
  6876.     xegas,            /* 4,35 ELOT 927 Greek to Latin/Cyrillic */
  6877.     xleft160,            /* 4,36 Latin/Greek to Latin/Cyrillic */
  6878.     xleft128,            /* 4,37 CP869 to Latin/Cyrillic */
  6879.     xl1as,            /* 4,38 latin-9 to latin/cyrillic */
  6880.     xleft128,            /* 4,39 CP858 to Latin/Cyrillic */
  6881.     x55lc,            /* 4,40 CP855 to Latin/Cyrillic */
  6882.     x1251lc,            /* 4,41 CP1251 to Latin/Cyrillic */
  6883.     xbulc,            /* 4,42 Bulgarian to Latin/Cyrillic */
  6884.     x1250as,            /* 4,43 CP1250 to Latin/Cyrillic */
  6885.     xmzas,            /* 4,44 Mazovia to Latin/Cyrillic */
  6886.     NULL,            /* 4,45 UCS-2 to Latin/Cyrillic */
  6887.     NULL,            /* 4,46 UTF-8 to Latin/Cyrillic */
  6888.     xkrlc,            /* 4,47 KOI8R to Latin/Cyrillic */
  6889.     xkulc,            /* 4,48 KOI8U to Latin/Cyrillic */
  6890.     xw1lc,            /* 4,49 CP1252 to Latin/Cyrillic */
  6891.     NULL,            /* 5,00 */
  6892.     NULL,            /* 5,01 */
  6893.     NULL,            /* 5,02 */
  6894.     NULL,            /* 5,03 */
  6895.     NULL,            /* 5,04 */
  6896.     NULL,            /* 5,05 */
  6897.     NULL,            /* 5,06 */
  6898.     NULL,            /* 4.07 */
  6899.     NULL,            /* 5,08 */
  6900.     NULL,            /* 5,09 */
  6901.     NULL,            /* 5,10 */
  6902.     NULL,            /* 5,11 */
  6903.     NULL,            /* 5,12 */
  6904.     NULL,            /* 5,13 */
  6905.     NULL,            /* 5,14 */
  6906.     NULL,            /* 5,15 */
  6907.     NULL,            /* 5,16 */
  6908.     NULL,            /* 5,17 */
  6909.     NULL,            /* 5,18 */
  6910.     NULL,            /* 5,19 */
  6911.     NULL,            /* 5,20 */
  6912.     NULL,            /* 5,21 */
  6913.     NULL,            /* 5,22 */
  6914.     NULL,            /* 5,23 */
  6915.     NULL,            /* 5,24 */
  6916.     NULL,            /* 5,25 */
  6917.     NULL,            /* 5,26 */
  6918.     NULL,            /* 5,27 */
  6919.     NULL,            /* 5,28 */
  6920.     NULL,            /* 5,29 */
  6921.     NULL,            /* 5,30 */
  6922.     NULL,            /* 5,31 */
  6923.     NULL,            /* 5,32 */
  6924.     NULL,            /* 5,33 */
  6925.     NULL,            /* 5,34 */
  6926.     NULL,            /* 5,35 */
  6927.     NULL,            /* 5,36 */
  6928.     NULL,            /* 5,37 */
  6929.     NULL,            /* 5,38 */
  6930.     NULL,            /* 5,39 */
  6931.     NULL,            /* 5,40 */
  6932.     NULL,            /* 5,41 */
  6933.     NULL,            /* 5,42 */
  6934.     NULL,            /* 5,43 */
  6935.     NULL,            /* 5,44 */
  6936.     NULL,            /* 5,45 */
  6937.     NULL,            /* 5,46 */
  6938.     NULL,            /* 5,47 */
  6939.     NULL,            /* 5,48 */
  6940.     NULL,            /* 5,49 */
  6941.     NULL,            /* 6,0 us ascii to Latin/Hebrew */
  6942.     NULL,            /* 6,1 uk ascii to Latin/Hebrew */
  6943.     xduas,            /* 6,2 dutch nrc to Latin/Hebrew */
  6944.     xfias,            /* 6,3 finnish nrc to Latin/Hebrew */
  6945.     xfras,            /* 6,4 french nrc to Latin/Hebrew */
  6946.     xfcas,            /* 6,5 french canadian nrc to Latin/Hebrew */
  6947.     xgeas,            /* 6,6 german nrc to Latin/Hebrew */
  6948.     xhuas,            /* 6,7 hungarian nrc to Latin/Hebrew */
  6949.     xitas,            /* 6,8 italian nrc to Latin/Hebrew */
  6950.     xnoas,            /* 6,9 norge/danish nrc to Latin/Hebrew */
  6951.     xpoas,            /* 6,10 portuguese nrc to Latin/Hebrew */
  6952.     xspas,            /* 6,11 spanish nrc to Latin/Hebrew */
  6953.     xswas,            /* 6,12 swedish nrc to Latin/Hebrew */
  6954.     xchas,            /* 6,13 swiss nrc to Latin/Hebrew */
  6955.     xl1lh,            /* 6,14 latin-1 to Latin/Hebrew */
  6956.     xl2as,            /* 6,15 latin-2 to Latin/Hebrew */
  6957.     xdmas,            /* 6,16 dec mcs to Latin/Hebrew */
  6958.     xneas,            /* 6,17 NeXT to Latin/Hebrew */
  6959.     x43as,            /* 6,18 CP437 to Latin/Hebrew */
  6960.     x85as,            /* 6,19 CP850 to Latin/Hebrew */
  6961.     x52as,            /* 6,20 CP852 to Latin/Hebrew */
  6962.     xaqas,            /* 6,21 Macintosh Latin to Latin/Hebrew */
  6963.     xdgas,            /* 6,22 DGI to Latin/Hebrew */
  6964.     xr8as,            /* 6,23 HP to Latin/Hebrew */
  6965.     xlcas,                      /* 6,24 Latin/Cyrillic to Latin/Hebrew */
  6966.     xacas,                      /* 6,25 CP866 to Latin/Hebrew */
  6967.     xskas,                      /* 6,26 Short KOI to Latin/Hebrew */
  6968.     xk8as,                      /* 6,27 Old KOI-8 Cyrillic to Latin/Hebrew */
  6969.     NULL,            /* 6,28 Kanji... */
  6970.     NULL,            /* 6,29 */
  6971.     NULL,            /* 6,30 */
  6972.     NULL,            /* 6,31 */
  6973.     xh7lh,            /* 6,32 Hebrew-7 to Latin/Hebrew */
  6974.     NULL,            /* 6,33 Latin/Hebrew to Latin/Hebrew */
  6975.     x62lh,            /* 6,34 CP862 Hebrew to Latin/Hebrew */
  6976.     xegas,            /* 6,35 ELOT 927 Greek to Latin/Hebrew */
  6977.     xlgas,            /* 6,36 Latin/Greek to Latin/Hebrew */
  6978.     x69as,            /* 6,37 CP869 to Latin/Hebrew */
  6979.     xl1as,            /* 6,38 latin-9 to Latin/Hebrew */
  6980.     x58as,            /* 6,39 CP858 to Latin/Hebrew */
  6981.     x55as,            /* 6,40 CP855 to Latin/Hebrew */
  6982.     x1251as,            /* 6,41 CP1251 to Latin/Hebrew */
  6983.     xleft128,            /* 6,42 Bulgarian to Latin/Hebrew */
  6984.     x1250as,            /* 6,43 CP1250 to Latin/Hebrew */
  6985.     xmzas,            /* 6,44 Mazovia to Latin/Hebrew */
  6986.     NULL,            /* 6,45 UCS-2 to Latin/Hebrew */
  6987.     NULL,            /* 6,46 UTF-8 to Latin/Hebrew */
  6988.     NULL,            /* 6,47 KOI8R to Latin/Hebrew */
  6989.     NULL,            /* 6,48 KOI8U to Latin/Hebrew */
  6990.     xw1lh,            /* 6,49 CP1252 to Latin/Hebrew */
  6991.     NULL,            /* 7,0 us ascii to Latin/Greek */
  6992.     NULL,            /* 7,1 uk ascii to Latin/Greek */
  6993.     xduas,            /* 7,2 dutch nrc to Latin/Greek */
  6994.     xfias,            /* 7,3 finnish nrc to Latin/Greek */
  6995.     xfras,            /* 7,4 french nrc to Latin/Greek */
  6996.     xfcas,            /* 7,5 french canadian nrc to Latin/Greek */
  6997.     xgeas,            /* 7,6 german nrc to Latin/Greek */
  6998.     xhuas,            /* 7,7 hungarian nrc to Latin/Greek */
  6999.     xitas,            /* 7,8 italian nrc to Latin/Greek */
  7000.     xnoas,            /* 7,9 norge/danish nrc to Latin/Greek */
  7001.     xpoas,            /* 7,10 portuguese nrc to Latin/Greek */
  7002.     xspas,            /* 7,11 spanish nrc to Latin/Greek */
  7003.     xswas,            /* 7,12 swedish nrc to Latin/Greek */
  7004.     xchas,            /* 7,13 swiss nrc to Latin/Greek */
  7005.     xl1lg,            /* 7,14 latin-1 to Latin/Greek */
  7006.     xl2lg,            /* 7,15 latin-2 to Latin/Greek */
  7007.     xl1lg,            /* 7,16 dec mcs to Latin/Greek */
  7008.     xneas,            /* 7,17 NeXT to Latin/Greek */
  7009.     xleft128,            /* 7,18 CP437 to Latin/Greek */
  7010.     x85as,            /* 7,19 CP850 to Latin/Greek */
  7011.     x52as,            /* 7,20 CP852 to Latin/Greek */
  7012.     xaqas,            /* 7,21 Macintosh Latin to Latin/Greek */
  7013.     xdgas,            /* 7,22 DGI to Latin/Greek */
  7014.     xr8as,            /* 7,23 HP to Latin/Greek */
  7015.     xleft160,                   /* 7,24 Latin/Cyrillic to Latin/Greek */
  7016.     xleft128,                   /* 7,25 CP866 to Latin/Greek */
  7017.     xskas,                      /* 7,26 Short KOI to Latin/Greek */
  7018.     xk8as,                      /* 7,27 Old KOI-8 Cyrillic to Latin/Greek */
  7019.     NULL,            /* 7,28 Kanji... */
  7020.     NULL,            /* 7,29 */
  7021.     NULL,            /* 7,30 */
  7022.     NULL,            /* 7,31 */
  7023.     xh7as,            /* 7,32 Hebrew-7 to Latin/Greek */
  7024.     NULL,            /* 7,33 Latin/Hebrew to Latin/Greek */
  7025.     x62as,            /* 7,34 CP862 Hebrew to Latin/Greek */
  7026.     xeglg,            /* 7,35 ELOT 927 Greek to Latin/Greek */
  7027.     NULL,            /* 7,36 Latin/Greek to Latin/Greek */
  7028.     x69lg,            /* 7,37 CP869 to Latin/Greek */
  7029.     xl1as,            /* 7,38 latin-9 to Latin/Greek */
  7030.     xl1as,            /* 7,39 latin-9 to Latin/Hebrew*/
  7031.     xleft128,            /* 7,40 CP855 to Latin/Greek */
  7032.     xleft128,            /* 7,41 CP1251 to Latin/Greek */
  7033.     xleft128,            /* 7,42 Bulgarian to Latin/Greek */
  7034.     x1250as,            /* 7,43 CP1250 to Latin/Greek */
  7035.     xmzas,            /* 7,44 Mazovia to Latin/Greek */
  7036.     NULL,            /* 7,45 UCS-2 to Latin/Greek */
  7037.     NULL,            /* 7,46 UTF-8 to Latin/Greek */
  7038.     NULL,            /* 7,47 KOI8R to Latin/Greek */
  7039.     NULL,            /* 7,48 KOI8U to Latin/Greek */
  7040.     xw1lg,            /* 7,49 CP1252 to Latin/Greek */
  7041.     NULL,            /* 8,0 us ascii to latin-9 */
  7042.     xukl1,            /* 8,1 uk ascii to latin-9 */
  7043.     xdul1,            /* 8,2 dutch nrc to latin-9 */
  7044.     xfil1,            /* 8,3 finnish nrc to latin-9 */
  7045.     xfrl1,            /* 8,4 french nrc to latin-9 */
  7046.     xfcl1,            /* 8,5 french canadian nrc to latin-9 */
  7047.     xgel1,            /* 8,6 german nrc to latin-9 */
  7048.     xhul1,            /* 8,7 hungarian nrc to latin-9 */
  7049.     xitl1,            /* 8,8 italian nrc to latin-9 */
  7050.     xnol1,            /* 8,9 norwegian/danish nrc to latin-9 */
  7051.     xpol1,            /* 8,10 portuguese nrc to latin-9 */
  7052.     xspl1,            /* 8,11 spanish nrc to latin-9 */
  7053.     xswl1,            /* 8,12 swedish nrc to latin-9 */
  7054.     xchl1,            /* 8,13 swiss nrc to latin-9 */
  7055.     NULL,            /* 8,14 latin-1 to latin-9 */
  7056.     xl2l9,            /* 8,15 latin-2 to latin-9 */
  7057.     xdml9,            /* 8,16 dec mcs to latin-9 */
  7058.     xnel9,                      /* 8,17 NeXT To Latin-9 */
  7059.     x43l1,                      /* 8,18 CP437 To Latin-9 */
  7060.     x85l1,                      /* 8,19 CP850 To Latin-9 */
  7061.     x52l1,                      /* 8,20 CP852 To Latin-9 */
  7062.     xaql1,                      /* 8,21 Macintosh Latin To Latin-9 */
  7063.     xdgl1,                      /* 8,22 DGI To Latin-9 */
  7064.     xr8l1,                      /* 8,23 HP To Latin-9 */
  7065.     xlcas,                      /* 8,24 Latin/Cyrillic To Latin-9 */
  7066.     xacas,                      /* 8,25 CP866 To Latin-9 */
  7067.     xskas,                      /* 8,26 Short KOI To Latin-9 */
  7068.     xk8as,                      /* 8,27 Old KOI-8 Cyrillic To Latin-9 */
  7069.     NULL,            /* 8,28 Kanji ... */
  7070.     NULL,            /* 8,29 */
  7071.     NULL,            /* 8,30 */
  7072.     NULL,            /* 8,31 */
  7073.     xh7as,            /* 8,32 Hebrew-7 To Latin-9 */
  7074.     xlhl1,            /* 8,33 Latin/Hebrew To Latin-9 */
  7075.     x62l1,            /* 8,34 CP862 Hebrew To Latin-9 */
  7076.     xegas,            /* 8,35 ELOT 927 Greek To Latin-9 */
  7077.     xlgl1,            /* 8,36 Latin/Greek To Latin-9 */
  7078.     xl169,            /* 8,37 CP869 To Latin-9 */
  7079.     NULL,            /* 8,38 Latin-9 To Latin-9 */
  7080.     x58l9,            /* 8,39 cp858 To Latin-9 */
  7081.     x55as,            /* 8,40 cp855 To Latin-9 */
  7082.     x55as,            /* 8,41 cp1251 To Latin-9 */
  7083.     xleft128,            /* 8,42 Bulgarian To Latin-9 */
  7084.     x1250l9,            /* 8,43 CP1250 To Latin-9 */
  7085.     xmzl9,            /* 8,44 Mazovia To Latin-9 */
  7086.     NULL,            /* 8,45 UCS-2 to Latin-9 */
  7087.     NULL,            /* 8,46 UTF-8 to Latin-9 */
  7088.     NULL,            /* 8,47 KOI8R to Latin-9 */
  7089.     NULL,            /* 8,48 KOI8U to Latin-9 */
  7090.     xw1l9,            /* 8,49 CP1252 to Latin-9 */
  7091.     NULL,            /* 9,00 Unicode... */
  7092.     NULL,            /* 9,01 */
  7093.     NULL,            /* 9,02 */
  7094.     NULL,            /* 9,03 */
  7095.     NULL,            /* 9,04 */
  7096.     NULL,            /* 9,05 */
  7097.     NULL,            /* 9,06 */
  7098.     NULL,            /* 9,07 */
  7099.     NULL,            /* 9,08 */
  7100.     NULL,            /* 9,09 */
  7101.     NULL,            /* 9,10 */
  7102.     NULL,            /* 9,11 */
  7103.     NULL,            /* 9,12 */
  7104.     NULL,            /* 9,13 */
  7105.     NULL,            /* 9,14 */
  7106.     NULL,            /* 9,15 */
  7107.     NULL,            /* 9,16 */
  7108.     NULL,            /* 9,17 */
  7109.     NULL,            /* 9,18 */
  7110.     NULL,            /* 9,19 */
  7111.     NULL,            /* 9,20 */
  7112.     NULL,            /* 9,21 */
  7113.     NULL,            /* 9,22 */
  7114.     NULL,            /* 9,23 */
  7115.     NULL,            /* 9,24 */
  7116.     NULL,            /* 9,25 */
  7117.     NULL,            /* 9,26 */
  7118.     NULL,            /* 9,27 */
  7119.     NULL,            /* 9,28 */
  7120.     NULL,            /* 9,29 */
  7121.     NULL,            /* 9,30 */
  7122.     NULL,            /* 9,31 */
  7123.     NULL,            /* 9,32 */
  7124.     NULL,            /* 9,33 */
  7125.     NULL,            /* 9,34 */
  7126.     NULL,            /* 9,35 */
  7127.     NULL,            /* 9,36 */
  7128.     NULL,            /* 9,37 */
  7129.     NULL,            /* 9,38 */
  7130.     NULL,            /* 9,39 */
  7131.     NULL,            /* 9,40 */
  7132.     NULL,            /* 9,41 */
  7133.     NULL,            /* 9,42 */
  7134.     NULL,            /* 9,43 */
  7135.     NULL,            /* 9,44 */
  7136.     NULL,            /* 9,45 */
  7137.     NULL,            /* 9,46 */
  7138.     NULL,            /* 9,47 */
  7139.     NULL,            /* 9,48 */
  7140.     NULL,            /* 9,49 */
  7141.     NULL,            /* 10,00 */
  7142.     NULL,            /* 10,01 */
  7143.     NULL,            /* 10,02 */
  7144.     NULL,            /* 10,03 */
  7145.     NULL,            /* 10,04 */
  7146.     NULL,            /* 10,05 */
  7147.     NULL,            /* 10,06 */
  7148.     NULL,            /* 10,07 */
  7149.     NULL,            /* 10,08 */
  7150.     NULL,            /* 10,09 */
  7151.     NULL,            /* 10,10 */
  7152.     NULL,            /* 10,11 */
  7153.     NULL,            /* 10,12 */
  7154.     NULL,            /* 10,13 */
  7155.     NULL,            /* 10,14 */
  7156.     NULL,            /* 10,15 */
  7157.     NULL,            /* 10,16 */
  7158.     NULL,            /* 10,17 */
  7159.     NULL,            /* 10,18 */
  7160.     NULL,            /* 10,19 */
  7161.     NULL,            /* 10,20 */
  7162.     NULL,            /* 10,21 */
  7163.     NULL,            /* 10,22 */
  7164.     NULL,            /* 10,23 */
  7165.     NULL,            /* 10,24 */
  7166.     NULL,            /* 10,25 */
  7167.     NULL,            /* 10,26 */
  7168.     NULL,            /* 10,27 */
  7169.     NULL,            /* 10,28 */
  7170.     NULL,            /* 10,29 */
  7171.     NULL,            /* 10,30 */
  7172.     NULL,            /* 10,31 */
  7173.     NULL,            /* 10,32 */
  7174.     NULL,            /* 10,33 */
  7175.     NULL,            /* 10,34 */
  7176.     NULL,            /* 10,35 */
  7177.     NULL,            /* 10,36 */
  7178.     NULL,            /* 10,37 */
  7179.     NULL,            /* 10,38 */
  7180.     NULL,            /* 10,39 */
  7181.     NULL,            /* 10,40 */
  7182.     NULL,            /* 10,41 */
  7183.     NULL,            /* 10,42 */
  7184.     NULL,            /* 10,43 */
  7185.     NULL,            /* 10,44 */
  7186.     NULL,            /* 10,45 */
  7187.     NULL,            /* 10,46 */
  7188.     NULL,            /* 10,47 */
  7189.     NULL,            /* 10,48 */
  7190.     NULL            /* 10,49 */
  7191. };
  7192. int nxls = (sizeof(xls) / sizeof(CHAR *));
  7193.  
  7194. #ifndef NOLOCAL
  7195. /*
  7196.   The following routines are useful only for terminal character sets, and so
  7197.   ifdef'd out for NOLOCAL compilations.
  7198. */
  7199.  
  7200. /*
  7201.   C S _ I S _ N R C
  7202.  
  7203.   Returns nonzero if argument indicates a 7-bit national character set,
  7204.   zero otherwise.
  7205. */
  7206. int
  7207. cs_is_nrc(x) int x; {
  7208. #ifdef UNICODE
  7209.     if (x == TX_J201R || x == TX_DECSPEC || x == TX_DECTECH
  7210.         || txrinfo[x] == NULL)
  7211.       return(0);
  7212.     else
  7213.       return(txrinfo[x]->flags & X2U_STD && txrinfo[x]->size == 94);
  7214. #else /* UNICODE */
  7215.     if ((cs_size(x) == 94))
  7216.       return(1);
  7217.     else
  7218.       return(0);
  7219. #endif /* UNICODE */
  7220. }
  7221.  
  7222. /*
  7223.   C S _ I S _ S T D
  7224.  
  7225.   Returns nonzero if argument indicates an ISO 4873-standard-format
  7226.   character set, i.e. one in which the control region is NOT used for
  7227.   graphics; zero otherwise.
  7228. */
  7229. int
  7230. cs_is_std(x) int x; {
  7231. #ifdef UNICODE
  7232.     if (!txrinfo[x])            /* Even more safety */
  7233.       return(0);
  7234.     else if (txrinfo[x]->size == 128)    /* Just for safety */
  7235.       return(0);
  7236.     else
  7237.       return(txrinfo[x]->flags & X2U_STD); /* Only this should be needed */
  7238. #else
  7239.     switch (x) {
  7240.       case FC_CP437:            /* Code pages use C1 graphics */
  7241.       case FC_CP850:
  7242.       case FC_CP852:
  7243.       case FC_CP862:
  7244.       case FC_CP866:
  7245.       case FC_CP869:
  7246.       case FC_CP858:
  7247.       case FC_APPQD:            /* So do Apple and NeXTSTEP */
  7248.       case FC_NEXT:
  7249.     return(0);
  7250.       default:                /* Others behave */
  7251.     return(1);
  7252.     }
  7253. #endif /* CKOUINI */
  7254. }
  7255.  
  7256. int
  7257. cs_size(x) int x; {
  7258. #ifdef UNICODE
  7259.     if (!txrinfo[x])
  7260.       return(128);
  7261.     return(txrinfo[x]->size);
  7262. #else
  7263.     switch(x) {
  7264.       case FC_USASCII:
  7265.       case FC_UKASCII:
  7266.       case FC_DUASCII:
  7267.       case FC_FIASCII:
  7268.       case FC_FRASCII:
  7269.       case FC_FCASCII:
  7270.       case FC_GEASCII:
  7271.       case FC_HUASCII:
  7272.       case FC_ITASCII:
  7273.       case FC_NOASCII:
  7274.       case FC_POASCII:
  7275.       case FC_SPASCII:
  7276.       case FC_SWASCII:
  7277.       case FC_CHASCII:
  7278.       case FC_KOI7:
  7279.       case FC_HE7:
  7280.       case FC_ELOT:
  7281.     return(94);
  7282.  
  7283.       case FC_1LATIN:
  7284.       case FC_2LATIN:
  7285.       case FC_DECMCS:
  7286.       case FC_DGMCS:
  7287.       case FC_HPR8:
  7288.       case FC_CYRILL:
  7289.       case FC_KOI8:
  7290.       case FC_HEBREW:
  7291.       case FC_GREEK:
  7292.       case FC_9LATIN:
  7293.     return(96);
  7294.  
  7295.       case FC_NEXT:
  7296.       case FC_CP437:
  7297.       case FC_CP850:
  7298.       case FC_CP852:
  7299.       case FC_CP855:
  7300.       case FC_CP862:
  7301.       case FC_CP866:
  7302.       case FC_CP1251:
  7303.       case FC_APPQD:
  7304.     return(128);
  7305. #ifdef KANJI
  7306.       case FC_JIS7:
  7307.     return(-94);
  7308.       case FC_SHJIS:
  7309.     return(-128);
  7310.       case FC_JEUC:
  7311.       case FC_JDEC:
  7312.     return(-96);
  7313. #endif /* KANJI */
  7314.       case FC_CP858:
  7315.       default:
  7316.     return(-1);
  7317.     }
  7318. #endif /* UNICODE */
  7319. }
  7320. #endif /* NOLOCAL */
  7321.  
  7322. /*
  7323.   S E T X L A T Y P E  --  Set Translation Type
  7324.  
  7325.   Sets global xlatype to indicate which kind of translation:
  7326.  
  7327.     XLA_NONE      No translation
  7328.     XLA_BYTE      Byte-for-Byte translation
  7329.     XLA_JAPAN     Japanese Kanji translation
  7330.     XLA_UNICODE   Unicode translations
  7331.  
  7332.   And sets up the appropriate translation function pointers as follows:
  7333.  
  7334.   For no translation:
  7335.     All function pointers are NULL.
  7336.  
  7337.   For Byte-for-Byte transation:
  7338.     rx  = TCS to FCS (these functions are in this module...)
  7339.     sx  = FCS to TCS
  7340.  
  7341.   For Unicode translations:
  7342.     xfu = FCS to UCS (these functions are in ckcuni.c...)
  7343.     xtu = TCS to UCS
  7344.     xuf = UCS to FCS
  7345.     xut = UCS to TCS
  7346. */
  7347. VOID
  7348. setxlatype(tcs, fcs) int tcs, fcs; {
  7349. #ifdef UNICODE
  7350.     xfu = NULL;                /* Unicode <-> TCS/FCS functions */
  7351.     xtu = NULL;
  7352.     xuf = NULL;
  7353.     xut = NULL;
  7354. #endif /* UNICODE */
  7355.     rx = sx = NULL;
  7356.     debug(F101,"setxlatype fcs","",fcs);
  7357.     debug(F101,"setxlatype tcs","",tcs);
  7358.  
  7359.     if (tcs < 0 || tcs > MAXTCSETS) {
  7360.     debug(F101,"setxlatype bad tcs","",tcs);
  7361.     return;
  7362.     }
  7363.     if (fcs < 0 || fcs > MAXFCSETS) {
  7364.     debug(F101,"setxlatype bad fcs","",fcs);
  7365.     return;
  7366.     }
  7367.     if (tcs == TC_TRANSP || xfrxla == 0) { /* Transfer charset TRANSPARENT */
  7368.     debug(F101,"setxlatype transparent because TCS==Transparent","",tcs);
  7369.     xlatype = XLA_NONE;        /* Translation type is None */
  7370. #ifdef UNICODE
  7371.     /* If any of our charsets is Unicode we use Unicode functions */
  7372.     /* even if TCS and FCS are the same because of BOM and byte swapping */
  7373.     } else if (tcs == TC_UCS2 || tcs == TC_UTF8 ||
  7374.            fcs == FC_UCS2 || fcs == FC_UTF8) {
  7375.     debug(F101,"setxlatype Unicode tcs","",tcs);
  7376.     debug(F101,"setxlatype Unicode fcs","",fcs);
  7377.     /* Unicode <-> TCS/FCS functions */
  7378.     xfu = xl_fcu[fcs];        /* FCS -> UCS */
  7379.     xtu = xl_tcu[tcs];        /* TCS -> UCS */
  7380.     xuf = xl_ufc[fcs];        /* UCS -> FCS */
  7381.     xut = xl_utc[tcs];        /* UCS -> TCS */
  7382.         xlatype = XLA_UNICODE;        /* Translation type is Unicode */
  7383. #ifdef COMMENT
  7384.     /* These make trouble in 64-bit land */
  7385.     debug(F001,"setxlatype Unicode xfu","",(unsigned)xfu);
  7386.     debug(F001,"setxlatype Unicode xuf","",(unsigned)xuf);
  7387. #endif /* COMMENT */
  7388. #endif /* UNICODE */
  7389.     } else if (cseqtab[tcs] == fcs) {    /* Or if TCS == FCS */
  7390.     debug(F101,"setxlatype transparent because TCS==FCS","",tcs);
  7391.     xlatype = XLA_NONE;        /* translation type is also None */
  7392. #ifdef KANJI
  7393.     /* Otherwise if any of them is Japanese, we use Kanji functions */
  7394.     } else if (tcs == TC_JEUC || fcsinfo[fcs].alphabet == AL_JAPAN) {
  7395.     debug(F101,"setxlatype Japanese tcs","",tcs);
  7396.     debug(F101,"setxlatype Japanese fcs","",fcs);
  7397.         xlatype = XLA_JAPAN;        /* Translation type is Japanese */
  7398. #endif /* KANJI */
  7399.     /* Otherwise we use byte functions */
  7400.     } else {                /* Otherwise... */
  7401.     rx = xlr[tcs][fcs];        /* Input translation function */
  7402.     sx = xls[tcs][fcs];        /* Output translation function */
  7403.     debug(F101,"setxlatype Byte tcs","",tcs);
  7404.     debug(F101,"setxlatype Byte fcs","",fcs);
  7405.         xlatype = XLA_BYTE;        /* Translation type is Byte */
  7406.     }
  7407.     debug(F101,"setxlatype xlatype","",xlatype);
  7408. }
  7409.  
  7410. /* Set up translation between two file character sets with UCS intermediate */
  7411.  
  7412. #ifdef UNICODE
  7413. VOID
  7414. initxlate(csin, csout) int csin, csout; {
  7415.     xfu = NULL;
  7416.     xtu = NULL;
  7417.     xuf = NULL;
  7418.     xut = NULL;
  7419.  
  7420.     debug(F101,"initxlate csin","",csin);
  7421.     debug(F101,"initxlate csout","",csout);
  7422.  
  7423.     if (csin < 0 || csin > MAXFCSETS) {
  7424.     debug(F101,"initxlate bad csin","",csin);
  7425.     return;
  7426.     }
  7427.     if (csout < 0 || csout > MAXFCSETS) {
  7428.     debug(F101,"initxlate bad csout","",csout);
  7429.     return;
  7430.     }
  7431.     if (csin == csout && csin != FC_UCS2) {
  7432.     xlatype = XLA_NONE;        /* Translation type is None */
  7433.     return;
  7434.     }
  7435.     xlatype = XLA_UNICODE;        /* Translation type is Unicode */
  7436.     xfu = xl_fcu[csin];            /* FCS -> UCS */
  7437.     xuf = xl_ufc[csout];        /* UCS -> FCS */
  7438.     xpnbyte(-1,0,0,NULL);        /* Reset UCS-2 */
  7439. #ifdef COMMENT
  7440.     debug(F001,"initxlate Unicode xfu","",(unsigned)xfu);
  7441.     debug(F001,"initxlate Unicode xuf","",(unsigned)xuf);
  7442. #endif /* COMMENT */
  7443.     debug(F101,"initxlate xlatype","",xlatype);
  7444. }
  7445. #endif /* UNICODE */
  7446.  
  7447. int csetsinited = 0;
  7448.  
  7449. VOID
  7450. initcsets() {                /* Routine to reset or initialize */
  7451.     int i;                /* character-set associations. */
  7452.  
  7453. #ifdef UNICODE
  7454.     if (ucsorder < 0)            /* For creating UCS-2 files. */
  7455.       ucsorder = byteorder;
  7456.     if (ucsorder < 0)
  7457.       ucsorder = 0;
  7458.     if (fileorder < 0)            /* For reading UCS-2 files. */
  7459.       fileorder = ucsorder;
  7460. #endif /* UNICODE */
  7461.  
  7462.     debug(F101,"initcsets nxls","",nxls);
  7463.     debug(F101,"initcsets nxlr","",nxlr);
  7464.  
  7465.     debug(F101,"initcsets TERM LOCAL CSET","",tcsl);
  7466.     debug(F101,"initcsets TERM REMOTE CSET","",tcsr);
  7467.  
  7468.     for (i = 0; i <= MAXFCSETS; i++)    /* First clear them all... */
  7469.       afcset[i] = -1;
  7470.     for (i = 0; i <= MAXTCSETS; i++)
  7471.       axcset[i] = -1;
  7472.  
  7473.     /* Now set specific defaults for incoming files */
  7474.  
  7475.     xlatype = XLA_NONE;
  7476.  
  7477.     axcset[TC_TRANSP]  = FC_TRANSP;
  7478.     axcset[TC_USASCII] = FC_USASCII;
  7479.  
  7480. #ifdef OS2
  7481.     switch (fcharset) {
  7482.       case FC_CP850:
  7483.       case FC_CP858:
  7484.       case FC_CP437:
  7485.       case FC_1LATIN:
  7486.     axcset[TC_1LATIN]  = fcharset;
  7487.     break;
  7488.       default:
  7489.     axcset[TC_1LATIN]  = FC_CP850;
  7490.     }
  7491. #else
  7492. #ifdef HPUX
  7493.     axcset[TC_1LATIN]  = FC_HPR8;
  7494. #else
  7495. #ifdef VMS
  7496.     axcset[TC_1LATIN]  = FC_DECMCS;
  7497. #else
  7498. #ifdef NEXT
  7499.     axcset[TC_1LATIN]  = FC_NEXT;
  7500. #else
  7501. #ifdef datageneral
  7502.     axcset[TC_1LATIN]  = FC_DGMCS;
  7503. #else
  7504.     /* Should we use code pages on some PC based UNIXes? */
  7505.     axcset[TC_1LATIN]  = FC_1LATIN;
  7506. #endif /* datageneral */
  7507. #endif /* NEXT */
  7508. #endif /* VMS */
  7509. #endif /* HPUX */
  7510. #endif /* OS2 */
  7511.  
  7512. #ifdef OS2
  7513.     axcset[TC_2LATIN]  = FC_CP852;
  7514.     axcset[TC_CYRILL]  = FC_CP866;
  7515.     axcset[TC_JEUC]    = FC_SHJIS;
  7516.     axcset[TC_HEBREW]  = FC_CP862;
  7517.     axcset[TC_GREEK]   = FC_CP869;
  7518.     axcset[TC_9LATIN]  = FC_CP858;
  7519.     axcset[TC_UCS2]    = FC_UCS2;
  7520.     axcset[TC_UTF8]    = FC_UCS2;
  7521. #else
  7522.     axcset[TC_2LATIN]  = FC_2LATIN;
  7523.     axcset[TC_CYRILL]  = FC_CYRILL;
  7524.     axcset[TC_JEUC]    = FC_JEUC;
  7525.     axcset[TC_HEBREW]  = FC_HEBREW;
  7526.     axcset[TC_GREEK]   = FC_GREEK;
  7527.     axcset[TC_9LATIN]  = FC_9LATIN;
  7528.     axcset[TC_UCS2]    = FC_UTF8;
  7529.     axcset[TC_UTF8]    = FC_UTF8;
  7530. #endif /* OS2 */
  7531.  
  7532.     /* And for outbound files */
  7533.  
  7534.     afcset[FC_USASCII] = TC_USASCII;
  7535.     afcset[FC_UKASCII] = TC_1LATIN;
  7536.     afcset[FC_DUASCII] = TC_1LATIN;
  7537.     afcset[FC_FIASCII] = TC_1LATIN;
  7538.     afcset[FC_FRASCII] = TC_1LATIN;
  7539.     afcset[FC_FCASCII] = TC_1LATIN;
  7540.     afcset[FC_GEASCII] = TC_1LATIN;
  7541.     afcset[FC_HUASCII] = TC_2LATIN;
  7542.     afcset[FC_ITASCII] = TC_1LATIN;
  7543.     afcset[FC_NOASCII] = TC_1LATIN;
  7544.     afcset[FC_POASCII] = TC_1LATIN;
  7545.     afcset[FC_SPASCII] = TC_1LATIN;
  7546.     afcset[FC_SWASCII] = TC_1LATIN;
  7547.     afcset[FC_CHASCII] = TC_1LATIN;
  7548.     afcset[FC_1LATIN]  = TC_1LATIN;
  7549.     afcset[FC_2LATIN]  = TC_2LATIN;
  7550.     afcset[FC_DECMCS]  = TC_1LATIN;
  7551.     afcset[FC_NEXT]    = TC_1LATIN;
  7552.     afcset[FC_CP437]   = TC_1LATIN;
  7553.     afcset[FC_CP850]   = TC_1LATIN;
  7554.     afcset[FC_CP852]   = TC_2LATIN;
  7555.     afcset[FC_APPQD]   = TC_1LATIN;
  7556.     afcset[FC_DGMCS]   = TC_1LATIN;
  7557.     afcset[FC_HPR8]    = TC_1LATIN;
  7558.     afcset[FC_CYRILL]  = TC_CYRILL;
  7559.     afcset[FC_CP866]   = TC_CYRILL;
  7560.     afcset[FC_KOI7]    = TC_CYRILL;
  7561.     afcset[FC_KOI8]    = TC_CYRILL;
  7562.     afcset[FC_JIS7]    = TC_JEUC;
  7563.     afcset[FC_SHJIS]   = TC_JEUC;
  7564.     afcset[FC_JEUC]    = TC_JEUC;
  7565.     afcset[FC_JDEC]    = TC_JEUC;
  7566.     afcset[FC_HE7]     = TC_HEBREW;
  7567.     afcset[FC_HEBREW]  = TC_HEBREW;
  7568.     afcset[FC_CP862]   = TC_HEBREW;
  7569.     afcset[FC_ELOT]    = TC_GREEK;
  7570.     afcset[FC_GREEK]   = TC_GREEK;
  7571.     afcset[FC_CP869]   = TC_GREEK;
  7572.     afcset[FC_9LATIN]  = TC_9LATIN;
  7573.     afcset[FC_CP923]   = TC_9LATIN;
  7574.     afcset[FC_CP858]   = TC_9LATIN;
  7575.     afcset[FC_CP855]   = TC_CYRILL;
  7576.     afcset[FC_CP1251]  = TC_CYRILL;
  7577.     afcset[FC_BULGAR]  = TC_CYRILL;
  7578.     afcset[FC_CP1250]  = TC_2LATIN;
  7579.     afcset[FC_MAZOVIA] = TC_2LATIN;
  7580.     afcset[FC_UCS2]    = TC_UTF8;
  7581.     afcset[FC_UTF8]    = TC_UTF8;
  7582.  
  7583.     afcset[FC_KOI8R]   = TC_CYRILL;
  7584.     afcset[FC_KOI8U]   = TC_CYRILL;
  7585.     afcset[FC_CP1252]  = TC_1LATIN;
  7586.  
  7587.     csetsinited++;
  7588.     return;
  7589. }
  7590. #endif /* NOCSETS */
  7591.