home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckuxla.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  276KB  |  7,589 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.044, 2 Jun 2011";
  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, 2011,
  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. #endif /* CYRILLIC */
  335.     "cp1252",             FC_CP1252,  0, /* Windows CP 1252 */
  336.     "cp437",              FC_CP437,   0, /* PC CP437 */
  337.     "cp850",              FC_CP850,   0, /* PC CP850 */
  338. #ifdef LATIN2
  339.     "cp852",              FC_CP852,   0, /* PC CP852 */
  340. #endif /* LATIN2 */
  341. #ifdef CYRILLIC
  342.     "cp855-cyrillic",     FC_CP855,   0, /* PC CP855 */
  343. #endif /* CYRILLIC */
  344.     "cp858",              FC_CP858,   0, /* PC CP858 */
  345. #ifdef HEBREW
  346.     "cp862-hebrew",       FC_CP862,   0, /* PC CP862 */
  347. #endif /* HEBREW */
  348. #ifdef CYRILLIC
  349.     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
  350. #endif /* CYRILLIC */
  351. #ifdef GREEK
  352.     "cp869-greek",        FC_CP869,   0, /* CP869 Greek */
  353. #endif /* GREEK */
  354. #ifdef CYRILLIC
  355.     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
  356. #endif /* CYRILLIC */
  357.     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
  358. #ifdef KANJI
  359.     "dec-kanji",          FC_JDEC,    0, /* Japanese DEC Kanji */
  360. #endif /* KANJI */
  361.     "dec-mcs",            FC_DECMCS,  CM_INV, /* DEC multinational char set */
  362.     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
  363.     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
  364.     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
  365. #ifdef GREEK
  366.     "elot927-greek",      FC_ELOT,    0, /* ELOT 927 Greek */
  367.     "elot928-greek",      FC_GREEK,   0, /* Same as ISO 8859-7 Latin/Greek */
  368. #endif /* GREEK */
  369. #ifdef KANJI
  370.     "euc-jp",             FC_JEUC,    0, /* Japanese EUC */
  371. #endif /* KANJI */
  372.     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
  373.     "french",             FC_FRASCII, 0, /* French NRC */
  374.     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
  375.     "german",             FC_GEASCII, 0, /* German NRC */
  376. #ifdef GREEK
  377.     "greek-iso",          FC_GREEK,   0, /* ISO 8859-7 Latin/Greek */
  378. #endif /* GREEK */
  379. #ifdef HEBREW
  380.     "he",                 FC_HEBREW,  CM_ABR|CM_INV,
  381.     "heb",                FC_HEBREW,  CM_ABR|CM_INV,
  382.     "hebr",               FC_HEBREW,  CM_ABR|CM_INV,
  383.     "hebre",              FC_HEBREW,  CM_ABR|CM_INV,
  384.     "hebrew",             FC_HEBREW,  CM_ABR|CM_INV,
  385.     "hebrew-7",           FC_HE7,     0, /* DEC 7-Bit Hebrew */
  386.     "hebrew-iso",         FC_HEBREW,  0, /* ISO Latin/Hebrew */
  387. #endif /* HEBREW */
  388.     "hp-roman8",          FC_HPR8,    0, /* Hewlett Packard Roman8 */
  389.     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
  390.  
  391.     "ibm437",             FC_CP437,   CM_INV, /* PC CP437 */
  392.     "ibm850",             FC_CP850,   CM_INV, /* PC CP850 (not in MIME) */
  393. #ifdef LATIN2
  394.     "ibm852",             FC_CP852,   CM_INV, /* PC CP852 */
  395. #endif /* LATIN2 */
  396. #ifdef CYRILLIC
  397.     "ibm855",             FC_CP855,   CM_INV, /* PC CP855 */
  398. #endif /* CYRILLIC */
  399.     "ibm858",             FC_CP858,   CM_INV, /* PC CP858 (not in MIME) */
  400. #ifdef HEBREW
  401.     "ibm862",             FC_CP862,   CM_INV, /* PC CP862 (not in MIME) */
  402. #endif /* HEBREW */
  403. #ifdef CYRILLIC
  404.     "ibm866",             FC_CP866,   CM_INV, /* CP866 Cyrillic */
  405. #endif /* CYRILLIC */
  406. #ifdef GREEK
  407.     "ibm869",             FC_CP869,   CM_INV, /* CP869 Greek */
  408. #endif /* GREEK */
  409.  
  410. #ifdef UNICODE
  411.     "iso-10646-ucs-2",    FC_UCS2,    CM_INV, /* ISO 10646 / Unicode UCS-2 */
  412. #endif /* UNICODE */
  413.     "iso-8859-1",         FC_1LATIN,  CM_INV, /* ISO Latin Alphabet 1 */
  414.     "iso-8859-15",        FC_9LATIN,  CM_INV, /* ISO Latin Alphabet 9 (yes) */
  415.     "iso-8859-2",         FC_2LATIN,  CM_INV, /* ISO Latin Alphabet 2 */
  416. #ifdef CYRILLIC
  417.     "iso-8859-5",         FC_CYRILL,  CM_INV, /* ISO Latin/Cyrillic Alphabet */
  418. #endif /* CYRILLIC */
  419. #ifdef GREEK
  420.     "iso-8859-7",         FC_GREEK,   CM_INV, /* ISO 8859-7 Latin/Greek */
  421. #endif /* GREEK */
  422. #ifdef HEBREW
  423.     "iso-8859-8",         FC_HEBREW,  CM_INV, /* ISO Latin/Hebrew */
  424. #endif /* HEBREW */
  425. #ifdef KANJI
  426.     "iso2022jp-kanji",    FC_JIS7,    CM_INV, /* Synonym for JIS-7 */
  427. #endif /* KANJI */
  428.  
  429.     "iso646-gb",          FC_UKASCII, CM_INV, /* British NRC */
  430.     "iso646-ca",          FC_FCASCII, CM_INV, /* French Canadian NRC */
  431.     "iso646-de",          FC_GEASCII, CM_INV, /* German NRC */
  432.     "iso646-dk",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  433.     "iso646-es",          FC_SPASCII, CM_INV, /* Spanish NRC */
  434.     "iso646-fi",          FC_FIASCII, CM_INV, /* Finnish NRC */
  435.     "iso646-fr",          FC_FRASCII, CM_INV, /* French NRC */
  436.     "iso646-hu",          FC_HUASCII, CM_INV, /* Hungarian NRC */
  437.     "iso646-it",          FC_ITASCII, CM_INV, /* Italian NRC */
  438.     "iso646-no",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  439.     "iso646-po",          FC_POASCII, CM_INV, /* Portuguese NRC */
  440.     "iso646-se",          FC_SWASCII, CM_INV, /* Swedish NRC */
  441.  
  442.     "italian",            FC_ITASCII, CM_INV, /* Italian NRC */
  443. #ifdef KANJI
  444.     "japanese-euc",       FC_JEUC,    CM_INV, /* Japanese EUC */
  445.     "jis7-kanji",         FC_JIS7,    0, /* Japanese JIS7 7bit code */
  446. #endif /* KANJI */
  447. #ifdef CYRILLIC
  448.     "k",                  FC_KOI8,    CM_ABR|CM_INV,
  449.     "ko",                 FC_KOI8,    CM_ABR|CM_INV,
  450.     "koi",                FC_KOI8,    CM_ABR|CM_INV,
  451.     "koi7",               FC_KOI7,    0, /* Short KOI Cyrillic */
  452.     "koi8",               FC_KOI8,    0, /* Old KOI-8 Cyrillic */
  453.     "koi8-e",             FC_KOI8,    CM_INV, /* Old KOI-8 Cyrillic */
  454.     "koi8-cyrillic",      FC_KOI8,    CM_INV,
  455.     "koi8-r",             FC_KOI8R,   CM_INV, /* KOI8-R RFC1489 */
  456.     "koi8-u",             FC_KOI8U,   CM_INV, /* KOI8-U RFC2319 */
  457.     "koi8r",              FC_KOI8R,   0, /* KOI8-R RFC1489 */
  458.     "koi8u",              FC_KOI8U,   0, /* KOI8-U RFC2319 */
  459. #endif /* CYRILLIC */
  460.     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
  461.     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
  462.     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
  463.     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
  464.     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
  465.     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
  466. #ifdef LATIN2
  467.     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
  468. #endif /* LATIN2 */
  469.     "latin9-iso",         FC_9LATIN,  0, /* ISO Latin Alphabet 9 */
  470.     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin" */
  471. #ifdef LATIN2
  472.     "mazovia-pc",         FC_MAZOVIA, 0, /* Polish Mazovia PC code page */
  473. #endif /* LATIN2 */
  474.     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
  475.     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
  476.     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
  477. #ifdef KANJI
  478.     "shift-jis-kanji",    FC_SHJIS,   0, /* Japanese Kanji Shift-JIS */
  479.     "shift_jis",          FC_SHJIS,   CM_INV, /* Japanese Kanji Shift-JIS */
  480. #endif /* KANJI */
  481. #ifdef CYRILLIC
  482.     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
  483. #endif /* CYRILLIC */
  484.     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
  485.     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
  486.     "swiss",              FC_CHASCII, 0, /* Swiss NRC */
  487. #ifdef UNICODE
  488.     "ucs2",               FC_UCS2,    0, /* ISO 10646 / Unicode UCS-2 */
  489. #endif /* UNICODE */
  490.     "us-ascii",           FC_USASCII, CM_INV, /* MIME */
  491.     "usascii",            FC_USASCII, CM_INV,
  492. #ifdef UNICODE
  493.     "utf-8",              FC_UTF8,    CM_INV, /* ISO 10646 / Unicode UTF-8 */
  494.     "utf8",               FC_UTF8,    0, /* ISO 10646 / Unicode UTF-8 */
  495. #endif /* UNICODE */
  496. #ifdef LATIN2
  497.     "windows-1250",       FC_CP1250,  CM_INV, /* Windows CP 1250 */
  498. #endif /* LATIN2 */
  499. #ifdef CYRILLIC
  500.     "windows-1251",       FC_CP1251,  CM_INV, /* Windows CP 1251 */
  501. #endif /* CYRILLIC */
  502.     "windows-1252",       FC_CP1252,  CM_INV, /* Windows CP 1252 */
  503.     "", 0, 0
  504. };
  505. int nfilc = (sizeof(fcstab) / sizeof(struct keytab)) - 1;
  506.  
  507. struct keytab ttcstab[] = { /* Keyword table for SET TERMINAL CHARACTER-SET */
  508. /*
  509.   IMPORTANT: This table is a replica of fcstab, immediately above, with the
  510.   addition of TRANSPARENT and deletion of the Japanese sets.  If you make
  511.   changes to this table, make the corresponding changes to fcstab.
  512. */
  513. /* Keyword             Value       Flags */
  514.     "apple-quickdraw",    FC_APPQD,   CM_INV, /* Apple Quickdraw */
  515.     "ascii",              FC_USASCII, 0, /* ASCII */
  516.     "british",            FC_UKASCII, 0, /* British NRC */
  517.     "bulgaria-pc",        FC_BULGAR,  0, /* Bulgarian PC Code Page */
  518.     "canadian-french",    FC_FCASCII, 0, /* French Canadian NRC */
  519. #ifdef LATIN2
  520.     "cp1250",             FC_CP1250,  0, /* Windows CP 1250 */
  521. #endif /* LATIN2 */
  522. #ifdef CYRILLIC
  523.     "cp1251-cyrillic",    FC_CP1251,  0, /* Windows CP 1251 */
  524. #endif /* CYRILLIC */
  525.     "cp1252",             FC_CP1252,  0, /* Windows CP 1252 */
  526.     "cp437",              FC_CP437,   0, /* PC CP437 */
  527.     "cp850",              FC_CP850,   0, /* PC CP850 */
  528. #ifdef LATIN2
  529.     "cp852",              FC_CP852,   0, /* PC CP852 */
  530. #endif /* LATIN2 */
  531. #ifdef CYRILLIC
  532.     "cp855-cyrillic",     FC_CP855,   0, /* PC CP855 */
  533. #endif /* CYRILLIC */
  534.     "cp858",              FC_CP858,   0, /* PC CP858 */
  535. #ifdef HEBREW
  536.     "cp862-hebrew",       FC_CP862,   0, /* PC CP862 */
  537. #endif /* HEBREW */
  538. #ifdef CYRILLIC
  539.     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
  540. #endif /* CYRILLIC */
  541. #ifdef GREEK
  542.     "cp869-greek",        FC_CP869,   0, /* CP869 Greek */
  543. #endif /* GREEK */
  544. #ifdef CYRILLIC
  545.     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
  546. #endif /* CYRILLIC */
  547.     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
  548.     "dec-mcs",            FC_DECMCS,  CM_INV, /* DEC multinational char set */
  549.     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
  550.     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
  551.     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
  552. #ifdef GREEK
  553.     "elot927-greek",      FC_ELOT,    0, /* ELOT 927 Greek */
  554.     "elot928-greek",      FC_GREEK,   0, /* Same as ISO 8859-7 Latin/Greek */
  555. #endif /* GREEK */
  556.     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
  557.     "french",             FC_FRASCII, 0, /* French NRC */
  558.     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
  559.     "german",             FC_GEASCII, 0, /* German NRC */
  560. #ifdef GREEK
  561.     "greek-iso",          FC_GREEK,   0, /* ISO 8859-7 Latin/Greek */
  562. #endif /* GREEK */
  563. #ifdef HEBREW
  564.     "he",                 FC_HEBREW,  CM_ABR|CM_INV,
  565.     "heb",                FC_HEBREW,  CM_ABR|CM_INV,
  566.     "hebr",               FC_HEBREW,  CM_ABR|CM_INV,
  567.     "hebre",              FC_HEBREW,  CM_ABR|CM_INV,
  568.     "hebrew",             FC_HEBREW,  CM_ABR|CM_INV,
  569.     "hebrew-7",           FC_HE7,     0, /* DEC 7-Bit Hebrew */
  570.     "hebrew-iso",         FC_HEBREW,  0, /* ISO Latin/Hebrew */
  571. #endif /* HEBREW */
  572.     "hp-roman8",          FC_HPR8,    0, /* Hewlett Packard Roman8 */
  573.     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
  574.  
  575.     "ibm437",             FC_CP437,   CM_INV, /* PC CP437 */
  576.     "ibm850",             FC_CP850,   CM_INV, /* PC CP850 (not in MIME) */
  577. #ifdef LATIN2
  578.     "ibm852",             FC_CP852,   CM_INV, /* PC CP852 */
  579. #endif /* LATIN2 */
  580. #ifdef CYRILLIC
  581.     "ibm855",             FC_CP855,   CM_INV, /* PC CP855 */
  582. #endif /* CYRILLIC */
  583.     "ibm858",             FC_CP858,   CM_INV, /* PC CP858 (not in MIME) */
  584. #ifdef HEBREW
  585.     "ibm862",             FC_CP862,   CM_INV, /* PC CP862 (not in MIME) */
  586. #endif /* HEBREW */
  587. #ifdef CYRILLIC
  588.     "ibm866",             FC_CP866,   CM_INV, /* CP866 Cyrillic */
  589. #endif /* CYRILLIC */
  590. #ifdef GREEK
  591.     "ibm869",             FC_CP869,   CM_INV, /* CP869 Greek */
  592. #endif /* GREEK */
  593.  
  594. #ifdef UNICODE
  595.     "iso-10646-ucs-2",    FC_UCS2,    CM_INV, /* ISO 10646 / Unicode UCS-2 */
  596. #endif /* UNICODE */
  597.     "iso-8859-1",         FC_1LATIN,  CM_INV, /* ISO Latin Alphabet 1 */
  598.     "iso-8859-15",        FC_9LATIN,  CM_INV, /* ISO Latin Alphabet 9 (yes) */
  599.     "iso-8859-2",         FC_2LATIN,  CM_INV, /* ISO Latin Alphabet 2 */
  600. #ifdef CYRILLIC
  601.     "iso-8859-5",         FC_CYRILL,  CM_INV, /* ISO Latin/Cyrillic Alphabet */
  602. #endif /* CYRILLIC */
  603. #ifdef GREEK
  604.     "iso-8859-7",         FC_GREEK,   CM_INV, /* ISO 8859-7 Latin/Greek */
  605. #endif /* GREEK */
  606. #ifdef HEBREW
  607.     "iso-8859-8",         FC_HEBREW,  CM_INV, /* ISO Latin/Hebrew */
  608. #endif /* HEBREW */
  609.  
  610.     "iso646-gb",          FC_UKASCII, CM_INV, /* British NRC */
  611.     "iso646-ca",          FC_FCASCII, CM_INV, /* French Canadian NRC */
  612.     "iso646-de",          FC_GEASCII, CM_INV, /* German NRC */
  613.     "iso646-dk",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  614.     "iso646-es",          FC_SPASCII, CM_INV, /* Spanish NRC */
  615.     "iso646-fi",          FC_FIASCII, CM_INV, /* Finnish NRC */
  616.     "iso646-fr",          FC_FRASCII, CM_INV, /* French NRC */
  617.     "iso646-hu",          FC_HUASCII, CM_INV, /* Hungarian NRC */
  618.     "iso646-it",          FC_ITASCII, CM_INV, /* Italian NRC */
  619.     "iso646-no",          FC_NOASCII, CM_INV, /* Norwegian and Danish NRC */
  620.     "iso646-po",          FC_POASCII, CM_INV, /* Portuguese NRC */
  621.     "iso646-se",          FC_SWASCII, CM_INV, /* Swedish NRC */
  622.  
  623.     "italian",            FC_ITASCII, CM_INV, /* Italian NRC */
  624.  
  625. #ifdef CYRILLIC
  626.     "k",                  FC_KOI8,    CM_ABR|CM_INV,
  627.     "ko",                 FC_KOI8,    CM_ABR|CM_INV,
  628.     "koi",                FC_KOI8,    CM_ABR|CM_INV,
  629.     "koi7",               FC_KOI7,    0, /* Short KOI Cyrillic */
  630.     "koi8",               FC_KOI8,    0, /* Old KOI-8 Cyrillic */
  631.     "koi8-e",             FC_KOI8,    CM_INV, /* Old KOI-8 Cyrillic */
  632.     "koi8-cyrillic",      FC_KOI8,    CM_INV,
  633.     "koi8-r",             FC_KOI8R,   CM_INV, /* KOI8-R RFC1489 */
  634.     "koi8-u",             FC_KOI8U,   CM_INV, /* KOI8-U RFC2319 */
  635.     "koi8r",              FC_KOI8R,   0, /* KOI8-R RFC1489 */
  636.     "koi8u",              FC_KOI8U,   0, /* KOI8-U RFC2319 */
  637. #endif /* CYRILLIC */
  638.     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
  639.     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
  640.     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
  641.     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
  642.     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
  643.     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
  644. #ifdef LATIN2
  645.     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
  646. #endif /* LATIN2 */
  647.     "latin9-iso",         FC_9LATIN,  0, /* ISO Latin Alphabet 9 */
  648.     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin" */
  649. #ifdef LATIN2
  650.     "mazovia-pc",         FC_MAZOVIA, 0, /* Polish Mazovia PC code page */
  651. #endif /* LATIN2 */
  652.     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
  653.     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
  654.     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
  655.  
  656. #ifdef CYRILLIC
  657.     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
  658. #endif /* CYRILLIC */
  659.     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
  660.     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
  661.     "swiss",              FC_CHASCII, 0, /* Swiss NRC */
  662.     "transparent",        FC_TRANSP,  0, /* Transparent */
  663. #ifdef UNICODE
  664.     "ucs2",               FC_UCS2,    0, /* ISO 10646 / Unicode UCS-2 */
  665. #endif /* UNICODE */
  666.     "us-ascii",           FC_USASCII, CM_INV, /* MIME */
  667.     "usascii",            FC_USASCII, CM_INV,
  668. #ifdef UNICODE
  669.     "utf-8",              FC_UTF8,    CM_INV, /* ISO 10646 / Unicode UTF-8 */
  670.     "utf8",               FC_UTF8,    0, /* ISO 10646 / Unicode UTF-8 */
  671. #endif /* UNICODE */
  672. #ifdef LATIN2
  673.     "windows-1250",       FC_CP1250,  CM_INV, /* Windows CP 1250 */
  674. #endif /* LATIN2 */
  675. #ifdef CYRILLIC
  676.     "windows-1251",       FC_CP1251,  CM_INV, /* Windows CP 1251 */
  677. #endif /* CYRILLIC */
  678.     "windows-1252",       FC_CP1252,  CM_INV, /* Windows CP 1252 */
  679.     "", 0, 0
  680. };
  681. int ntermc = (sizeof(ttcstab) / sizeof(struct keytab)) - 1;
  682.  
  683. /* This table contains the equivalent FCS number for each TCS. */
  684. /* If the TC_xxx symbol definitions are ever changed, fix this table. */
  685. /* Ditto if another TCS is added. */
  686.  
  687. int
  688. cseqtab[MAXTCSETS+1] = {        /* TCS/FCS equivalency table */
  689.     -1,                    /*  0 = Transparent */
  690.     FC_USASCII,                /*  1 = ASCII */
  691.     FC_1LATIN,                /*  2 = Latin-1 */
  692.     FC_2LATIN,                /*  3 = Latin-2 */
  693.     FC_CYRILL,                /*  4 = Latin/Cyrillic */
  694.     FC_JEUC,                /*  5 = Japanese EUC */
  695.     FC_HEBREW,                /*  6 = Latin/Hebrew */
  696.     FC_GREEK,                /*  7 = Latin/Greek */
  697.     FC_9LATIN,                /*  8 = Latin-9 */
  698.     FC_UCS2,                /*  9 = UCS-2 */
  699.     FC_UTF8                /* 10 = UTF-8 */
  700. };
  701.  
  702. /*
  703.  Languages:
  704.  
  705.  This table allows C-Kermit to have a SET LANGUAGE command to apply special
  706.  language-specific rules when translating from a character set that contains
  707.  national characters into plain ASCII, like German umlaut-a becomes ae.
  708.  
  709.  Originally, I thought it would be a good idea to let SET LANGUAGE also select
  710.  an appropriate FILE CHARACTER-SET and TRANSFER CHARACTER-SET automatically,
  711.  and these are included in the langinfo structure.  Later I realized that this
  712.  was a bad idea.  Any particular language (e.g. Dutch) can be represented by
  713.  many different and incompatible character sets.
  714.  
  715.  (But we could use the new (1998) ASSOCIATE command for this...)
  716. */
  717.  
  718. struct langinfo langs[] = {
  719. /*  Language code   File Charset Xfer Charset Name */
  720.     L_USASCII,      FC_USASCII,  TC_USASCII,  "ASCII (American English)",
  721.     L_DANISH,       FC_NOASCII,  TC_1LATIN,   "Danish",
  722.     L_DUTCH,        FC_DUASCII,  TC_1LATIN,   "Dutch",
  723.     L_FINNISH,      FC_FIASCII,  TC_1LATIN,   "Finnish",
  724.     L_FRENCH,       FC_FRASCII,  TC_1LATIN,   "French",
  725.     L_GERMAN,       FC_GEASCII,  TC_1LATIN,   "German",
  726. #ifdef GREEK
  727.     L_GREEK,        FC_GREEK,    TC_GREEK,    "Greek",
  728. #endif /* GREEK */
  729. #ifdef HEBREW
  730.     L_HEBREW,       FC_HEBREW,   TC_HEBREW,   "Hebrew",
  731. #endif /* HEBREW */
  732.     L_HUNGARIAN,    FC_HUASCII,  TC_2LATIN,   "Hungarian",
  733.     L_ICELANDIC,    FC_USASCII,  TC_1LATIN,   "Icelandic",
  734.     L_ITALIAN,      FC_ITASCII,  TC_1LATIN,   "Italian",
  735. #ifdef KANJI
  736.     L_JAPANESE,     FC_JEUC,     TC_JEUC,     "Japanese",
  737. #endif /* KANJI */
  738.     L_NORWEGIAN,    FC_NOASCII,  TC_1LATIN,   "Norwegian",
  739.     L_PORTUGUESE,   FC_POASCII,  TC_1LATIN,   "Portuguese",
  740. #ifdef CYRILLIC
  741.     L_RUSSIAN,      FC_CP866,    TC_CYRILL,   "Russian",
  742. #endif /* CYRILLIC */
  743.     L_SPANISH,      FC_SPASCII,  TC_1LATIN,   "Spanish",
  744.     L_SWEDISH,      FC_SWASCII,  TC_1LATIN,   "Swedish",
  745.     L_SWISS,        FC_CHASCII,  TC_1LATIN,   "Swiss"
  746. };
  747. int nlangs = (sizeof(langs) / sizeof(struct langinfo));
  748.  
  749. /*
  750.   Keyword table for the SET LANGUAGE command.
  751.   Only a few of these (German, Scandinavian, etc) actually do anything.
  752.   The language is used to invoke special translation rules when converting
  753.   from an 8-bit character set to ASCII; for example, German u-diaeresis
  754.   becomes "ue", Dutch y-diaeresis becomes "ij".  Languages without associated
  755.   rules are invisible (CM_INV).
  756. */
  757. struct keytab lngtab[] = {
  758.     "ascii",            L_USASCII,    CM_INV,
  759.     "danish",           L_DANISH,     0,
  760.     "dutch",            L_DUTCH,      0,
  761.     "english",          L_USASCII,    CM_INV,
  762.     "finnish",          L_FINNISH,    0,
  763.     "french",           L_FRENCH,     0,
  764.     "german",           L_GERMAN,     0,
  765. #ifdef GREEK
  766.     "greek",            L_GREEK,      CM_INV,
  767. #endif /* GREEK */
  768. #ifdef HEBREW
  769.     "hebrew",           L_HEBREW,     CM_INV,
  770. #endif /* HEBREW */
  771.     "hungarian",        L_HUNGARIAN,  CM_INV,
  772.     "icelandic",        L_ICELANDIC,  0,
  773.     "italian",          L_ITALIAN,    CM_INV,
  774. #ifdef KANJI
  775.     "japanese",         L_JAPANESE,   CM_INV,
  776. #endif /* KANJI */
  777.     "norwegian",        L_NORWEGIAN,  0,
  778.     "none",             L_USASCII,    0,
  779.     "portuguese",       L_PORTUGUESE, CM_INV,
  780. #ifdef CYRILLIC
  781.     "russian",          L_RUSSIAN,    0,
  782. #endif /* CYRILLIC */
  783.     "spanish",          L_SPANISH,    CM_INV,
  784.     "swedish",          L_SWEDISH,    0,
  785. #ifdef CYRILLIC
  786.     "ukrainian",        L_RUSSIAN,    0,
  787. #endif /* CYRILLIC */
  788.     "", 0, 0
  789. };
  790. int nlng = (sizeof(lngtab) / sizeof(struct keytab)) - 1; /* how many */
  791.  
  792.  
  793. /* Translation tables ... */
  794.  
  795. /*
  796.   For each pair of (transfer,file) character sets, we need two translation
  797.   functions, one for sending, one for receiving.
  798. */
  799.  
  800. /*
  801.   Here is the first table, Latin-1 to ASCII, fully annotated...
  802.   This one is absolutely NOT invertible, since we're going from an 8-bit
  803.   set to a 7-bit set.  Accented letters are mapped to unaccented
  804.   equivalents, C1 control characters are all translated to "?", etc.
  805. */
  806. CONST CHAR
  807. yl1as[] = {  /* ISO 8859-1 Latin Alphabet 1 to US ASCII */
  808.       /*  Source character    Description               => Translation */
  809.       /*  Dec row/col Set                                           */
  810.   0,  /*  000  00/00  C0 NUL  Ctrl-@                    =>  (self)  */
  811.   1,  /*  001  00/01  C0 SOH  Ctrl-A                    =>  (self)  */
  812.   2,  /*  002  00/02  C0 STX  Ctrl-B                    =>  (self)  */
  813.   3,  /*  003  00/03  C0 ETX  Ctrl-C                    =>  (self)  */
  814.   4,  /*  004  00/04  C0 EOT  Ctrl-D                    =>  (self)  */
  815.   5,  /*  005  00/05  C0 ENQ  Ctrl-E                    =>  (self)  */
  816.   6,  /*  006  00/06  C0 ACK  Ctrl-F                    =>  (self)  */
  817.   7,  /*  007  00/07  C0 BEL  Ctrl-G                    =>  (self)  */
  818.   8,  /*  008  00/08  C0 BS   Ctrl-H                    =>  (self)  */
  819.   9,  /*  009  00/09  C0 HT   Ctrl-I                    =>  (self)  */
  820.  10,  /*  010  00/10  C0 LF   Ctrl-J                    =>  (self)  */
  821.  11,  /*  011  00/11  C0 VT   Ctrl-K                    =>  (self)  */
  822.  12,  /*  012  00/12  C0 FF   Ctrl-L                    =>  (self)  */
  823.  13,  /*  013  00/13  C0 CR   Ctrl-M                    =>  (self)  */
  824.  14,  /*  014  00/14  C0 SO   Ctrl-N                    =>  (self)  */
  825.  15,  /*  015  00/15  C0 SI   Ctrl-O                    =>  (self)  */
  826.  16,  /*  016  01/00  C0 DLE  Ctrl-P                    =>  (self)  */
  827.  17,  /*  017  01/01  C0 DC1  Ctrl-Q                    =>  (self)  */
  828.  18,  /*  018  01/02  C0 DC2  Ctrl-R                    =>  (self)  */
  829.  19,  /*  019  01/03  C0 DC3  Ctrl-S                    =>  (self)  */
  830.  20,  /*  020  01/04  C0 DC4  Ctrl-T                    =>  (self)  */
  831.  21,  /*  021  01/05  C0 NAK  Ctrl-U                    =>  (self)  */
  832.  22,  /*  022  01/06  C0 SYN  Ctrl-V                    =>  (self)  */
  833.  23,  /*  023  01/07  C0 ETB  Ctrl-W                    =>  (self)  */
  834.  24,  /*  024  01/08  C0 CAN  Ctrl-X                    =>  (self)  */
  835.  25,  /*  025  01/09  C0 EM   Ctrl-Y                    =>  (self)  */
  836.  26,  /*  026  01/10  C0 SUB  Ctrl-Z                    =>  (self)  */
  837.  27,  /*  027  01/11  C0 ESC  Ctrl-[                    =>  (self)  */
  838.  28,  /*  028  01/12  C0 FS   Ctrl-\                    =>  (self)  */
  839.  29,  /*  029  01/13  C0 GS   Ctrl-]                    =>  (self)  */
  840.  30,  /*  030  01/14  C0 RS   Ctrl-^                    =>  (self)  */
  841.  31,  /*  031  01/15  C0 US   Ctrl-_                    =>  (self)  */
  842.  32,  /*  032  02/00     SP   Space                     =>  (self)  */
  843.  33,  /*  033  02/01  G0 !    Exclamation mark          =>  (self)  */
  844.  34,  /*  034  02/02  G0 "    Doublequote               =>  (self)  */
  845.  35,  /*  035  02/03  G0 #    Number sign               =>  (self)  */
  846.  36,  /*  036  02/04  G0 $    Dollar sign               =>  (self)  */
  847.  37,  /*  037  02/05  G0 %    Percent sign              =>  (self)  */
  848.  38,  /*  038  02/06  G0 &    Ampersand                 =>  (self)  */
  849.  39,  /*  039  02/07  G0 '    Apostrophe                =>  (self)  */
  850.  40,  /*  040  02/08  G0 (    Left parenthesis          =>  (self)  */
  851.  41,  /*  041  02/09  G0 )    Right parenthesis         =>  (self)  */
  852.  42,  /*  042  02/10  G0 *    Asterisk                  =>  (self)  */
  853.  43,  /*  043  02/11  G0 +    Plus sign                 =>  (self)  */
  854.  44,  /*  044  02/12  G0 ,    Comma                     =>  (self)  */
  855.  45,  /*  045  02/13  G0 -    Hyphen, minus sign        =>  (self)  */
  856.  46,  /*  046  02/14  G0 .    Period, full stop         =>  (self)  */
  857.  47,  /*  047  02/15  G0 /    Slash, solidus            =>  (self)  */
  858.  48,  /*  048  03/00  G0 0    Digit 0                   =>  (self)  */
  859.  49,  /*  049  03/01  G0 1    Digit 1                   =>  (self)  */
  860.  50,  /*  050  03/02  G0 2    Digit 2                   =>  (self)  */
  861.  51,  /*  051  03/03  G0 3    Digit 3                   =>  (self)  */
  862.  52,  /*  052  03/04  G0 4    Digit 4                   =>  (self)  */
  863.  53,  /*  053  03/05  G0 5    Digit 5                   =>  (self)  */
  864.  54,  /*  054  03/06  G0 6    Digit 6                   =>  (self)  */
  865.  55,  /*  055  03/07  G0 7    Digit 7                   =>  (self)  */
  866.  56,  /*  056  03/08  G0 8    Digit 8                   =>  (self)  */
  867.  57,  /*  057  03/09  G0 9    Digit 9                   =>  (self)  */
  868.  58,  /*  058  03/10  G0 :    Colon                     =>  (self)  */
  869.  59,  /*  059  03/11  G0 ;    Semicolon                 =>  (self)  */
  870.  60,  /*  060  03/12  G0 <    Less-than sign            =>  (self)  */
  871.  61,  /*  061  03/13  G0 =    Equals sign               =>  (self)  */
  872.  62,  /*  062  03/14  G0 >    Greater-than sign         =>  (self)  */
  873.  63,  /*  063  03/15  G0 ?    Question mark             =>  (self)  */
  874.  64,  /*  064  04/00  G0 @    Commercial at sign        =>  (self)  */
  875.  65,  /*  065  04/01  G0 A    Letter A                  =>  (self)  */
  876.  66,  /*  066  04/02  G0 B    Letter B                  =>  (self)  */
  877.  67,  /*  067  04/03  G0 C    Letter C                  =>  (self)  */
  878.  68,  /*  068  04/04  G0 D    Letter D                  =>  (self)  */
  879.  69,  /*  069  04/05  G0 E    Letter E                  =>  (self)  */
  880.  70,  /*  070  04/06  G0 F    Letter F                  =>  (self)  */
  881.  71,  /*  071  04/07  G0 G    Letter G                  =>  (self)  */
  882.  72,  /*  072  04/08  G0 H    Letter H                  =>  (self)  */
  883.  73,  /*  073  04/09  G0 I    Letter I                  =>  (self)  */
  884.  74,  /*  074  04/10  G0 J    Letter J                  =>  (self)  */
  885.  75,  /*  075  04/11  G0 K    Letter K                  =>  (self)  */
  886.  76,  /*  076  04/12  G0 L    Letter L                  =>  (self)  */
  887.  77,  /*  077  04/13  G0 M    Letter M                  =>  (self)  */
  888.  78,  /*  078  04/14  G0 N    Letter N                  =>  (self)  */
  889.  79,  /*  079  04/15  G0 O    Letter O                  =>  (self)  */
  890.  80,  /*  080  05/00  G0 P    Letter P                  =>  (self)  */
  891.  81,  /*  081  05/01  G0 Q    Letter Q                  =>  (self)  */
  892.  82,  /*  082  05/02  G0 R    Letter R                  =>  (self)  */
  893.  83,  /*  083  05/03  G0 S    Letter S                  =>  (self)  */
  894.  84,  /*  084  05/04  G0 T    Letter T                  =>  (self)  */
  895.  85,  /*  085  05/05  G0 U    Letter U                  =>  (self)  */
  896.  86,  /*  086  05/06  G0 V    Letter V                  =>  (self)  */
  897.  87,  /*  087  05/07  G0 W    Letter W                  =>  (self)  */
  898.  88,  /*  088  05/08  G0 X    Letter X                  =>  (self)  */
  899.  89,  /*  089  05/09  G0 Y    Letter Y                  =>  (self)  */
  900.  90,  /*  090  05/10  G0 Z    Letter Z                  =>  (self)  */
  901.  91,  /*  091  05/11  G0 [    Left square bracket       =>  (self)  */
  902.  92,  /*  092  05/12  G0 \    Reverse slash             =>  (self)  */
  903.  93,  /*  093  05/13  G0 ]    Right square bracket      =>  (self)  */
  904.  94,  /*  094  05/14  G0 ^    Circumflex accent         =>  (self)  */
  905.  95,  /*  095  05/15  G0 _    Underline, low line       =>  (self)  */
  906.  96,  /*  096  06/00  G0 `    Grave accent              =>  (self)  */
  907.  97,  /*  097  06/01  G0 a    Letter a                  =>  (self)  */
  908.  98,  /*  098  06/02  G0 b    Letter b                  =>  (self)  */
  909.  99,  /*  099  06/03  G0 c    Letter c                  =>  (self)  */
  910. 100,  /*  100  06/04  G0 d    Letter d                  =>  (self)  */
  911. 101,  /*  101  06/05  G0 e    Letter e                  =>  (self)  */
  912. 102,  /*  102  06/06  G0 f    Letter f                  =>  (self)  */
  913. 103,  /*  103  06/07  G0 g    Letter g                  =>  (self)  */
  914. 104,  /*  104  06/08  G0 h    Letter h                  =>  (self)  */
  915. 105,  /*  105  06/09  G0 i    Letter i                  =>  (self)  */
  916. 106,  /*  106  06/10  G0 j    Letter j                  =>  (self)  */
  917. 107,  /*  107  06/11  G0 k    Letter k                  =>  (self)  */
  918. 108,  /*  108  06/12  G0 l    Letter l                  =>  (self)  */
  919. 109,  /*  109  06/13  G0 m    Letter m                  =>  (self)  */
  920. 110,  /*  110  06/14  G0 n    Letter n                  =>  (self)  */
  921. 111,  /*  111  06/15  G0 o    Letter o                  =>  (self)  */
  922. 112,  /*  112  07/00  G0 p    Letter p                  =>  (self)  */
  923. 113,  /*  113  07/01  G0 q    Letter q                  =>  (self)  */
  924. 114,  /*  114  07/02  G0 r    Letter r                  =>  (self)  */
  925. 115,  /*  115  07/03  G0 s    Letter s                  =>  (self)  */
  926. 116,  /*  116  07/04  G0 t    Letter t                  =>  (self)  */
  927. 117,  /*  117  07/05  G0 u    Letter u                  =>  (self)  */
  928. 118,  /*  118  07/06  G0 v    Letter v                  =>  (self)  */
  929. 119,  /*  119  07/07  G0 w    Letter w                  =>  (self)  */
  930. 120,  /*  120  07/08  G0 x    Letter x                  =>  (self)  */
  931. 121,  /*  121  07/09  G0 y    Letter y                  =>  (self)  */
  932. 122,  /*  122  07/10  G0 z    Letter z                  =>  (self)  */
  933. 123,  /*  123  07/11  G0 {    Left curly bracket        =>  (self)  */
  934. 124,  /*  124  07/12  G0 |    Vertical bar              =>  (self)  */
  935. 125,  /*  125  07/13  G0 }    Right curly bracket       =>  (self)  */
  936. 126,  /*  126  07/14  G0 ~    Tilde                     =>  (self)  */
  937. 127,  /*  127  07/15     DEL  Delete, Rubout            =>  (self)  */
  938. UNK,  /*  128  08/00  C1                                =>  UNK     */
  939. UNK,  /*  129  08/01  C1                                =>  UNK     */
  940. UNK,  /*  130  08/02  C1                                =>  UNK     */
  941. UNK,  /*  131  08/03  C1                                =>  UNK     */
  942. UNK,  /*  132  08/04  C1 IND                            =>  UNK     */
  943. UNK,  /*  133  08/05  C1 NEL                            =>  UNK     */
  944. UNK,  /*  134  08/06  C1 SSA                            =>  UNK     */
  945. UNK,  /*  135  08/07  C1 ESA                            =>  UNK     */
  946. UNK,  /*  136  08/08  C1 HTS                            =>  UNK     */
  947. UNK,  /*  137  08/09  C1                                =>  UNK     */
  948. UNK,  /*  138  08/10  C1                                =>  UNK     */
  949. UNK,  /*  139  08/11  C1                                =>  UNK     */
  950. UNK,  /*  140  08/12  C1                                =>  UNK     */
  951. UNK,  /*  141  08/13  C1 RI                             =>  UNK     */
  952. UNK,  /*  142  08/14  C1 SS2                            =>  UNK     */
  953. UNK,  /*  143  08/15  C1 SS3                            =>  UNK     */
  954. UNK,  /*  144  09/00  C1 DCS                            =>  UNK     */
  955. UNK,  /*  145  09/01  C1                                =>  UNK     */
  956. UNK,  /*  146  09/02  C1                                =>  UNK     */
  957. UNK,  /*  147  09/03  C1 STS                            =>  UNK     */
  958. UNK,  /*  148  09/04  C1                                =>  UNK     */
  959. UNK,  /*  149  09/05  C1                                =>  UNK     */
  960. UNK,  /*  150  09/06  C1 SPA                            =>  UNK     */
  961. UNK,  /*  151  09/07  C1 EPA                            =>  UNK     */
  962. UNK,  /*  152  09/08  C1                                =>  UNK     */
  963. UNK,  /*  153  09/09  C1                                =>  UNK     */
  964. UNK,  /*  154  09/10  C1                                =>  UNK     */
  965. UNK,  /*  155  09/11  C1 CSI                            =>  UNK     */
  966. UNK,  /*  156  09/12  C1 ST                             =>  UNK     */
  967. UNK,  /*  157  09/13  C1 OSC                            =>  UNK     */
  968. UNK,  /*  158  09/14  C1 PM                             =>  UNK     */
  969. UNK,  /*  159  09/15  C1 APC                            =>  UNK     */
  970.  32,  /*  160  10/00  G1      No-break space            =>  SP      */
  971.  33,  /*  161  10/01  G1      Inverted exclamation      =>  !       */
  972.  99,  /*  162  10/02  G1      Cent sign                 =>  c       */
  973.  35,  /*  163  10/03  G1      Pound sign                =>  #       */
  974.  36,  /*  164  10/04  G1      Currency sign             =>  $       */
  975.  89,  /*  165  10/05  G1      Yen sign                  =>  Y       */
  976. 124,  /*  166  10/06  G1      Broken bar                =>  |       */
  977.  80,  /*  167  10/07  G1      Paragraph sign            =>  P       */
  978.  34,  /*  168  10/08  G1      Diaeresis                 =>  "       */
  979.  67,  /*  169  10/09  G1      Copyright sign            =>  C       */
  980.  97,  /*  170  10/10  G1      Feminine ordinal          =>  a       */
  981.  34,  /*  171  10/11  G1      Left angle quotation      =>  "       */
  982. 126,  /*  172  10/12  G1      Not sign                  =>  ~       */
  983.  45,  /*  173  10/13  G1      Soft hyphen               =>  -       */
  984.  82,  /*  174  10/14  G1      Registered trade mark     =>  R       */
  985.  95,  /*  175  10/15  G1      Macron                    =>  _       */
  986. 111,  /*  176  11/00  G1      Degree sign, ring above   =>  o       */
  987. UNK,  /*  177  11/01  G1      Plus-minus sign           =>  UNK     */
  988.  50,  /*  178  11/02  G1      Superscript two           =>  2       */
  989.  51,  /*  179  11/03  G1      Superscript three         =>  3       */
  990.  39,  /*  180  11/04  G1      Acute accent              =>  '       */
  991. 117,  /*  181  11/05  G1      Micro sign                =>  u       */
  992.  45,  /*  182  11/06  G1      Pilcrow sign              =>  -       */
  993.  45,  /*  183  11/07  G1      Middle dot                =>  -       */
  994.  44,  /*  184  11/08  G1      Cedilla                   =>  ,       */
  995.  49,  /*  185  11/09  G1      Superscript one           =>  1       */
  996. 111,  /*  186  11/10  G1      Masculine ordinal         =>  o       */
  997.  34,  /*  187  11/11  G1      Right angle quotation     =>  "       */
  998. UNK,  /*  188  11/12  G1      One quarter               =>  UNK     */
  999. UNK,  /*  189  11/13  G1      One half                  =>  UNK     */
  1000. UNK,  /*  190  11/14  G1      Three quarters            =>  UNK     */
  1001.  63,  /*  191  11/15  G1      Inverted question mark    =>  ?       */
  1002.  65,  /*  192  12/00  G1      A grave                   =>  A       */
  1003.  65,  /*  193  12/01  G1      A acute                   =>  A       */
  1004.  65,  /*  194  12/02  G1      A circumflex              =>  A       */
  1005.  65,  /*  195  12/03  G1      A tilde                   =>  A       */
  1006.  65,  /*  196  12/04  G1      A diaeresis               =>  A       */
  1007.  65,  /*  197  12/05  G1      A ring above              =>  A       */
  1008.  65,  /*  198  12/06  G1      A with E                  =>  A       */
  1009.  67,  /*  199  12/07  G1      C Cedilla                 =>  C       */
  1010.  69,  /*  200  12/08  G1      E grave                   =>  E       */
  1011.  69,  /*  201  12/09  G1      E acute                   =>  E       */
  1012.  69,  /*  202  12/10  G1      E circumflex              =>  E       */
  1013.  69,  /*  203  12/11  G1      E diaeresis               =>  E       */
  1014.  73,  /*  204  12/12  G1      I grave                   =>  I       */
  1015.  73,  /*  205  12/13  G1      I acute                   =>  I       */
  1016.  73,  /*  206  12/14  G1      I circumflex              =>  I       */
  1017.  73,  /*  207  12/15  G1      I diaeresis               =>  I       */
  1018.  68,  /*  208  13/00  G1      Icelandic Eth             =>  D       */
  1019.  78,  /*  209  13/01  G1      N tilde                   =>  N       */
  1020.  79,  /*  210  13/02  G1      O grave                   =>  O       */
  1021.  79,  /*  211  13/03  G1      O acute                   =>  O       */
  1022.  79,  /*  212  13/04  G1      O circumflex              =>  O       */
  1023.  79,  /*  213  13/05  G1      O tilde                   =>  O       */
  1024.  79,  /*  214  13/06  G1      O diaeresis               =>  O       */
  1025. 120,  /*  215  13/07  G1      Multiplication sign       =>  x       */
  1026.  79,  /*  216  13/08  G1      O oblique stroke          =>  O       */
  1027.  85,  /*  217  13/09  G1      U grave                   =>  U       */
  1028.  85,  /*  218  13/10  G1      U acute                   =>  U       */
  1029.  85,  /*  219  13/11  G1      U circumflex              =>  U       */
  1030.  85,  /*  220  13/12  G1      U diaeresis               =>  U       */
  1031.  89,  /*  221  13/13  G1      Y acute                   =>  Y       */
  1032.  84,  /*  222  13/14  G1      Icelandic Thorn           =>  T       */
  1033. 115,  /*  223  13/15  G1      German sharp s            =>  s       */
  1034.  97,  /*  224  14/00  G1      a grave                   =>  a       */
  1035.  97,  /*  225  14/01  G1      a acute                   =>  a       */
  1036.  97,  /*  226  14/02  G1      a circumflex              =>  a       */
  1037.  97,  /*  227  14/03  G1      a tilde                   =>  a       */
  1038.  97,  /*  228  14/04  G1      a diaeresis               =>  a       */
  1039.  97,  /*  229  14/05  G1      a ring above              =>  a       */
  1040.  97,  /*  230  14/06  G1      a with e                  =>  a       */
  1041.  99,  /*  231  14/07  G1      c cedilla                 =>  c       */
  1042. 101,  /*  232  14/08  G1      e grave                   =>  e       */
  1043. 101,  /*  233  14/09  G1      e acute                   =>  e       */
  1044. 101,  /*  234  14/10  G1      e circumflex              =>  e       */
  1045. 101,  /*  235  14/11  G1      e diaeresis               =>  e       */
  1046. 105,  /*  236  14/12  G1      i grave                   =>  i       */
  1047. 105,  /*  237  14/13  G1      i acute                   =>  i       */
  1048. 105,  /*  238  14/14  G1      i circumflex              =>  i       */
  1049. 105,  /*  239  14/15  G1      i diaeresis               =>  i       */
  1050. 100,  /*  240  15/00  G1      Icelandic eth             =>  d       */
  1051. 110,  /*  241  15/01  G1      n tilde                   =>  n       */
  1052. 111,  /*  242  15/02  G1      o grave                   =>  o       */
  1053. 111,  /*  243  15/03  G1      o acute                   =>  o       */
  1054. 111,  /*  244  15/04  G1      o circumflex              =>  o       */
  1055. 111,  /*  245  15/05  G1      o tilde                   =>  o       */
  1056. 111,  /*  246  15/06  G1      o diaeresis               =>  o       */
  1057.  47,  /*  247  15/07  G1      Division sign             =>  /       */
  1058. 111,  /*  248  15/08  G1      o oblique stroke          =>  o       */
  1059. 117,  /*  249  15/09  G1      u grave                   =>  u       */
  1060. 117,  /*  250  15/10  G1      u acute                   =>  u       */
  1061. 117,  /*  251  15/11  G1      u circumflex              =>  u       */
  1062. 117,  /*  252  15/12  G1      u diaeresis               =>  u       */
  1063. 121,  /*  253  15/13  G1      y acute                   =>  y       */
  1064. 116,  /*  254  15/14  G1      Icelandic thorn           =>  t       */
  1065. 121   /*  255  15/15  G1      y diaeresis               =>  y       */
  1066. };
  1067.  
  1068.  
  1069. /* Translation tables for ISO Latin Alphabet 1 to local file character sets */
  1070.  
  1071. /*
  1072.   Most of the remaining tables are not annotated like the one above, because
  1073.   the size of the resulting source file would be ridiculous.  Each row in the
  1074.   following tables corresponds to a column of ISO 8859-1.
  1075. */
  1076.  
  1077. CONST CHAR
  1078. yl185[] = {  /* ISO 8859-1 Latin Alphabet 1 (Latin-1) to IBM Code Page 850 */
  1079. /*
  1080.   This is based on IBM's official invertible translation.  Reference: IBM
  1081.   Character Data Representation Architecture (CDRA), Level 1, Registry,
  1082.   SC09-1291-00 (1990), p.152.  (Note: Latin-1 is IBM Code Page 00819.)  Note:
  1083.   IBM's bizarre rearrangement of C0 controls and DEL has been undone in this
  1084.   table.
  1085. */
  1086.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1087.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1088.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1089.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1090.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1091.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1092.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1093. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1094. 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
  1095. 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
  1096. 255, 173, 189, 156, 207, 190, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
  1097. 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
  1098. 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
  1099. 209, 165, 227, 224, 226, 229, 153, 158, 157, 235, 233, 234, 154, 237, 232, 225,
  1100. 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
  1101. 208, 164, 149, 162, 147, 228, 148, 246, 155, 151, 163, 150, 129, 236, 231, 152
  1102. };
  1103.  
  1104. CONST CHAR
  1105. y85l1[] = {  /* IBM Code Page 850 to Latin-1 */
  1106. /*
  1107.   This is from IBM CDRA page 153.  It is the inverse of yl185[].
  1108.   As of edit 183, this table is no longer pure CDRA.  The translations
  1109.   involving C0 controls and DEL have been removed.
  1110. */
  1111.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1112.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1113.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1114.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1115.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1116.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1117.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1118. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1119. 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
  1120. 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 248, 163, 216, 215, 159,
  1121. 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
  1122. 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 162, 165, 147,
  1123. 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
  1124. 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
  1125. 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
  1126. 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
  1127. };
  1128.  
  1129. #ifdef COMMENT
  1130. CONST CHAR
  1131. yl1r8[] = {  /* Latin-1 to Hewlett Packard Roman8 */
  1132. /* This is HP's official translation, straight from iconv */
  1133. /* It is NOT invertible. */
  1134.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1135.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1136.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1137.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1138.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1139.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1140.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1141. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1142. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1143. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1144. 160, 184, 191, 187, 186, 188, 124, 189, 171,  99, 249, 251, 126,  45,  82, 176,
  1145. 179, 254,  50,  51, 168, 243, 244, 242,  44,  49, 250, 253, 247, 248, 245, 185,
  1146. 161, 224, 162, 225, 216, 208, 211, 180, 163, 220, 164, 165, 230, 229, 166, 167,
  1147. 227, 182, 232, 231, 223, 233, 218, 120, 210, 173, 237, 174, 219, 177, 240, 222,
  1148. 200, 196, 192, 226, 204, 212, 215, 181, 201, 197, 193, 205, 217, 213, 209, 221,
  1149. 228, 183, 202, 198, 194, 234, 206,  47, 214, 203, 199, 195, 207, 178, 241, 239
  1150. };
  1151. CONST CHAR
  1152. yr8l1[] = {  /* Hewlett Packard Roman8 to Latin-1 */
  1153. /* This is HP's official translation, straight from iconv */
  1154. /* It is NOT invertible. */
  1155.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1156.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1157.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1158.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1159.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1160.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1161.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1162. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1163. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1164. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1165. 160, 192, 194, 200, 202, 203, 206, 207, 180,  96,  94, 168, 126, 217, 219, 163,
  1166. 175, 221, 253, 176, 199, 231, 209, 241, 161, 191, 164, 163, 165, 167, 102, 162,
  1167. 226, 234, 244, 251, 225, 233, 243, 250, 224, 232, 242, 249, 228, 235, 246, 252,
  1168. 197, 238, 216, 198, 229, 237, 248, 230, 196, 236, 214, 220, 201, 239, 223, 212,
  1169. 193, 195, 227, 208, 240, 205, 204, 211, 210, 213, 245,  83, 115, 218,  89, 255,
  1170. 222, 254, 183, 181, 182, 190,  45, 188, 189, 170, 186, 171,  42, 187, 177, 160
  1171. };
  1172. #else /* !COMMENT */
  1173. /* This is an invertible mapping, approved by HP in January 1994. */
  1174. CONST CHAR
  1175. yl1r8[] = {  /* ISO Latin-1 to HP Roman8, Invertible */
  1176.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1177.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1178.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1179.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1180.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1181.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1182.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1183. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1184. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1185. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1186. 160, 184, 191, 187, 186, 188, 169, 189, 171, 170, 249, 251, 172, 175, 190, 176,
  1187. 179, 254, 235, 236, 168, 243, 244, 242, 238, 246, 250, 253, 247, 248, 245, 185,
  1188. 161, 224, 162, 225, 216, 208, 211, 180, 163, 220, 164, 165, 230, 229, 166, 167,
  1189. 227, 182, 232, 231, 223, 233, 218, 252, 210, 173, 237, 174, 219, 177, 240, 222,
  1190. 200, 196, 192, 226, 204, 212, 215, 181, 201, 197, 193, 205, 217, 213, 209, 221,
  1191. 228, 183, 202, 198, 194, 234, 206, 255, 214, 203, 199, 195, 207, 178, 241, 239
  1192. };
  1193.  
  1194. CONST CHAR
  1195. yr8l1[] = { /* HP Roman8 to ISO Latin-1, Invertible */
  1196.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1197.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1198.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1199.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1200.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1201.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1202.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1203. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1204. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1205. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1206. 160, 192, 194, 200, 202, 203, 206, 207, 180, 166, 169, 168, 172, 217, 219, 173,
  1207. 175, 221, 253, 176, 199, 231, 209, 241, 161, 191, 164, 163, 165, 167, 174, 162,
  1208. 226, 234, 244, 251, 225, 233, 243, 250, 224, 232, 242, 249, 228, 235, 246, 252,
  1209. 197, 238, 216, 198, 229, 237, 248, 230, 196, 236, 214, 220, 201, 239, 223, 212,
  1210. 193, 195, 227, 208, 240, 205, 204, 211, 210, 213, 245, 178, 179, 218, 184, 255,
  1211. 222, 254, 183, 181, 182, 190, 185, 188, 189, 170, 186, 171, 215, 187, 177, 247
  1212. };
  1213. #endif /* COMMENT */
  1214.  
  1215. CONST CHAR
  1216. yl143[] = {  /* Latin-1 to IBM Code Page 437 */
  1217. /*
  1218.   Although the IBM CDRA does not include an official translation between CP437
  1219.   and ISO Latin Alphabet 1, it does include an official, invertible
  1220.   translation between CP437 and CP850 (page 196), and another from CP850 to
  1221.   Latin-1 (CP819) (page 153).  This translation was obtained with a two-step
  1222.   process based on those tables.
  1223.   As of edit 183, the translation is modified to leave C0 controls alone.
  1224. */
  1225.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1226.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1227.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1228.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1229.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1230.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1231.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1232. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1233. 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
  1234. 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
  1235. 255, 173, 155, 156, 207, 157, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
  1236. 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
  1237. 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
  1238. 209, 165, 227, 224, 226, 229, 153, 158, 190, 235, 233, 234, 154, 237, 232, 225,
  1239. 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
  1240. 208, 164, 149, 162, 147, 228, 148, 246, 189, 151, 163, 150, 129, 236, 231, 152
  1241. };
  1242.  
  1243. CONST CHAR
  1244. y43l1[] = {  /* IBM Code Page 437 to Latin-1 */
  1245. /*
  1246.   This table is the inverse of yl143[].
  1247. */
  1248.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1249.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1250.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1251.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1252.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1253.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1254.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1255. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1256. 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
  1257. 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 215, 159,
  1258. 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
  1259. 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 248, 216, 147,
  1260. 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
  1261. 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
  1262. 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
  1263. 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
  1264. };
  1265.  
  1266. CONST CHAR
  1267. yl1aq[] = {  /* Latin-1 to Extended Mac Latin (based on Apple QuickDraw) */
  1268.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1269.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1270.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1271.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1272.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1273.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1274.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1275. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1276. 182, 183, 184, 185, 189, 196, 197, 198, 206, 207, 210, 211, 217, 218, 195, 212,
  1277. 209, 215, 213, 226, 227, 228, 240, 245, 246, 247, 249, 250, 251, 253, 254, 255,
  1278. 202, 193, 162, 163, 219, 180, 201, 164, 172, 169, 187, 199, 194, 208, 168, 248,
  1279. 161, 177, 170, 173, 171, 181, 166, 225, 252, 176, 188, 200, 178, 179, 186, 192,
  1280. 203, 231, 229, 204, 128, 129, 174, 130, 233, 131, 230, 232, 237, 234, 235, 236,
  1281. 220, 132, 241, 238, 239, 205, 133, 165, 175, 244, 242, 243, 134, 160, 222, 167,
  1282. 136, 135, 137, 139, 138, 140, 190, 141, 143, 142, 144, 145, 147, 146, 148, 149,
  1283. 221, 150, 152, 151, 153, 155, 154, 214, 191, 157, 156, 158, 159, 224, 223, 216
  1284. };
  1285.  
  1286. CONST CHAR
  1287. yl1du[] = {  /* Latin-1 to Dutch ISO 646 */
  1288.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1289.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1290.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1291.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1292. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1293.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1294.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1295. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK,  39, 127,
  1296. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1297. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1298.  32,  33, UNK,  35, 124, UNK, UNK,  93, 123,  67, UNK,  34, UNK,  45,  82, UNK,
  1299.  91, UNK, UNK, UNK, 126, 117, UNK, UNK,  44, UNK, UNK,  34, 125,  92,  64,  63,
  1300.  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1301. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1302.  97,  97,  97,  97,  97,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  1303. UNK, 110, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK,  91
  1304. };
  1305.  
  1306. CONST CHAR
  1307. yl1fi[] = {  /* Latin-1 to Finnish ISO NRC (*not* ISO 646) */
  1308.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1309.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1310.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1311.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1312.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1313.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  1314. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1315. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1316. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1317. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1318.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1319. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1320.  65,  65,  65,  65,  91,  93,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1321. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
  1322.  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
  1323. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
  1324. };
  1325.  
  1326. CONST CHAR
  1327. yl1fr[] = {  /* Latin-1 to French ISO 646 */
  1328.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1329.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1330.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1331.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1332. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1333.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1334.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1335. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1336. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1337. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1338.  32,  33, UNK,  35, UNK, UNK, UNK,  93,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1339.  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1340.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1341. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1342.  64,  97,  97,  97,  97,  97,  97,  92, 125, 123, 101, 101, 105, 105, 105, 105,
  1343. UNK, 110, 111, 111, 111, 111, 111,  47, 111, 124, 117, 117, 117, 121, UNK, 121
  1344. };
  1345.  
  1346. CONST CHAR
  1347. yl1fc[] = {  /* Latin-1 to French-Canadian ISO 646 */
  1348.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1349.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1350.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1351.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1352. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1353.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  1354. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1355. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1356. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1357. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1358.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1359. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1360.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1361. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1362.  64,  97,  91,  97,  97,  97,  97,  92, 125, 123,  93, 101, 105, 105,  94, 105,
  1363. UNK, 110, 111, 111,  96, 111, 111,  47, 111, 124, 117, 126, 117, 121, UNK, 121
  1364. };
  1365.  
  1366. CONST CHAR
  1367. yl1ge[] = {  /* Latin-1 to German ISO 646 */
  1368.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1369.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1370.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1371.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1372. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1373.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1374.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1375. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1376. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1377. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1378.  32,  33, UNK, UNK, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1379. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1380.  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1381. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 126,
  1382.  97,  97,  97,  97, 123,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  1383. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
  1384. };
  1385.  
  1386. CONST CHAR
  1387. yl1hu[] = {  /* Latin-1 to Hungarian ISO-646 */
  1388.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1389.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1390.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1391.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1392.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1393.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1394.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1395. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1396. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1397. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1398.  32,  33, UNK, UNK,  36, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1399. UNK,  64, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1400.  65,  65,  65,  65,  65,  65,  65,  67,  69,  91,  69,  69,  73,  73,  73,  73,
  1401. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 115,
  1402.  97,  96,  97,  97,  97,  97,  97,  99, 101, 123, 101, 101, 105, 105, 105, 105,
  1403. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
  1404. };
  1405.  
  1406. CONST CHAR
  1407. yl1it[] = {  /* Latin-1 to Italian ISO 646 */
  1408.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1409.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1410.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1411.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1412. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1413.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1414. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1415. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1416. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1417. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1418.  32,  33, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1419.  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1420.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1421. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1422. 123,  97,  97,  97,  97,  97,  97,  92, 125,  93, 101, 101, 126, 105, 105, 105,
  1423. UNK, 110, 124, 111, 111, 111, 111,  47, 111,  96, 117, 117, 117, 121, UNK, 121
  1424. };
  1425.  
  1426. CONST CHAR
  1427. yl1ne[] = {  /* Latin-1 to NeXT */
  1428. /* NEED TO MAKE THIS ONE INVERTIBLE, LIKE CP850 */
  1429. /*
  1430.   Which means finding all the graphic characters in the NeXT set that have
  1431.   no equivalent in Latin-1 and assigning them to the UNK positions (mostly
  1432.   Latin-1 C1 controls).  Then make the ynel1[] table be the inverse of this
  1433.   one.  But first we should try to get an official Latin-1/NeXT translation
  1434.   table from NeXT, Inc.
  1435. */
  1436.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1437.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1438.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1439.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1440.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1441.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1442.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1443. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1444. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1445. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1446.  32, 161, 162, 163, 168, 165, 181, 167, 200, 160, 227, 171, 190, UNK, 176, 197,
  1447. 202, 209, 201, 204, 194, 157, 182, 183, 203, 192, 235, 187, 210, 211, 212, 191,
  1448. 129, 130, 131, 132, 133, 134, 225, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1449. 144, 145, 146, 147, 148, 149, 150, 158, 233, 151, 152, 153, 154, 155, 156, 251,
  1450. 213, 214, 215, 216, 217, 218, 241, 219, 220, 221, 222, 223, 224, 226, 228, 229,
  1451. 230, 231, 236, 237, 238, 239, 240, 159, 249, 242, 243, 244, 246, 247, 252, 253
  1452. };
  1453.  
  1454. CONST CHAR
  1455. yl1no[] = {  /* Latin-1 to Norwegian/Danish ISO 646 */
  1456.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1457.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1458.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1459.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1460.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1461.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1462.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1463. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, 126, 127,
  1464. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1465. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1466.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1467. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1468.  65,  65,  65,  65,  65,  93,  91,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1469. UNK,  78,  79,  79,  79,  79,  79, 120,  92,  85,  85,  85,  85,  89, UNK, 115,
  1470.  97,  97,  97,  97,  97, 125, 123,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  1471. UNK, 110, 111, 111, 111, 111, 111,  47, 124, 117, 117, 117, 117, 121, UNK, 121
  1472. };
  1473.  
  1474. CONST CHAR
  1475. yl1po[] = {  /* Latin-1 to Portuguese ISO 646 */
  1476.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1477.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1478.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1479.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1480.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1481.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1482.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1483. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, 126, 127,
  1484. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1485. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1486.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1487. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1488.  65,  65,  65,  91,  65,  65,  65,  92,  69,  69,  69,  69,  73,  73,  73,  73,
  1489. UNK,  78,  79,  79,  79,  93,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1490.  97,  97,  97, 123,  97,  97,  97, 124, 101, 101, 101, 101, 105, 105, 105, 105,
  1491. UNK, 110, 111, 111, 111, 125, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
  1492. };
  1493.  
  1494. CONST CHAR
  1495. yl1sp[] = {  /* Latin-1 to Spanish ISO 646 */
  1496.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1497.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1498.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1499.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1500. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1501.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1502.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1503. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,  96, UNK, UNK, 126, 127,
  1504. 126, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1505. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1506.  32,  91, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1507. 123, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  93,
  1508.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1509. UNK,  92,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1510. 124,  97,  97,  97,  97,  97,  97, 125, 101, 101, 101, 101, 105, 105, 105, 105,
  1511. UNK, 124, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
  1512. };
  1513.  
  1514. CONST CHAR
  1515. yl1sw[] = {  /* Latin-1 to Swedish ISO 646 */
  1516.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1517.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1518.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1519.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1520. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1521.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  1522. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1523. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1524. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1525. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1526.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1527. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1528.  65,  65,  65,  65,  91,  93,  65,  67,  69,  64,  69,  69,  73,  73,  73,  73,
  1529. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
  1530.  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
  1531. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
  1532. };
  1533.  
  1534. CONST CHAR
  1535. yl1ch[] = {  /* Latin-1 to Swiss ISO 646 */
  1536.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1537.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1538.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1539.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1540. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1541.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK, UNK,
  1542.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1543. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1544. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1545. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1546.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1547. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1548.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1549. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1550.  64,  97,  97,  97, 123,  97,  97,  92,  95,  91,  93, 101, 105, 105,  94, 105,
  1551. UNK, 110, 111, 111,  96, 111, 124,  47, 111,  35, 117, 126, 125, 121, UNK, 121
  1552. };
  1553.  
  1554. CONST CHAR
  1555. yl1dm[] = {  /* Latin-1 to DEC Multinational Character Set */
  1556.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1557.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1558.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1559.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1560.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1561.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1562.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1563. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1564. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1565. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1566.  32, 161, 162, 163, 168, 165, 124, 167,  34, 169, 170, 171, 126, UNK,  82, UNK,
  1567. 176, 177, 178, 179,  39, 181, 182, 183,  44, 185, 186, 187, 188, 189, UNK, 191,
  1568. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1569. UNK, 209, 210, 211, 212, 213, 214, 120, 216, 217, 218, 219, 220, 221, UNK, 223,
  1570. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1571. UNK, 241, 242, 243, 244, 245, 246,  47, 248, 249, 250, 251, 252, UNK, UNK, 253
  1572. };
  1573.  
  1574. CONST CHAR
  1575. yl1dg[] = {  /* Latin-1 to Data General International Character Set */
  1576.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1577.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1578.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1579.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1580.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1581.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1582.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1583. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1584. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1585. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1586. 160, 171, 167, 168, 166, 181, 191, 187, 189, 173, 169, 177, 161, 255, 174, 175,
  1587. 188, 182, 164, 165, 190, 163, 178, 185, 186, 179, 170, 176, 223, 162, 220, 172,
  1588. 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
  1589. 184, 208, 210, 209, 211, 213, 212, 215, 214, 217, 216, 218, 219, 221, 222, 252,
  1590. 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
  1591. 183, 240, 242, 241, 243, 245, 244, 247, 246, 249, 248, 250, 251, 180, 254, 253
  1592. };
  1593.  
  1594.  
  1595. /* Local file character sets to ISO Latin Alphabet 1 */
  1596.  
  1597. #ifdef NOTUSED
  1598. CONST CHAR
  1599. yasl1[] = {  /* ASCII to Latin-1 */
  1600.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1601.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1602.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1603.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1604.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1605.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1606.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1607. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127
  1608. };
  1609. #endif /* NOTUSED */
  1610.  
  1611. CONST CHAR
  1612. yaql1[] = {  /* Extended Mac Latin (based on Apple Quickdraw) to Latin-1 */
  1613.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1614.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1615.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1616.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1617.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1618.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1619.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1620. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1621. 196, 197, 199, 201, 209, 214, 220, 225, 224, 226, 228, 227, 229, 231, 233, 232,
  1622. 234, 235, 237, 236, 238, 239, 241, 243, 242, 244, 246, 245, 250, 249, 251, 252,
  1623. 221, 176, 162, 163, 167, 215, 182, 223, 174, 169, 178, 180, 168, 179, 198, 216,
  1624. 185, 177, 188, 189, 165, 181, 128, 129, 130, 131, 190, 170, 186, 132, 230, 248,
  1625. 191, 161, 172, 142, 133, 134, 135, 171, 187, 166, 160, 192, 195, 213, 136, 137,
  1626. 173, 144, 138, 139, 143, 146, 247, 145, 255, 140, 141, 164, 208, 240, 222, 254,
  1627. 253, 183, 147, 148, 149, 194, 202, 193, 203, 200, 205, 206, 207, 204, 211, 212,
  1628. 150, 210, 218, 219, 217, 151, 152, 153, 175, 154, 155, 156, 184, 157, 158, 159
  1629. };
  1630.  
  1631. CONST CHAR
  1632. ydul1[] = {  /* Dutch ISO 646 to Latin-1 */
  1633.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1634.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1635.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1636.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1637. 190,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1638.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 255, 189, 124,  94,  95,
  1639.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1640. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 168, 164, 188,  39, 127
  1641. };
  1642.  
  1643. CONST CHAR
  1644. yfil1[] = {  /* Finnish NRC (*not* ISO-646) to Latin-1 */
  1645.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1646.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1647.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1648.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1649.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1650.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
  1651. 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1652. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
  1653. };
  1654.  
  1655. CONST CHAR
  1656. yfrl1[] = {  /* French ISO 646 to Latin-1 */
  1657.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1658.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1659.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1660.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1661. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1662.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 167,  94,  95,
  1663.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1664. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 168, 127
  1665. };
  1666.  
  1667. CONST CHAR
  1668. yfcl1[] = {  /* French-Canadian ISO 646 to Latin-1 */
  1669.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1670.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1671.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1672.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1673. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1674.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 226, 231, 234, 238,  95,
  1675. 244,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1676. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 251, 127
  1677. };
  1678.  
  1679. CONST CHAR
  1680. ygel1[] = {  /* German ISO 646 to Latin-1 */
  1681.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1682.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1683.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1684.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1685. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1686.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 220,  94,  95,
  1687.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1688. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 252, 223, 127
  1689. };
  1690.  
  1691. CONST CHAR
  1692. yitl1[] = {  /* Italian ISO 646 to Latin-1 */
  1693.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1694.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1695.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1696.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1697. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1698.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 233,  94,  95,
  1699. 249,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1700. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 224, 242, 232, 236, 127
  1701. };
  1702.  
  1703. CONST CHAR
  1704. ynel1[] = {  /* NeXT to Latin-1 */
  1705. /* NEED TO MAKE THIS ONE INVERTIBLE */
  1706.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1707.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1708.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1709.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1710.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1711.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1712.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1713. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1714. 160, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1715. 208, 209, 210, 211, 212, 213, 214, 217, 218, 219, 220, 221, 222, 181, 215, 247,
  1716. 169, 161, 162, 163, UNK, 165, UNK, 167, 164, UNK, UNK, 171, UNK, UNK, UNK, UNK,
  1717. 174, UNK, UNK, UNK, 183, 166, 182, UNK, UNK, UNK, UNK, 187, UNK, UNK, 172, 191,
  1718. 185,  96, 180,  94, 126, 175, UNK, UNK, 168, 178, 176, 184, 179, UNK, UNK, UNK,
  1719. UNK, 177, 188, 189, 190, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235,
  1720. 236, 198, 237, 170, 238, 239, 240, 241, UNK, 216, UNK, 186, 242, 243, 244, 245,
  1721. 246, 230, 249, 250, 251, UNK, 252, 253, UNK, 248, UNK, 223, 254, 255, UNK, UNK
  1722. };
  1723.  
  1724. CONST CHAR
  1725. ynol1[] = {  /* Norwegian/Danish ISO 646 to Latin-1 */
  1726.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1727.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1728.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1729.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1730.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1731.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 198, 216, 197,  94,  95,
  1732.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1733. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 230, 248, 229, 126, 127
  1734. };
  1735.  
  1736. CONST CHAR
  1737. ypol1[] = {  /* Portuguese ISO 646 to Latin-1 */
  1738.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1739.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1740.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1741.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1742.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1743.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 195, 199, 213,  94,  95,
  1744.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1745. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 227, 231, 245, 126, 127
  1746. };
  1747.  
  1748. CONST CHAR
  1749. yspl1[] = {  /* Spanish ISO 646 to Latin-1 */
  1750.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1751.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1752.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1753.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1754. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1755.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 161, 209, 191,  94,  95,
  1756.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1757. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 176, 241, 231, 126, 127
  1758. };
  1759.  
  1760. CONST CHAR
  1761. yswl1[] = {  /* Swedish ISO 646 to Latin-1 */
  1762.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1763.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1764.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1765.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1766. 201,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1767.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
  1768. 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1769. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
  1770. };
  1771.  
  1772. CONST CHAR
  1773. ychl1[] = {  /* Swiss ISO 646 to Latin-1 */
  1774.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1775.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1776.  32,  33,  34, 249,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1777.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1778. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1779.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 233, 231, 234, 238, 232,
  1780. 244,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1781. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 252, 251, 127
  1782. };
  1783.  
  1784. CONST CHAR
  1785. yhul1[] = {  /* Hungarian ISO 646 to Latin-1 */
  1786.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1787.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1788.  32,  33,  34,  35, 164,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1789.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1790. 193,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1791.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 201, 214, 220,  94,  95,
  1792. 225,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1793. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 246, 252,  34, 127
  1794. };
  1795.  
  1796. CONST CHAR
  1797. ydml1[] = {  /* DEC Multinational Character Set to Latin-1 */
  1798. /* Note: This is a null translation */
  1799.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1800.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1801.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1802.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1803.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1804.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1805.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1806. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1807. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1808. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1809. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1810. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1811. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1812. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1813. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1814. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  1815. };
  1816.  
  1817. CONST CHAR
  1818. ydgl1[] = {  /* Data General International to Latin-1 */
  1819.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1820.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1821.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1822.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1823.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1824.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1825.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1826. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1827. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1828. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1829. 160, 172, 189, 181, 178, 179, 164, 162, 163, 170, 186, 161, 191, 169, 174, 175,
  1830. 187, 171, 182, 185, 253, 165, 177, 240, 208, 183, 184, 167, 176, 168, 180, 166,
  1831. 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
  1832. 209, 211, 210, 212, 214, 213, 216, 215, 218, 217, 219, 220, 190, 221, 222, 188,
  1833. 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
  1834. 241, 243, 242, 244, 246, 245, 248, 247, 250, 249, 251, 252, 223, 255, 254, 173
  1835. };
  1836.  
  1837.  
  1838. /* Translation tables for Cyrillic character sets */
  1839.  
  1840. #ifdef CYRILLIC
  1841. CONST CHAR
  1842. ylcac[] = {  /* Latin/Cyrillic to CP866 */
  1843.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1844.  16,  17,  18,  19, 208, 209,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1845.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1846.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1847.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1848.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1849.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1850. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1851. 196, 179, 192, 217, 191, 218, 195, 193, 180, 194, 197, 176, 177, 178, 211, 216,
  1852. 205, 186, 200, 188, 187, 201, 204, 202, 185, 203, 206, 223, 220, 219, 254, UNK,
  1853. 255, 240, 132, 131, 242,  83,  73, 244,  74, 139, 141, 151, 138,  45, 246, 135,
  1854. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1855. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1856. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1857. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1858. 252, 241, 164, 163, 243, 115, 105, 245, 106, 171, 173, 231, 170,  21, 247, 167
  1859. };
  1860.  
  1861. CONST CHAR
  1862. ylc55[] = {  /* Latin/Cyrillic to CP855 (inverse of y55lc) */
  1863.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1864.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1865.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1866.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1867.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1868.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1869.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1870. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1871. 174, 175, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194, 195,
  1872. 196, 197, 200, 201, 202, 203, 204, 205, 206, 207, 217, 218, 219, 220, 223, 254,
  1873. 255, 133, 129, 131, 135, 137, 139, 141, 143, 145, 147, 149, 151, 240, 153, 155,
  1874. 161, 163, 236, 173, 167, 169, 234, 244, 184, 190, 199, 209, 211, 213, 215, 221,
  1875. 226, 228, 230, 232, 171, 182, 165, 252, 246, 250, 159, 242, 238, 248, 157, 224,
  1876. 160, 162, 235, 172, 166, 168, 233, 243, 183, 189, 198, 208, 210, 212, 214, 216,
  1877. 225, 227, 229, 231, 170, 181, 164, 251, 245, 249, 158, 241, 237, 247, 156, 222,
  1878. 239, 132, 128, 130, 134, 136, 138, 140, 142, 144, 146, 148, 150, 253, 152, 154
  1879. };
  1880.  
  1881. CONST CHAR
  1882. ylc1251[] = {  /* Latin/Cyrillic to CP1251 (inverse of y1251lc) */
  1883.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1884.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1885.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1886.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1887.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1888.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1889.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1890. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1891. 130, 132, 133, 134, 135, 136, 137, 139, 145, 146, 147, 148, 149, 150, 151, 152,
  1892. 153, 155, 164, 165, 166, 169, 171, 172, 174, 176, 177, 180, 181, 182, 183, 187,
  1893. 160, 168, 128, 129, 170, 189, 178, 175, 163, 138, 140, 142, 141, 173, 161, 143,
  1894. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1895. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1896. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1897. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
  1898. 185, 184, 144, 131, 186, 190, 179, 191, 188, 154, 156, 158, 157, 167, 162, 159
  1899. };
  1900.  
  1901. CONST CHAR
  1902. ylcbu[] = {  /* Latin/Cyrillic to Bulgarian PC Code Page */
  1903.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1904.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1905.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1906.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1907.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1908.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1909.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1910. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1911. 255, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
  1912. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1913. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1914. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1915. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1916. 213, 207, 208, 209, 210, 211, 212, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1917. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1918. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 214, 253, 254
  1919. };
  1920.  
  1921. CONST CHAR
  1922. ylck8[] = {  /* Latin/Cyrillic to Old KOI-8 Cyrillic */
  1923.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1924.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1925.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1926.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1927.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1928.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1929.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1930. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1931. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1932. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1933. UNK, 229, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 235, UNK, 245, UNK,
  1934. 225, 226, 247, 231, 228, 229, 246, 250, 233, 234, 235, 236, 237, 238, 239, 240,
  1935. 242, 243, 244, 245, 230, 232, 227, 254, 251, 253, 255, 249, 248, 252, 224, 241,
  1936. 193, 194, 215, 199, 196, 197, 214, 218, 201, 202, 203, 204, 205, 206, 207, 208,
  1937. 210, 211, 212, 213, 198, 200, 195, 222, 219, 221, 223, 217, 216, 220, 192, 209,
  1938. UNK, 197, UNK, UNK, UNK, 115, 105, 105, 106, UNK, UNK, UNK, 203, UNK, 213, UNK
  1939. };
  1940.  
  1941. CONST CHAR
  1942. yaclc[] = {  /* CP866 to Latin/Cyrillic */
  1943. /* NEED TO MAKE THIS ONE INVERTIBLE */
  1944.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1945.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1946.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1947.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1948.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1949.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1950.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1951. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1952. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1953. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1954. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1955. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1956. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1957. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1958. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1959. 161, 241, 164, 244, 167, 247, 174, 254, UNK, UNK, UNK, UNK, 240, UNK, UNK, UNK
  1960. };
  1961.  
  1962. CONST CHAR
  1963. y55lc[] = {  /* CP855 to Latin/Cyrillic (inverse of ylc55) */
  1964.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1965.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1966.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1967.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1968.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1969.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1970.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1971. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1972. 242, 162, 243, 163, 241, 161, 244, 164, 245, 165, 246, 166, 247, 167, 248, 168,
  1973. 249, 169, 250, 170, 251, 171, 252, 172, 254, 174, 255, 175, 238, 206, 234, 202,
  1974. 208, 176, 209, 177, 230, 198, 212, 180, 213, 181, 228, 196, 211, 179, 128, 129,
  1975. 130, 131, 132, 133, 134, 229, 197, 216, 184, 135, 136, 137, 138, 217, 185, 139,
  1976. 140, 141, 142, 143, 144, 145, 218, 186, 146, 147, 148, 149, 150, 151, 152, 153,
  1977. 219, 187, 220, 188, 221, 189, 222, 190, 223, 154, 155, 156, 157, 191, 239, 158,
  1978. 207, 224, 192, 225, 193, 226, 194, 227, 195, 214, 182, 210, 178, 236, 204, 240,
  1979. 173, 235, 203, 215, 183, 232, 200, 237, 205, 233, 201, 231, 199, 253, 159, 160
  1980. };
  1981.  
  1982. CONST CHAR
  1983. y1251lc[] = {  /* CP1251 to Latin/Cyrillic (inverse of ylc1251) */
  1984.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1985.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1986.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1987.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1988.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1989.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1990.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1991. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1992. 162, 163, 128, 243, 129, 130, 131, 132, 133, 134, 169, 135, 170, 172, 171, 175,
  1993. 242, 136, 137, 138, 139, 140, 141, 142, 143, 144, 249, 145, 250, 252, 251, 255,
  1994. 160, 174, 254, 168, 146, 147, 148, 253, 161, 149, 164, 150, 151, 173, 152, 167,
  1995. 153, 154, 166, 246, 155, 156, 157, 158, 241, 240, 244, 159, 248, 165, 245, 247,
  1996. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1997. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1998. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1999. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239
  2000. };
  2001.  
  2002. CONST CHAR
  2003. ybulc[] = {  /* Bulgarian PC Code Page to Latin/Cyrillic */
  2004.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2005.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2006.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2007.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2008.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2009.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2010.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2011. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2012. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2013. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  2014. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  2015. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2016. 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 209,
  2017. 210, 211, 212, 213, 214, 208, 253, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2018. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2019. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 254, 255, 128
  2020. };
  2021.  
  2022. CONST CHAR
  2023. yk8lc[] = {  /* Old KOI-8 Cyrillic to Latin/Cyrillic */
  2024.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2025.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2026.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2027.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2028.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2029.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2030.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2031. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2032. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2033. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2034. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2035. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2036. 238, 208, 209, 230, 212, 213, 228, 211, 229, 216, 217, 218, 219, 220, 221, 222,
  2037. 223, 239, 224, 225, 226, 227, 214, 210, 236, 235, 215, 232, 237, 233, 231, 234,
  2038. 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
  2039. 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
  2040. };
  2041.  
  2042. CONST CHAR
  2043. ylcsk[] = {  /* Latin/Cyrillic to Short KOI */
  2044.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2045.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2046.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2047.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2048.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2049.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  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, 127,
  2052.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2053.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2054.  32, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107,  45, 117, UNK,
  2055.  97,  98, 119, 103, 100, 101, 118, 122, 105, 106, 107, 108, 109, 110, 111, 112,
  2056. 114, 115, 116, 117, 102, 104,  99, 126, 123, 125,  39, 121, 120, 124,  96, 113,
  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. UNK, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107, UNK, 117, UNK
  2060. };
  2061.  
  2062. CONST CHAR yskcy[] = {  /* Short KOI to Latin/Cyrillic */
  2063.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2064.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2065.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2066.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2067.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2068.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2069. 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
  2070. 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
  2071. };
  2072. #endif /* CYRILLIC */
  2073.  
  2074. #ifdef LATIN2
  2075.  
  2076. /* Latin-2 tables */
  2077.  
  2078. CONST CHAR
  2079. yl252[] = {                /* Latin-2 to Code Page 852 */
  2080.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2081.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2082.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2083.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2084.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2085.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2086.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2087. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2088. 174, 175, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194, 195,
  2089. 196, 197, 200, 201, 202, 203, 204, 205, 206, 217, 218, 219, 220, 223, 240, 254,
  2090. 255, 164, 244, 157, 207, 149, 151, 245, 249, 230, 184, 155, 141, 170, 166, 189,
  2091. 248, 165, 242, 136, 239, 150, 152, 243, 247, 231, 173, 156, 171, 241, 167, 190,
  2092. 232, 181, 182, 198, 142, 145, 143, 128, 172, 144, 168, 211, 183, 214, 215, 210,
  2093. 209, 227, 213, 224, 226, 138, 153, 158, 252, 222, 233, 235, 154, 237, 221, 225,
  2094. 234, 160, 131, 199, 132, 146, 134, 135, 159, 130, 169, 137, 216, 161, 140, 212,
  2095. 208, 228, 229, 162, 147, 139, 148, 246, 253, 133, 163, 251, 129, 236, 238, 250
  2096. };
  2097.  
  2098. CONST CHAR
  2099. y52l2[] = {                /* Code Page 852 to Latin-2 */
  2100.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2101.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2102.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2103.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2104.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2105.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2106.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2107. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2108. 199, 252, 233, 226, 228, 249, 230, 231, 179, 235, 213, 245, 238, 172, 196, 198,
  2109. 201, 197, 229, 244, 246, 165, 181, 166, 182, 214, 220, 171, 187, 163, 215, 232,
  2110. 225, 237, 243, 250, 161, 177, 174, 190, 202, 234, 173, 188, 200, 186, 128, 129,
  2111. 130, 131, 132, 133, 134, 193, 194, 204, 170, 135, 136, 137, 138, 175, 191, 139,
  2112. 140, 141, 142, 143, 144, 145, 195, 227, 146, 147, 148, 149, 150, 151, 152, 164,
  2113. 240, 208, 207, 203, 239, 210, 205, 206, 236, 153, 154, 155, 156, 222, 217, 157,
  2114. 211, 223, 212, 209, 241, 242, 169, 185, 192, 218, 224, 219, 253, 221, 254, 180,
  2115. 158, 189, 178, 183, 162, 167, 247, 184, 176, 168, 255, 251, 216, 248, 159, 160
  2116. };
  2117.  
  2118. CONST CHAR
  2119. yl21250[] = {                /* Latin-2 to Code Page 1250 */
  2120.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2121.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2122.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2123.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2124.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2125.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2126.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2127. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2128. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 139, 144, 145, 146, 147, 148,
  2129. 149, 150, 151, 152, 153, 155, 166, 169, 171, 172, 174, 177, 181, 182, 183, 187,
  2130. 160, 165, 162, 163, 164, 188, 140, 167, 168, 138, 170, 141, 143, 173, 142, 175,
  2131. 176, 185, 178, 179, 180, 190, 156, 161, 184, 154, 186, 157, 159, 189, 158, 191,
  2132. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2133. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2134. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2135. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  2136. };
  2137.  
  2138. CONST CHAR
  2139. y1250l2[] = {                /* Code Page 1250 to Latin-2 */
  2140.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2141.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2142.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2143.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2144.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2145.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2146.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2147. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2148. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 169, 138, 166, 171, 174, 172,
  2149. 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 185, 149, 182, 187, 190, 188,
  2150. 160, 183, 162, 163, 164, 161, 150, 167, 168, 151, 170, 152, 153, 173, 154, 175,
  2151. 176, 155, 178, 179, 180, 156, 157, 158, 184, 177, 186, 159, 165, 189, 181, 191,
  2152. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2153. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2154. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2155. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  2156. };
  2157.  
  2158. CONST CHAR
  2159. yl2mz[] = {                 /* Latin-2 to Mazovia (NOT invertible) */
  2160.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2161.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2162.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2163.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2164.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2165.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2166.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2167. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2168. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2169. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2170. 255, 143, UNK, 156, 155,  76, 152,  21,  34,  83,  83,  84, 160,  45,  90, 161,
  2171. 248, 134,  44, 146,  39, 108, 158, UNK,  44, 115, 115, 116, 166,  34, 122, 167,
  2172.  82,  65,  65,  65, 142,  76, 149, 128,  67,  69, 144,  69,  69,  73,  73,  68,
  2173.  68, 165,  78, 163,  79, 153, 153, 250,  82,  85,  85, 154, 154,  89,  84, 225,
  2174. 114,  97, 131,  97, 132, 108, 141, 135,  99, 130, 145, 137, 101, 105, 140, 101,
  2175. 100, 164, 110, 162, 147, 148, 148, 246, 114, 117, 117, 129, 129, 121, 116, 249
  2176. };
  2177.  
  2178. CONST CHAR
  2179. ymzl2[] = {                 /* Mazovia to Latin-2 (NOT INVERTIBLE) */
  2180.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2181.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2182.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2183.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2184.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2185.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2186.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2187. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2188. 128, 252, 233, 226, 228,  97, 177, 231, 101, 235, 101, 105, 238, 230, 196, 161,
  2189. 202, 234, 179, 244, 246, 198, 117, 117, 166, 214, 220, 164, 163,  89, 182, 102,
  2190. 172, 175, 243, 211, 242, 210, 188, 191,  63, UNK, UNK, UNK, UNK,  33,  34,  34,
  2191. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2192. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2193. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2194. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2195. UNK, UNK, UNK, UNK, UNK, UNK, 247, UNK, 176, 255, 215, UNK, UNK, UNK, UNK, 160
  2196. };
  2197.  
  2198. CONST CHAR
  2199. yl2l1[] = {                /* Latin-2 to Latin-1 */
  2200.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2201.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2202.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2203.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2204.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2205.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2206.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2207. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2208. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2209. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2210. 160, 'A', UNK, 'L', 164, 'L', 'S', 167, 168, 'S', 'S', 'T', 'Z', 173, 'Z', 'Z',
  2211. 176, 'a', UNK, 'l', 180, 'l', 's', UNK, 184, 's', 's', 't', 'z', UNK, 'z', 'z',
  2212. 'R', 193, 194, 'A', 196, 'L', 'C', 199, 'C', 201, 'E', 203, 'E', 205, 'I', 'D',
  2213. 208, 'N', 'N', 211, 212, 'O', 214, 215, 'R', 'U', 218, 'U', 220, 221, 'T', 223,
  2214. 'r', 225, 226, 'a', 228, 'l', 'c', 231, 'c', 233, 'e', 235, 'e', 237, 'i', 'd',
  2215. 240, 'n', 'n', 243, 244, 'o', 246, 247, 'r', 'u', 250, 'u', 252, 253, 't', '.'
  2216. };
  2217.  
  2218. CONST CHAR
  2219. yl1l2[] = {                /* Latin-1 to Latin-2 */
  2220.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2221.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2222.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2223.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2224.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2225.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2226.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2227. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2228. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2229. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  2230. 160, 'A', UNK, 'L', 164, UNK, UNK, 167, 168, 'C', 'a', '<', '>', 173, 'R', UNK,
  2231. 176, UNK, UNK, UNK, 180, UNK, UNK, UNK, 184, UNK, 'o', '>', UNK, UNK, UNK, UNK,
  2232. 'A', 193, 194, 'A', 196, 'A', 'A', 199, 'E', 201, 'E', 203, 'I', 205, 'I', 'I',
  2233. 208, 'N', 'O', 211, 212, 'O', 214, 215, 'O', 'U', 218, 'U', 220, 221, UNK, 223,
  2234. 'a', 225, 226, 'a', 228, 'a', 'a', 231, 'e', 233, 'e', 235, 'i', 237, 'i', 'i',
  2235. 240, 'n', 'o', 243, 244, 'o', 246, 247, 'o', 'u', 250, 'u', 252, 253, UNK, 'y'
  2236. };
  2237.  
  2238. CONST CHAR
  2239. yl2as[] = {                /* Latin-2 to ASCII */
  2240.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2241.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2242.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2243.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2244.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2245.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2246.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2247. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2248. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2249. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2250.  32, 'A', UNK, 'L', UNK, 'L', 'S', UNK,  34, 'S', 'S', 'T', 'Z', '-', 'Z', 'Z',
  2251. UNK, 'a', UNK, 'l',  39, 'l', 's', UNK,  44, 's', 's', 't', 'z', UNK, 'z', 'z',
  2252. 'R', 'A', 'A', 'A', 'A', 'L', 'C', 'C', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'D',
  2253. 'D', 'N', 'N', 'O', 'O', 'O', 'O', 'x', 'R', 'U', 'U', 'U', 'U', 'Y', 'T', 's',
  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', '/', 'r', 'u', 'u', 'u', 'u', 'y', 't', '.'
  2256. };
  2257. #endif /* LATIN2 */
  2258.  
  2259. #ifdef HEBREW
  2260. /*
  2261.   8-bit Tables providing invertible translation between Latin/Hebrew and CP862.
  2262. */
  2263. CONST CHAR
  2264. y62lh[] = {  /* PC Code Page 862 to ISO 8859-8 Latin/Hebrew */
  2265.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2266.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2267.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2268.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2269.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2270.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2271.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2272. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2273. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  2274. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 162, 163, 165, 128, 129,
  2275. 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 172, 189, 188, 140, 171, 187,
  2276. 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
  2277. 157, 158, 159, 161, 164, 166, 167, 168, 169, 170, 173, 174, 175, 223, 179, 180,
  2278. 182, 184, 185, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
  2279. 203, 204, 205, 206, 207, 208, 181, 209, 210, 211, 212, 213, 214, 215, 216, 217,
  2280. 218, 177, 219, 220, 221, 222, 186, 251, 176, 183, 252, 253, 254, 178, 255, 160
  2281. };
  2282.  
  2283. CONST CHAR
  2284. ylh62[] = {  /* ISO 8859-8 Latin/Hebrew to PC Code Page 862 */
  2285.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2286.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2287.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2288.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2289.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2290.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2291.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2292. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2293. 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 173, 176, 177, 178,
  2294. 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
  2295. 255, 195, 155, 156, 196, 157, 197, 198, 199, 200, 201, 174, 170, 202, 203, 204,
  2296. 248, 241, 253, 206, 207, 230, 208, 249, 209, 210, 246, 175, 172, 171, 211, 212,
  2297. 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
  2298. 229, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 205,
  2299. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  2300. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 247, 250, 251, 252, 254
  2301. };
  2302. /*
  2303.   7-bit table providing readable translation from DEC Hebrew-7 to CP862.
  2304. */
  2305. CONST CHAR
  2306. yh762[] = {
  2307.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2308.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2309.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2310.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2311.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2312.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2313. UNK,  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, 123, 124, 125, 126, 127
  2315. };
  2316. /*
  2317.   8-bit table providing readable translation from CP862 to Hebrew-7.
  2318. */
  2319. CONST CHAR
  2320. y62h7[] = {  /* PC Code Page 862 to Hebrew-7 */
  2321.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2322.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2323.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2324.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2325.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2326.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  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, 123, 124, 125, 126, 127,
  2329.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2330. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, UNK,
  2331. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2332. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, 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. };
  2338. /*
  2339.   7-bit table providing readable translation from Hebrew-7 to ISO Latin/Hebrew.
  2340. */
  2341. CONST CHAR
  2342. yh7lh[] = {
  2343.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2344.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2345.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2346.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2347.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2348.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2349. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  2350. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 123, 124, 125, 126, 127
  2351. };
  2352. /*
  2353.   8-bit table providing readable translation from ISO Latin/Hebrew to Hebrew-7.
  2354. */
  2355. CONST CHAR
  2356. ylhh7[] = {  /* Latin/Hebrew to Hebrew-7 */
  2357.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2358.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2359.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2360.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2361.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2362.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  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, 123, 124, 125, 126, 127,
  2365. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2366. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  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.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2372. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, UNK
  2373. };
  2374. #endif /* HEBREW */
  2375.  
  2376. #ifdef GREEK
  2377. /*
  2378.   8-bit Tables providing invertible translation between Latin/Greek and CP869.
  2379. */
  2380. CONST CHAR
  2381. ylg69[] = {  /* ISO 8859-7 Latin/Greek to PC Code Page 869 */
  2382.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2383.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2384.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2385.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2386.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2387.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2388.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2389. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2390. 135, 147, 148, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194,
  2391. 195, 196, 197, 200, 201, 202, 203, 204, 205, 206, 217, 218, 219, 220, 223, 254,
  2392. 255, 139, 140, 156, 128, 129, 138, 245, 249, 151, 130, 174, 137, 240, 131, 142,
  2393. 248, 241, 153, 154, 239, 247, 134, 136, 141, 143, 144, 175, 146, 171, 149, 152,
  2394. 161, 164, 165, 166, 167, 168, 169, 170, 172, 173, 181, 182, 183, 184, 189, 190,
  2395. 198, 199, 132, 207, 208, 209, 210, 211, 212, 213, 145, 150, 155, 157, 158, 159,
  2396. 252, 214, 215, 216, 221, 222, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
  2397. 234, 235, 237, 236, 238, 242, 243, 244, 246, 250, 160, 251, 162, 163, 253, 133
  2398. };
  2399.  
  2400. CONST CHAR
  2401. y69lg[] = {  /* PC Code Page 869 to ISO 8859-7 Latin/Greek */
  2402.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2403.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2404.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2405.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2406.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2407.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2408.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2409. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  2410. 164, 165, 170, 174, 210, 255, 182, 128, 183, 172, 166, 161, 162, 184, 175, 185,
  2411. 186, 218, 188, 129, 130, 190, 219, 169, 191, 178, 179, 220, 163, 221, 222, 223,
  2412. 250, 192, 252, 253, 193, 194, 195, 196, 197, 198, 199, 189, 200, 201, 171, 187,
  2413. 131, 132, 133, 134, 135, 202, 203, 204, 205, 136, 137, 138, 139, 206, 207, 140,
  2414. 141, 142, 143, 144, 145, 146, 208, 209, 147, 148, 149, 150, 151, 152, 153, 211,
  2415. 212, 213, 214, 215, 216, 217, 225, 226, 227, 154, 155, 156, 157, 228, 229, 158,
  2416. 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 243, 242, 244, 180,
  2417. 173, 177, 245, 246, 247, 167, 248, 181, 176, 168, 249, 251, 224, 254, 159, 160
  2418. };
  2419. /*
  2420.   7-bit table providing readable translation from ELOT 927 to CP869.
  2421. */
  2422. CONST CHAR
  2423. yeg69[] = {
  2424.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2425.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2426.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2427.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2428.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2429.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2430.  96, 164, 165, 166, 167, 168, 169, 170, 172, 173, 181, 182, 183, 184, 189, 190,
  2431. 198, 199, 207, 208, 209, 210, 211, 212, 213,  32,  32,  23, 124, 125, 126, 127
  2432. };
  2433. /*
  2434.   8-bit table providing readable translation from CP869 to ELOT 927.
  2435. */
  2436. CONST CHAR
  2437. y69eg[] = {  /* PC Code Page 869 to ELOT 927 */
  2438.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2439.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2440.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2441.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2442.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2443.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2444.  96,  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, 123, 124, 125, 126, 127,
  2446. UNK, UNK, UNK, UNK, UNK, UNK,  97, UNK,  46, UNK, 124,  39,  39, 101,  45, 103,
  2447. 105, 105, 111, UNK, UNK, 116, 116, UNK, 120,  50,  51,  97, UNK, 101, 103, 105,
  2448. 105, 105, 111, 116,  97,  98,  99, 100, 101, 102, 103, UNK, 104, 105,  34,  34,
  2449. UNK, UNK, UNK, UNK, UNK, 106, 107, 108, 109, UNK, UNK, UNK, UNK, 110, 111, UNK,
  2450. UNK, UNK, UNK, UNK, UNK, UNK, 112, 113, UNK, UNK, UNK, UNK, UNK, UNK, UNK, 114,
  2451. 115, 116, 117, 118, 119, 120,  97,  98,  99, UNK, UNK, UNK, UNK, 100, 101, UNK,
  2452. 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115,  39,
  2453.  45, UNK, 116, 117, 118, UNK, 119, UNK, UNK, UNK, 120, 116, 116, 120, UNK,  32
  2454.  
  2455. };
  2456. /*
  2457.   7-bit table providing readable translation from ELOT 927 to ISO Latin/Greek.
  2458. */
  2459. CONST CHAR
  2460. yeglg[] = {
  2461.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2462.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2463.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2464.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2465.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2466.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2467.  96, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  2468. 208, 209, 211, 212, 213, 214, 215, 216, 217,  32,  32, 123, 124, 125, 126, 127
  2469. };
  2470. /*
  2471.   8-bit table providing readable translation from ISO Latin/Greek to ELOT 927.
  2472. */
  2473. CONST CHAR
  2474. ylgeg[] = {  /* Latin/Greek to ELOT 927 */
  2475.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  2476.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  2477.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  2478.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  2479.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  2480.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  2481.  96,  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, 123, 124, 125, 126, 127,
  2483. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2484. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  2485.  32,  39,  39, UNK, UNK, UNK, 124, UNK,  34, UNK, UNK,  34, UNK,  45, UNK,  45,
  2486. UNK, UNK,  50,  51,  39, UNK,  97,  46, 101, 103, 105,  34, 111, UNK, 116, 120,
  2487. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2488. 112, 113, UNK, 114, 115, 116, 117, 118, 119, 120, 105, 116,  97, 101, 103, 105,
  2489. 116,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2490. 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 105, 116, 111, 116, 120, UNK
  2491. };
  2492. #endif /* GREEK */
  2493.  
  2494. /* Translation functions ... */
  2495.  
  2496. CHAR                    /* The identity function... */
  2497. #ifdef CK_ANSIC
  2498. ident(CHAR c)                /* (no longer used) */
  2499. #else
  2500. ident(c) CHAR c;
  2501. #endif /* CK_ANSIC */
  2502. { /* ident */
  2503.     return(c);                /* Instead, enter NULL in the  */
  2504. }                    /* table of functions to avoid */
  2505.                     /* needless function calls.    */
  2506.  
  2507. CHAR
  2508. #ifdef CK_ANSIC
  2509. xleft128(CHAR c)
  2510. #else
  2511. xleft128(c) CHAR c;
  2512. #endif /* CK_ANSIC */
  2513. { /* xleft128 */
  2514.     return((c < 128) ? c : '?');
  2515. }
  2516.  
  2517. CHAR
  2518. #ifdef CK_ANSIC
  2519. xleft160(CHAR c)
  2520. #else
  2521. xleft160(c) CHAR c;
  2522. #endif /* CK_ANSIC */
  2523. { /* xleft160 */
  2524.     return((c < 160) ? c : '?');
  2525. }
  2526.  
  2527.  
  2528. CHAR
  2529. #ifdef CK_ANSIC
  2530. xl1as(CHAR c)
  2531. #else
  2532. xl1as(c) CHAR c;
  2533. #endif /* CK_ANSIC */
  2534. { /* xl1as */                 /* Latin-1 to US ASCII... */
  2535.     switch(langs[language].id) {
  2536.  
  2537.       case L_DUTCH:
  2538.     if (c == 255) {            /* Dutch umlaut-y */
  2539.         zmstuff('j');        /* becomes ij */
  2540.         return('i');
  2541.     } else return(yl1as[c]);    /* all others by the book */
  2542.  
  2543.       case L_GERMAN:
  2544.     switch (c) {            /* German, special rules. */
  2545.       case 196:            /* umlaut-A -> Ae */
  2546.         zmstuff('e');
  2547.         return('A');
  2548.       case 214:            /* umlaut-O -> Oe */
  2549.         zmstuff('e');
  2550.         return('O');
  2551.       case 220:            /* umlaut-U -> Ue */
  2552.         zmstuff('e');
  2553.         return('U');
  2554.       case 228:            /* umlaut-a -> ae */
  2555.         zmstuff('e');
  2556.         return('a');
  2557.       case 246:            /* umlaut-o -> oe */
  2558.         zmstuff('e');
  2559.         return('o');
  2560.       case 252:            /* umlaut-u -> ue */
  2561.         zmstuff('e');
  2562.         return('u');
  2563.       case 223:            /* ess-zet -> ss */
  2564.         zmstuff('s');
  2565.         return('s');
  2566.       default: return(yl1as[c]);    /* all others by the book */
  2567.     }
  2568.       case L_DANISH:
  2569.       case L_FINNISH:
  2570.       case L_NORWEGIAN:
  2571.       case L_SWEDISH:
  2572.     switch (c) {            /* Scandanavian languages. */
  2573.       case 196:            /* umlaut-A -> Ae */
  2574.           case 198:            /* AE ligature also -> Ae */
  2575.         zmstuff('e');
  2576.         return('A');
  2577.       case 214:            /* umlaut-O -> Oe */
  2578.       case 216:            /* O-slash -> Oe */
  2579.         zmstuff('e');
  2580.         return('O');
  2581.       case 220:            /* umlaut-U -> Ue */
  2582.       /*  return('Y'); replaced by "Ue" by popular demand. */
  2583.           /*  Y for Umlaut-U is only used in German names. */
  2584.         zmstuff('e');
  2585.         return('U');
  2586.       case 228:            /* umlaut-a -> ae */
  2587.           case 230:            /* ditto for ae ligature */
  2588.         zmstuff('e');
  2589.         return('a');
  2590.       case 246:            /* umlaut-o -> oe */
  2591.       case 248:            /* o-slash -> oe */
  2592.         zmstuff('e');
  2593.         return('o');
  2594.       case 252:            /* umlaut-u -> ue */
  2595.       /*  return('y'); replaced by "ue" by popular demand. */
  2596.         zmstuff('e');
  2597.         return('u');
  2598.       case 197:            /* A-ring -> Aa */
  2599.         zmstuff('a');
  2600.         return('A');
  2601.           case 229:            /* a-ring -> aa */
  2602.         zmstuff('a');
  2603.         return('a');
  2604.       default: return(yl1as[c]);    /* All others by the book */
  2605.     }
  2606.       case L_ICELANDIC:            /* Icelandic. */
  2607.     switch (c) {
  2608.       case 198:            /* uppercase AE -> AE */
  2609.         zmstuff('e');
  2610.         return('A');
  2611.       case 208:            /* uppercase Eth -> D */
  2612.         return('D');
  2613.       case 214:            /* uppercase O-diaeresis -> Oe */
  2614.         zmstuff('e');
  2615.         return('O');
  2616.       case 222:            /* uppercase Thorn -> Th */
  2617.         zmstuff('h');
  2618.         return('T');
  2619.       case 230:            /* lowercase ae -> ae */
  2620.         zmstuff('e');
  2621.         return('a');
  2622.       case 240:            /* lowercase Eth -> d */
  2623.         return('d');
  2624.       case 246:            /* lowercase O-diaeresis -> oe */
  2625.         zmstuff('e');
  2626.         return('o');
  2627.       case 254:            /* lowercase Thorn -> th */
  2628.         zmstuff('h');
  2629.         return('t');
  2630.       default: return(yl1as[c]);    /* All others by the book */
  2631.     }
  2632.       default:
  2633.     return(yl1as[c]);        /* None of the above, by the table. */
  2634.     }
  2635. }
  2636.  
  2637. CHAR                    /* CP1252 to ASCII */
  2638. #ifdef CK_ANSIC
  2639. xw1as(CHAR c)
  2640. #else
  2641. xw1as(c) CHAR c;
  2642. #endif /* CK_ANSIC */
  2643. { /* xw1as */
  2644.     switch(c) {                /* Microsoft name... */
  2645.       case 0x80: return('?');        /* Euro Sign */
  2646.       case 0x82: return('\047');    /* Single Low-9 Quotation Mark */
  2647.       case 0x83: return('f');        /* Latin Small Letter f with Hook */
  2648.       case 0x84: return('"');        /* Double low-9 Quotation Mark */
  2649.       case 0x85: return('-');        /* Horizontal Ellipsis */
  2650.       case 0x86: return('+');        /* Dagger */
  2651.       case 0x87: return('+');        /* Double Dagger */
  2652.       case 0x88: return('^');        /* Modifier Letter Circumflex Accent */
  2653.       case 0x89: return('?');        /* Per Mille Sign */
  2654.       case 0x8A: return('S');        /* Latin Capital Letter S with Caron */
  2655.       case 0x8B: return('<');        /* Single Left Angle Quotation Mark */
  2656.       case 0x8C: return('O');        /* Latin Capital Ligature OE */
  2657.       case 0x8E: return('Z');        /* Latin Capital Letter Z with Caron */
  2658.       case 0x91: return('\047');    /* Left Single Quotation Mark */
  2659.       case 0x92: return('\047');    /* Right Single Quotation Mark */
  2660.       case 0x93: return('"');        /* Left Double Quotation Mark */
  2661.       case 0x94: return('"');        /* Right Double Quotation Mark */
  2662.       case 0x95: return('.');        /* Bullet */
  2663.       case 0x96: return('-');        /* En Dash */
  2664.       case 0x97: return('-');        /* Em Dash */
  2665.       case 0x98: return('~');        /* Small Tilde */
  2666.       case 0x99: return('T');        /* Trade Mark Sign */
  2667.       case 0x9A: return('s');        /* Latin Small Letter s with Caron */
  2668.       case 0x9B: return('>');        /* Single Right Angle Quotation Mark */
  2669.       case 0x9C: return('o');        /* Latin Small Ligature OE */
  2670.       case 0x9E: return('z');        /* Latin Small Letter z with Caron */
  2671.       case 0x9F: return('Y');        /* Latin Capital Letter Y Diaeresis */
  2672.       default:
  2673.     if (c > 0x80 && c < 0xa0)
  2674.       return('?');
  2675.     else
  2676.       return(yl1as[c]);
  2677.     }
  2678. }
  2679.  
  2680. CHAR                    /* CP1252 to Latin-1 */
  2681. #ifdef CK_ANSIC
  2682. xw1l1(CHAR c)
  2683. #else
  2684. xw1l1(c) CHAR c;
  2685. #endif /* CK_ANSIC */
  2686. { /* xw1l1 */
  2687.     if (c == 0x95) return(0xb7);    /* Middle dot */
  2688.     return((c < 160) ? xw1as(c) : c);
  2689. }
  2690.  
  2691. CHAR                    /* Latin-1 to German */
  2692. #ifdef CK_ANSIC
  2693. xl1ge(CHAR c)
  2694. #else
  2695. xl1ge(c) CHAR c;
  2696. #endif /* CK_ANSIC */
  2697. { /* xl1ge */
  2698.     return(yl1ge[c]);
  2699. }
  2700.  
  2701. CHAR                    /* German to Latin-1 */
  2702. #ifdef CK_ANSIC
  2703. xgel1(CHAR c)
  2704. #else
  2705. xgel1(c) CHAR c;
  2706. #endif /* CK_ANSIC */
  2707. { /* xgel1 */
  2708.     if (c & 0x80)
  2709.       return(UNK);
  2710.     return(ygel1[c]);
  2711. }
  2712.  
  2713. CHAR
  2714. #ifdef CK_ANSIC
  2715. xgeas(CHAR c)
  2716. #else
  2717. xgeas(c) CHAR c;
  2718. #endif /* CK_ANSIC */
  2719. { /* xgeas */                /* German ISO 646 to ASCII */
  2720.     if (c & 0x80)
  2721.       return(UNK);
  2722.     switch (c) {
  2723.       case 91:                /* umlaut-A -> Ae */
  2724.     zmstuff('e');
  2725.     return('A');
  2726.       case 92:                /* umlaut-O -> Oe */
  2727.     zmstuff('e');
  2728.     return('O');
  2729.       case 93:                /* umlaut-U -> Ue */
  2730.     zmstuff('e');
  2731.     return('U');
  2732.       case 123:                /* umlaut-a -> ae */
  2733.     zmstuff('e');
  2734.     return('a');
  2735.       case 124:                /* umlaut-o -> oe */
  2736.     zmstuff('e');
  2737.     return('o');
  2738.       case 125:                /* umlaut-u -> ue */
  2739.     zmstuff('e');
  2740.     return('u');
  2741.       case 126:                /* ess-zet -> ss */
  2742.     zmstuff('s');
  2743.     return('s');
  2744.       default:  return(c);        /* all others stay the same */
  2745.     }
  2746. }
  2747.  
  2748. CHAR
  2749. #ifdef CK_ANSIC
  2750. xl1w1(CHAR c)
  2751. #else
  2752. xl1w1(c) CHAR c;
  2753. #endif /* CK_ANSIC */
  2754. { /* xl1w1 */                /* Latin-1 to CP1252 (Windows L1) */
  2755.     if (c > 127 && c < 160)
  2756.       return(UNK);
  2757.     else
  2758.       return(c);
  2759. }
  2760.  
  2761. CHAR
  2762. #ifdef CK_ANSIC
  2763. xduas(CHAR c)
  2764. #else
  2765. xduas(c) CHAR c;
  2766. #endif /* CK_ANSIC */
  2767. { /* xduas */                /* Dutch ISO 646 to US ASCII */
  2768.     if (c & 0x80)
  2769.       return(UNK);
  2770.     switch (c) {
  2771.       case 64:  return(UNK);        /* 3/4 */
  2772.       case 91:                /* y-diaeresis */
  2773.     zmstuff('j');
  2774.     return('i');
  2775.       case 92:  return(UNK);        /* 1/2 */
  2776.       case 93:  return(124);        /* vertical bar */
  2777.       case 123: return(34);        /* diaeresis */
  2778.       case 124: return(UNK);        /* Florin */
  2779.       case 125: return(UNK);        /* 1/4 */
  2780.       case 126: return(39);        /* Apostrophe */
  2781.       default:  return(c);
  2782.     }
  2783. }
  2784.  
  2785. CHAR
  2786. #ifdef CK_ANSIC
  2787. xfias(CHAR c)
  2788. #else
  2789. xfias(c) CHAR c;
  2790. #endif /* CK_ANSIC */
  2791. { /* xfias */                /* Finnish ISO 646 to US ASCII */
  2792.     if (c & 0x80)
  2793.       return(UNK);
  2794.     switch (c) {
  2795.       case 91:                /* A-diaeresis */
  2796.     zmstuff('e');
  2797.     return('A');
  2798.       case 92:                /* O-diaeresis */
  2799.     zmstuff('e');
  2800.     return('O');
  2801.       case 93:                /* A-ring */
  2802.     zmstuff('a');
  2803.     return('A');
  2804.       case 94:                /* U-diaeresis */
  2805.     /* return('Y'); */
  2806.     zmstuff('e');
  2807.     return('U');
  2808.       case 96:                /* e-acute */
  2809.     return('e');
  2810.       case 123:                /* a-diaeresis */
  2811.     zmstuff('e');
  2812.     return('a');
  2813.       case 124:                /* o-diaeresis */
  2814.     zmstuff('e');
  2815.     return('o');
  2816.       case 125:                /* a-ring */
  2817.     zmstuff('a');
  2818.     return('a');
  2819.       case 126:                /* u-diaeresis */
  2820.     /* return('y'); */
  2821.     zmstuff('e');
  2822.     return('U');
  2823.       default:
  2824.     return(c);
  2825.     }
  2826. }
  2827.  
  2828. CHAR
  2829. #ifdef CK_ANSIC
  2830. xfras(CHAR c)
  2831. #else
  2832. xfras(c) CHAR c;
  2833. #endif /* CK_ANSIC */
  2834. { /* xfras */                /* French ISO 646 to US ASCII */
  2835.     if (c & 0x80)
  2836.       return(UNK);
  2837.     switch (c) {
  2838.       case 64:  return(97);        /* a grave */
  2839.       case 91:  return(UNK);        /* degree sign */
  2840.       case 92:  return(99);        /* c cedilla */
  2841.       case 93:  return(UNK);        /* paragraph sign */
  2842.       case 123: return(101);        /* e acute */
  2843.       case 124: return(117);        /* u grave */
  2844.       case 125: return(101);        /* e grave */
  2845.       case 126: return(34);        /* diaeresis */
  2846.       default:  return(c);
  2847.     }
  2848. }
  2849.  
  2850. CHAR
  2851. #ifdef CK_ANSIC
  2852. xfcas(CHAR c)
  2853. #else
  2854. xfcas(c) CHAR c;
  2855. #endif /* CK_ANSIC */
  2856. { /* xfcas */                /* French Canadian ISO 646 to ASCII */
  2857.     if (c & 0x80)
  2858.       return(UNK);
  2859.     switch (c) {
  2860.       case 64:  return('a');        /* a grave */
  2861.       case 91:  return('a');        /* a circumflex */
  2862.       case 92:  return('c');        /* c cedilla */
  2863.       case 93:  return('e');        /* e circumflex */
  2864.       case 94:  return('i');        /* i circumflex */
  2865.       case 96:  return('o');        /* o circumflex */
  2866.       case 123: return('e');        /* e acute */
  2867.       case 124: return('u');        /* u grave */
  2868.       case 125: return('e');        /* e grave */
  2869.       case 126: return('u');        /* u circumflex */
  2870.       default:  return(c);
  2871.     }
  2872. }
  2873.  
  2874. CHAR
  2875. #ifdef CK_ANSIC
  2876. xitas(CHAR c)
  2877. #else
  2878. xitas(c) CHAR c;
  2879. #endif /* CK_ANSIC */
  2880. { /* xitas */                /* Italian ISO 646 to ASCII */
  2881.     if (c & 0x80)
  2882.       return(UNK);
  2883.     switch (c) {
  2884.       case 91:  return(UNK);        /* degree */
  2885.       case 92:  return('c');        /* c cedilla */
  2886.       case 93:  return('e');        /* e acute */
  2887.       case 96:  return('u');        /* u grave */
  2888.       case 123: return('a');        /* a grave */
  2889.       case 124: return('o');        /* o grave */
  2890.       case 125: return('e');        /* e grave */
  2891.       case 126: return('i');        /* i grave */
  2892.       default:  return(c);
  2893.     }
  2894. }
  2895.  
  2896. CHAR
  2897. #ifdef CK_ANSIC
  2898. xneas(CHAR c)
  2899. #else
  2900. xneas(c) CHAR c;
  2901. #endif /* CK_ANSIC */
  2902. { /* xneas */                /* NeXT to ASCII */
  2903.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2904.     if (c == 234) {            /* handle OE digraph. */
  2905.         zmstuff('E');
  2906.         return('O');
  2907.     } else if (c == 250) {        /* Also lowercase oe. */
  2908.         zmstuff('e');
  2909.         return('o');
  2910.     }
  2911.     }
  2912.     c = xnel1(c);            /* Convert to Latin-1 */
  2913.     return(yl1as[c]);            /* Convert Latin-1 to ASCII */
  2914. }
  2915.  
  2916. CHAR
  2917. #ifdef CK_ANSIC
  2918. xnoas(CHAR c)
  2919. #else
  2920. xnoas(c) CHAR c;
  2921. #endif /* CK_ANSIC */
  2922. { /* xnoas */                /* Norge/Danish ISO 646 to ASCII */
  2923.     if (c & 0x80)
  2924.       return(UNK);
  2925.     switch (c) {
  2926.       case 91:
  2927.     zmstuff('E');            /* AE digraph */
  2928.     return('A');
  2929.       case 92: return('O');        /* O slash */
  2930.       case 93:                /* A ring */
  2931.     zmstuff('a');
  2932.     return('A');
  2933.       case 123:                /* ae digraph */
  2934.     zmstuff('e');
  2935.     return('a');
  2936.       case 124: return('o');        /* o slash */
  2937.       case 125:                /* a ring */
  2938.     zmstuff('a');
  2939.     return('a');
  2940.       default:  return(c);
  2941.     }
  2942. }
  2943.  
  2944. CHAR
  2945. #ifdef CK_ANSIC
  2946. xpoas(CHAR c)
  2947. #else
  2948. xpoas(c) CHAR c;
  2949. #endif /* CK_ANSIC */
  2950. { /* xpoas */                /* Portuguese ISO 646 to ASCII */
  2951.     if (c & 0x80)
  2952.       return(UNK);
  2953.     switch (c) {
  2954.       case 91:  return('A');        /* A tilde */
  2955.       case 92:  return('C');        /* C cedilla */
  2956.       case 93:  return('O');        /* O tilde */
  2957.       case 123: return('a');        /* a tilde */
  2958.       case 124: return('c');        /* c cedilla */
  2959.       case 125: return('o');        /* o tilde */
  2960.       default:  return(c);
  2961.     }
  2962. }
  2963.  
  2964. CHAR
  2965. #ifdef CK_ANSIC
  2966. xspas(CHAR c)
  2967. #else
  2968. xspas(c) CHAR c;
  2969. #endif /* CK_ANSIC */
  2970. { /* xspas */                /* Spanish ISO 646 to ASCII */
  2971.     if (c & 0x80)
  2972.       return(UNK);
  2973.     switch (c) {
  2974.       case 91:  return(33);        /* Inverted exclamation */
  2975.       case 92:  return('N');        /* N tilde */
  2976.       case 93:  return(63);        /* Inverted question mark */
  2977.       case 123: return(UNK);        /* degree */
  2978.       case 124: return('n');        /* n tilde */
  2979.       case 125: return('c');        /* c cedilla */
  2980.       default:  return(c);
  2981.     }
  2982. }
  2983.  
  2984. CHAR
  2985. #ifdef CK_ANSIC
  2986. xswas(CHAR c)
  2987. #else
  2988. xswas(c) CHAR c;
  2989. #endif /* CK_ANSIC */
  2990. { /* xswas */                /* Swedish ISO 646 to ASCII */
  2991.     if (c & 0x80)
  2992.       return(UNK);
  2993.     switch (c) {
  2994.       case 64:  return('E');        /* E acute */
  2995.       case 91:                /* A diaeresis */
  2996.     zmstuff('e');
  2997.     return('A');
  2998.       case 92:                /* O diaeresis */
  2999.     zmstuff('e');
  3000.     return('O');
  3001.       case 93:                /* A ring */
  3002.     zmstuff('a');
  3003.     return('A');
  3004.       case 94:                /* U diaeresis */
  3005.     /* return('Y'); */
  3006.     zmstuff('e');
  3007.     return('U');
  3008.       case 96:  return('e');        /* e acute */
  3009.       case 123:                /* a diaeresis */
  3010.     zmstuff('e');
  3011.     return('a');
  3012.       case 124:                /* o diaeresis */
  3013.     zmstuff('e');
  3014.     return('o');
  3015.       case 125:                /* a ring */
  3016.     zmstuff('a');
  3017.     return('a');
  3018.       case 126:                /* u diaeresis */
  3019.     /* return('y'); */
  3020.     zmstuff('e');
  3021.     return('u');
  3022.       default:  return(c);
  3023.     }
  3024. }
  3025.  
  3026. CHAR
  3027. #ifdef CK_ANSIC
  3028. xchas(CHAR c)
  3029. #else
  3030. xchas(c) CHAR c;
  3031. #endif /* CK_ANSIC */
  3032. { /* xchas */                /* Swiss ISO 646 to ASCII */
  3033.     if (c & 0x80)
  3034.       return(UNK);
  3035.     switch (c) {
  3036.       case 35:  return('u');        /* u grave */
  3037.       case 64:  return('a');        /* a grave */
  3038.       case 91:  return('e');        /* e acute */
  3039.       case 92:  return('c');        /* c cedilla */
  3040.       case 93:  return('e');        /* e circumflex */
  3041.       case 94:  return('i');        /* i circumflex */
  3042.       case 95:  return('e');        /* e grave */
  3043.       case 96:  return('o');        /* o circumflex */
  3044.       case 123:                /* a diaeresis */
  3045.     zmstuff('e');
  3046.     return('a');
  3047.       case 124:                /* o diaeresis */
  3048.     zmstuff('e');
  3049.     return('o');
  3050.       case 125:                /* u diaeresis */
  3051.     zmstuff('e');
  3052.     return('u');
  3053.       case 126: return('u');        /* u circumflex */
  3054.       default:  return(c);
  3055.     }
  3056. }
  3057.  
  3058. CHAR
  3059. #ifdef CK_ANSIC
  3060. xhuas(CHAR c)
  3061. #else
  3062. xhuas(c) CHAR c;
  3063. #endif /* CK_ANSIC */
  3064. { /* xhuas */                /* Hungarian ISO 646 to ASCII */
  3065.     if (c & 0x80)
  3066.       return(UNK);
  3067.     switch (c) {
  3068.       case 64:  return('A');        /* A acute */
  3069.       case 91:  return('E');        /* E acute */
  3070.       case 92:  return('O');        /* O diaeresis */
  3071.       case 93:  return('U');        /* U diaeresis */
  3072.       case 96:  return('a');        /* a acute */
  3073.       case 123: return('e');        /* e acute */
  3074.       case 124: return('o');        /* o acute */
  3075.       case 125: return('u');        /* u acute */
  3076.       case 126: return(34);        /* double acute accent */
  3077.       default:  return(c);
  3078.     }
  3079. }
  3080.  
  3081. CHAR
  3082. #ifdef CK_ANSIC
  3083. xdmas(CHAR c)
  3084. #else
  3085. xdmas(c) CHAR c;
  3086. #endif /* CK_ANSIC */
  3087. { /* xdmas */                /* DEC MCS to ASCII */
  3088.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3089.     if (c == 215) {            /* handle OE digraph. */
  3090.         zmstuff('E');
  3091.         return('O');
  3092.     } else if (c == 247) {        /* Also lowercase oe. */
  3093.         zmstuff('e');
  3094.         return('o');
  3095.     }
  3096.     }
  3097.     return(yl1as[c]);            /* Otherwise treat like Latin-1 */
  3098. }
  3099.  
  3100. CHAR
  3101. #ifdef CK_ANSIC
  3102. xdgas(CHAR c)
  3103. #else
  3104. xdgas(c) CHAR c;
  3105. #endif /* CK_ANSIC */
  3106. { /*  xdgas */                /* Data General to ASCII */
  3107.     switch(c) {
  3108.       case 180: return('f');        /* Florin */
  3109.       case 183: return('<');        /* Less-equal */
  3110.       case 184: return('>');        /* Greater-equal */
  3111.       case 186: return(96);        /* Grave accent */
  3112.       case 191: return('^');        /* Uparrow */
  3113.       case 215:
  3114.     if (langs[language].id == L_FRENCH) { /* OE digraph */
  3115.         zmstuff('E');
  3116.         return('O');
  3117.     } else return('O');
  3118.       case 247:
  3119.     if (langs[language].id == L_FRENCH) { /* oe digraph */
  3120.         zmstuff('e');
  3121.         return('o');
  3122.     } else return('o');
  3123.       case 175: case 179: case 220: case 222:
  3124.       case 223: case 254: case 255:
  3125.     return(UNK);
  3126.       default:                /* The rest, convert to Latin-1 */
  3127.     return(yl1as[ydgl1[c]]);    /* and from there to ASCII */
  3128.     }
  3129. }
  3130.  
  3131. CHAR
  3132. #ifdef CK_ANSIC
  3133. xr8as(CHAR c)
  3134. #else
  3135. xr8as(c) CHAR c;
  3136. #endif /* CK_ANSIC */
  3137. { /*  xr8as */                /* Hewlett Packard Roman8 to ASCII */
  3138.     switch(c) {
  3139.       case 175: return('L');        /* Lira */
  3140.       case 190: return('f');        /* Florin */
  3141.       case 235: return('S');        /* S caron */
  3142.       case 236: return('s');        /* s caron */
  3143.       case 246: return('-');        /* Horizontal bar */
  3144.       case 252: return('*');        /* Solid box */
  3145.       default:                /* The rest, convert to Latin-1 */
  3146.     return(yl1as[yr8l1[c]]);    /* and from there to ASCII */
  3147.     }
  3148. }
  3149.  
  3150. CHAR
  3151. #ifdef CK_ANSIC
  3152. xukl1(CHAR c)
  3153. #else
  3154. xukl1(c) CHAR c;
  3155. #endif /* CK_ANSIC */
  3156. { /* xukl1 */                /* UK ASCII to Latin-1 */
  3157.     if (c & 0x80)
  3158.       return(UNK);
  3159.     if (c == 35)
  3160.       return(163);
  3161.     else return(c);
  3162. }
  3163.  
  3164. CHAR
  3165. #ifdef CK_ANSIC
  3166. xl1uk(CHAR c)
  3167. #else
  3168. xl1uk(c) CHAR c;
  3169. #endif /* CK_ANSIC */
  3170. { /* xl1uk */                /* Latin-1 to UK ASCII */
  3171.     if (c == 163)
  3172.       return(35);
  3173.     else return(yl1as[c]);
  3174. }
  3175.  
  3176. CHAR                    /* Latin-1 to French ISO 646 */
  3177. #ifdef CK_ANSIC
  3178. xl1fr(CHAR c)
  3179. #else
  3180. xl1fr(c) CHAR c;
  3181. #endif /* CK_ANSIC */
  3182. { /* xl1fr */
  3183.     return(yl1fr[c]);
  3184. }
  3185.  
  3186.  
  3187. CHAR                    /* French ISO 646 to Latin-1 */
  3188. #ifdef CK_ANSIC
  3189. xfrl1(CHAR c)
  3190. #else
  3191. xfrl1(c) CHAR c;
  3192. #endif /* CK_ANSIC */
  3193. { /* xfrl1 */
  3194.     if (c & 0x80)
  3195.       return(UNK);
  3196.     return(yfrl1[c]);
  3197. }
  3198.  
  3199. CHAR                    /* Latin-1 to Dutch ASCII */
  3200. #ifdef CK_ANSIC
  3201. xl1du(CHAR c)
  3202. #else
  3203. xl1du(c) CHAR c;
  3204. #endif /* CK_ANSIC */
  3205. { /* xl1du */
  3206.     return(yl1du[c]);
  3207. }
  3208.  
  3209. CHAR
  3210. #ifdef CK_ANSIC
  3211. xdul1(CHAR c)
  3212. #else
  3213. xdul1(c) CHAR c;
  3214. #endif /* CK_ANSIC */
  3215. { /* xdul1 */                /* Dutch ISO 646 to Latin-1 */
  3216.     if (c & 0x80)
  3217.       return(UNK);
  3218.     return(ydul1[c]);
  3219. }
  3220.  
  3221. CHAR
  3222. #ifdef CK_ANSIC
  3223. xfil1(CHAR c)
  3224. #else
  3225. xfil1(c) CHAR c;
  3226. #endif /* CK_ANSIC */
  3227. { /* xfil1 */                /* Finnish ISO 646 to Latin-1 */
  3228.     if (c & 0x80)
  3229.       return(UNK);
  3230.     return(yfil1[c]);
  3231. }
  3232.  
  3233. CHAR
  3234. #ifdef CK_ANSIC
  3235. xl1fi(CHAR c)
  3236. #else
  3237. xl1fi(c) CHAR c;
  3238. #endif /* CK_ANSIC */
  3239. { /* xl1fi */                /* Latin-1 to Finnish ISO 646 */
  3240.     return(yl1fi[c]);
  3241. }
  3242.  
  3243. CHAR
  3244. #ifdef CK_ANSIC
  3245. xfcl1(CHAR c)
  3246. #else
  3247. xfcl1(c) CHAR c;
  3248. #endif /* CK_ANSIC */
  3249. { /* xfcl1 */                /* French Canadian ISO646 to Latin-1 */
  3250.     if (c & 0x80)
  3251.       return(UNK);
  3252.     return(yfcl1[c]);
  3253. }
  3254.  
  3255. CHAR
  3256. #ifdef CK_ANSIC
  3257. xl1fc(CHAR c)
  3258. #else
  3259. xl1fc(c) CHAR c;
  3260. #endif /* CK_ANSIC */
  3261. { /* xl1fc */                /* Latin-1 to French Canadian ISO646 */
  3262.     return(yl1fc[c]);
  3263. }
  3264.  
  3265. CHAR
  3266. #ifdef CK_ANSIC
  3267. xitl1(CHAR c)
  3268. #else
  3269. xitl1(c) CHAR c;
  3270. #endif /* CK_ANSIC */
  3271. { /* xitl1 */                /* Italian ISO 646 to Latin-1 */
  3272.     if (c & 0x80)
  3273.       return(UNK);
  3274.     return(yitl1[c]);
  3275. }
  3276.  
  3277. CHAR
  3278. #ifdef CK_ANSIC
  3279. xl1it(CHAR c)
  3280. #else
  3281. xl1it(c) CHAR c;
  3282. #endif /* CK_ANSIC */
  3283. { /* xl1it */                /* Latin-1 to Italian ISO 646 */
  3284.     return(yl1it[c]);
  3285. }
  3286.  
  3287. CHAR
  3288. #ifdef CK_ANSIC
  3289. xnel1(CHAR c)
  3290. #else
  3291. xnel1(c) CHAR c;
  3292. #endif /* CK_ANSIC */
  3293. { /* xnel1 */                 /* NeXT to Latin-1 */
  3294.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3295.     if (c == 234) {            /* handle OE digraph. */
  3296.         zmstuff('E');
  3297.         return('O');
  3298.     } else if (c == 250) {        /* Also lowercase oe. */
  3299.         zmstuff('e');
  3300.         return('o');
  3301.     }
  3302.     }
  3303.     return(ynel1[c]);
  3304. }
  3305.  
  3306. CHAR
  3307. #ifdef CK_ANSIC
  3308. xnel9(CHAR c)
  3309. #else
  3310. xnel9(c) CHAR c;
  3311. #endif /* CK_ANSIC */
  3312. { /* xnel9 */                 /* NeXT to Latin-9 */
  3313.     switch (c) {
  3314.       case 234: return(188);        /* OE */
  3315.       case 250: return(189);        /* oe */
  3316.       case 188: return(234);        /* keep it invertible... */
  3317.       case 189: return(250);        /* oe */
  3318.       default:
  3319.     return(ynel1[c]);
  3320.     }
  3321. }
  3322.  
  3323. CHAR
  3324. #ifdef CK_ANSIC
  3325. xl1ne(CHAR c)
  3326. #else
  3327. xl1ne(c) CHAR c;
  3328. #endif /* CK_ANSIC */
  3329. { /* xl1ne */                 /* Latin-1 to NeXT */
  3330.     return(yl1ne[c]);
  3331. }
  3332.  
  3333. CHAR
  3334. #ifdef CK_ANSIC
  3335. xl9ne(CHAR c)
  3336. #else
  3337. xl9ne(c) CHAR c;
  3338. #endif /* CK_ANSIC */
  3339. { /* xl9ne */                 /* Latin-9 to NeXT */
  3340.     switch (c) {
  3341.       case 188: return(234);        /* OE */
  3342.       case 189: return(250);        /* oe */
  3343.       case 234: return(188);        /* OE */
  3344.       case 250: return(189);        /* oe */
  3345.       default:
  3346.     return(yl1ne[c]);
  3347.     }
  3348. }
  3349.  
  3350. CHAR
  3351. #ifdef CK_ANSIC
  3352. xnol1(CHAR c)
  3353. #else
  3354. xnol1(c) CHAR c;
  3355. #endif /* CK_ANSIC */
  3356. { /* xnol1 */                 /* Norway/Denmark ISO 646 to Latin-1 */
  3357.     if (c & 0x80)
  3358.       return(UNK);
  3359.     return(ynol1[c]);
  3360. }
  3361.  
  3362. CHAR
  3363. #ifdef CK_ANSIC
  3364. xl1no(CHAR c)
  3365. #else
  3366. xl1no(c) CHAR c;
  3367. #endif /* CK_ANSIC */
  3368. { /* xl1no */                 /* Latin-1 to Norway/Denmark ISO 646 */
  3369.     return(yl1no[c]);
  3370. }
  3371.  
  3372. CHAR
  3373. #ifdef CK_ANSIC
  3374. xpol1(CHAR c)
  3375. #else
  3376. xpol1(c) CHAR c;
  3377. #endif /* CK_ANSIC */
  3378. { /* xpol1 */                /* Portuguese ISO 646 to Latin-1 */
  3379.     if (c & 0x80)
  3380.       return(UNK);
  3381.     return(ypol1[c]);
  3382. }
  3383.  
  3384. CHAR
  3385. #ifdef CK_ANSIC
  3386. xl1po(CHAR c)
  3387. #else
  3388. xl1po(c) CHAR c;
  3389. #endif /* CK_ANSIC */
  3390. { /* xl1po */                /* Latin-1 to Portuguese ISO 646 */
  3391.     return(yl1po[c]);
  3392. }
  3393.  
  3394. CHAR
  3395. #ifdef CK_ANSIC
  3396. xspl1(CHAR c)
  3397. #else
  3398. xspl1(c) CHAR c;
  3399. #endif /* CK_ANSIC */
  3400. { /* xspl1 */                /* Spanish ISO 646 to Latin-1 */
  3401.     if (c & 0x80)
  3402.       return(UNK);
  3403.     return(yspl1[c]);
  3404. }
  3405.  
  3406. CHAR
  3407. #ifdef CK_ANSIC
  3408. xl1sp(CHAR c)
  3409. #else
  3410. xl1sp(c) CHAR c;
  3411. #endif /* CK_ANSIC */
  3412. { /* xl1sp */                /* Latin-1 to Spanish ISO 646 */
  3413.     return(yl1sp[c]);
  3414. }
  3415.  
  3416. CHAR
  3417. #ifdef CK_ANSIC
  3418. xswl1(CHAR c)
  3419. #else
  3420. xswl1(c) CHAR c;
  3421. #endif /* CK_ANSIC */
  3422. { /* xswl1 */                /* Swedish ISO 646 to Latin-1 */
  3423.     if (c & 0x80)
  3424.       return(UNK);
  3425.     return(yswl1[c]);
  3426. }
  3427.  
  3428. CHAR
  3429. #ifdef CK_ANSIC
  3430. xl1sw(CHAR c)
  3431. #else
  3432. xl1sw(c) CHAR c;
  3433. #endif /* CK_ANSIC */
  3434. { /* xl1sw */                /* Latin-1 to Swedish ISO 646 */
  3435.     return(yl1sw[c]);
  3436. }
  3437.  
  3438. CHAR
  3439. #ifdef CK_ANSIC
  3440. xchl1(CHAR c)
  3441. #else
  3442. xchl1(c) CHAR c;
  3443. #endif /* CK_ANSIC */
  3444. { /* xchl1 */                /* Swiss ISO 646 to Latin-1 */
  3445.     if (c & 0x80)
  3446.       return(UNK);
  3447.     return(ychl1[c]);
  3448. }
  3449.  
  3450. CHAR
  3451. #ifdef CK_ANSIC
  3452. xl1ch(CHAR c)
  3453. #else
  3454. xl1ch(c) CHAR c;
  3455. #endif /* CK_ANSIC */
  3456. { /* xl1ch */                /* Latin-1 to Swiss ISO 646 */
  3457.     return(yl1ch[c]);
  3458. }
  3459.  
  3460. CHAR
  3461. #ifdef CK_ANSIC
  3462. xhul1(CHAR c)
  3463. #else
  3464. xhul1(c) CHAR c;
  3465. #endif /* CK_ANSIC */
  3466. { /* xhul1 */                /* Hungarian ISO 646 to Latin-1 */
  3467.     if (c & 0x80)
  3468.       return(UNK);
  3469.     return(yhul1[c]);
  3470. }
  3471.  
  3472. CHAR
  3473. #ifdef CK_ANSIC
  3474. xl1hu(CHAR c)
  3475. #else
  3476. xl1hu(c) CHAR c;
  3477. #endif /* CK_ANSIC */
  3478. { /* xl1hu */                /* Latin-1 to Hungarian ISO 646 */
  3479.     return(yl1hu[c]);
  3480. }
  3481.  
  3482. CHAR
  3483. #ifdef CK_ANSIC
  3484. xl1dm(CHAR c)
  3485. #else
  3486. xl1dm(c) CHAR c;
  3487. #endif /* CK_ANSIC */
  3488. { /* xl1dm */                /* Latin-1 to DEC MCS */
  3489.     return(yl1dm[c]);
  3490. }
  3491.  
  3492. CHAR
  3493. #ifdef CK_ANSIC
  3494. xl9dm(CHAR c)
  3495. #else
  3496. xl9dm(c) CHAR c;
  3497. #endif /* CK_ANSIC */
  3498. { /* xl9dm */                /* Latin-9 to DEC MCS */
  3499.     switch (c) {
  3500.       case 188: return(215);
  3501.       case 189: return(247);
  3502.       case 215: return(188);
  3503.       case 247: return(189);
  3504.       default:
  3505.     return(yl1dm[c]);
  3506.     }
  3507. }
  3508.  
  3509. CHAR
  3510. #ifdef CK_ANSIC
  3511. xl9w1(CHAR c)
  3512. #else
  3513. xl9w1(c) CHAR c;
  3514. #endif /* CK_ANSIC */
  3515. { /* xl9w1 */                /* Latin-9 to CP1252 */
  3516.     if (c < 128)
  3517.       return(c);
  3518.     else if (c < 160)
  3519.       return('?');
  3520.     switch (c) {
  3521.       case 0xa4: return(0x80);        /* Euro */
  3522.       case 0xa6: return(0x8a);        /* S-caron */
  3523.       case 0xa8: return(0x9a);        /* s-caron */
  3524.       case 0xb4: return(0x8e);        /* Z-caron */
  3525.       case 0xb8: return(0x9e);        /* z-caron */
  3526.       case 0xbc: return(0x8c);        /* OE */
  3527.       case 0xbd: return(0x9c);        /* oe */
  3528.       case 0xbe: return(0x9f);        /* Y-diaeresis */
  3529.       default:
  3530.     return(c);
  3531.     }
  3532. }
  3533.  
  3534. CHAR
  3535. #ifdef CK_ANSIC
  3536. xl1dg(CHAR c)
  3537. #else
  3538. xl1dg(c) CHAR c;
  3539. #endif /* CK_ANSIC */
  3540. { /* xl1dg */                /* Latin-1 to DG ICS */
  3541.     return(yl1dg[c]);
  3542. }
  3543.  
  3544. CHAR
  3545. #ifdef CK_ANSIC
  3546. xdml1(CHAR c)
  3547. #else
  3548. xdml1(c) CHAR c;
  3549. #endif /* CK_ANSIC */
  3550. { /* xdml1 */                /* DEC MCS to Latin-1 */
  3551.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3552.     if (c == 215) {            /* handle OE digraph. */
  3553.         zmstuff('E');
  3554.         return('O');
  3555.     } else if (c == 247) {        /* Also lowercase oe. */
  3556.         zmstuff('e');
  3557.         return('o');
  3558.     }
  3559.     }
  3560.     return(ydml1[c]);
  3561. }
  3562.  
  3563. CHAR
  3564. #ifdef CK_ANSIC
  3565. xdml9(CHAR c)
  3566. #else
  3567. xdml9(c) CHAR c;
  3568. #endif /* CK_ANSIC */
  3569. { /* xdml9 */                /* DEC MCS to Latin-9 */
  3570.     switch (c) {
  3571.       case 215: return(188);        /* OE */
  3572.       case 247: return(189);        /* oe */
  3573.       case 188: return(215);        /* and swap the other two... */
  3574.       case 189: return(247);        /* (1/4 and 1/2) */
  3575.       default:                /* to keep it invertible */
  3576.     return(ydml1[c]);
  3577.     }
  3578. }
  3579.  
  3580. CHAR
  3581. #ifdef CK_ANSIC
  3582. xdgl1(CHAR c)
  3583. #else
  3584. xdgl1(c) CHAR c;
  3585. #endif /* CK_ANSIC */
  3586. { /* xdgl1 */                /* DG International CS to Latin-1 */
  3587.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3588.     if (c == 215) {            /* handle OE digraph. */
  3589.         zmstuff('E');
  3590.         return('O');
  3591.     } else if (c == 247) {        /* Also lowercase oe. */
  3592.         zmstuff('e');
  3593.         return('o');
  3594.     }
  3595.     }
  3596.     return(ydgl1[c]);
  3597. }
  3598.  
  3599. CHAR
  3600. #ifdef CK_ANSIC
  3601. xr8l1(CHAR c)
  3602. #else
  3603. xr8l1(c) CHAR c;
  3604. #endif /* CK_ANSIC */
  3605. { /* xr8l1 */                /* Hewlett Packard Roman8 to Latin-1 */
  3606.     return(yr8l1[c]);
  3607. }
  3608.  
  3609. CHAR
  3610. #ifdef CK_ANSIC
  3611. xl1r8(CHAR c)
  3612. #else
  3613. xl1r8(c) CHAR c;
  3614. #endif /* CK_ANSIC */
  3615. { /* xl1r8 */                /* Latin-1 to Hewlett Packard Roman8 */
  3616.     return(yl1r8[c]);
  3617. }
  3618.  
  3619. /* Translation functions for receiving files and translating them into ASCII */
  3620.  
  3621. CHAR
  3622. #ifdef CK_ANSIC
  3623. zl1as(CHAR c)
  3624. #else
  3625. zl1as(c) CHAR c;
  3626. #endif /* CK_ANSIC */
  3627. { /* zl1as */
  3628.     switch(langs[language].id) {
  3629.  
  3630.       case L_DUTCH:
  3631.     if (c == 255) {            /* Dutch umlaut-y */
  3632.         zdstuff('j');        /* becomes ij */
  3633.         return('i');
  3634.     } else return(yl1as[c]);    /* all others by the book */
  3635.  
  3636.       case L_GERMAN:
  3637.     switch (c) {            /* German, special rules. */
  3638.       case 196:            /* umlaut-A -> Ae */
  3639.         zdstuff('e');
  3640.         return('A');
  3641.       case 214:            /* umlaut-O -> Oe */
  3642.         zdstuff('e');
  3643.         return('O');
  3644.       case 220:            /* umlaut-U -> Ue */
  3645.         zdstuff('e');
  3646.         return('U');
  3647.       case 228:            /* umlaut-a -> ae */
  3648.         zdstuff('e');
  3649.         return('a');
  3650.       case 246:            /* umlaut-o -> oe */
  3651.         zdstuff('e');
  3652.         return('o');
  3653.       case 252:            /* umlaut-u -> ue */
  3654.         zdstuff('e');
  3655.         return('u');
  3656.       case 223:            /* ess-zet -> ss */
  3657.         zdstuff('s');
  3658.         return('s');
  3659.       default: return(yl1as[c]);    /* all others by the book */
  3660.     }
  3661.       case L_DANISH:
  3662.       case L_FINNISH:
  3663.       case L_NORWEGIAN:
  3664.       case L_SWEDISH:
  3665.     switch (c) {            /* Scandanavian languages. */
  3666.       case 196:            /* umlaut-A -> Ae */
  3667.         zdstuff('e');
  3668.         return('A');
  3669.       case 214:            /* umlaut-O -> Oe */
  3670.       case 216:            /* O-slash -> Oe */
  3671.         zdstuff('e');
  3672.         return('O');
  3673.       case 220:            /* umlaut-U -> Y */
  3674.         /* return('Y'); */
  3675.         zdstuff('e');
  3676.         return('U');
  3677.       case 228:            /* umlaut-a -> ae */
  3678.         zdstuff('e');
  3679.         return('a');
  3680.       case 246:            /* umlaut-o -> oe */
  3681.       case 248:            /* o-slash -> oe */
  3682.         zdstuff('e');
  3683.         return('o');
  3684.       case 252:            /* umlaut-u -> y */
  3685.         /* return('y'); */
  3686.         zdstuff('e');
  3687.         return('u');
  3688.       case 197:            /* A-ring -> Aa */
  3689.         zdstuff('a');
  3690.         return('A');
  3691.           case 229:            /* a-ring -> aa */
  3692.         zdstuff('a');
  3693.         return('a');
  3694.       default: return(yl1as[c]);    /* All others by the book */
  3695.     }
  3696.       default:
  3697.     return(yl1as[c]);        /* No language, go by the table. */
  3698.     }
  3699. }
  3700.  
  3701. CHAR                    /* IBM CP437 to Latin-1 */
  3702. #ifdef CK_ANSIC
  3703. x43l1(CHAR c)
  3704. #else
  3705. x43l1(c) CHAR c;
  3706. #endif /* CK_ANSIC */
  3707. { /* x43l1 */
  3708.     return(y43l1[c]);
  3709. }
  3710.  
  3711. CHAR                    /* IBM CP850 to Latin-1 */
  3712. #ifdef CK_ANSIC
  3713. x85l1(CHAR c)
  3714. #else
  3715. x85l1(c) CHAR c;
  3716. #endif /* CK_ANSIC */
  3717. { /* x85l1 */
  3718.     return(y85l1[c]);
  3719. }
  3720.  
  3721. CHAR                    /* Latin-1 to IBM CP437 */
  3722. #ifdef CK_ANSIC
  3723. xl143(CHAR c)
  3724. #else
  3725. xl143(c) CHAR c;
  3726. #endif /* CK_ANSIC */
  3727. { /* xl143 */
  3728.     return(yl143[c]);
  3729. }
  3730.  
  3731. CHAR                    /* Latin-1 to CP850 */
  3732. #ifdef CK_ANSIC
  3733. xl185(CHAR c)
  3734. #else
  3735. xl185(c) CHAR c;
  3736. #endif /* CK_ANSIC */
  3737. { /* xl185 */
  3738.     return(yl185[c]);
  3739. }
  3740.  
  3741. CHAR
  3742. #ifdef CK_ANSIC
  3743. x43as(CHAR c)
  3744. #else
  3745. x43as(c) CHAR c;
  3746. #endif /* CK_ANSIC */
  3747. { /* x43as */                /* CP437 to ASCII */
  3748.     c = y43l1[c];            /* Translate to Latin-1 */
  3749.     return(xl143(c));            /* and from Latin-1 to ASCII. */
  3750. }
  3751.  
  3752. CHAR
  3753. #ifdef CK_ANSIC
  3754. x85as(CHAR c)
  3755. #else
  3756. x85as(c) CHAR c;
  3757. #endif /* CK_ANSIC */
  3758. { /* x85as */                /* CP850 to ASCII */
  3759.     c = y85l1[c];            /* Translate to Latin-1 */
  3760.     return(xl1as(c));            /* and from Latin-1 to ASCII. */
  3761. }
  3762.  
  3763. CHAR                    /* Macintosh Latin to Latin-1 */
  3764. #ifdef CK_ANSIC
  3765. xaql1(CHAR c)
  3766. #else
  3767. xaql1(c) CHAR c;
  3768. #endif /* CK_ANSIC */
  3769. { /* xaql1 */
  3770.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3771.     if (c == 206) {            /* handle OE digraph. */
  3772.         zmstuff('E');
  3773.         return('O');
  3774.     } else if (c == 207) {        /* Also lowercase oe. */
  3775.         zmstuff('e');
  3776.         return('o');
  3777.     }
  3778.     }
  3779.     return(yaql1[c]);
  3780. }
  3781.  
  3782. CHAR                    /* Macintosh Latin to ASCII */
  3783. #ifdef CK_ANSIC
  3784. xaqas(CHAR c)
  3785. #else
  3786. xaqas(c) CHAR c;
  3787. #endif /* CK_ANSIC */
  3788. { /* xaqas */
  3789.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  3790.     if (c == 206) {            /* handle OE digraph. */
  3791.         zmstuff('E');
  3792.         return('O');
  3793.     } else if (c == 207) {        /* Also lowercase oe. */
  3794.         zmstuff('e');
  3795.         return('o');
  3796.     }
  3797.     }
  3798.     c = yaql1[c];            /* Translate to Latin-1 */
  3799.     return(xl1as(c));            /* then to ASCII. */
  3800. }
  3801.  
  3802. CHAR                    /* Latin-1 to Macintosh Latin */
  3803. #ifdef CK_ANSIC
  3804. xl1aq(CHAR c)
  3805. #else
  3806. xl1aq(c) CHAR c;
  3807. #endif /* CK_ANSIC */
  3808. { /* xl1aq */
  3809.     return(yl1aq[c]);
  3810. }
  3811.  
  3812. #ifdef LATIN2
  3813.  
  3814. /* Translation functions for Latin Alphabet 2 */
  3815.  
  3816. CHAR                    /* Latin-2 to Latin-1 */
  3817. #ifdef CK_ANSIC
  3818. xl2l1(CHAR c)
  3819. #else
  3820. xl2l1(c) CHAR c;
  3821. #endif /* CK_ANSIC */
  3822. { /* xll2l1 */
  3823.     return(yl2l1[c]);
  3824. }
  3825.  
  3826. CHAR
  3827. #ifdef CK_ANSIC
  3828. xl2w1(CHAR c)
  3829. #else
  3830. xl2w1(c) CHAR c;
  3831. #endif /* CK_ANSIC */
  3832. { /* xl2w1 */                /* Latin-2 to CP1252 (Windows L1) */
  3833.     if (c > 127 && c < 160)
  3834.       return(UNK);
  3835.     else
  3836.       return(yl2l1[c]);
  3837. }
  3838.  
  3839. CHAR                    /* Latin-1 to Latin-2 */
  3840. #ifdef CK_ANSIC
  3841. xl1l2(CHAR c)
  3842. #else
  3843. xl1l2(c) CHAR c;
  3844. #endif /* CK_ANSIC */
  3845. { /* xll1l2 */
  3846.     return(yl1l2[c]);
  3847. }
  3848.  
  3849. CHAR                    /* CP1252 to Latin-1 */
  3850. #ifdef CK_ANSIC
  3851. xw1l2(CHAR c)
  3852. #else
  3853. xw1l2(c) CHAR c;
  3854. #endif /* CK_ANSIC */
  3855. { /* xw1l2 */
  3856.     switch (c) {
  3857.       case 0x8a: return(0xa9);        /* S caron */
  3858.       case 0x8e: return(0xae);        /* Z caron */
  3859.       case 0x9a: return(0xb9);        /* s caron */
  3860.       case 0x9e: return(0xbe);        /* z caron */
  3861.       default:
  3862.     return((c < 160) ? xw1as(c) : xl1l2(c));
  3863.     }
  3864. }
  3865.  
  3866.  
  3867. CHAR                    /* Latin-2 to ASCII */
  3868. #ifdef CK_ANSIC
  3869. xl2as(CHAR c)
  3870. #else
  3871. xl2as(c) CHAR c;
  3872. #endif /* CK_ANSIC */
  3873. { /* xll2as */
  3874.     return(yl2as[c]);
  3875. }
  3876.  
  3877. CHAR                    /* Latin-2 to CP852 */
  3878. #ifdef CK_ANSIC
  3879. xl252(CHAR c)
  3880. #else
  3881. xl252(c) CHAR c;
  3882. #endif /* CK_ANSIC */
  3883. { /* xll252 */
  3884.     return(yl252[c]);
  3885. }
  3886.  
  3887. CHAR                    /* Latin-2 to Mazovia */
  3888. #ifdef CK_ANSIC
  3889. xl2mz(CHAR c)
  3890. #else
  3891. xl2mz(c) CHAR c;
  3892. #endif /* CK_ANSIC */
  3893. { /* xll2mz */
  3894.     return(yl2mz[c]);
  3895. }
  3896.  
  3897. CHAR                    /* Latin-1 to Mazovia */
  3898. #ifdef CK_ANSIC
  3899. xl1mz(CHAR c)
  3900. #else
  3901. xl1mz(c) CHAR c;
  3902. #endif /* CK_ANSIC */
  3903. { /* xll1mz */
  3904.     return(yl2mz[yl1l2[c]]);
  3905. }
  3906.  
  3907. CHAR                    /* Mazovia to Latin-1 */
  3908. #ifdef CK_ANSIC
  3909. xmzl1(CHAR c)
  3910. #else
  3911. xmzl1(c) CHAR c;
  3912. #endif /* CK_ANSIC */
  3913. { /* xmzl1 */
  3914.     return(yl2l1[ymzl2[c]]);
  3915. }
  3916.  
  3917. CHAR                    /* Mazovia to Latin-9 */
  3918. #ifdef CK_ANSIC
  3919. xmzl9(CHAR c)
  3920. #else
  3921. xmzl9(c) CHAR c;
  3922. #endif /* CK_ANSIC */
  3923. { /* xmzl9 */
  3924.     return(xl2l9(ymzl2[c]));
  3925. }
  3926.  
  3927. CHAR                    /* CP852 to Latin-2 */
  3928. #ifdef CK_ANSIC
  3929. x52l2(CHAR c)
  3930. #else
  3931. x52l2(c) CHAR c;
  3932. #endif /* CK_ANSIC */
  3933. { /* x52l2 */
  3934.     return(y52l2[c]);
  3935. }
  3936.  
  3937. CHAR                    /* Mazovia to Latin-2 */
  3938. #ifdef CK_ANSIC
  3939. xmzl2(CHAR c)
  3940. #else
  3941. xmzl2(c) CHAR c;
  3942. #endif /* CK_ANSIC */
  3943. { /* xmzl2 */
  3944.     return(ymzl2[c]);
  3945. }
  3946.  
  3947. CHAR                    /* Latin-2 to CP1250 */
  3948. #ifdef CK_ANSIC
  3949. xl21250(CHAR c)
  3950. #else
  3951. xl21250(c) CHAR c;
  3952. #endif /* CK_ANSIC */
  3953. { /* xll21250 */
  3954.     return(yl21250[c]);
  3955. }
  3956.  
  3957. CHAR                    /* CP1250 to Latin-2 */
  3958. #ifdef CK_ANSIC
  3959. x1250l2(CHAR c)
  3960. #else
  3961. x1250l2(c) CHAR c;
  3962. #endif /* CK_ANSIC */
  3963. { /* x1250l2 */
  3964.     return(y1250l2[c]);
  3965. }
  3966.  
  3967. CHAR                    /* CP852 to ASCII */
  3968. #ifdef CK_ANSIC
  3969. x52as(CHAR c)
  3970. #else
  3971. x52as(c) CHAR c;
  3972. #endif /* CK_ANSIC */
  3973. { /* xl52as */
  3974.     return(yl2as[y52l2[c]]);        /* CP852 -> Latin-2 -> ASCII */
  3975. }
  3976.  
  3977. CHAR                    /* CP1250 to ASCII */
  3978. #ifdef CK_ANSIC
  3979. x1250as(CHAR c)
  3980. #else
  3981. x1250as(c) CHAR c;
  3982. #endif /* CK_ANSIC */
  3983. { /* xl1250as */
  3984.     return(yl2as[y1250l2[c]]);        /* CP81250 -> Latin-2 -> ASCII */
  3985. }
  3986.  
  3987.  
  3988. CHAR                    /* CP852 to Latin-1 */
  3989. #ifdef CK_ANSIC
  3990. x52l1(CHAR c)
  3991. #else
  3992. x52l1(c) CHAR c;
  3993. #endif /* CK_ANSIC */
  3994. { /* xl52l1 */
  3995.     return(yl2l1[y52l2[c]]);        /* CP852 -> Latin-2 -> Latin-1 */
  3996. }
  3997.  
  3998. CHAR                    /* CP1250 to Latin-1 */
  3999. #ifdef CK_ANSIC
  4000. x1250l1(CHAR c)
  4001. #else
  4002. x1250l1(c) CHAR c;
  4003. #endif /* CK_ANSIC */
  4004. { /* xl1250l1 */
  4005.     return(yl2l1[y1250l2[c]]);        /* CP1250 -> Latin-2 -> Latin-1 */
  4006. }
  4007.  
  4008. CHAR                    /* CP1250 to Latin-9 */
  4009. #ifdef CK_ANSIC
  4010. x1250l9(CHAR c)
  4011. #else
  4012. x1250l9(c) CHAR c;
  4013. #endif /* CK_ANSIC */
  4014. { /* x1250l9 */
  4015.     if (c == (CHAR)128)            /* Euro */
  4016.       return((CHAR)164);
  4017.     else
  4018.       return(xl2l9(y1250l2[c]));    /* CP1250 -> Latin-2 -> Latin-9 */
  4019. }
  4020.  
  4021. CHAR                    /* Latin-1 to CP852 */
  4022. #ifdef CK_ANSIC
  4023. xl152(CHAR c)
  4024. #else
  4025. xl152(c) CHAR c;
  4026. #endif /* CK_ANSIC */
  4027. { /* xll152 */
  4028.     return(yl252[yl1l2[c]]);        /* Latin-1 -> Latin-2 -> CP852 */
  4029. }
  4030.  
  4031. CHAR                    /* Latin-1 to CP1250 */
  4032. #ifdef CK_ANSIC
  4033. xl11250(CHAR c)
  4034. #else
  4035. xl11250(c) CHAR c;
  4036. #endif /* CK_ANSIC */
  4037. { /* xll11250 */
  4038.     return(yl21250[yl1l2[c]]);        /* Latin-1 -> Latin-2 -> CP1250 */
  4039. }
  4040.  
  4041. CHAR                    /* Latin-9 to CP1250 */
  4042. #ifdef CK_ANSIC
  4043. xl91250(CHAR c)
  4044. #else
  4045. xl91250(c) CHAR c;
  4046. #endif /* CK_ANSIC */
  4047. { /* xll91250 */
  4048.     if (c == (CHAR)164)            /* Euro */
  4049.       return((CHAR)128);
  4050.     else
  4051.       return(yl21250[xl9l2(c)]);    /* Latin-9 -> Latin-2 -> CP1250 */
  4052. }
  4053.  
  4054. CHAR                    /* Latin-9 to Mazovia */
  4055. #ifdef CK_ANSIC
  4056. xl9mz(CHAR c)
  4057. #else
  4058. xl9mz(c) CHAR c;
  4059. #endif /* CK_ANSIC */
  4060. { /* xll9mz */
  4061.     return(yl2mz[xl9l2(c)]);        /* Latin-9 -> Latin-2 -> Mazovia */
  4062. }
  4063.  
  4064. CHAR                    /* Latin-9 to Mazovia */
  4065. #ifdef CK_ANSIC
  4066. xmzas(CHAR c)
  4067. #else
  4068. xmzas(c) CHAR c;
  4069. #endif /* CK_ANSIC */
  4070. { /* xmzas */
  4071.     return(yl2as[xmzl2(c)]);        /* Mazovia -> Latin-2 -> ASCII */
  4072. }
  4073.  
  4074. CHAR                    /* Latin-2 to NeXT */
  4075. #ifdef CK_ANSIC
  4076. xl2ne(CHAR c)
  4077. #else
  4078. xl2ne(c) CHAR c;
  4079. #endif /* CK_ANSIC */
  4080. { /* xll2ne */
  4081.     switch(c) {
  4082.       case 162: return(198);        /* Breve */
  4083.       case 163: return(232);        /* L with stroke */
  4084.       case 178: return(206);        /* Ogonek */
  4085.       case 179: return(248);        /* l with stroke */
  4086.       case 183: return(207);        /* Caron */
  4087.       case 189: return(205);        /* Double acute */
  4088.       case 208: return(144);        /* D stroke = Eth */
  4089.       case 240: return(230);        /* d stroke = eth */
  4090.       case 255: return(199);        /* Dot above */
  4091.       default:  return(yl1ne[yl2l1[c]]);
  4092.     }
  4093. }
  4094.  
  4095. CHAR                    /* Latin-2 to CP437 */
  4096. #ifdef CK_ANSIC
  4097. xl243(CHAR c)
  4098. #else
  4099. xl243(c) CHAR c;
  4100. #endif /* CK_ANSIC */
  4101. { /* xll243 */
  4102.     return(yl1l2[y43l1[c]]);
  4103. }
  4104.  
  4105. CHAR                    /* Latin-2 to CP850 */
  4106. #ifdef CK_ANSIC
  4107. xl285(CHAR c)
  4108. #else
  4109. xl285(c) CHAR c;
  4110. #endif /* CK_ANSIC */
  4111. { /* xll285 */
  4112.     return(yl1l2[y85l1[c]]);
  4113. }
  4114.  
  4115. CHAR                    /* Latin-2 to Apple */
  4116. #ifdef CK_ANSIC
  4117. xl2aq(CHAR c)
  4118. #else
  4119. xl2aq(c) CHAR c;
  4120. #endif /* CK_ANSIC */
  4121. { /* xl2aq */
  4122.     return(yl1aq[yl2l1[c]]);        /* Could do more... */
  4123. }
  4124.  
  4125. CHAR                    /* Latin-2 to DGI */
  4126. #ifdef CK_ANSIC
  4127. xl2dg(CHAR c)
  4128. #else
  4129. xl2dg(c) CHAR c;
  4130. #endif /* CK_ANSIC */
  4131. { /* xll2dg */
  4132.     return(ydgl1[yl1l2[c]]);
  4133. }
  4134.  
  4135. CHAR                    /* Latin-2 to Short KOI */
  4136. #ifdef CK_ANSIC
  4137. xl2sk(CHAR c)
  4138. #else
  4139. xl2sk(c) CHAR c;
  4140. #endif /* CK_ANSIC */
  4141. { /* xll2sk */
  4142.     return(islower(c) ? toupper(c) : c);
  4143. }
  4144.  
  4145. CHAR                    /* NeXT to Latin-2 */
  4146. #ifdef CK_ANSIC
  4147. xnel2(CHAR c)
  4148. #else
  4149. xnel2(c) CHAR c;
  4150. #endif /* CK_ANSIC */
  4151. { /* xnel2 */
  4152.     switch (c) {
  4153.       case 144: return(208);        /* D stroke = Eth */
  4154.       case 198: return(162);        /* Breve */
  4155.       case 199: return(255);        /* Dot above */
  4156.       case 205: return(189);        /* Double acute */
  4157.       case 206: return(178);        /* Ogonek */
  4158.       case 207: return(183);        /* Caron */
  4159.       case 230: return(240);        /* d stroke = eth */
  4160.       case 232: return(163);        /* L with stroke */
  4161.       case 248: return(179);        /* l with stroke */
  4162.       default:  return(yl1l2[ynel1[c]]); /* Others, go thru Latin-1 */
  4163.     }
  4164. }
  4165.  
  4166. CHAR                    /* CP437 to Latin-2 */
  4167. #ifdef CK_ANSIC
  4168. x43l2(CHAR c)
  4169. #else
  4170. x43l2(c) CHAR c;
  4171. #endif /* CK_ANSIC */
  4172. { /* xl43l2 */
  4173.     return(yl1l2[y43l1[c]]);
  4174. }
  4175.  
  4176. CHAR                    /* CP850 to Latin-2 */
  4177. #ifdef CK_ANSIC
  4178. x85l2(CHAR c)
  4179. #else
  4180. x85l2(c) CHAR c;
  4181. #endif /* CK_ANSIC */
  4182. { /* xl85l2 */
  4183.     return(yl1l2[y85l1[c]]);
  4184. }
  4185.  
  4186. CHAR                    /* Apple to Latin-2 */
  4187. #ifdef CK_ANSIC
  4188. xaql2(CHAR c)
  4189. #else
  4190. xaql2(c) CHAR c;
  4191. #endif /* CK_ANSIC */
  4192. { /* xlaql2 */
  4193.     switch (c) {
  4194.       case 249: return(162);        /* Breve accent */
  4195.       case 250: return(255);        /* Dot accent */
  4196.       case 253: return(189);        /* Double acute */
  4197.       default: return(yl1l2[yaql1[c]]);
  4198.     }
  4199. }
  4200.  
  4201. CHAR                    /* DGI to Latin-2 */
  4202. #ifdef CK_ANSIC
  4203. xdgl2(CHAR c)
  4204. #else
  4205. xdgl2(c) CHAR c;
  4206. #endif /* CK_ANSIC */
  4207. { /* xldgl2 */
  4208.     return(yl1l2[ydgl1[c]]);        /* (for now) */
  4209. }
  4210.  
  4211. CHAR                    /* Short KOI to Latin-2 */
  4212. #ifdef CK_ANSIC
  4213. xskl2(CHAR c)
  4214. #else
  4215. xskl2(c) CHAR c;
  4216. #endif /* CK_ANSIC */
  4217. { /* xlskl2 */
  4218.     return(islower(c) ? toupper(c) : c);
  4219. }
  4220.  
  4221. CHAR                    /* Latin-2 to German */
  4222. #ifdef CK_ANSIC
  4223. xl2ge(CHAR c)
  4224. #else
  4225. xl2ge(c) CHAR c;
  4226. #endif /* CK_ANSIC */
  4227. { /* xll2ge */
  4228.     switch(c) {
  4229.       case 167: return(64);        /* Paragraph sign */
  4230.       case 196: return(91);        /* A-diaeresis */
  4231.       case 214: return(92);        /* O-diaeresis */
  4232.       case 220: return(93);        /* U-diaeresis */
  4233.       case 223: return(126);        /* double-s */
  4234.       case 228: return(123);        /* a-diaeresis */
  4235.       case 246: return(124);        /* o-diaeresis */
  4236.       case 252: return(125);        /* u-diaeresis */
  4237.       default:  return(yl2as[c]);    /* Others */
  4238.     }
  4239. }
  4240.  
  4241. CHAR                    /* German to Latin-2 */
  4242. #ifdef CK_ANSIC
  4243. xgel2(CHAR c)
  4244. #else
  4245. xgel2(c) CHAR c;
  4246. #endif /* CK_ANSIC */
  4247. { /* xlgel2 */
  4248.     if (c & 0x80)
  4249.       return(UNK);
  4250.     switch(c) {
  4251.       case 64:  return(167);        /* Paragraph sign */
  4252.       case 91:  return(196);        /* A-diaeresis */
  4253.       case 92:  return(214);        /* O-diaeresis */
  4254.       case 93:  return(220);        /* U-diaeresis */
  4255.       case 123: return(228);        /* a-diaeresis */
  4256.       case 126: return(223);        /* double-s */
  4257.       case 124: return(246);        /* o-diaeresis */
  4258.       case 125: return(252);        /* u-diaeresis */
  4259.       default:  return(c);        /* Others */
  4260.     }
  4261. }
  4262.  
  4263. CHAR                    /* Latin-2 to Hungarian */
  4264. #ifdef CK_ANSIC
  4265. xl2hu(CHAR c)
  4266. #else
  4267. xl2hu(c) CHAR c;
  4268. #endif /* CK_ANSIC */
  4269. { /* xll2hu */
  4270.     switch(c) {
  4271.       case 164: return(36);        /* Currency symbol */
  4272.       case 189: return(126);        /* Double acute accent */
  4273.       case 193: return(64);        /* A-acute */
  4274.       case 201: return(91);        /* E-acute */
  4275.       case 214: return(92);        /* O-diaeresis */
  4276.       case 220: return(93);        /* U-diaeresis */
  4277.       case 225: return(96);        /* a-acute */
  4278.       case 233: return(123);        /* e-acute */
  4279.       case 246: return(124);        /* o-diaeresis */
  4280.       case 252: return(125);        /* u-diaeresis */
  4281.       default:  return(yl2as[c]);    /* Others */
  4282.     }
  4283. }
  4284.  
  4285. CHAR                    /* Hungarian to Latin-2 */
  4286. #ifdef CK_ANSIC
  4287. xhul2(CHAR c)
  4288. #else
  4289. xhul2(c) CHAR c;
  4290. #endif /* CK_ANSIC */
  4291. { /* xlhul2 */
  4292.     if (c & 0x80)
  4293.       return(UNK);
  4294.     switch(c) {
  4295.       case 36:  return(164);        /* Currency symbol */
  4296.       case 64:  return(193);        /* A-acute */
  4297.       case 91:  return(201);        /* E-acute */
  4298.       case 92:  return(214);        /* O-diaeresis */
  4299.       case 93:  return(220);        /* U-diaeresis */
  4300.       case 96:  return(225);        /* a-acute */
  4301.       case 123: return(233);        /* e-acute */
  4302.       case 124: return(246);        /* o-diaeresis */
  4303.       case 125: return(252);        /* u-diaeresis */
  4304.       case 126: return(189);        /* Double acute accent */
  4305.       default:  return(c);        /* Others */
  4306.     }
  4307. }
  4308.  
  4309. CHAR
  4310. #ifdef CK_ANSIC
  4311. xr8l2(CHAR c)
  4312. #else
  4313. xr8l2(c) CHAR c;
  4314. #endif /* CK_ANSIC */
  4315. { /* xr8l2 */ /* Hewlett Packard Roman8 to Latin-2 */
  4316.     switch (c) {
  4317.       case 235: return(169);        /* S caron */
  4318.       case 236: return(185);        /* s caron */
  4319.       default:  return(yl1l2[yr8l1[c]]);
  4320.     }
  4321. }
  4322.  
  4323. CHAR
  4324. #ifdef CK_ANSIC
  4325. xl2r8(CHAR c)
  4326. #else
  4327. xl2r8(c) CHAR c;
  4328. #endif /* CK_ANSIC */
  4329. { /* xl2r8 */ /* Latin-2 to Hewlett Packard Roman8 Character Set */
  4330.     switch (c) {
  4331.       case 169: return(235);        /* S caron */
  4332.       case 185: return(236);        /* s caron */
  4333.       default:  return(yr8l1[yl1l2[c]]);
  4334.     }
  4335. }
  4336.  
  4337. #else /* NOLATIN2 */
  4338.  
  4339. #define xl1mz NULL
  4340. #define xmzl1 NULL
  4341. #define xl2mz NULL
  4342. #define xmzl2 NULL
  4343. #define xl9mz NULL
  4344. #define xmzl9 NULL
  4345. #define xmzas NULL
  4346.  
  4347. #define xl11250 NULL
  4348. #define xl21250 NULL
  4349. #define xl91250 NULL
  4350.  
  4351. #define x1250as NULL
  4352. #define x1250l1 NULL
  4353. #define x1250l2 NULL
  4354. #define x1250l9 NULL
  4355.  
  4356. #define xl2l1 NULL
  4357. #define xl2w1 NULL
  4358. #define xl1l2 NULL
  4359. #define xw1l2 NULL
  4360. #define xl2as NULL
  4361. #define xl252 NULL
  4362. #define x52l2 NULL
  4363. #define x52as NULL
  4364. #define x52l1 NULL
  4365. #define xl152 NULL
  4366. #define xl2ne NULL
  4367. #define xl243 NULL
  4368. #define xl285 NULL
  4369. #define xl2aq NULL
  4370. #define xl2dg NULL
  4371. #define xl2sk NULL
  4372. #define xnel2 NULL
  4373. #define x43l2 NULL
  4374. #define x85l2 NULL
  4375. #define xaql2 NULL
  4376. #define xdgl2 NULL
  4377. #define xskl2 NULL
  4378. #define xl2ge NULL
  4379. #define xgel2 NULL
  4380. #define xl2hu NULL
  4381. #define xhul2 NULL
  4382. #define xl2r8 NULL
  4383. #define xr8l2 NULL
  4384. #endif /* LATIN2 */
  4385.  
  4386. /* This one can also be used for ELOT 927, Hebrew 7, etc */
  4387.  
  4388. CHAR
  4389. #ifdef CK_ANSIC
  4390. xassk(CHAR c)
  4391. #else
  4392. xassk(c) CHAR c;
  4393. #endif /* CK_ANSIC */
  4394. { /* xassk */                /* ASCII to Short KOI */
  4395.     if (c & 0x80)
  4396.       return(UNK);
  4397.     return((c > 95) ? (c - 32) : c);    /* Fold columns 6-7 to 4-5 */
  4398. }
  4399.  
  4400. #ifdef CYRILLIC
  4401. /* Translation functions for Cyrillic character sets */
  4402.  
  4403. CHAR                    /* Latin/Cyrillic to CP866 */
  4404. #ifdef CK_ANSIC
  4405. xlcac(CHAR c)
  4406. #else
  4407. xlcac(c) CHAR c;
  4408. #endif /* CK_ANSIC */
  4409. { /* xlcac */                /* PC Code Page 866 */
  4410.     return(ylcac[c]);
  4411. }
  4412.  
  4413. CHAR                    /* Latin/Cyrillic to */
  4414. #ifdef CK_ANSIC
  4415. xlc55(CHAR c)
  4416. #else
  4417. xlc55(c) CHAR c;
  4418. #endif /* CK_ANSIC */
  4419. { /* xlc55 */                /* PC Code Page 855 */
  4420.     return(ylc55[c]);
  4421. }
  4422.  
  4423. CHAR                    /* Latin/Cyrillic to */
  4424. #ifdef CK_ANSIC
  4425. xlc1251(CHAR c)
  4426. #else
  4427. xlc1251(c) CHAR c;
  4428. #endif /* CK_ANSIC */
  4429. { /* xlc1251 */                /* PC Code Page 1251 */
  4430.     return(ylc1251[c]);
  4431. }
  4432.  
  4433. CHAR                    /* Latin/Cyrillic to... */
  4434. #ifdef CK_ANSIC
  4435. xlcbu(CHAR c)
  4436. #else
  4437. xlcbu(c) CHAR c;
  4438. #endif /* CK_ANSIC */
  4439. { /* xlcbu */                /* Bulgarian PC Code Page */
  4440.     return(ylcbu[c]);
  4441. }
  4442.  
  4443. CHAR                    /* Latin/Cyrillic to Old KOI-8 */
  4444. #ifdef CK_ANSIC
  4445. xlck8(CHAR c)
  4446. #else
  4447. xlck8(c) CHAR c;
  4448. #endif /* CK_ANSIC */
  4449. { /* xlck8 */
  4450.     return(ylck8[c]);
  4451. }
  4452.  
  4453. CHAR                    /* Latin/Cyrillic to KOI8-R */
  4454. #ifdef CK_ANSIC
  4455. xlckr(CHAR c)
  4456. #else
  4457. xlckr(c) CHAR c;
  4458. #endif /* CK_ANSIC */
  4459. { /* xlckr */
  4460.     switch(c) {
  4461.       case 0xa1: return(0xb3);        /* Io */
  4462.       case 0xf1: return(0xa3);        /* io */
  4463.       default:
  4464.     if (c > 0x7f && c < 0xc0)
  4465.       return(UNK);
  4466.     return(ylck8[c]);
  4467.     }
  4468. }
  4469.  
  4470. CHAR                    /* Latin/Cyrillic to  KOI8-U */
  4471. #ifdef CK_ANSIC
  4472. xlcku(CHAR c)
  4473. #else
  4474. xlcku(c) CHAR c;
  4475. #endif /* CK_ANSIC */
  4476. { /* xlcku */
  4477.     switch(c) {
  4478.       case 0xa1: return(0xb3);        /* Io */
  4479.       case 0xf1: return(0xa3);        /* io */
  4480.       case 0xf4: return(0xa4);        /* Ukrainian ie */
  4481.       case 0xf6: return(0xa6);        /* Ukrainian i */
  4482.       case 0xf7: return(0xa7);        /* Ukrainian yi */
  4483.       case 0xf3: return(0xad);        /* Ukrainian ghe with upturn */
  4484.       case 0xa4: return(0xb4);        /* Ukrainian Ie */
  4485.       case 0xa6: return(0xb6);        /* Ukrainian I */
  4486.       case 0xa7: return(0xb7);        /* Ukrainian Yi */
  4487.       case 0xa3: return(0xbd);        /* Ukrainian Ghe with upturn */
  4488.       default:
  4489.     if (c > 0x7f && c < 0xc0)
  4490.       return(UNK);
  4491.     return(ylck8[c]);
  4492.     }
  4493. }
  4494.  
  4495. CHAR
  4496. #ifdef CK_ANSIC
  4497. xlcsk(CHAR c)
  4498. #else
  4499. xlcsk(c) CHAR c;
  4500. #endif /* CK_ANSIC */
  4501. { /* xlcsk */                /* Latin/Cyrillic to Short KOI */
  4502.     return(ylcsk[c]);
  4503. }
  4504.  
  4505. CHAR
  4506. #ifdef CK_ANSIC
  4507. xlcas(CHAR c)
  4508. #else
  4509. xlcas(c) CHAR c;
  4510. #endif /* CK_ANSIC */
  4511. { /* xlcas */                /* Latin/Cyrillic to ASCII */
  4512.     if (langs[language].id == L_RUSSIAN)
  4513.       return(ylcsk[c]);
  4514.     else
  4515.       return((c > 127) ? '?' : c);
  4516. }
  4517.  
  4518. CHAR                    /* CP866 */
  4519. #ifdef CK_ANSIC
  4520. xaclc(CHAR c)
  4521. #else
  4522. xaclc(c) CHAR c;
  4523. #endif /* CK_ANSIC */
  4524. { /* xaclc */                /* to Latin/Cyrillic */
  4525.     return(yaclc[c]);
  4526. }
  4527.  
  4528. CHAR                    /* CP855 */
  4529. #ifdef CK_ANSIC
  4530. x55lc(CHAR c)
  4531. #else
  4532. x55lc(c) CHAR c;
  4533. #endif /* CK_ANSIC */
  4534. { /* x55lc */                /* to Latin/Cyrillic */
  4535.     return(y55lc[c]);
  4536. }
  4537.  
  4538. CHAR                    /* Bulgarian PC Code Page ... */
  4539. #ifdef CK_ANSIC
  4540. xbulc(CHAR c)
  4541. #else
  4542. xbulc(c) CHAR c;
  4543. #endif /* CK_ANSIC */
  4544. { /* xbulc */                /* to Latin/Cyrillic */
  4545.     return(ybulc[c]);
  4546. }
  4547.  
  4548. CHAR                    /* CP1251 */
  4549. #ifdef CK_ANSIC
  4550. x1251lc(CHAR c)
  4551. #else
  4552. x1251lc(c) CHAR c;
  4553. #endif /* CK_ANSIC */
  4554. { /* x1251lc */                /* to Latin/Cyrillic */
  4555.     return(y1251lc[c]);
  4556. }
  4557.  
  4558. CHAR                    /* Old KOI-8 to Latin/Cyrillic */
  4559. #ifdef CK_ANSIC
  4560. xk8lc(CHAR c)
  4561. #else
  4562. xk8lc(c) CHAR c;
  4563. #endif /* CK_ANSIC */
  4564. { /* xk8lc */
  4565.     return(yk8lc[c]);
  4566. }
  4567.  
  4568. CHAR                    /* KOI8-R to Latin/Cyrillic */
  4569. #ifdef CK_ANSIC
  4570. xkrlc(CHAR c)
  4571. #else
  4572. xkrlc(c) CHAR c;
  4573. #endif /* CK_ANSIC */
  4574. { /* xkrlc */
  4575.     if (c == 0xb3) return(0xa1);
  4576.     else if (c == 0xa3) return(0xf1);
  4577.     else if (c > 0x7f && c < 0xc0)
  4578.       return(UNK);
  4579.     return(yk8lc[c]);
  4580. }
  4581.  
  4582. CHAR                    /* KOI8-U to Latin/Cyrillic */
  4583. #ifdef CK_ANSIC
  4584. xkulc(CHAR c)
  4585. #else
  4586. xkulc(c) CHAR c;
  4587. #endif /* CK_ANSIC */
  4588. { /* xkulc */
  4589.     switch (c) {
  4590.       case 0xb3: return(0xa1);        /* Io */
  4591.       case 0xa3: return(0xf1);        /* io */
  4592.       case 0xa4: return(0xf4);        /* Ukrainian ie */
  4593.       case 0xa6: return(0xf6);        /* Ukrainian i */
  4594.       case 0xa7: return(0xf7);        /* Ukrainian yi */
  4595.       case 0xad: return(0xf3);        /* Ukrainian ghe with upturn */
  4596.       case 0xb4: return(0xa4);        /* Ukrainian Ie */
  4597.       case 0xb6: return(0xa6);        /* Ukrainian I */
  4598.       case 0xb7: return(0xa7);        /* Ukrainian Yi */
  4599.       case 0xbd: return(0xa3);        /* Ukrainian Ghe with upturn */
  4600.       /* Note substitution of Gje for Ghe-Upturn, which is not in 8859-5 */
  4601.       default:
  4602.     if (c > 0x7f && c < 0xc0)
  4603.       return(UNK);
  4604.     return(yk8lc[c]);
  4605.     }
  4606. }
  4607.  
  4608. CHAR
  4609. #ifdef CK_ANSIC
  4610. xskcy(CHAR c)
  4611. #else
  4612. xskcy(c) CHAR c;
  4613. #endif /* CK_ANSIC */
  4614. { /* xskcy */            /* Short KOI to Latin/Cyrillic */
  4615.     return(yskcy[c & 0x7f]);
  4616. }
  4617.  
  4618. CHAR
  4619. #ifdef CK_ANSIC
  4620. xascy(CHAR c)
  4621. #else
  4622. xascy(c) CHAR c;
  4623. #endif /* CK_ANSIC */
  4624. { /* xascy */            /* ASCII to Latin/Cyrillic */
  4625.     if (langs[language].id == L_RUSSIAN) { /* If LANGUAGE == RUSSIAN  */
  4626.     return(yskcy[c & 0x7f]);    /* treat ASCII as Short KOI */
  4627.     } else return((c > 127) ? '?' : c);
  4628. }
  4629.  
  4630. CHAR
  4631. #ifdef CK_ANSIC
  4632. xacas(CHAR c)
  4633. #else
  4634. xacas(c) CHAR c;
  4635. #endif /* CK_ANSIC */
  4636. { /* xacas */            /* CP866 to ASCII */
  4637.     if (langs[language].id == L_RUSSIAN) {
  4638.     c = yaclc[c];            /* First to Latin/Cyrillic */
  4639.     return(ylcsk[c]);        /* Then to Short KOI */
  4640.     } else return((c > 127) ? '?' : c);
  4641. }
  4642.  
  4643. CHAR
  4644. #ifdef CK_ANSIC
  4645. x55as(CHAR c)
  4646. #else
  4647. x55as(c) CHAR c;
  4648. #endif /* CK_ANSIC */
  4649. { /* x55as */            /* CP855 to ASCII */
  4650.     if (langs[language].id == L_RUSSIAN) {
  4651.     c = y55lc[c];            /* First to Latin/Cyrillic */
  4652.     return(ylcsk[c]);        /* Then to Short KOI */
  4653.     } else return((c > 127) ? '?' : c);
  4654. }
  4655.  
  4656. CHAR
  4657. #ifdef CK_ANSIC
  4658. x1251as(CHAR c)
  4659. #else
  4660. x1251as(c) CHAR c;
  4661. #endif /* CK_ANSIC */
  4662. { /* x1251as */            /* CP81251 to ASCII */
  4663.     if (langs[language].id == L_RUSSIAN) {
  4664.     c = y1251lc[c];            /* First to Latin/Cyrillic */
  4665.     return(ylcsk[c]);        /* Then to Short KOI */
  4666.     } else return((c > 127) ? '?' : c);
  4667. }
  4668.  
  4669. CHAR
  4670. #ifdef CK_ANSIC
  4671. xskas(CHAR c)
  4672. #else
  4673. xskas(c) CHAR c;
  4674. #endif /* CK_ANSIC */
  4675. { /* xskas */                /* Short KOI to ASCII */
  4676.     return((c > 95) ? '?' : c);
  4677. }
  4678.  
  4679. CHAR
  4680. #ifdef CK_ANSIC
  4681. xk8as(CHAR c)
  4682. #else
  4683. xk8as(c) CHAR c;
  4684. #endif /* CK_ANSIC */
  4685. { /* xk8as */                /* Old KOI-8 Cyrillic to ASCII */
  4686.     if (langs[language].id == L_RUSSIAN) {
  4687.     c = yk8lc[c];            /* First to Latin/Cyrillic */
  4688.     return(ylcsk[c]);        /* Then to Short KOI */
  4689.     } else return((c > 127) ? '?' : c);
  4690. }
  4691.  
  4692. CHAR
  4693. #ifdef CK_ANSIC
  4694. xl1sk(CHAR c)
  4695. #else
  4696. xl1sk(c) CHAR c;
  4697. #endif /* CK_ANSIC */
  4698. { /* xl1sk */                /* Latin-1 to Short KOI */
  4699.     c = zl1as(c);            /* Convert to ASCII */
  4700.     return(c = xassk(c));        /* Convert ASCII to Short KOI */
  4701. }
  4702.  
  4703. CHAR
  4704. #ifdef CK_ANSIC
  4705. xw1lc(CHAR c)
  4706. #else
  4707. xw1lc(c) CHAR c;
  4708. #endif /* CK_ANSIC */
  4709. { /* xw1lc */                /* CP1252 to Latin/Cyrillic */
  4710.     return((c < 160) ? xw1as(c) : zl1as(c));
  4711. }
  4712.  
  4713. CHAR
  4714. #ifdef CK_ANSIC
  4715. xaslc(CHAR c)
  4716. #else
  4717. xaslc(c) CHAR c;
  4718. #endif /* CK_ANSIC */
  4719. { /* xaslc */            /* ASCII to Latin/Cyrillic */
  4720.     if (langs[language].id == L_RUSSIAN)
  4721.       return(yskcy[c & 0x7f]);
  4722.     else return(c & 0x7f);
  4723. }
  4724.  
  4725. CHAR
  4726. #ifdef CK_ANSIC
  4727. xasac(CHAR c)
  4728. #else
  4729. xasac(c) CHAR c;
  4730. #endif /* CK_ANSIC */
  4731. { /* xasac */            /* ASCII to CP866 */
  4732.     if (c & 0x80)
  4733.       return(UNK);
  4734.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4735.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4736.     return(ylcac[c]);        /* Then to CP866 */
  4737.     } else return(c & 0x7f);
  4738. }
  4739.  
  4740. CHAR
  4741. #ifdef CK_ANSIC
  4742. xas55(CHAR c)
  4743. #else
  4744. xas55(c) CHAR c;
  4745. #endif /* CK_ANSIC */
  4746. { /* xas55 */            /* ASCII to CP855 */
  4747.     if (c & 0x80)
  4748.       return(UNK);
  4749.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4750.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4751.     return(ylc55[c]);        /* Then to CP866 */
  4752.     } else return(c & 0x7f);
  4753. }
  4754.  
  4755. CHAR
  4756. #ifdef CK_ANSIC
  4757. xas1251(CHAR c)
  4758. #else
  4759. xas1251(c) CHAR c;
  4760. #endif /* CK_ANSIC */
  4761. { /* xas1251 */            /* ASCII to CP81251 */
  4762.     if (c & 0x80)
  4763.       return(UNK);
  4764.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4765.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4766.     return(ylc1251[c]);        /* Then to CP866 */
  4767.     } else return(c & 0x7f);
  4768. }
  4769.  
  4770. CHAR
  4771. #ifdef CK_ANSIC
  4772. xask8(CHAR c)
  4773. #else
  4774. xask8(c) CHAR c;
  4775. #endif /* CK_ANSIC */
  4776. { /* xask8 */            /* ASCII to KOI-8 */
  4777.     if (c & 0x80)
  4778.       return(UNK);
  4779.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  4780.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  4781.     return(ylck8[c]);        /* Then to KOI-8 */
  4782.     } else return(c & 0x7f);
  4783. }
  4784. #else /* No Cyrillic */
  4785. #define xacas NULL
  4786. #define x55as NULL
  4787. #define x1251as NULL
  4788. #define xaclc NULL
  4789. #define x55lc NULL
  4790. #define x1251lc NULL
  4791. #define xasac NULL
  4792. #define xas55 NULL
  4793. #define xas1251 NULL
  4794. #define xascy NULL
  4795. #define xask8 NULL
  4796. #define xaslc NULL
  4797. #define xassk NULL
  4798. #define xk8as NULL
  4799. #define xk8lc NULL
  4800. #define xkrlc NULL
  4801. #define xkulc NULL
  4802. #define xl1sk NULL
  4803. #define xw1lc NULL
  4804. #define xlcac NULL
  4805. #define xlc55 NULL
  4806. #define xlc1251 NULL
  4807. #define xlcas NULL
  4808. #define xlck8 NULL
  4809. #define xlckr NULL
  4810. #define xlcku NULL
  4811. #define xlch7 NULL
  4812. #define xlcsk NULL
  4813. #define xskas NULL
  4814. #define xskcy NULL
  4815. #define xbulc NULL
  4816. #define xlcbu NULL
  4817. #endif /* CYRILLIC */
  4818.  
  4819. /* Translation functions for Hebrew character sets */
  4820.  
  4821. #ifdef HEBREW
  4822.  
  4823. CHAR
  4824. #ifdef CK_ANSIC
  4825. xash7(CHAR c)
  4826. #else
  4827. xash7(c) CHAR c;
  4828. #endif /* CK_ANSIC */
  4829. { /* xash7 */            /* ASCII to Hebrew-7 */
  4830.     if (c & 0x80)
  4831.       return(UNK);
  4832.     if (c == 96) return('?');
  4833.     if (c > 96 && c < 123) return(c - 32);
  4834.     else return(c);
  4835. }
  4836.  
  4837. CHAR
  4838. #ifdef CK_ANSIC
  4839. xl1h7(CHAR c)
  4840. #else
  4841. xl1h7(c) CHAR c;
  4842. #endif /* CK_ANSIC */
  4843. { /* xl1h7 */            /* Latin-1 to Hebrew-7 */
  4844.     return(xash7(xl1as(c)));
  4845. }
  4846.  
  4847. CHAR
  4848. #ifdef CK_ANSIC
  4849. xl1lh(CHAR c)
  4850. #else
  4851. xl1lh(c) CHAR c;
  4852. #endif /* CK_ANSIC */
  4853. { /* xl1lh */                /* Latin-1 to Latin/Hebrew */
  4854.     switch(c) {
  4855.       case 170: return('a');        /* Feminine ordinal */
  4856.       case 186: return('o');        /* Masculine ordinal */
  4857.       case 215: return(170);        /* Times */
  4858.       case 247: return(186);        /* Divide */
  4859.       default:  return( (c > 190) ? xl1as(c) : c );
  4860.     }
  4861. }
  4862.  
  4863. CHAR
  4864. #ifdef CK_ANSIC
  4865. xw1lh(CHAR c)
  4866. #else
  4867. xw1lh(c) CHAR c;
  4868. #endif /* CK_ANSIC */
  4869. { /* xw1lh */                /* CP1252 to Latin/Hebrew */
  4870.     switch(c) {
  4871.       case 170: return('a');        /* Feminine ordinal */
  4872.       case 186: return('o');        /* Masculine ordinal */
  4873.       case 215: return(170);        /* Times */
  4874.       case 247: return(186);        /* Divide */
  4875.       default:
  4876.     if (c < 160)
  4877.       return(xw1as(c));
  4878.     else
  4879.       return((c > 190) ? xl1as(c) : c);
  4880.     }
  4881. }
  4882.  
  4883. #ifdef LATIN2
  4884. CHAR
  4885. #ifdef CK_ANSIC
  4886. xl2h7(CHAR c)
  4887. #else
  4888. xl2h7(c) CHAR c;
  4889. #endif /* CK_ANSIC */
  4890. { /* xl2h7 */                /* Latin-2 to Hebrew-7 */
  4891.     return(xash7(xl2as(c)));
  4892. }
  4893. #else
  4894. #define xl2h7 NULL
  4895. #endif /* LATIN2 */
  4896.  
  4897. #ifndef NOCYRIL
  4898. CHAR
  4899. #ifdef CK_ANSIC
  4900. xlch7(CHAR c)
  4901. #else
  4902. xlch7(c) CHAR c;
  4903. #endif /* CK_ANSIC */
  4904. { /* xlch7 */                /* Latin/Cyrillic to Hebrew-7 */
  4905.     return(xash7(xlcas(c)));
  4906. }
  4907. #endif /* NOCYRIL */
  4908.  
  4909. CHAR
  4910. #ifdef CK_ANSIC
  4911. xlhas(CHAR c)
  4912. #else
  4913. xlhas(c) CHAR c;
  4914. #endif /* CK_ANSIC */
  4915. { /* xlhas */            /* Latin/Hebrew to ASCII */
  4916.     return( (c > 127) ? '?' : c );
  4917. }
  4918.  
  4919. CHAR
  4920. #ifdef CK_ANSIC
  4921. xlhl1(CHAR c)
  4922. #else
  4923. xlhl1(c) CHAR c;
  4924. #endif /* CK_ANSIC */
  4925. { /* xlhl1 */            /* Latin/Hebrew to Latin-1 */
  4926.     switch (c) {
  4927.       case 170: return(215);
  4928.       case 186: return(247);
  4929.       default: return( (c > 190) ? '?' : c );
  4930.     }
  4931. }
  4932.  
  4933. CHAR
  4934. #ifdef CK_ANSIC
  4935. xlhw1(CHAR c)
  4936. #else
  4937. xlhw1(c) CHAR c;
  4938. #endif /* CK_ANSIC */
  4939. { /* xlhw1 */            /* Latin/Hebrew to CP1252 */
  4940.     if (c > 127 && c < 160)
  4941.       return('?');
  4942.     switch (c) {
  4943.       case 170: return(215);
  4944.       case 186: return(247);
  4945.       default: return( (c > 190) ? '?' : c );
  4946.     }
  4947. }
  4948.  
  4949. CHAR
  4950. #ifdef CK_ANSIC
  4951. xlh62(CHAR c)
  4952. #else
  4953. xlh62(c) CHAR c;
  4954. #endif /* CK_ANSIC */
  4955. { /* xlh62 */            /* Latin/Hebrew to CP862 */
  4956.     return(ylh62[c]);
  4957. }
  4958.  
  4959. CHAR
  4960. #ifdef CK_ANSIC
  4961. xl162(CHAR c)
  4962. #else
  4963. xl162(c) CHAR c;
  4964. #endif /* CK_ANSIC */
  4965. { /* xl162 */            /* Latin-1 to CP862 */
  4966.     return(xlh62(xl1lh(c)));    /* Via Latin/Hebrew */
  4967. }
  4968.  
  4969. CHAR
  4970. #ifdef CK_ANSIC
  4971. xlhh7(CHAR c)
  4972. #else
  4973. xlhh7(c) CHAR c;
  4974. #endif /* CK_ANSIC */
  4975. { /* xlhh7 */            /* Latin/Hebrew to Hebrew-7 */
  4976.     return(ylhh7[c]);
  4977. }
  4978.  
  4979. CHAR
  4980. #ifdef CK_ANSIC
  4981. xh7as(CHAR c)
  4982. #else
  4983. xh7as(c) CHAR c;
  4984. #endif /* CK_ANSIC */
  4985. { /* xh7as */            /* Hebrew-7 to ASCII */
  4986.     if (c & 0x80)
  4987.       return(UNK);
  4988.     return( (c > 95 && c < 123) ? '?' : c );
  4989. }
  4990.  
  4991. CHAR
  4992. #ifdef CK_ANSIC
  4993. x62lh(CHAR c)
  4994. #else
  4995. x62lh(c) CHAR c;
  4996. #endif /* CK_ANSIC */
  4997. { /* x62lh */            /* CP862 to Latin/Hebrew */
  4998.     return(y62lh[c]);
  4999. }
  5000.  
  5001. CHAR
  5002. #ifdef CK_ANSIC
  5003. x62as(CHAR c)
  5004. #else
  5005. x62as(c) CHAR c;
  5006. #endif /* CK_ANSIC */
  5007. { /* x62as */            /* CP862 to ASCII */
  5008.     return( xlhas(x62lh(c)) );
  5009. }
  5010.  
  5011. CHAR
  5012. #ifdef CK_ANSIC
  5013. x62l1(CHAR c)
  5014. #else
  5015. x62l1(c) CHAR c;
  5016. #endif /* CK_ANSIC */
  5017. { /* x62l1 */            /* CP862 to Latin-1 */
  5018.     return( xlhl1(x62lh(c)) );
  5019. }
  5020.  
  5021. CHAR
  5022. #ifdef CK_ANSIC
  5023. xh7lh(CHAR c)
  5024. #else
  5025. xh7lh(c) CHAR c;
  5026. #endif /* CK_ANSIC */
  5027. { /* xh7lh */            /* Hebrew-7 to Latin/Hebrew */
  5028.     if (c & 0x80)
  5029.       return(UNK);
  5030.     return(yh7lh[c]);
  5031. }
  5032.  
  5033. #else /* No Hebrew */
  5034.  
  5035. #define xash7 NULL
  5036. #define xl1h7 NULL
  5037. #define xl2h7 NULL
  5038. #define xlch7 NULL
  5039. #define xl1lh NULL
  5040. #define xw1lh NULL
  5041. #define xlhas NULL
  5042. #define xlhl1 NULL
  5043. #define xlhw1 NULL
  5044. #define xl162 NULL
  5045. #define xlhh7 NULL
  5046. #define xlh62 NULL
  5047. #define xh7as NULL
  5048. #define x62as NULL
  5049. #define x62l1 NULL
  5050. #define xh7lh NULL
  5051. #define x62lh NULL
  5052.  
  5053. #endif /* HEBREW */
  5054.  
  5055. /* Translation functions for Greek character sets */
  5056.  
  5057. #ifdef GREEK
  5058.  
  5059. CHAR
  5060. #ifdef CK_ANSIC
  5061. xaseg(CHAR c)
  5062. #else
  5063. xaseg(c) CHAR c;
  5064. #endif /* CK_ANSIC */
  5065. { /* xaseg */            /* ASCII to ELOT 927 */
  5066.     if (c & 0x80)
  5067.       return(UNK);
  5068.     if (c > 96 && c < 123) return(c - 32);
  5069.     else return(c);
  5070. }
  5071.  
  5072. CHAR
  5073. #ifdef CK_ANSIC
  5074. xl1eg(CHAR c)
  5075. #else
  5076. xl1eg(c) CHAR c;
  5077. #endif /* CK_ANSIC */
  5078. { /* xl1ge */            /* Latin-1 to ELOT 927 */
  5079.     return(xaseg(xl1as(c)));
  5080. }
  5081.  
  5082. CHAR
  5083. #ifdef CK_ANSIC
  5084. xl2lg(CHAR c)
  5085. #else
  5086. xl2lg(c) CHAR c;
  5087. #endif /* CK_ANSIC */
  5088. { /* xl2lg */            /* Latin-1 to Latin/Greek */
  5089.     if (c < 160) return(c);
  5090.     else if (c == 160 || c == 168 || c == 173 || c == 174)
  5091.       return(c);
  5092.     else return('?');
  5093. }
  5094.  
  5095. CHAR
  5096. #ifdef CK_ANSIC
  5097. xl1lg(CHAR c)
  5098. #else
  5099. xl1lg(c) CHAR c;
  5100. #endif /* CK_ANSIC */
  5101. { /* xl1lg */            /* Latin-1 to Latin/Greek */
  5102.     if (c < 160) return(c);
  5103.     switch(c) {
  5104.       case 160:                /* Themselves */
  5105.       case 164:
  5106.       case 166:
  5107.       case 167:
  5108.       case 168:
  5109.       case 169:
  5110.       case 171:
  5111.       case 172:
  5112.       case 173:
  5113.       case 176:
  5114.       case 177:
  5115.       case 178:
  5116.       case 179:
  5117.       case 180:
  5118.       case 187:
  5119.       case 189:
  5120.     return(c);
  5121.       case 181:                /* Lowercase mu */
  5122.     return(236);
  5123.       default:
  5124.     return(UNK);
  5125.     }
  5126. }
  5127.  
  5128. CHAR
  5129. #ifdef CK_ANSIC
  5130. xw1lg(CHAR c)
  5131. #else
  5132. xw1lg(c) CHAR c;
  5133. #endif /* CK_ANSIC */
  5134. { /* xw1lg */                /* CP1252 to Latin/Greek */
  5135.     return((c < 160) ? xw1as(c) : xl1lg(c));
  5136. }
  5137.  
  5138.  
  5139. #ifdef LATIN2
  5140. CHAR
  5141. #ifdef CK_ANSIC
  5142. xl2eg(CHAR c)
  5143. #else
  5144. xl2eg(c) CHAR c;
  5145. #endif /* CK_ANSIC */
  5146. { /* xl2eg */                /* Latin-2 to ELOT 927 */
  5147.     return(xaseg(xl2as(c)));
  5148. }
  5149. #else
  5150. #define xl2eg NULL
  5151. #endif /* LATIN2 */
  5152.  
  5153. #ifndef NOCYRIL
  5154. CHAR
  5155. #ifdef CK_ANSIC
  5156. xlceg(CHAR c)
  5157. #else
  5158. xlceg(c) CHAR c;
  5159. #endif /* CK_ANSIC */
  5160. { /* xlceg */            /* Latin/Cyrillic to ELOT 927 */
  5161.     return(xaseg(xlcas(c)));
  5162. }
  5163. #endif /* NOCYRIL */
  5164.  
  5165. CHAR
  5166. #ifdef CK_ANSIC
  5167. xlgas(CHAR c)
  5168. #else
  5169. xlgas(c) CHAR c;
  5170. #endif /* CK_ANSIC */
  5171. { /* xlgas */            /* Latin/Greek to ASCII */
  5172.     return( (c > 127) ? '?' : c );
  5173. }
  5174.  
  5175. CHAR
  5176. #ifdef CK_ANSIC
  5177. xlgl1(CHAR c)
  5178. #else
  5179. xlgl1(c) CHAR c;
  5180. #endif /* CK_ANSIC */
  5181. { /* xlgl1 */            /* Latin/Greek to Latin-1 */
  5182.     if (c == 236)
  5183.       return(181);
  5184.     else
  5185.       return(xl1lg(c));
  5186. }
  5187.  
  5188. CHAR
  5189. #ifdef CK_ANSIC
  5190. xlgw1(CHAR c)
  5191. #else
  5192. xlgw1(c) CHAR c;
  5193. #endif /* CK_ANSIC */
  5194. { /* xlgw1 */            /* Latin/Greek to Latin-1 */
  5195.     if (c > 127 && c < 160)
  5196.       return('?');
  5197.     return(xlgl1(c));
  5198. }
  5199.  
  5200. CHAR
  5201. #ifdef CK_ANSIC
  5202. xlg69(CHAR c)
  5203. #else
  5204. xlg69(c) CHAR c;
  5205. #endif /* CK_ANSIC */
  5206. { /* xlg69 */            /* Latin/Greek to CP869 */
  5207.     return(ylg69[c]);
  5208. }
  5209.  
  5210. CHAR
  5211. #ifdef CK_ANSIC
  5212. xl169(CHAR c)
  5213. #else
  5214. xl169(c) CHAR c;
  5215. #endif /* CK_ANSIC */
  5216. { /* xl169 */            /* Latin-1 to CP869 */
  5217.     return(xlg69(xl1lg(c)));    /* Via Latin/Greek */
  5218. }
  5219.  
  5220. CHAR
  5221. #ifdef CK_ANSIC
  5222. xlgeg(CHAR c)
  5223. #else
  5224. xlgeg(c) CHAR c;
  5225. #endif /* CK_ANSIC */
  5226. { /* xlgeg */            /* Latin/Greek to ELOT 927 */
  5227.     return(ylgeg[c]);
  5228. }
  5229.  
  5230. CHAR
  5231. #ifdef CK_ANSIC
  5232. xegas(CHAR c)
  5233. #else
  5234. xegas(c) CHAR c;
  5235. #endif /* CK_ANSIC */
  5236. { /* xegas */            /* ELOT 927 to ASCII */
  5237.     if (c & 0x80)
  5238.       return(UNK);
  5239.     return( (c > 96 && c < 123) ? '?' : c );
  5240. }
  5241.  
  5242. CHAR
  5243. #ifdef CK_ANSIC
  5244. x69lg(CHAR c)
  5245. #else
  5246. x69lg(c) CHAR c;
  5247. #endif /* CK_ANSIC */
  5248. { /* x69lg */            /* CP869 to Latin/Greek */
  5249.     return(y69lg[c]);
  5250. }
  5251.  
  5252. CHAR
  5253. #ifdef CK_ANSIC
  5254. x69as(CHAR c)
  5255. #else
  5256. x69as(c) CHAR c;
  5257. #endif /* CK_ANSIC */
  5258. { /* x69as */            /* CP869 to ASCII */
  5259.     return( xlgas(x69lg(c)) );
  5260. }
  5261.  
  5262. CHAR
  5263. #ifdef CK_ANSIC
  5264. x69l1(CHAR c)
  5265. #else
  5266. x69l1(c) CHAR c;
  5267. #endif /* CK_ANSIC */
  5268. { /* x69l1 */            /* CP869 to Latin-1 */
  5269.     return( xlgl1(x69lg(c)) );
  5270. }
  5271.  
  5272. CHAR
  5273. #ifdef CK_ANSIC
  5274. xeglg(CHAR c)
  5275. #else
  5276. xeglg(c) CHAR c;
  5277. #endif /* CK_ANSIC */
  5278. { /* xeglg */            /* ELOT 927 to Latin/Greek */
  5279.     return(yeglg[c]);
  5280. }
  5281.  
  5282. #else /* No Greek */
  5283.  
  5284. #define x69as NULL
  5285. #define x69l1 NULL
  5286. #define x69lg NULL
  5287. #define xaseg NULL
  5288. #define xegas NULL
  5289. #define xeglg NULL
  5290. #define xl169 NULL
  5291. #define xl1eg NULL
  5292. #define xl1lg NULL
  5293. #define xw1lg NULL
  5294. #define xl2ge NULL
  5295. #define xl2lg NULL
  5296. #define xlcge NULL
  5297. #define xlg69 NULL
  5298. #define xlgas NULL
  5299. #define xlgeg NULL
  5300. #define xlgge NULL
  5301. #define xlgl1 NULL
  5302. #define xlgw1 NULL
  5303.  
  5304. #endif /* GREEK */
  5305.  
  5306.  
  5307. /* Translation functions for Japanese Kanji character sets */
  5308.  
  5309. #ifdef KANJI
  5310. /*
  5311.   Translate Kanji Transfer Character Set (EUC) to local file character set,
  5312.   contributed by Dr. Hirofumi Fujii, Japan High Energy Research Laboratory
  5313.   (KEK), Tokyo, Japan.
  5314.  
  5315.   a is a byte to be translated, which may be a single-byte character,
  5316.   the Katakana prefix, the first byte of a two-byte Kanji character, or the
  5317.   second byte of 2-byte Kanji character.
  5318.  
  5319.   fn is the output function.
  5320.  
  5321.   Returns 0 on success, -1 on failure.
  5322. */
  5323.  
  5324. _PROTOTYP(static int jpnxas, (int, int[]) );
  5325. _PROTOTYP(static int jpnxkt, (int, int[]) );
  5326. _PROTOTYP(static int jpnxkn, (int[], int[]) );
  5327.  
  5328. static int jpncnt;            /* Byte count for Japanese */
  5329. static int jpnlst;            /* Last status (for JIS7) */
  5330.  
  5331. static int
  5332. jpnxas(a, obuf) int a; int obuf[]; { /* Translate ASCII to local file code */
  5333.     int r;
  5334.  
  5335.     r = 0;
  5336.     if (fcharset == FC_JIS7) {
  5337.     switch (jpnlst) {
  5338.       case 1:
  5339.         obuf[0] = 0x0f;
  5340.         obuf[1] = a;
  5341.         r = 2;
  5342.         break;
  5343.       case 2:
  5344.         obuf[0] = 0x1b;
  5345.         obuf[1] = 0x28;
  5346.         obuf[2] = 0x4a;
  5347.         obuf[3] = a;
  5348.         r = 4;
  5349.         break;
  5350.       default:
  5351.         obuf[0] = a;
  5352.         r = 1;
  5353.         break;
  5354.     }
  5355.     } else {
  5356.     obuf[0] = a;
  5357.     r = 1;
  5358.     }
  5359.     return(r);
  5360. }
  5361.  
  5362. static int
  5363. jpnxkt(a, obuf) int a; int obuf[]; {
  5364. /* Translate JIS X 201 Katakana to local code */
  5365.  
  5366.     int r;
  5367.  
  5368.     r = 0;
  5369.     if (fcharset == FC_JIS7) {
  5370.     switch (jpnlst) {
  5371.       case 2:                /* from Kanji */
  5372.         obuf[r++] = 0x1b;
  5373.         obuf[r++] = 0x28;
  5374.         obuf[r++] = 0x4a;
  5375.       case 0:                /* from Roman */
  5376.         obuf[r++] = 0x0e;
  5377.       default:
  5378.         obuf[r++] = (a & 0x7f);
  5379.       break;
  5380.     }
  5381.     } else {
  5382.     if (fcharset == FC_JEUC)
  5383.       obuf[r++] = 0x8e;
  5384.     obuf[r++] = (a | 0x80);
  5385.     }
  5386.     return(r);
  5387. }
  5388.  
  5389. static int
  5390. jpnxkn(ibuf, obuf) int ibuf[], obuf[]; {
  5391.     /* Translate JIS X 0208 Kanji to local code */
  5392.     int c1, c2;
  5393.     int r;
  5394.  
  5395.     c1 = ibuf[0] & 0x7f;
  5396.     c2 = ibuf[1] & 0x7f;
  5397.  
  5398.     if (fcharset == FC_SHJIS) {
  5399.     if (c1 & 1)
  5400.       c2 += 0x1f;
  5401.     else
  5402.       c2 += 0x7d;
  5403.  
  5404.         if (c2 >= 0x7f) c2++;
  5405.  
  5406.         c1 = ((c1 - 0x21) >> 1) + 0x81;
  5407.         if (c1 > 0x9f) c1 += 0x40;
  5408.  
  5409.         obuf[0] = c1;
  5410.         obuf[1] = c2;
  5411.         r = 2;
  5412.     } else if (fcharset == FC_JIS7) {
  5413.         r = 0;
  5414.         switch (jpnlst) {
  5415.         case 1:
  5416.         obuf[r++] = 0x0f; /* From Katakana */
  5417.         case 0:
  5418.         obuf[r++] = 0x1b;
  5419.         obuf[r++] = 0x24;
  5420.         obuf[r++] = 0x42;
  5421.       default:
  5422.         obuf[r++] = c1;
  5423.         obuf[r++] = c2;
  5424.         break;
  5425.     }
  5426.     } else {
  5427.         obuf[0] = (c1 | 0x80);
  5428.         obuf[1] = (c2 | 0x80);
  5429.         r = 2;
  5430.     }
  5431.     return(r);
  5432. }
  5433.  
  5434. int
  5435. xkanjf() {
  5436. /* Initialize parameters for xkanji */
  5437. /* This function should be called when F/X-packet is received */
  5438.     jpncnt = jpnlst = 0;
  5439.     return(0);
  5440. }
  5441.  
  5442. int
  5443. #ifdef CK_ANSIC
  5444. xkanjz(int (*fn)(char))
  5445. #else
  5446. xkanjz(fn) int (*fn)();
  5447. #endif /* CK_ANSIC */
  5448. { /* xkanjz */
  5449. /*
  5450.   Terminate xkanji
  5451.   This function must be called when Z-packet is received
  5452.   (before closing the file).
  5453. */
  5454.     static int obuf[6];
  5455.     int r, i, c;
  5456.  
  5457.     if (fcharset == FC_JIS7) {
  5458.         c = 'A';            /* Dummy Roman character */
  5459.         r = jpnxas(c, obuf) - 1;    /* -1 removes Dummy character */
  5460.         if (r > 0) {
  5461.         for (i = 0; i < r; i++)
  5462.           if (((*fn)((char) obuf[i])) < 0)
  5463.         return(-1);
  5464.     }
  5465.     }
  5466.     return(0);
  5467. }
  5468.  
  5469. int
  5470. #ifdef CK_ANSIC
  5471. xkanji(int a, int (*fn)(char))
  5472. #else
  5473. xkanji(a, fn) int a; int (*fn)();
  5474. #endif /* CK_ANSIC */
  5475. { /* xkanji */
  5476.     static int xbuf[2];
  5477.     static int obuf[8];
  5478.  
  5479.     int i, r;
  5480.     int c7;
  5481.     int state=0;
  5482.  
  5483.     r = 0;
  5484.     if (jpncnt == 0) {
  5485.     /* 1st byte */
  5486.     if ((a & 0x80) == 0) {
  5487.         /* 8th bit is 0, i.e., single-byte code */
  5488.         r = jpnxas(a, obuf);
  5489.         state = 0;
  5490.     } else {
  5491.         /* 8th bit is 1, check the range */
  5492.         c7 = a & 0x7f;
  5493.         if (((c7 > 0x20) && (c7 < 0x7f)) || (c7 == 0x0e)) {
  5494.             /* double byte code */
  5495.             xbuf[jpncnt++] = a;
  5496.         } else {
  5497.             /* single byte code */
  5498.             r = jpnxas(a, obuf);
  5499.             state = 0;
  5500.         }
  5501.     }
  5502.     } else {
  5503.     /* not the 1st byte */
  5504.     xbuf[jpncnt++] = a;
  5505.     if (xbuf[0] == 0x8e) {
  5506.         r = jpnxkt(xbuf[1], obuf);
  5507.         state = 1;
  5508.     } else {
  5509.         r = jpnxkn(xbuf, obuf);
  5510.         state = 2;
  5511.     }
  5512.     }
  5513.     if (r > 0) {
  5514.         for (i = 0; i < r; i++ )
  5515.       if (((*fn)((char) obuf[i])) < 0)
  5516.         return(-1);
  5517.         jpnlst = state;
  5518.         jpncnt = 0;
  5519.     }
  5520.     return(0);
  5521. }
  5522.  
  5523. /*
  5524.   Function for translating from Japanese file character set
  5525.   to Japanese EUC transfer character set.
  5526.   Returns a pointer to a string containing 0, 1, or 2 bytes.
  5527. */
  5528.  
  5529. /* zkanji */
  5530. static int jpnstz;            /* status for JIS-7 */
  5531. static int jpnpnd;            /* number of pending bytes */
  5532. static int jpnpnt;            /* pending buffer index */
  5533. static int jpnpbf[8];            /* pending buffer */
  5534.  
  5535. /* There is some duplication here between the old and new JIS-7 parsers */
  5536. /* to be cleaned up later... */
  5537.  
  5538. VOID
  5539. j7init() {                /* Initialize JIS-7 parser */
  5540.     jpnstz = 0;
  5541.     jpnpnd = 0;
  5542.     jpnpnt = 0;
  5543. }
  5544.  
  5545. int
  5546. getj7() {                /* Reads JIS-7 returns next EUC byte */
  5547.     int x;
  5548.  
  5549.     if (jpnpnd > 0) {            /* If something is pending */
  5550.     x = (unsigned) jpnpbf[jpnpnt++]; /* Get it */
  5551.     jpnpnd--;
  5552.     if (jpnpnd < 0) jpnpnd = 0;
  5553.     return((unsigned)x);
  5554.     }
  5555.     jpnpnt = 0;
  5556.  
  5557.     if ((x = zminchar()) < 0) return(x);
  5558.     while (jpnpnd == 0) {        /* While something is pending... */
  5559.     if ((x > 0x20) && (x < 0x7f)) {    /* 7-bit graphic character */
  5560.         switch (jpnstz) {
  5561.           case 1:             /* Katakana */
  5562. #ifdef COMMENT
  5563.         /* This can't be right... */
  5564.         jpnpbf[jpnpnd++] = 0x80; /* Insert flag (NOT SS2???) */
  5565. #else
  5566.         jpnpbf[jpnpnd++] = 0x8e; /* Insert SS2 */
  5567. #endif /* COMMENT */
  5568.         jpnpbf[jpnpnd++] = (x | 0x80); /* Insert Kana + 8th bit */
  5569.         break;
  5570.           case 2:            /* Kanji */
  5571.         jpnpbf[jpnpnd++] = (x | 0x80); /* Get another byte */
  5572.         if ((x = zminchar()) < 0) return(x);
  5573.         jpnpbf[jpnpnd++] = (x | 0x80);
  5574.         break;
  5575.           default:            /* ASCII / JIS Roman */
  5576.         jpnpbf[jpnpnd++] = x;
  5577.         break;
  5578.         }
  5579.     } else if (x == 0x0e) {        /* ^N = SO */
  5580.         jpnstz = 1;            /* Katakana */
  5581.         if ((x = zminchar()) < 0) return(x);
  5582.     } else if (x == 0x0f) {        /* ^O = SI */
  5583.         jpnstz = 0;            /* ASCII / JIS Roman */
  5584.         if ((x = zminchar()) < 0) return(x);
  5585.     } else if (x == 0x1b) {        /* Escape */
  5586.         jpnpbf[jpnpnd++] = x;    /* Save in buffer */
  5587.         if ((x = zminchar()) < 0) return(x);
  5588.         jpnpbf[jpnpnd++] = x;    /* Save in buffer */
  5589.         if (x == '$') {        /* <ESC>$ */
  5590.         if ((x = zminchar()) < 0) return(x);
  5591.         jpnpbf[jpnpnd++] = x;
  5592.         if ((x == '@') || (x == 'B')) {    /* Kanji */
  5593.             jpnstz = 2;
  5594.             jpnpnt = jpnpnd = 0;
  5595.             if ((x = zminchar()) < 0) return(x);
  5596.         }
  5597.         } else if (x == '(') {    /* <ESC>( == 94-byte single-byte set */
  5598.         if ((x = zminchar()) < 0) return(x);
  5599.         jpnpbf[jpnpnd++] = x;
  5600.         if ((x == 'B') || (x == 'J')) {    /* ASCII or JIS Roman */
  5601.             jpnstz = 0;                /* Set state */
  5602.             jpnpnt = jpnpnd = 0;        /* Reset pointers */
  5603.             if ((x = zminchar()) < 0) return(x);
  5604.         }
  5605.         } else if (x == 0x1b) {    /* <ESC><ESC> */
  5606.         jpnpnt = jpnpnd = 0;    /* Reset pointers, stay in state */
  5607.         if ((x = zminchar()) < 0) return(x);
  5608.         }
  5609.     } else {            /* Not <ESC> - just save it */
  5610.         jpnpbf[jpnpnd++] = x;
  5611.     }
  5612.     }
  5613.     jpnpnt = 0;
  5614.     x = (unsigned)jpnpbf[jpnpnt++];
  5615.     jpnpnd--;
  5616.     return((unsigned)x);
  5617. }
  5618.  
  5619. USHORT
  5620. #ifdef CK_ANSIC
  5621. eu_to_sj(USHORT eu)            /* EUC-JP to Shift-JIS */
  5622. #else
  5623. eu_to_sj(eu) USHORT eu;
  5624. #endif /* CK_ANSIC */
  5625. {
  5626.     int c1, c2;
  5627.     union ck_short jcode,scode;
  5628.  
  5629.     jcode.x_short = eu;
  5630.     c1 = (jcode.x_char[byteorder] & 0x7f);
  5631.     c2 = (jcode.x_char[1-byteorder] & 0x7f);
  5632.  
  5633.     if (c1 & 1)
  5634.       c2 += 0x1f;
  5635.     else
  5636.       c2 += 0x7d;
  5637.     if (c2 >= 0x7f)
  5638.       c2++;
  5639.     c1 = ((c1 - 0x21) >> 1) + 0x81;
  5640.     if (c1 > 0x9f)
  5641.       c1 += 0x40;
  5642.  
  5643.     scode.x_char[byteorder] = c1;
  5644.     scode.x_char[1-byteorder] = c2;
  5645.     return(scode.x_short);
  5646. }
  5647.  
  5648.  
  5649. USHORT
  5650. #ifdef CK_ANSIC
  5651. sj_to_eu(USHORT sj)            /* Shift-JIS to EUC-JP */
  5652. #else
  5653. sj_to_eu(sj) USHORT sj;
  5654. #endif /* CK_ANSIC */
  5655. {
  5656.     union ck_short jcode, scode;
  5657.     int c0, c1;
  5658.  
  5659.     scode.x_short = sj;
  5660.     c0 = scode.x_char[byteorder];    /* Left (hi order) byte */
  5661.     c1 = scode.x_char[1-byteorder];    /* Right (lo order) byte */
  5662.  
  5663.     if (((c0 >= 0x81) && (c0 <= 0x9f)) || /* High order byte has 8th bit set */
  5664.         ((c0 >= 0xe0) && (c0 <= 0xfc))) { /* Kanji */
  5665.     if (c0 <= 0x9f)              /* Two bytes in */
  5666.       c0 -= 0x71;              /* Do the shifting... */
  5667.     else
  5668.       c0 -= 0xb1;
  5669.     c0 = c0 * 2 + 1;
  5670.     if (c1 > 0x7f) c1 -= 1;
  5671.     if (c1 >= 0x9e) {
  5672.         c1 -= 0x7d;
  5673.         c0 += 1;
  5674.     } else {
  5675.         c1 -= 0x1f;
  5676.     }
  5677.     jcode.x_char[byteorder] = (c0 | 0x80); /* Two bytes out */
  5678.     jcode.x_char[1-byteorder] = (c1 | 0x80);
  5679.  
  5680.     } else if (c0 == 0) {        /* Single byte */
  5681.     if (c1 >= 0xa1 && c1 <= 0xdf) {    /* Katakana */
  5682.         jcode.x_char[byteorder] = 0x8e; /* SS2 */
  5683.         jcode.x_char[1-byteorder] = c1; /* Kana code */
  5684.     } else {            /* ASCII or C0 */
  5685.         jcode.x_short = c1;
  5686.     }
  5687.     } else {                /* Something bad */
  5688.     debug(F001,"sj_to_eu bad sj","",sj);
  5689.     jcode.x_short = 0xffff;
  5690.     }
  5691.     return(jcode.x_short);
  5692. }
  5693.  
  5694. int
  5695. zkanjf() {                /* Initialize */
  5696.     jpnstz = jpnpnd = jpnpnt = 0;
  5697.     return(0);
  5698. }
  5699.  
  5700. int
  5701. zkanjz() {
  5702.     return(0);
  5703. }
  5704.  
  5705. int
  5706. #ifdef CK_ANSIC
  5707. zkanji(int (*fn)(void))
  5708. #else
  5709. zkanji(fn) int (*fn)();
  5710. #endif /* CK_ANSIC */
  5711. { /* zkanji */
  5712.     /* Read Japanese local code and translate to Japanese EUC */
  5713.     int a;
  5714.     int sc[3];
  5715.  
  5716.     /* No pending characters */
  5717.     if (fcharset == FC_SHJIS) {        /* Translating from Shift-JIS */
  5718.         if (jpnpnd) {
  5719.             jpnpnd--;
  5720.             return(jpnpbf[jpnpnt++]);
  5721.         }
  5722.         a = (*fn)();
  5723.     jpnpnd = jpnpnt = 0;
  5724.     if (((a >= 0x81) && (a <= 0x9f)) ||
  5725.         ((a >= 0xe0) && (a <= 0xfc))) { /* 2-byte Kanji code */
  5726.         sc[0] = a;
  5727.         if ((sc[1] = (*fn)()) < 0)    /* Get second byte */
  5728.           return(sc[1]);
  5729.         if (sc[0] <= 0x9f)
  5730.           sc[0] -= 0x71;
  5731.         else
  5732.           sc[0] -= 0xb1;
  5733.         sc[0] = sc[0] * 2 + 1;
  5734.         if (sc[1] > 0x7f)
  5735.           sc[1]--;
  5736.         if (sc[1] >= 0x9e) {
  5737.             sc[1] -= 0x7d;
  5738.             sc[0]++;
  5739.         } else {
  5740.             sc[1] -= 0x1f;
  5741.         }
  5742.         a = (sc[0] | 0x80);
  5743.         jpnpbf[0] = (sc[1] | 0x80);
  5744.         jpnpnd = 1;
  5745.         jpnpnt = 0;
  5746.     } else if ((a >= 0xa1) && (a <= 0xdf)) { /* Katakana */
  5747.         jpnpbf[0] = a;
  5748.         jpnpnd = 1;
  5749.         jpnpnt = 0;
  5750.         a = 0x8e;
  5751.     }
  5752.     return(a);
  5753.     } else if (fcharset == FC_JIS7 ) {    /* 7-bit JIS X 0208 */
  5754.         if (jpnpnd) {
  5755.             a = jpnpbf[jpnpnt++];
  5756.         jpnpnd--;
  5757.             return(a);
  5758.         }
  5759.         jpnpnt = 0;
  5760.         if ((a = (*fn)()) < 0)
  5761.       return(a);
  5762.         while (jpnpnd == 0) {
  5763.             if ((a > 0x20) && (a < 0x7f)) {
  5764.                 switch (jpnstz) {
  5765.           case 1:
  5766.             jpnpbf[jpnpnd++] = 0x80; /* Katakana */
  5767.             jpnpbf[jpnpnd++] = (a | 0x80);
  5768.             break;
  5769.           case 2:
  5770.             jpnpbf[jpnpnd++] = (a | 0x80); /* Kanji */
  5771.             if ((a = (*fn)()) < 0)
  5772.               return(a);
  5773.             jpnpbf[jpnpnd++] = (a | 0x80);
  5774.             break;
  5775.           default:
  5776.             jpnpbf[jpnpnd++] = a; /* Single byte */
  5777.             break;
  5778.                 }
  5779.             } else if (a == 0x0e) {
  5780.                 jpnstz = 1;
  5781.                 if ((a = (*fn)()) < 0)
  5782.           return(a);
  5783.             } else if (a == 0x0f) {
  5784.                 jpnstz = 0;
  5785.                 if ((a = (*fn)()) < 0)
  5786.           return(a);
  5787.             } else if (a == 0x1b) {
  5788.                 jpnpbf[jpnpnd++] = a;    /* Escape */
  5789.                 if ((a = (*fn)()) < 0)
  5790.           return(a);
  5791.                 jpnpbf[jpnpnd++] = a;
  5792.                 if (a == '$') {
  5793.                     if ((a = (*fn)()) < 0)
  5794.               return(a);
  5795.                     jpnpbf[jpnpnd++] = a;
  5796.                     if ((a == '@') || (a == 'B')) {
  5797.                         jpnstz = 2;
  5798.             jpnpnt = jpnpnd = 0;
  5799.                         if ((a = (*fn)()) < 0)
  5800.               return(a);
  5801.                     }
  5802.                 } else if (a == '(') {
  5803.                     if ((a = (*fn)()) < 0)
  5804.               return(a);
  5805.                     jpnpbf[jpnpnd++] = a;
  5806.                     if ((a == 'B') || (a == 'J')) {
  5807.                         jpnstz = 0;
  5808.             jpnpnt = jpnpnd = 0;
  5809.                         if ((a = (*fn)()) < 0)
  5810.               return(a);
  5811.                     }
  5812.                 } else if (a == 0x1b) {
  5813.                     jpnpnt = jpnpnd = 0;
  5814.                     if ((a = (*fn)()) < 0)
  5815.               return(a);
  5816.                 }
  5817.             } else {
  5818.                 jpnpbf[jpnpnd++] = a;
  5819.             }
  5820.         }
  5821.         jpnpnt = 0;
  5822.         a = jpnpbf[jpnpnt++];
  5823.     jpnpnd--;
  5824.         return(a);
  5825.     } else {
  5826.         a = (*fn)();
  5827.         return(a);
  5828.     }
  5829. }
  5830. #endif /* KANJI */
  5831.  
  5832. /* Euro functions */
  5833.  
  5834. #ifdef LATIN2
  5835. CHAR
  5836. #ifdef CK_ANSIC
  5837. xl2l9(CHAR c)
  5838. #else
  5839. xl2l9(c) CHAR c;
  5840. #endif /* CK_ANSIC */
  5841. { /* xl2l9 */                 /* Latin-2 to Latin-9... */
  5842.     switch (c) {
  5843.       case 169: return((CHAR)166);    /* S caron */
  5844.       case 185: return((CHAR)168);    /* s caron */
  5845.       case 174: return((CHAR)180);    /* Z caron */
  5846.       case 190: return((CHAR)184);    /* z caron */
  5847.       default:
  5848.     return(yl2l1[c]);
  5849.     }
  5850.  
  5851. }
  5852.  
  5853. _PROTOTYP( CHAR xl258, ( CHAR ) );
  5854. CHAR
  5855. #ifdef CK_ANSIC
  5856. xl258(CHAR c)
  5857. #else
  5858. xl258(c) CHAR c;
  5859. #endif /* CK_ANSIC */
  5860. { /* xl258 */                 /* Latin-2 to CP858... */
  5861.     return(c);
  5862. }
  5863. #else
  5864. #define xl2l9 NULL
  5865. #define xl258 NULL
  5866. #endif /* LATIN2 */
  5867.  
  5868. CHAR
  5869. #ifdef CK_ANSIC
  5870. zl9as(CHAR c)
  5871. #else
  5872. zl9as(c) CHAR c;
  5873. #endif /* CK_ANSIC */
  5874. { /* zl9as */                 /* Latin-9 to US ASCII... */
  5875.     if (c < (CHAR)0x80) return(c);    /* Save a function call */
  5876.     switch (c) {
  5877.       case 0xa4: return(UNK);        /* Euro */
  5878.       case 0xa6: return('S');        /* S Caron */
  5879.       case 0xa8: return('s');        /* s Caron */
  5880.       case 0xb4: return('Z');        /* Z Caron */
  5881.       case 0xbc: return('O');        /* OE digraph */
  5882.       case 0xbd: return('o');        /* oe digraph */
  5883.       case 0xbe: return('Y');        /* Y diaeresis */
  5884.       default:   return(zl1as(c));    /* The rest is like Latin-1 */
  5885.     }
  5886. }
  5887.  
  5888. _PROTOTYP( CHAR xl9as, ( CHAR ) );
  5889. CHAR
  5890. #ifdef CK_ANSIC
  5891. xl9as(CHAR c)
  5892. #else
  5893. xl9as(c) CHAR c;
  5894. #endif /* CK_ANSIC */
  5895. { /* xl9as */                 /* Latin-9 to US ASCII... */
  5896.     if (c < (CHAR)0x80) return(c);    /* Save a function call */
  5897.     switch (c) {
  5898.       case 0xa4: return(UNK);        /* Euro */
  5899.       case 0xa6: return('S');        /* S Caron */
  5900.       case 0xa8: return('s');        /* s Caron */
  5901.       case 0xb4: return('Z');        /* Z Caron */
  5902.       case 0xb8: return('z');        /* z Caron */
  5903.       case 0xbc: return('O');        /* OE digraph */
  5904.       case 0xbd: return('o');        /* oe digraph */
  5905.       case 0xbe: return('Y');        /* Y diaeresis */
  5906.       default:   return(xl1as(c));    /* The rest is like Latin-1 */
  5907.     }
  5908. }
  5909.  
  5910. CHAR                    /* CP1252 to Latin-9 */
  5911. #ifdef CK_ANSIC
  5912. xw1l9(CHAR c)
  5913. #else
  5914. xw1l9(c) CHAR c;
  5915. #endif /* CK_ANSIC */
  5916. { /* xw1l9 */
  5917.     switch (c) {
  5918.       case 0x80: return(0xa4);        /* Euro sign */
  5919.       case 0x8a: return(0xa6);        /* S caron */
  5920.       case 0x8c: return(0xbc);        /* OE */
  5921.       case 0x8e: return(0xb4);        /* Z caron */
  5922.       case 0x9a: return(0xa8);        /* s caron */
  5923.       case 0x9c: return(0xbd);        /* oe */
  5924.       case 0x9e: return(0xb8);        /* z caron */
  5925.       case 0x9f: return(0xbe);        /* Y diaeresis */
  5926.       case 0xa4:            /* Currency sign */
  5927.       case 0xa6:            /* Broken vertical bar */
  5928.       case 0xa8:            /* Diaeresis */
  5929.       case 0xb4:            /* Acute accent */
  5930.       case 0xb8:            /* Cedilla */
  5931.       case 0xbc:            /* 1/4 */
  5932.       case 0xbd:            /* 1/2 */
  5933.       case 0xbe: return('?');        /* 3/4 */
  5934.       default: return((c < 160) ? xw1as(c) : c);
  5935.     }
  5936. }
  5937.  
  5938. #ifdef LATIN2
  5939. CHAR
  5940. #ifdef CK_ANSIC
  5941. xl9l2(CHAR c)
  5942. #else
  5943. xl9l2(c) CHAR c;
  5944. #endif /* CK_ANSIC */
  5945. { /* xl9l2 */                 /* Latin-9 to Latin-2... */
  5946.     if (c < (CHAR)0x80) return(c);    /* Save a function call */
  5947.     switch (c) {
  5948.       case 0xa4: return(UNK);        /* Euro */
  5949.       case 0xa6: return((CHAR)0xa9);    /* S Caron */
  5950.       case 0xa8: return((CHAR)0xb9);    /* s Caron */
  5951.       case 0xb4: return((CHAR)0xae);    /* Z Caron */
  5952.       case 0xb8: return((CHAR)0xaf);    /* z Caron */
  5953.       case 0xbc: return('O');        /* OE digraph */
  5954.       case 0xbd: return('o');        /* oe digraph */
  5955.       case 0xbe: return('Y');        /* Y diaeresis */
  5956.       default:   return(xl1l2(c));    /* The rest is like Latin-1 */
  5957.     }
  5958. }
  5959. #else
  5960. #define xl9l2 NULL
  5961. #endif /* LATIN2 */
  5962.  
  5963. CHAR
  5964. #ifdef CK_ANSIC
  5965. xl958(CHAR c)
  5966. #else
  5967. xl958(c) CHAR c;
  5968. #endif /* CK_ANSIC */
  5969. { /* xl958 */                 /* Latin-9 to CP858... */
  5970.     if (c == 0xa4)            /* Euro Symbol */
  5971.       return((CHAR)0xd5);
  5972.     else if (c == 0x9e)            /* This was currency symbol */
  5973.       return((CHAR)0xcf);
  5974.     c = yl185[c];
  5975.     return(c);
  5976. }
  5977.  
  5978. CHAR
  5979. #ifdef CK_ANSIC
  5980. x58as(CHAR c)
  5981. #else
  5982. x58as(c) CHAR c;
  5983. #endif /* CK_ANSIC */
  5984. { /* x58as */                 /* CP858 to US ASCII... */
  5985.     if (c == 0xd5)            /* Euro rather than dotless i */
  5986.       return(UNK);
  5987.     else
  5988.       return(x85as(c));            /* The rest is like CP850 */
  5989. }
  5990.  
  5991. CHAR
  5992. #ifdef CK_ANSIC
  5993. x58l1(CHAR c)
  5994. #else
  5995. x58l1(c) CHAR c;
  5996. #endif /* CK_ANSIC */
  5997. { /* x58l1 */                 /* CP858 to Latin-1... */
  5998.     if (c == 0xd5)            /* Euro rather than dotless i */
  5999.       return((CHAR)0xa4);        /* Return currency symbol */
  6000.     else if (c == 0xcf)            /* This keeps it invertible */
  6001.       return((CHAR)0x9e);
  6002.     else
  6003.       return(x85l1(c));
  6004. }
  6005.  
  6006. #ifdef LATIN2
  6007. CHAR
  6008. #ifdef CK_ANSIC
  6009. x58l2(CHAR c)
  6010. #else
  6011. x58l2(c) CHAR c;
  6012. #endif /* CK_ANSIC */
  6013. { /* x58l2 */                 /* CP858 to Latin-2... */
  6014.     if (c == 0xd5)            /* Euro rather than dotless i */
  6015.       return((CHAR)0xa4);        /* Return currency symbol */
  6016.     else if (c == 0xcf)            /* This keeps it invertible */
  6017.       return((CHAR)0x9e);        /* (if it ever was...) */
  6018.     else                /* Otherwise like CP850 */
  6019.       return(x85l2(c));
  6020. }
  6021. #else
  6022. #define x58l2 NULL
  6023. #endif /* LATIN2 */
  6024.  
  6025. CHAR
  6026. #ifdef CK_ANSIC
  6027. x58l9(CHAR c)
  6028. #else
  6029. x58l9(c) CHAR c;
  6030. #endif /* CK_ANSIC */
  6031. { /* x58l9 */                 /* CP-858 to Latin-9... */
  6032.     if (c == 0xd5)            /* Euro rather than dotless i */
  6033.       return((CHAR)0xa4);        /* Return currency symbol */
  6034.     else if (c == 0xcf)            /* This keeps it invertible */
  6035.       return((CHAR)0x9e);        /* (if it ever was...) */
  6036.     else                /* Otherwise like CP850 */
  6037.       return(x85l1(c));            /* to Latin-1 */
  6038. }
  6039.  
  6040. /* End Euro functions */
  6041.  
  6042.  
  6043. /*  TABLES OF TRANSLATION FUNCTIONS */
  6044.  
  6045. /*
  6046.   First, the table of translation functions for RECEIVING files.  That is,
  6047.   *from* the TRANSFER character set *to* the FILE character set, an array of
  6048.   pointers to functions.  The first index is the TRANSFER CHARACTER-SET
  6049.   number, the second index is the FILE CHARACTER-SET number.
  6050.  
  6051.   These arrays must be fully populated, even if (as is the case with Kanji
  6052.   character sets), all the entries are NULL.  Otherwise, subscript
  6053.   calculations will be wrong and we'll use the wrong functions.
  6054. */
  6055.  
  6056. /* Pointers to byte-for-byte translation functions */
  6057.  
  6058. _PROTOTYP( CHAR (*rx), (CHAR) );
  6059. _PROTOTYP( CHAR (*sx), (CHAR) );
  6060.  
  6061. #ifdef UNICODE
  6062. _PROTOTYP( int (*xut), (USHORT) );    /* Translation function UCS to TCS */
  6063. _PROTOTYP( int (*xuf), (USHORT) );    /* Translation function UCS to FCS */
  6064. _PROTOTYP( USHORT (*xtu), (CHAR) );    /* Translation function TCS to UCS */
  6065. _PROTOTYP( USHORT (*xfu), (CHAR) );    /* Translation function FCS to UCS */
  6066. #endif /* UNICODE */
  6067.  
  6068. #ifdef CK_ANSIC
  6069. CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
  6070. #else
  6071. CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])() =
  6072. #endif /* CK_ANSIC */
  6073. {
  6074.     NULL,            /* 0,0 transparent to us ascii */
  6075.     NULL,            /* 0,1 transparent to uk ascii */
  6076.     NULL,            /* 0,2 transparent to dutch nrc */
  6077.     NULL,            /* 0,3 transparent to finnish nrc */
  6078.     NULL,            /* 0,4 transparent to french nrc */
  6079.     NULL,            /* 0,5 transparent to fr-canadian nrc */
  6080.     NULL,            /* 0,6 transparent to german nrc */
  6081.     NULL,            /* 0,7 transparent to hungarian nrc */
  6082.     NULL,            /* 0,8 transparent to italian nrc */
  6083.     NULL,            /* 0,9 transparent to norge/danish nrc */
  6084.     NULL,            /* 0,10 transparent to portuguese nrc */
  6085.     NULL,            /* 0,11 transparent to spanish nrc */
  6086.     NULL,            /* 0,12 transparent to swedish nrc */
  6087.     NULL,            /* 0,13 transparent to swiss nrc */
  6088.     NULL,            /* 0,14 transparent to latin-1 */
  6089.     NULL,            /* 0,15 transparent to latin-2 */
  6090.     NULL,            /* 0,16 transparent to DEC MCS */
  6091.     NULL,            /* 0,17 transparent to NeXT */
  6092.     NULL,            /* 0,18 transparent to CP437 */
  6093.     NULL,            /* 0,19 transparent to CP850 */
  6094.     NULL,            /* 0,20 transparent to CP852 */
  6095.     NULL,            /* 0,21 transparent to Macintosh Latin */
  6096.     NULL,            /* 0,22 transparent to DGI */
  6097.     NULL,            /* 0,23 transparent to HP */
  6098.     NULL,            /* 0,24 transparent to Latin/Cyrillic */
  6099.     NULL,                       /* 0,25 transparent to CP866 */
  6100.     NULL,            /* 0,26 transparent to Short KOI-7 */
  6101.     NULL,                       /* 0,27 transparent to Old KOI-8 Cyrillic */
  6102.     NULL,            /* 0,28 transparent to JIS-7 */
  6103.     NULL,            /* 0,29 transparent to Shift-JIS */
  6104.     NULL,            /* 0,30 transparent to J-EUC */
  6105.     NULL,            /* 0,31 transparent to DEC Kanji */
  6106.     NULL,            /* 0,32 transparent to Hebrew-7 */
  6107.     NULL,            /* 0,33 transparent to Latin/Hebrew */
  6108.     NULL,            /* 0,34 transparent to CP862 Hebrew */
  6109.     NULL,            /* 0,35 transparent to ELOT 927 Greek */
  6110.     NULL,            /* 0,36 transparent to Latin/Greek */
  6111.     NULL,            /* 0,37 transparent to CP869 */
  6112.     NULL,            /* 0,38 transparent to Latin-9 */
  6113.     NULL,            /* 0,39 transparent to CP858 */
  6114.     NULL,            /* 0,40 transparent to CP855 */
  6115.     NULL,            /* 0,41 transparent to CP1251 */
  6116.     NULL,            /* 0,42 transparent to Bulgarian */
  6117.     NULL,            /* 0,43 transparent to CP1250 */
  6118.     NULL,            /* 0,44 transparent to Mazovia */
  6119.     NULL,            /* 0,45 transparent to UCS-2 */
  6120.     NULL,            /* 0,46 transparent to UTF-8 */
  6121.     NULL,            /* 0,47 transparent to KOI8R */
  6122.     NULL,            /* 0,48 transparent to KOI8U */
  6123.     NULL,            /* 0,49 transparent to CP1252 */
  6124.     NULL,            /* 1,0 ascii to us ascii */
  6125.     NULL,            /* 1,1 ascii to uk ascii */
  6126.     NULL,            /* 1,2 ascii to dutch nrc */
  6127.     NULL,            /* 1,3 ascii to finnish nrc */
  6128.     NULL,            /* 1,4 ascii to french nrc */
  6129.     NULL,            /* 1,5 ascii to fr-canadian nrc */
  6130.     NULL,            /* 1,6 ascii to german nrc */
  6131.     NULL,            /* 1,7 ascii to hungarian nrc */
  6132.     NULL,            /* 1,8 ascii to italian nrc */
  6133.     NULL,            /* 1,9 ascii to norge/danish nrc */
  6134.     NULL,            /* 1,10 ascii to portuguese nrc */
  6135.     NULL,            /* 1,11 ascii to spanish nrc */
  6136.     NULL,            /* 1,12 ascii to swedish nrc */
  6137.     NULL,            /* 1,13 ascii to swiss nrc */
  6138.     NULL,            /* 1,14 ascii to latin-1 */
  6139.     NULL,            /* 1,15 ascii to latin-2 */
  6140.     NULL,            /* 1,16 ascii to DEC MCS */
  6141.     NULL,            /* 1,17 ascii to NeXT */
  6142.     NULL,            /* 1,18 ascii to CP437 */
  6143.     NULL,            /* 1,19 ascii to CP850 */
  6144.     NULL,            /* 1,20 ascii to CP852 */
  6145.     NULL,            /* 1,21 ascii to Macintosh Latin */
  6146.     NULL,            /* 1,22 ascii to DGI */
  6147.     NULL,            /* 1,23 ascii to HP */
  6148.     xaslc,                      /* 1,24 ascii to Latin/Cyrillic */
  6149.     xasac,                      /* 1,25 ascii to CP866 */
  6150.     xassk,                      /* 1,26 ascii to Short KOI */
  6151.     xask8,                      /* 1,27 ascii to Old KOI-8 Cyrillic */
  6152.     NULL,            /* 1,28 ascii to JIS-7 */
  6153.     NULL,            /* 1,29 ascii to Shift-JIS */
  6154.     NULL,            /* 1,30 ascii to J-EUC */
  6155.     NULL,            /* 1,31 ascii to DEC Kanji */
  6156.     xash7,            /* 1,32 ascii to Hebrew-7 */
  6157.     NULL,            /* 1,33 ascii to Latin/Hebrew */
  6158.     NULL,            /* 1,34 ascii to CP862 Hebrew */
  6159.     xaseg,            /* 1,35 ascii to ELOT 927 Greek */
  6160.     NULL,            /* 1,36 ascii to Latin/Greek */
  6161.     NULL,            /* 1,37 ascii to CP869 */
  6162.     NULL,            /* 1,38 ascii to Latin-9 */
  6163.     NULL,            /* 1,39 ascii to CP858 */
  6164.     xas55,            /* 1,40 ascii to CP855 */
  6165.     xas1251,            /* 1,41 ascii to CP1251 */
  6166.     xleft128,            /* 1,42 ascii to bulgarian */
  6167.     xleft128,            /* 1,43 ascii to CP1250 */
  6168.     xleft128,            /* 1,44 ascii to Mazovia */
  6169.     NULL,            /* 1,45 ascii to UCS-2 */
  6170.     NULL,            /* 1,46 ascii to UTF-8 */
  6171.     NULL,            /* 1,47 ascii to KOI8-R */
  6172.     NULL,            /* 1,48 ascii to KOI8-U */
  6173.     NULL,            /* 1,49 ascii to CP1252 */
  6174.     zl1as,            /* 2,0 latin-1 to us ascii */
  6175.     xl1uk,            /* 2,1 latin-1 to uk ascii */
  6176.     xl1du,            /* 2,2 latin-1 to dutch nrc */
  6177.     xl1fi,            /* 2,3 latin-1 to finnish nrc */
  6178.     xl1fr,            /* 2,4 latin-1 to french nrc */
  6179.     xl1fc,            /* 2,5 latin-1 to fr-canadian nrc */
  6180.     xl1ge,            /* 2,6 latin-1 to german nrc */
  6181.     xl1it,            /* 2,7 latin-1 to italian nrc */
  6182.     xl1hu,            /* 2,8 latin-1 to hungarian nrc */
  6183.     xl1no,            /* 2,9 latin-1 to norge/danish nrc */
  6184.     xl1po,            /* 2,10 latin-1 to portuguese nrc */
  6185.     xl1sp,            /* 2,11 latin-1 to spanish nrc */
  6186.     xl1sw,            /* 2,12 latin-1 to swedish nrc */
  6187.     xl1ch,            /* 2,13 latin-1 to swiss nrc */
  6188.     NULL,            /* 2,14 latin-1 to latin-1 */
  6189.     xl1l2,            /* 2,15 latin-1 to latin-2 */
  6190.     xl1dm,            /* 2,16 latin-1 to DEC MCS */
  6191.     xl1ne,            /* 2,17 latin-1 to NeXT */
  6192.     xl143,            /* 2,18 latin-1 to CP437 */
  6193.     xl185,            /* 2,19 latin-1 to CP850 */
  6194.     xl152,            /* 2,20 latin-1 to CP852 */
  6195.     xl1aq,            /* 2,21 latin-1 to Macintosh Latin */
  6196.     xl1dg,            /* 2,22 latin-1 to DGI */
  6197.     xl1r8,            /* 2,23 latin-1 to HP Roman8 */
  6198.     zl1as,            /* 2,24 latin-1 to Latin/Cyrillic */
  6199.     zl1as,                      /* 2,25 latin-1 to CP866 */
  6200.     xl1sk,                      /* 2,26 latin-1 to Short KOI */
  6201.     zl1as,                   /* 2,27 latin-1 to Old KOI-8 Cyrillic */
  6202.     NULL,            /* 2,28 latin-1 to JIS-7 */
  6203.     NULL,            /* 2,29 latin-1 to Shift-JIS */
  6204.     NULL,            /* 2,30 latin-1 to J-EUC */
  6205.     NULL,            /* 2,31 latin-1 to DEC Kanji */
  6206.     xl1h7,            /* 2,32 latin-1 to Hebrew-7 */
  6207.     xl1lh,            /* 2,33 latin-1 to Latin/Hebrew */
  6208.     xl162,            /* 2,34 latin-1 to CP862 Hebrew */
  6209.     xl1eg,            /* 2,35 latin-1 to ELOT 927 Greek */
  6210.     xl1lg,            /* 2,36 latin-1 to Latin/Greek */
  6211.     xl169,            /* 2,37 latin-1 to CP869 */
  6212.     NULL,            /* 2,38 latin-1 to Latin9 */
  6213.     xl185,            /* 2,39 latin-1 to CP858 */
  6214.     zl1as,            /* 2,40 latin-1 to CP855 */
  6215.     zl1as,            /* 2,41 latin-1 to CP1251 */
  6216.     zl1as,            /* 2,42 latin-1 to Bulgarian */
  6217.     xl11250,            /* 2,43 latin-1 to CP1250 */
  6218.     xl1mz,            /* 2,44 latin-1 to Mazovia */
  6219.     NULL,            /* 2,45 latin-1 to UCS-2 */
  6220.     NULL,            /* 2,46 latin-1 to UTF-8 */
  6221.     zl1as,            /* 2,47 latin-1 to KOI8R */
  6222.     zl1as,            /* 2,48 latin-1 to KOI8U */
  6223.     xl1w1,            /* 2,49 latin-1 to CP1252 */
  6224.     xl2as,            /* 3,0 latin-2 to us ascii */
  6225.     xl2as,            /* 3,1 latin-2 to uk ascii */
  6226.     xl2as,            /* 3,2 latin-2 to dutch nrc */
  6227.     xl2as,            /* 3,3 latin-2 to finnish nrc */
  6228.     xl2as,            /* 3,4 latin-2 to french nrc */
  6229.     xl2as,            /* 3,5 latin-2 to fr-canadian nrc */
  6230.     xl2as,            /* 3,6 latin-2 to german nrc */
  6231.     xl2as,            /* 3,7 latin-2 to italian nrc */
  6232.     xl2as,            /* 3,8 latin-2 to hungarian nrc */
  6233.     xl2as,            /* 3,9 latin-2 to norge/danish nrc */
  6234.     xl2as,            /* 3,10 latin-2 to portuguese nrc */
  6235.     xl2as,            /* 3,11 latin-2 to spanish nrc */
  6236.     xl2as,            /* 3,12 latin-2 to swedish nrc */
  6237.     xl2as,            /* 3,13 latin-2 to swiss nrc */
  6238.     xl2l1,            /* 3,14 latin-2 to latin-1 */
  6239.     NULL,            /* 3,15 latin-2 to latin-2 */
  6240.     xl2l1,            /* 3,16 latin-2 to DEC MCS */
  6241.     xl2ne,            /* 3,17 latin-2 to NeXT */
  6242.     xl243,            /* 3,18 latin-2 to CP437 */
  6243.     xl285,            /* 3,19 latin-2 to CP850 */
  6244.     xl252,            /* 3,20 latin-2 to CP852 */
  6245.     xl2aq,            /* 3,21 latin-2 to Macintosh Latin */
  6246.     xl2dg,            /* 3,22 latin-2 to DGI */
  6247.     xl2r8,            /* 3,23 latin-2 to HP */
  6248.     xl2as,            /* 3,24 latin-2 to Latin/Cyrillic */
  6249.     xl2as,                      /* 3,25 latin-2 to CP866 */
  6250.     xl2sk,                      /* 3,26 latin-2 to Short KOI */
  6251.     xl2as,                   /* 3,27 latin-2 to Old KOI-8 Cyrillic */
  6252.     NULL,            /* 3,28 latin-2 to JIS-7 */
  6253.     NULL,            /* 3,29 latin-2 to Shift-JIS */
  6254.     NULL,            /* 3,30 latin-2 to J-EUC */
  6255.     NULL,            /* 3,31 latin-2 to DEC Kanji */
  6256.     xl2h7,            /* 3,32 latin-2 to Hebrew-7 */
  6257.     xl2as,            /* 3,33 latin-2 to Latin/Hebrew */
  6258.     xl2as,            /* 3,34 latin-2 to CP862 Hebrew */
  6259.     xassk,            /* 3,35 latin-2 to ELOT 927 Greek */
  6260.     xl2as,            /* 3,36 latin-2 to Latin/Greek */
  6261.     xl2as,            /* 3,37 latin-2 to CP869 */
  6262.     xl2l9,            /* 3,38 latin-2 to Latin-9 */
  6263.     xl258,            /* 3,39 latin-2 to CP858 */
  6264.     xl2as,            /* 3,40 latin-2 to CP855 */
  6265.     xl2as,            /* 3,41 latin-2 to CP1251 */
  6266.     xl2as,            /* 3,42 latin-2 to Bulgarian */
  6267.     xl21250,            /* 3,43 latin-2 to CP1250 */
  6268.     xl2mz,            /* 3,44 latin-2 to Mazovia */
  6269.     NULL,            /* 3,45 latin-2 to UCS-2 */
  6270.     NULL,            /* 3,46 latin-2 to UTF-8 */
  6271.     xl2as,            /* 3,47 latin-2 to KOI8R */
  6272.     xl2as,            /* 3,48 latin-2 to KOI8U */
  6273.     xl2w1,            /* 3,49 latin-2 to CP1252 */
  6274.     xlcas,            /* 4,0 latin/cyrillic to us ascii */
  6275.     xlcas,            /* 4,1 latin/cyrillic to uk ascii */
  6276.     xlcas,                 /* 4,2 latin/cyrillic to dutch nrc */
  6277.     xlcas,            /* 4,3 latin/cyrillic to finnish ascii */
  6278.     xlcas,            /* 4,4 latin/cyrillic to french nrc */
  6279.     xlcas,            /* 4,5 latin/cyrillic to fr-canadian nrc */
  6280.     xlcas,            /* 4,6 latin/cyrillic to german nrc */
  6281.     xlcas,            /* 4,7 latin/cyrillic to italian nrc */
  6282.     xlcas,            /* 4,8 latin/cyrillic to hungarian nrc */
  6283.     xlcas,            /* 4,9 latin/cyrillic to norge/danish nrc */
  6284.     xlcas,            /* 4,10 latin/cyrillic to portuguese nrc */
  6285.     xlcas,            /* 4,11 latin/cyrillic to spanish nrc */
  6286.     xlcas,            /* 4,12 latin/cyrillic to swedish nrc */
  6287.     xlcas,            /* 4,13 latin/cyrillic to swiss nrc */
  6288.     xlcas,            /* 4,14 latin/cyrillic to latin-1 */
  6289.     xlcas,            /* 4,15 latin/cyrillic to latin-2 */
  6290.     xlcas,            /* 4,16 latin/cyrillic to DEC MCS */
  6291.     xlcas,            /* 4,17 latin/cyrillic to NeXT */
  6292.     xlcas,            /* 4,18 latin/cyrillic to CP437 */
  6293.     xlcas,            /* 4,19 latin/cyrillic to CP850 */
  6294.     xlcas,            /* 4,20 latin/cyrillic to CP852 */
  6295.     xlcas,            /* 4,21 latin/cyrillic to Macintosh Latin */
  6296.     xlcas,            /* 4,22 latin/cyrillic to DGI */
  6297.     xlcas,            /* 4,23 latin/cyrillic to HP */
  6298.     NULL,                       /* 4,24 latin/cyrillic to Latin/Cyrillic */
  6299.     xlcac,                      /* 4,25 latin/cyrillic to CP866 */
  6300.     xlcsk,                      /* 4,26 latin/cyrillic to Short KOI */
  6301.     xlck8,                   /* 4,27 latin/cyrillic to Old KOI-8 Cyrillic */
  6302.     NULL,            /* 4,28 latin/cyril to JIS-7 */
  6303.     NULL,            /* 4,29 latin/cyril to Shift-JIS */
  6304.     NULL,            /* 4,30 latin/cyril to J-EUC */
  6305.     NULL,            /* 4,31 latin/cyril to DEC Kanji */
  6306.     xlch7,            /* 4,32 latin/cyril to Hebrew-7 */
  6307.     xlcas,            /* 4,33 latin/cyril to Latin/Hebrew */
  6308.     xlcas,            /* 4,34 latin/cyril to CP862 Hebrew */
  6309.     xassk,            /* 4,35 latin/cyril to ELOT 927 Greek */
  6310.     xleft160,            /* 4,36 latin/cyril to Latin/Greek */
  6311.     xleft128,            /* 4,37 latin/cyril to CP869 */
  6312.     xlcas,            /* 4,38 latin/cyril to latin-9 */
  6313.     xlcas,            /* 4,39 latin/cyril to CP858 */
  6314.     xlc55,            /* 4,40 latin/cyril to CP855 */
  6315.     xlc1251,            /* 4,41 latin/cyril to CP1251 */
  6316.     xlcbu,            /* 4,42 latin/cyril to Bulgarian */
  6317.     xlcas,            /* 4,43 latin/cyril to CP1250 */
  6318.     xlcas,            /* 4,44 latin/cyril to Mazovia */
  6319.     NULL,            /* 4,45 latin/cyril to UCS-2 */
  6320.     NULL,            /* 4,46 latin/cyril to UTF-8 */
  6321.     xlckr,            /* 4,47 latin/cyril to KOI8R */
  6322.     xlcku,            /* 4,48 latin/cyril to KOI8U */
  6323.     xlcas,            /* 4,49 latin/cyril to CP1252 */
  6324.     NULL,            /* 5,00 */
  6325.     NULL,            /* 5,01 */
  6326.     NULL,            /* 5,02 */
  6327.     NULL,            /* 5,03 */
  6328.     NULL,            /* 5,04 */
  6329.     NULL,            /* 5,05 */
  6330.     NULL,            /* 5,06 */
  6331.     NULL,            /* 5,07 */
  6332.     NULL,            /* 5,08 */
  6333.     NULL,            /* 5,09 */
  6334.     NULL,            /* 5,10 */
  6335.     NULL,            /* 5,11 */
  6336.     NULL,            /* 5,12 */
  6337.     NULL,            /* 5,13 */
  6338.     NULL,            /* 5,14 */
  6339.     NULL,            /* 5,15 */
  6340.     NULL,            /* 5,16 */
  6341.     NULL,            /* 5,17 */
  6342.     NULL,            /* 5,18 */
  6343.     NULL,            /* 5,19 */
  6344.     NULL,            /* 5,20 */
  6345.     NULL,            /* 5,21 */
  6346.     NULL,            /* 5,22 */
  6347.     NULL,            /* 5,23 */
  6348.     NULL,            /* 5,24 */
  6349.     NULL,            /* 5,25 */
  6350.     NULL,            /* 5,26 */
  6351.     NULL,            /* 5,27 */
  6352.     NULL,            /* 5,28 */
  6353.     NULL,            /* 5,29 */
  6354.     NULL,            /* 5,30 */
  6355.     NULL,            /* 5,31 */
  6356.     NULL,            /* 5,32 */
  6357.     NULL,            /* 5,33 */
  6358.     NULL,            /* 5,34 */
  6359.     NULL,            /* 5,35 */
  6360.     NULL,            /* 5,36 */
  6361.     NULL,            /* 5,37 */
  6362.     NULL,            /* 5,38 */
  6363.     NULL,            /* 5,39 */
  6364.     NULL,            /* 5,40 */
  6365.     NULL,            /* 5,41 */
  6366.     NULL,            /* 5,42 */
  6367.     NULL,            /* 5,43 */
  6368.     NULL,            /* 5,44 */
  6369.     NULL,            /* 5,45 */
  6370.     NULL,            /* 5,46 */
  6371.     NULL,            /* 5,47 */
  6372.     NULL,            /* 5,48 */
  6373.     NULL,            /* 5,49 */
  6374.     xlhas,            /* 6,0 latin/hebrew to us ascii */
  6375.     xlhas,            /* 6,1 latin/hebrew to uk ascii */
  6376.     xlhas,                 /* 6,2 latin/hebrew to dutch nrc */
  6377.     xlhas,            /* 6,3 latin/hebrew to finnish ascii */
  6378.     xlhas,            /* 6,4 latin/hebrew to french nrc */
  6379.     xlhas,            /* 6,5 latin/hebrew to fr-canadian nrc */
  6380.     xlhas,            /* 6,6 latin/hebrew to german nrc */
  6381.     xlhas,            /* 6,7 latin/hebrew to italian nrc */
  6382.     xlhas,            /* 6,8 latin/hebrew to hungarian nrc */
  6383.     xlhas,            /* 6,9 latin/hebrew to norge/danish nrc */
  6384.     xlhas,            /* 6,10 latin/hebrew to portuguese nrc */
  6385.     xlhas,            /* 6,11 latin/hebrew to spanish nrc */
  6386.     xlhas,            /* 6,12 latin/hebrew to swedish nrc */
  6387.     xlhas,            /* 6,13 latin/hebrew to swiss nrc */
  6388.     xlhl1,            /* 6,14 latin/hebrew to latin-1 */
  6389.     xlhas,            /* 6,15 latin/hebrew to latin-2 */
  6390.     xlhl1,            /* 6,16 latin/hebrew to DEC MCS */
  6391.     xlhas,            /* 6,17 latin/hebrew to NeXT */
  6392.     xlhas,            /* 6,18 latin/hebrew to CP437 */
  6393.     xlhas,            /* 6,19 latin/hebrew to CP850 */
  6394.     xlhas,            /* 6,20 latin/hebrew to CP852 */
  6395.     xlhas,            /* 6,21 latin/hebrew to Macintosh Latin */
  6396.     xlhas,            /* 6,22 latin/hebrew to DGI */
  6397.     xlhas,                      /* 6,23 latin/hebrew to HP */
  6398.     xlhas,                      /* 6,24 latin/hebrew to Latin/Cyrillic */
  6399.     xlhas,                      /* 6,25 latin/hebrew to CP866 */
  6400.     NULL,                       /* 6,26 latin/hebrew to Short KOI */
  6401.     xlhas,                   /* 6,27 latin/hebrew to Old KOI-8 Cyrillic */
  6402.     NULL,            /* 6,28 latin/hebrew to JIS-7 */
  6403.     NULL,            /* 6,29 latin/hebrew to Shift-JIS */
  6404.     NULL,            /* 6,30 latin/hebrew to J-EUC */
  6405.     NULL,            /* 6,31 latin/hebrew to DEC Kanji */
  6406.     xlhh7,            /* 6,32 latin/hebrew to Hebrew-7 */
  6407.     NULL,            /* 6,33 latin/hebrew to Latin/Hebrew */
  6408.     xlh62,            /* 6,34 latin/hebrew to CP862 Hebrew */
  6409.     NULL,            /* 6,35 latin/hebrew to ELOT 927 Greek */
  6410.     xlhas,            /* 6,36 latin/hebrew to Latin/Greek */
  6411.     xlhas,            /* 6,37 latin/hebrew to CP869 */
  6412.     xlhas,            /* 6,38 latin/hebrew to Latin-9 */
  6413.     xlhas,            /* 6,39 latin/hebrew to CP858 */
  6414.     xlhas,            /* 6,40 latin/hebrew to CP855 */
  6415.     xlhas,            /* 6,41 latin/hebrew to CP1251 */
  6416.     xlhas,            /* 6,42 latin/hebrew to Bulgarian */
  6417.     xlhas,            /* 6,43 latin/hebrew to CP1250 */
  6418.     xlhas,            /* 6,44 latin/hebrew to Mazovia */
  6419.     NULL,            /* 6,45 latin/hebrew to UCS-2 */
  6420.     NULL,            /* 6,46 latin/hebrew to UTF-8 */
  6421.     NULL,            /* 6,47 latin/hebrew to KOI8R */
  6422.     NULL,            /* 6,48 latin/hebrew to KOI8U */
  6423.     xlhw1,            /* 6,49 latin/hebrew to CP1252 */
  6424.     xlgas,            /* 7,0 latin/greek to us ascii */
  6425.     xlgas,            /* 7,1 latin/greek to uk ascii */
  6426.     xlgas,                 /* 7,2 latin/greek to dutch nrc */
  6427.     xlgas,            /* 7,3 latin/greek to finnish ascii */
  6428.     xlgas,            /* 7,4 latin/greek to french nrc */
  6429.     xlgas,            /* 7,5 latin/greek to fr-canadian nrc */
  6430.     xlgas,            /* 7,6 latin/greek to german nrc */
  6431.     xlgas,            /* 7,7 latin/greek to italian nrc */
  6432.     xlgas,            /* 7,8 latin/greek to hungarian nrc */
  6433.     xlgas,            /* 7,9 latin/greek to norge/danish nrc */
  6434.     xlgas,            /* 7,10 latin/greek to portuguese nrc */
  6435.     xlgas,            /* 7,11 latin/greek to spanish nrc */
  6436.     xlgas,            /* 7,12 latin/greek to swedish nrc */
  6437.     xlgas,            /* 7,13 latin/greek to swiss nrc */
  6438.     xlgas,            /* 7,14 latin/greek to latin-1 */
  6439.     xlgas,            /* 7,15 latin/greek to latin-2 */
  6440.     xlgas,            /* 7,16 latin/greek to DEC MCS */
  6441.     xlgas,            /* 7,17 latin/greek to NeXT */
  6442.     xlgas,            /* 7,18 latin/greek to CP437 */
  6443.     xlgas,            /* 7,19 latin/greek to CP850 */
  6444.     xlgas,            /* 7,20 latin/greek to CP852 */
  6445.     xlgas,            /* 7,21 latin/greek to Macintosh Latin */
  6446.     xlgas,            /* 7,22 latin/greek to DGI */
  6447.     xlgas,            /* 7,23 latin/greek to HP */
  6448.     xleft160,                   /* 7,24 latin/greek to Latin/Cyrillic */
  6449.     xleft128,                   /* 7,25 latin/greek to CP866 */
  6450.     xassk,                      /* 7,26 latin/greek to Short KOI */
  6451.     xleft160,                   /* 7,27 latin/greek to Old KOI-8 Greek */
  6452.     NULL,            /* 7,28 latin/greek to JIS-7 */
  6453.     NULL,            /* 7,29 latin/greek to Shift-JIS */
  6454.     NULL,            /* 7,30 latin/greek to J-EUC */
  6455.     NULL,            /* 7,31 latin/greek to DEC Kanji */
  6456.     NULL,            /* 7,32 latin/greek to Hebrew-7 */
  6457.     xlgas,            /* 7,33 latin/greek to Latin/Hebrew */
  6458.     xlgas,            /* 7,34 latin/greek to CP862 Hebrew */
  6459.     xlgeg,            /* 7,35 latin/greek to ELOT 927 Greek */
  6460.     NULL,            /* 7,36 latin/greek to Latin/Greek */
  6461.     xlg69,            /* 7,37 latin/greek to CP869 */
  6462.     xlgas,            /* 7,38 latin/greek to Latin-9 */
  6463.     xlgas,            /* 7,39 latin/greek to CP858 */
  6464.     xleft128,            /* 7,40 latin/greek to CP855 */
  6465.     xleft128,            /* 7,41 latin/greek to CP1251 */
  6466.     xleft128,            /* 7,42 latin/greek to Bulgarian */
  6467.     xleft128,            /* 7,43 latin/greek to CP1250 */
  6468.     xleft128,            /* 7,44 latin/greek to Mazovia */
  6469.     NULL,            /* 7,45 latin/greek to UCS-2 */
  6470.     NULL,            /* 7,46 latin/greek to UTF-8 */
  6471.     NULL,            /* 7,47 latin/greek to KOI8R */
  6472.     NULL,            /* 7,48 latin/greek to KOI8U */
  6473.     xlgw1,            /* 7,49 latin/greek to CP1252 */
  6474.     zl9as,            /* 8,0 latin-9 to us ascii */
  6475.     xl1uk,            /* 8,1 latin-9 to uk ascii */
  6476.     xl1du,            /* 8,2 latin-9 to dutch nrc */
  6477.     xl1fi,            /* 8,3 latin-9 to finnish nrc */
  6478.     xl1fr,            /* 8,4 latin-9 to french nrc */
  6479.     xl1fc,            /* 8,5 latin-9 to fr-canadian nrc */
  6480.     xl1ge,            /* 8,6 latin-9 to german nrc */
  6481.     xl1it,            /* 8,7 latin-9 to italian nrc */
  6482.     xl1hu,            /* 8,8 latin-9 to hungarian nrc */
  6483.     xl1no,            /* 8,9 latin-9 to norge/danish nrc */
  6484.     xl1po,            /* 8,10 latin-9 to portuguese nrc */
  6485.     xl1sp,            /* 8,11 latin-9 to spanish nrc */
  6486.     xl1sw,            /* 8,12 latin-9 to swedish nrc */
  6487.     xl1ch,            /* 8,13 latin-9 to swiss nrc */
  6488.     NULL,            /* 8,14 latin-9 to latin-1 */
  6489.     xl1l2,            /* 8,15 latin-9 to latin-2 */
  6490.     xl9dm,            /* 8,16 latin-9 to DEC MCS */
  6491.     xl9ne,            /* 8,17 latin-9 to NeXT */
  6492.     xl143,            /* 8,18 latin-9 to CP437 */
  6493.     xl185,            /* 8,19 latin-9 to CP850 */
  6494.     xl152,            /* 8,20 latin-9 to CP852 */
  6495.     xl1aq,            /* 8,21 latin-9 to Macintosh Latin */
  6496.     xl1dg,            /* 8,22 latin-9 to DGI */
  6497.     xl1r8,            /* 8,23 latin-9 to HP Roman8 */
  6498.     zl1as,            /* 8,24 latin-9 to Latin/Cyrillic */
  6499.     zl1as,                      /* 8,25 latin-9 to CP866 */
  6500.     xl1sk,                      /* 8,26 latin-9 to Short KOI */
  6501.     zl1as,                   /* 8,27 latin-9 to Old KOI-8 Cyrillic */
  6502.     NULL,            /* 8,28 latin-9 to JIS-7 */
  6503.     NULL,            /* 8,29 latin-9 to Shift-JIS */
  6504.     NULL,            /* 8,30 latin-9 to J-EUC */
  6505.     NULL,            /* 8,31 latin-9 to DEC Kanji */
  6506.     xl1h7,            /* 8,32 latin-9 to Hebrew-7 */
  6507.     xl1lh,            /* 8,33 latin-9 to Latin/Hebrew */
  6508.     xl162,            /* 8,34 latin-9 to CP862 Hebrew */
  6509.     xl1eg,            /* 8,35 latin-9 to ELOT 927 Greek */
  6510.     xl1lg,            /* 8,36 latin-9 to Latin/Greek */
  6511.     xl169,            /* 8,37 latin-9 to CP869 */
  6512.     NULL,            /* 8,38 latin-9 to Latin9 */
  6513.     xl958,            /* 8,39 latin-9 to CP858 */
  6514.     zl1as,            /* 8,40 latin-9 to CP855 */
  6515.     zl1as,            /* 8,41 latin-9 to CP1251 */
  6516.     xl1as,            /* 8,42 latin-9 to Bulgarian */
  6517.     xl91250,            /* 8,43 latin-9 to CP1250 */
  6518.     xl9mz,            /* 8,44 latin-9 to Mazovia */
  6519.     NULL,            /* 8,45 latin-9 to UCS-2 */
  6520.     NULL,            /* 8,46 latin-9 to UTF-8 */
  6521.     zl1as,            /* 8,47 latin-9 to KOI8-R */
  6522.     zl1as,            /* 8,48 latin-9 to KOI8-U */
  6523.     xl9w1,            /* 8,49 latin-9 to CP1252 */
  6524.     NULL,            /* 9,00 Unicode... */
  6525.     NULL,            /* 9,01 */
  6526.     NULL,            /* 9,02 */
  6527.     NULL,            /* 9,03 */
  6528.     NULL,            /* 9,04 */
  6529.     NULL,            /* 9,05 */
  6530.     NULL,            /* 9,06 */
  6531.     NULL,            /* 9,07 */
  6532.     NULL,            /* 9,08 */
  6533.     NULL,            /* 9,09 */
  6534.     NULL,            /* 9,10 */
  6535.     NULL,            /* 9,11 */
  6536.     NULL,            /* 9,12 */
  6537.     NULL,            /* 9,13 */
  6538.     NULL,            /* 9,14 */
  6539.     NULL,            /* 9,15 */
  6540.     NULL,            /* 9,16 */
  6541.     NULL,            /* 9,17 */
  6542.     NULL,            /* 9,18 */
  6543.     NULL,            /* 9,19 */
  6544.     NULL,            /* 9,20 */
  6545.     NULL,            /* 9,21 */
  6546.     NULL,            /* 9,22 */
  6547.     NULL,            /* 9,23 */
  6548.     NULL,            /* 9,24 */
  6549.     NULL,            /* 9,25 */
  6550.     NULL,            /* 9,26 */
  6551.     NULL,            /* 9,27 */
  6552.     NULL,            /* 9,28 */
  6553.     NULL,            /* 9,29 */
  6554.     NULL,            /* 9,30 */
  6555.     NULL,            /* 9,31 */
  6556.     NULL,            /* 9,32 */
  6557.     NULL,            /* 9,33 */
  6558.     NULL,            /* 9,34 */
  6559.     NULL,            /* 9,35 */
  6560.     NULL,            /* 9,36 */
  6561.     NULL,            /* 9,37 */
  6562.     NULL,            /* 9,38 */
  6563.     NULL,            /* 9,39 */
  6564.     NULL,            /* 9,40 */
  6565.     NULL,            /* 9,41 */
  6566.     NULL,            /* 9,42 */
  6567.     NULL,            /* 9,43 */
  6568.     NULL,            /* 9,44 */
  6569.     NULL,            /* 9,45 */
  6570.     NULL,            /* 9,46 */
  6571.     NULL,            /* 9,47 */
  6572.     NULL,            /* 9,48 */
  6573.     NULL,            /* 9,49 */
  6574.     NULL,            /* 10,00 */
  6575.     NULL,            /* 10,01 */
  6576.     NULL,            /* 10,02 */
  6577.     NULL,            /* 10,03 */
  6578.     NULL,            /* 10,04 */
  6579.     NULL,            /* 10,05 */
  6580.     NULL,            /* 10,06 */
  6581.     NULL,            /* 10,07 */
  6582.     NULL,            /* 10,08 */
  6583.     NULL,            /* 10,09 */
  6584.     NULL,            /* 10,10 */
  6585.     NULL,            /* 10,11 */
  6586.     NULL,            /* 10,12 */
  6587.     NULL,            /* 10,13 */
  6588.     NULL,            /* 10,14 */
  6589.     NULL,            /* 10,15 */
  6590.     NULL,            /* 10,16 */
  6591.     NULL,            /* 10,17 */
  6592.     NULL,            /* 10,18 */
  6593.     NULL,            /* 10,19 */
  6594.     NULL,            /* 10,20 */
  6595.     NULL,            /* 10,21 */
  6596.     NULL,            /* 10,22 */
  6597.     NULL,            /* 10,23 */
  6598.     NULL,            /* 10,24 */
  6599.     NULL,            /* 10,25 */
  6600.     NULL,            /* 10,26 */
  6601.     NULL,            /* 10,27 */
  6602.     NULL,            /* 10,28 */
  6603.     NULL,            /* 10,29 */
  6604.     NULL,            /* 10,30 */
  6605.     NULL,            /* 10,31 */
  6606.     NULL,            /* 10,32 */
  6607.     NULL,            /* 10,33 */
  6608.     NULL,            /* 10,34 */
  6609.     NULL,            /* 10,35 */
  6610.     NULL,            /* 10,36 */
  6611.     NULL,            /* 10,37 */
  6612.     NULL,            /* 10,38 */
  6613.     NULL,            /* 10,39 */
  6614.     NULL,            /* 10,40 */
  6615.     NULL,            /* 10,41 */
  6616.     NULL,            /* 10,42 */
  6617.     NULL,            /* 10,43 */
  6618.     NULL,            /* 10,44 */
  6619.     NULL,            /* 10,45 */
  6620.     NULL,            /* 10,46 */
  6621.     NULL,            /* 10,47 */
  6622.     NULL,            /* 10,48 */
  6623.     NULL            /* 10,49 */
  6624. };
  6625. int nxlr = (sizeof(xlr) / sizeof(CHAR *));
  6626.  
  6627. /*
  6628.   Translation function table for sending files.
  6629.   Array of pointers to functions for translating from the local file
  6630.   character set to the transfer character set.  Indexed in the same
  6631.   way as the xlr array above, but with the indices reversed.
  6632. */
  6633. #ifdef CK_ANSIC
  6634. CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
  6635. #else
  6636. CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])() =
  6637. #endif /* CK_ANSIC */
  6638. {
  6639.     NULL,            /* 0,0 us ascii to transparent */
  6640.     NULL,            /* 0,1 uk ascii to transparent */
  6641.     NULL,            /* 0,2 dutch nrc to transparent */
  6642.     NULL,            /* 0,3 finnish nrc to transparent */
  6643.     NULL,            /* 0,4 french nrc to transparent */
  6644.     NULL,            /* 0,5 fr-canadian nrc to transparent */
  6645.     NULL,            /* 0,6 german nrc to transparent */
  6646.     NULL,            /* 0,7 hungarian nrc to transparent */
  6647.     NULL,            /* 0,8 italian nrc to transparent */
  6648.     NULL,            /* 0,9 norge/danish nrc to transparent */
  6649.     NULL,            /* 0,10 portuguese nrc to transparent */
  6650.     NULL,            /* 0,11 spanish nrc to transparent */
  6651.     NULL,            /* 0,12 swedish nrc to transparent */
  6652.     NULL,            /* 0,13 swiss nrc to transparent */
  6653.     NULL,            /* 0,14 latin-1 to transparent */
  6654.     NULL,            /* 0,15 latin-2 to transparent */
  6655.     NULL,            /* 0,16 DEC MCS to transparent */
  6656.     NULL,            /* 0,17 NeXT to transparent */
  6657.     NULL,            /* 0,18 CP437 to transparent */
  6658.     NULL,            /* 0,19 CP850 to transparent */
  6659.     NULL,            /* 0,20 CP852 to transparent */
  6660.     NULL,            /* 0,21 Macintosh Latin to transparent */
  6661.     NULL,            /* 0,22 DGI to transparent */
  6662.     NULL,            /* 0,23 HP to transparent */
  6663.     NULL,            /* 0,24 Latin/Cyrillic to transparent */
  6664.     NULL,                       /* 0,25 CP866 to transparent */
  6665.     NULL,                       /* 0,26 Short KOI to transparent */
  6666.     NULL,                       /* 0,27 Old KOI-8 to transparent */
  6667.     NULL,            /* 0,28 JIS-7 to transparent */
  6668.     NULL,            /* 0,29 Shift JIS to transparent */
  6669.     NULL,            /* 0,30 Japanese EUC to transparent */
  6670.     NULL,            /* 0,31 DEC Kanji to transparent */
  6671.     NULL,            /* 0,32 Hebrew-7 to transparent */
  6672.     NULL,            /* 0,33 Latin/Hebrew to transparent */
  6673.     NULL,            /* 0,34 CP862 Hebrew to transparent */
  6674.     NULL,            /* 0,35 ELOT 927 Greek to transparent */
  6675.     NULL,            /* 0,36 Latin/Greek to transparent */
  6676.     NULL,            /* 0,37 CP869 to transparent */
  6677.     NULL,            /* 0,38 Latin-9 to transparent */
  6678.     NULL,            /* 0,39 CP858 to transparent */
  6679.     NULL,            /* 0,40 CP855 to transparent */
  6680.     NULL,            /* 0,41 CP1251 to transparent */
  6681.     NULL,            /* 0,42 Bulgarian to transparent */
  6682.     NULL,            /* 0,43 CP1250 to transparent */
  6683.     NULL,            /* 0,44 Mazovia to transparent */
  6684.     NULL,            /* 0,45 UCS-2 to transparent */
  6685.     NULL,            /* 0,46 UTF-8 to transparent */
  6686.     NULL,            /* 0,47 KOI8R to transparent */
  6687.     NULL,            /* 0,48 KOI8U to transparent */
  6688.     NULL,            /* 0,49 CP1252 to transparent */
  6689.     NULL,            /* 1,0 us ascii to ascii */
  6690.     NULL,            /* 1,1 uk ascii to ascii */
  6691.     xduas,            /* 1,2 dutch nrc to ascii */
  6692.     xfias,            /* 1,3 finnish nrc to ascii */
  6693.     xfras,            /* 1,4 french nrc to ascii */
  6694.     xfcas,            /* 1,5 french canadian nrc to ascii */
  6695.     xgeas,            /* 1,6 german nrc to ascii */
  6696.     xhuas,            /* 1,7 hungarian nrc to ascii */
  6697.     xitas,            /* 1,8 italian nrc to ascii */
  6698.     xnoas,            /* 1,9 norwegian/danish nrc to ascii */
  6699.     xpoas,            /* 1,10 portuguese nrc to ascii */
  6700.     xspas,            /* 1,11 spanish nrc to ascii */
  6701.     xswas,            /* 1,12 swedish nrc to ascii */
  6702.     xchas,            /* 1,13 swiss nrc to ascii */
  6703.     xl1as,            /* 1,14 latin-1 to ascii */
  6704.     xl2as,            /* 1,15 latin-2 to ascii */
  6705.     xdmas,            /* 1,16 dec mcs to ascii */
  6706.     xneas,            /* 1,17 NeXT to ascii */
  6707.     x43as,            /* 1,18 CP437 to ascii */
  6708.     x85as,            /* 1,19 CP850 to ascii */
  6709.     x52as,            /* 1,20 CP850 to ascii */
  6710.     xaqas,            /* 1,21 Macintosh Latin to ascii */
  6711.     xdgas,            /* 1,22 DGI to ascii */
  6712.     xr8as,            /* 1,23 HP to ASCII */
  6713.     xlcas,            /* 1,24 Latin/Cyrillic to ASCII */
  6714.     xacas,                      /* 1,25 CP866 to ASCII */
  6715.     xskas,            /* 1,26 Short KOI to ASCII */
  6716.     xk8as,                      /* 1,27 Old KOI-8 Cyrillic to ASCII */
  6717.     NULL,            /* 1,28 */
  6718.     NULL,            /* 1,29 */
  6719.     NULL,            /* 1,30 */
  6720.     NULL,            /* 1,31 */
  6721.     xh7as,            /* 1,32 Hebrew-7 to ASCII */
  6722.     xlhas,            /* 1,33 Latin/Hebrew to ASCII */
  6723.     x62as,            /* 1,34 CP862 Hebrew to ASCII */
  6724.     xegas,            /* 1,35 ELOT 927 Greek to ASCII */
  6725.     xlgas,            /* 1,36 Latin/Greek to ASCII */
  6726.     x69as,            /* 1,37 CP869 to ASCII */
  6727.     xl9as,            /* 1,38 Latin-9 to ASCII */
  6728.     x58as,            /* 1,39 CP858 to ASCII */
  6729.     x55as,            /* 1,40 CP855 to ASCII */
  6730.     x1251as,            /* 1,41 CP1251 to ASCII */
  6731.     xleft128,            /* 1,42 Bulgarian to ASCII */
  6732.     x1250as,            /* 1,43 CP1250 to ASCII */
  6733.     xmzas,            /* 1,44 Mazovia to ASCII */
  6734.     NULL,            /* 1,45 UCS-2 to ASCII */
  6735.     NULL,            /* 1,46 UTF-8 to ASCII */
  6736.     xk8as,            /* 1,47 KOI8R to ASCII */
  6737.     xk8as,            /* 1,48 KOI8U to ASCII */
  6738.     xw1as,            /* 1,49 CP1252 to ASCII */
  6739.     NULL,            /* 2,0 us ascii to latin-1 */
  6740.     xukl1,            /* 2,1 uk ascii to latin-1 */
  6741.     xdul1,            /* 2,2 dutch nrc to latin-1 */
  6742.     xfil1,            /* 2,3 finnish nrc to latin-1 */
  6743.     xfrl1,            /* 2,4 french nrc to latin-1 */
  6744.     xfcl1,            /* 2,5 french canadian nrc to latin-1 */
  6745.     xgel1,            /* 2,6 german nrc to latin-1 */
  6746.     xhul1,            /* 2,7 hungarian nrc to latin-1 */
  6747.     xitl1,            /* 2,8 italian nrc to latin-1 */
  6748.     xnol1,            /* 2,9 norwegian/danish nrc to latin-1 */
  6749.     xpol1,            /* 2,10 portuguese nrc to latin-1 */
  6750.     xspl1,            /* 2,11 spanish nrc to latin-1 */
  6751.     xswl1,            /* 2,12 swedish nrc to latin-1 */
  6752.     xchl1,            /* 2,13 swiss nrc to latin-1 */
  6753.     NULL,            /* 2,14 latin-1 to latin-1 */
  6754.     xl2l1,            /* 2,15 latin-2 to latin-1 */
  6755.     xdml1,            /* 2,16 dec mcs to latin-1 */
  6756.     xnel1,                      /* 2,17 NeXT to Latin-1 */
  6757.     x43l1,                      /* 2,18 CP437 to Latin-1 */
  6758.     x85l1,                      /* 2,19 CP850 to Latin-1 */
  6759.     x52l1,                      /* 2,20 CP852 to Latin-1 */
  6760.     xaql1,                      /* 2,21 Macintosh Latin to Latin-1 */
  6761.     xdgl1,                      /* 2,22 DGI to Latin-1 */
  6762.     xr8l1,                      /* 2,23 HP to Latin-1 */
  6763.     xlcas,                      /* 2,24 Latin/Cyrillic to Latin-1 */
  6764.     xacas,                      /* 2,25 CP866 to Latin-1 */
  6765.     xskas,                      /* 2,26 Short KOI to Latin-1 */
  6766.     xk8as,                      /* 2,27 Old KOI-8 Cyrillic to Latin-1 */
  6767.     NULL,            /* 2,28 Kanji ... */
  6768.     NULL,            /* 2,29 */
  6769.     NULL,            /* 2,30 */
  6770.     NULL,            /* 2,31 */
  6771.     xh7as,            /* 2,32 Hebrew-7 to Latin-1 */
  6772.     xlhl1,            /* 2,33 Latin/Hebrew to Latin-1 */
  6773.     x62l1,            /* 2,34 CP862 Hebrew to Latin-1 */
  6774.     xegas,            /* 2,35 ELOT 927 Greek to Latin-1 */
  6775.     xlgl1,            /* 2,36 Latin/Greek to Latin-1 */
  6776.     NULL,            /* 2,37 CP869 to Latin-1 */
  6777.     NULL,            /* 2,38 Latin-9 to Latin-1 */
  6778.     x58l1,            /* 2,39 CP858 to Latin-1 */
  6779.     x55as,            /* 2,40 CP855 to Latin-1 */
  6780.     x1251as,            /* 2,41 CP1251 to Latin-1 */
  6781.     xleft128,            /* 2,42 Bulgarian to Latin-1 */
  6782.     x1250l1,            /* 2,43 CP1250 to Latin-1 */
  6783.     xmzl1,            /* 2,44 Mazovia to Latin-1 */
  6784.     NULL,            /* 2,45 UCS-2 to Latin-1 */
  6785.     NULL,            /* 2,46 UTF-8 to Latin-1 */
  6786.     xk8as,            /* 2,47 KOI8R to Latin-1 */
  6787.     xk8as,            /* 2,48 KOI8U to Latin-1 */
  6788.     xw1l1,            /* 2,49 CP1252 to Latin-1 */
  6789.     NULL,            /* 3,0 us ascii to latin-2 */
  6790.     NULL,            /* 3,1 uk ascii to latin-2 */
  6791.     xduas,            /* 3,2 dutch nrc to latin-2 */
  6792.     xfias,            /* 3,3 finnish nrc to latin-2 */
  6793.     xfras,            /* 3,4 french nrc to latin-2 */
  6794.     xfcas,            /* 3,5 french canadian nrc to latin-2 */
  6795.     xgel2,            /* 3,6 german nrc to latin-2 */
  6796.     xhul2,            /* 3,7 hungarian nrc to latin-2 */
  6797.     xitas,            /* 3,8 italian nrc to latin-2 */
  6798.     xnoas,            /* 3,9 norwegian/danish nrc to latin-2 */
  6799.     xpoas,            /* 3,10 portuguese nrc to latin-2 */
  6800.     xspas,            /* 3,11 spanish nrc to latin-2 */
  6801.     xswas,            /* 3,12 swedish nrc to latin-2 */
  6802.     xchas,            /* 3,13 swiss nrc to latin-2 */
  6803.     xl1l2,            /* 3,14 latin-1 to latin-2 */
  6804.     NULL,            /* 3,15 latin-2 to latin-2 */
  6805.     xl1l2,            /* 3,16 dec mcs to latin-2 */
  6806.     xnel2,                      /* 3,17 NeXT to Latin-2 */
  6807.     x43l2,                      /* 3,18 CP437 to Latin-2 */
  6808.     x85l2,                      /* 3,19 CP850 to Latin-2 */
  6809.     x52l2,                      /* 3,20 CP852 to Latin-2 */
  6810.     xaql2,                      /* 3,21 Macintosh Latin to Latin-2 */
  6811.     xdgl2,                      /* 3,22 DGI to Latin-2 */
  6812.     xr8l2,                      /* 3,23 HP to Latin-2 */
  6813.     xlcas,                      /* 3,24 Latin/Cyrillic to Latin-2 */
  6814.     xacas,                      /* 3,25 CP866 to Latin-2 */
  6815.     xskas,                      /* 3,26 Short KOI to Latin-2 */
  6816.     xk8as,                      /* 3,27 Old KOI-8 Cyrillic to Latin-2 */
  6817.     NULL,            /* 3,28 Kanji ... */
  6818.     NULL,            /* 3,29 */
  6819.     NULL,            /* 3,30 */
  6820.     NULL,            /* 3,31 */
  6821.     xh7as,            /* 3,32 Hebrew-7 to Latin-2 */
  6822.     xlhas,            /* 3,33 Latin/Hebrew to Latin-2 */
  6823.     x62as,            /* 3,34 CP862 Hebrew to Latin-2 */
  6824.     xegas,            /* 3,35 ELOT 927 Greek to Latin-2 */
  6825.     xl2lg,            /* 3,36 Latin/Greek to Latin-2 */
  6826.     xleft128,            /* 3,37 CP869 to Latin-2 */
  6827.     xl9l2,            /* 3,38 Latin-9 to Latin-2 */
  6828.     x58l2,            /* 3,39 CP858 to Latin-2 */
  6829.     x55as,            /* 3,40 CP855 to Latin-2 */
  6830.     x1251as,            /* 3,41 CP1251 to Latin-2 */
  6831.     xleft128,            /* 3,42 Bulgarian to Latin-2 */
  6832.     x1250l2,            /* 3,43 CP1250 to Latin-2 */
  6833.     xmzl2,            /* 3,44 Mazovia to Latin-2 */
  6834.     NULL,            /* 3,45 UCS-2 to Latin-2 */
  6835.     NULL,            /* 3,46 UTF-8 to Latin-2 */
  6836.     xk8as,            /* 3,47 KOI8R to Latin-2 */
  6837.     xk8as,            /* 3,48 KOI8U to Latin-2 */
  6838.     xw1l2,            /* 3,49 CP1252 to latin-2 */
  6839.     xaslc,            /* 4,0 us ascii to latin/cyrillic */
  6840.     xaslc,            /* 4,1 uk ascii to latin/cyrillic */
  6841.     xduas,            /* 4,2 dutch nrc to latin/cyrillic */
  6842.     xfias,            /* 4,3 finnish nrc to latin/cyrillic */
  6843.     xfras,            /* 4,4 french nrc to latin/cyrillic */
  6844.     xfcas,            /* 4,5 french canadian nrc to latin/cyrillic */
  6845.     xgeas,            /* 4,6 german nrc to latin/cyrillic */
  6846.     xhuas,            /* 4,7 hungarian nrc to latin/cyrillic */
  6847.     xitas,            /* 4,8 italian nrc to latin/cyrillic */
  6848.     xnoas,            /* 4,9 norge/danish nrc to latin/cyrillic */
  6849.     xpoas,            /* 4,10 portuguese nrc to latin/cyrillic */
  6850.     xspas,            /* 4,11 spanish nrc to latin/cyrillic */
  6851.     xswas,            /* 4,12 swedish nrc to latin/cyrillic */
  6852.     xchas,            /* 4,13 swiss nrc to latin/cyrillic */
  6853.     xl1as,            /* 4,14 latin-1 to latin/cyrillic */
  6854.     xl2as,            /* 4,15 latin-2 to latin/cyrillic */
  6855.     xdmas,            /* 4,16 dec mcs to latin/cyrillic */
  6856.     xneas,            /* 4,17 NeXT to latin/cyrillic */
  6857.     x43as,            /* 4,18 CP437 to latin/cyrillic */
  6858.     x85as,            /* 4,19 CP850 to latin/cyrillic */
  6859.     x52as,            /* 4,20 CP852 to latin/cyrillic */
  6860.     xaqas,            /* 4,21 Macintosh Latin to latin/cyrillic */
  6861.     xdgas,            /* 4,22 DGI to Latin/Cyrillic */
  6862.     xr8as,            /* 4,23 HP to Latin/Cyrillic */
  6863.     NULL,                       /* 4,24 Latin/Cyrillic to Latin/Cyrillic */
  6864.     xaclc,                      /* 4,25 CP866 to Latin/Cyrillic */
  6865.     xskcy,                      /* 4,26 Short KOI to Latin/Cyrillic */
  6866.     xk8lc,                      /* 4,27 Old KOI-8 Cyrillic to Latin/Cyrillic */
  6867.     NULL,            /* 4,28 Kanji... */
  6868.     NULL,            /* 4,29 */
  6869.     NULL,            /* 4,30 */
  6870.     NULL,            /* 4,31 */
  6871.     xh7as,            /* 4,32 Hebrew-7 to Latin/Cyrillic */
  6872.     xlhas,            /* 4,33 Latin/Hebrew to Latin/Cyrillic */
  6873.     x62as,            /* 4,34 CP862 Hebrew to Latin/Cyrillic */
  6874.     xegas,            /* 4,35 ELOT 927 Greek to Latin/Cyrillic */
  6875.     xleft160,            /* 4,36 Latin/Greek to Latin/Cyrillic */
  6876.     xleft128,            /* 4,37 CP869 to Latin/Cyrillic */
  6877.     xl1as,            /* 4,38 latin-9 to latin/cyrillic */
  6878.     xleft128,            /* 4,39 CP858 to Latin/Cyrillic */
  6879.     x55lc,            /* 4,40 CP855 to Latin/Cyrillic */
  6880.     x1251lc,            /* 4,41 CP1251 to Latin/Cyrillic */
  6881.     xbulc,            /* 4,42 Bulgarian to Latin/Cyrillic */
  6882.     x1250as,            /* 4,43 CP1250 to Latin/Cyrillic */
  6883.     xmzas,            /* 4,44 Mazovia to Latin/Cyrillic */
  6884.     NULL,            /* 4,45 UCS-2 to Latin/Cyrillic */
  6885.     NULL,            /* 4,46 UTF-8 to Latin/Cyrillic */
  6886.     xkrlc,            /* 4,47 KOI8R to Latin/Cyrillic */
  6887.     xkulc,            /* 4,48 KOI8U to Latin/Cyrillic */
  6888.     xw1lc,            /* 4,49 CP1252 to Latin/Cyrillic */
  6889.     NULL,            /* 5,00 */
  6890.     NULL,            /* 5,01 */
  6891.     NULL,            /* 5,02 */
  6892.     NULL,            /* 5,03 */
  6893.     NULL,            /* 5,04 */
  6894.     NULL,            /* 5,05 */
  6895.     NULL,            /* 5,06 */
  6896.     NULL,            /* 4.07 */
  6897.     NULL,            /* 5,08 */
  6898.     NULL,            /* 5,09 */
  6899.     NULL,            /* 5,10 */
  6900.     NULL,            /* 5,11 */
  6901.     NULL,            /* 5,12 */
  6902.     NULL,            /* 5,13 */
  6903.     NULL,            /* 5,14 */
  6904.     NULL,            /* 5,15 */
  6905.     NULL,            /* 5,16 */
  6906.     NULL,            /* 5,17 */
  6907.     NULL,            /* 5,18 */
  6908.     NULL,            /* 5,19 */
  6909.     NULL,            /* 5,20 */
  6910.     NULL,            /* 5,21 */
  6911.     NULL,            /* 5,22 */
  6912.     NULL,            /* 5,23 */
  6913.     NULL,            /* 5,24 */
  6914.     NULL,            /* 5,25 */
  6915.     NULL,            /* 5,26 */
  6916.     NULL,            /* 5,27 */
  6917.     NULL,            /* 5,28 */
  6918.     NULL,            /* 5,29 */
  6919.     NULL,            /* 5,30 */
  6920.     NULL,            /* 5,31 */
  6921.     NULL,            /* 5,32 */
  6922.     NULL,            /* 5,33 */
  6923.     NULL,            /* 5,34 */
  6924.     NULL,            /* 5,35 */
  6925.     NULL,            /* 5,36 */
  6926.     NULL,            /* 5,37 */
  6927.     NULL,            /* 5,38 */
  6928.     NULL,            /* 5,39 */
  6929.     NULL,            /* 5,40 */
  6930.     NULL,            /* 5,41 */
  6931.     NULL,            /* 5,42 */
  6932.     NULL,            /* 5,43 */
  6933.     NULL,            /* 5,44 */
  6934.     NULL,            /* 5,45 */
  6935.     NULL,            /* 5,46 */
  6936.     NULL,            /* 5,47 */
  6937.     NULL,            /* 5,48 */
  6938.     NULL,            /* 5,49 */
  6939.     NULL,            /* 6,0 us ascii to Latin/Hebrew */
  6940.     NULL,            /* 6,1 uk ascii to Latin/Hebrew */
  6941.     xduas,            /* 6,2 dutch nrc to Latin/Hebrew */
  6942.     xfias,            /* 6,3 finnish nrc to Latin/Hebrew */
  6943.     xfras,            /* 6,4 french nrc to Latin/Hebrew */
  6944.     xfcas,            /* 6,5 french canadian nrc to Latin/Hebrew */
  6945.     xgeas,            /* 6,6 german nrc to Latin/Hebrew */
  6946.     xhuas,            /* 6,7 hungarian nrc to Latin/Hebrew */
  6947.     xitas,            /* 6,8 italian nrc to Latin/Hebrew */
  6948.     xnoas,            /* 6,9 norge/danish nrc to Latin/Hebrew */
  6949.     xpoas,            /* 6,10 portuguese nrc to Latin/Hebrew */
  6950.     xspas,            /* 6,11 spanish nrc to Latin/Hebrew */
  6951.     xswas,            /* 6,12 swedish nrc to Latin/Hebrew */
  6952.     xchas,            /* 6,13 swiss nrc to Latin/Hebrew */
  6953.     xl1lh,            /* 6,14 latin-1 to Latin/Hebrew */
  6954.     xl2as,            /* 6,15 latin-2 to Latin/Hebrew */
  6955.     xdmas,            /* 6,16 dec mcs to Latin/Hebrew */
  6956.     xneas,            /* 6,17 NeXT to Latin/Hebrew */
  6957.     x43as,            /* 6,18 CP437 to Latin/Hebrew */
  6958.     x85as,            /* 6,19 CP850 to Latin/Hebrew */
  6959.     x52as,            /* 6,20 CP852 to Latin/Hebrew */
  6960.     xaqas,            /* 6,21 Macintosh Latin to Latin/Hebrew */
  6961.     xdgas,            /* 6,22 DGI to Latin/Hebrew */
  6962.     xr8as,            /* 6,23 HP to Latin/Hebrew */
  6963.     xlcas,                      /* 6,24 Latin/Cyrillic to Latin/Hebrew */
  6964.     xacas,                      /* 6,25 CP866 to Latin/Hebrew */
  6965.     xskas,                      /* 6,26 Short KOI to Latin/Hebrew */
  6966.     xk8as,                      /* 6,27 Old KOI-8 Cyrillic to Latin/Hebrew */
  6967.     NULL,            /* 6,28 Kanji... */
  6968.     NULL,            /* 6,29 */
  6969.     NULL,            /* 6,30 */
  6970.     NULL,            /* 6,31 */
  6971.     xh7lh,            /* 6,32 Hebrew-7 to Latin/Hebrew */
  6972.     NULL,            /* 6,33 Latin/Hebrew to Latin/Hebrew */
  6973.     x62lh,            /* 6,34 CP862 Hebrew to Latin/Hebrew */
  6974.     xegas,            /* 6,35 ELOT 927 Greek to Latin/Hebrew */
  6975.     xlgas,            /* 6,36 Latin/Greek to Latin/Hebrew */
  6976.     x69as,            /* 6,37 CP869 to Latin/Hebrew */
  6977.     xl1as,            /* 6,38 latin-9 to Latin/Hebrew */
  6978.     x58as,            /* 6,39 CP858 to Latin/Hebrew */
  6979.     x55as,            /* 6,40 CP855 to Latin/Hebrew */
  6980.     x1251as,            /* 6,41 CP1251 to Latin/Hebrew */
  6981.     xleft128,            /* 6,42 Bulgarian to Latin/Hebrew */
  6982.     x1250as,            /* 6,43 CP1250 to Latin/Hebrew */
  6983.     xmzas,            /* 6,44 Mazovia to Latin/Hebrew */
  6984.     NULL,            /* 6,45 UCS-2 to Latin/Hebrew */
  6985.     NULL,            /* 6,46 UTF-8 to Latin/Hebrew */
  6986.     NULL,            /* 6,47 KOI8R to Latin/Hebrew */
  6987.     NULL,            /* 6,48 KOI8U to Latin/Hebrew */
  6988.     xw1lh,            /* 6,49 CP1252 to Latin/Hebrew */
  6989.     NULL,            /* 7,0 us ascii to Latin/Greek */
  6990.     NULL,            /* 7,1 uk ascii to Latin/Greek */
  6991.     xduas,            /* 7,2 dutch nrc to Latin/Greek */
  6992.     xfias,            /* 7,3 finnish nrc to Latin/Greek */
  6993.     xfras,            /* 7,4 french nrc to Latin/Greek */
  6994.     xfcas,            /* 7,5 french canadian nrc to Latin/Greek */
  6995.     xgeas,            /* 7,6 german nrc to Latin/Greek */
  6996.     xhuas,            /* 7,7 hungarian nrc to Latin/Greek */
  6997.     xitas,            /* 7,8 italian nrc to Latin/Greek */
  6998.     xnoas,            /* 7,9 norge/danish nrc to Latin/Greek */
  6999.     xpoas,            /* 7,10 portuguese nrc to Latin/Greek */
  7000.     xspas,            /* 7,11 spanish nrc to Latin/Greek */
  7001.     xswas,            /* 7,12 swedish nrc to Latin/Greek */
  7002.     xchas,            /* 7,13 swiss nrc to Latin/Greek */
  7003.     xl1lg,            /* 7,14 latin-1 to Latin/Greek */
  7004.     xl2lg,            /* 7,15 latin-2 to Latin/Greek */
  7005.     xl1lg,            /* 7,16 dec mcs to Latin/Greek */
  7006.     xneas,            /* 7,17 NeXT to Latin/Greek */
  7007.     xleft128,            /* 7,18 CP437 to Latin/Greek */
  7008.     x85as,            /* 7,19 CP850 to Latin/Greek */
  7009.     x52as,            /* 7,20 CP852 to Latin/Greek */
  7010.     xaqas,            /* 7,21 Macintosh Latin to Latin/Greek */
  7011.     xdgas,            /* 7,22 DGI to Latin/Greek */
  7012.     xr8as,            /* 7,23 HP to Latin/Greek */
  7013.     xleft160,                   /* 7,24 Latin/Cyrillic to Latin/Greek */
  7014.     xleft128,                   /* 7,25 CP866 to Latin/Greek */
  7015.     xskas,                      /* 7,26 Short KOI to Latin/Greek */
  7016.     xk8as,                      /* 7,27 Old KOI-8 Cyrillic to Latin/Greek */
  7017.     NULL,            /* 7,28 Kanji... */
  7018.     NULL,            /* 7,29 */
  7019.     NULL,            /* 7,30 */
  7020.     NULL,            /* 7,31 */
  7021.     xh7as,            /* 7,32 Hebrew-7 to Latin/Greek */
  7022.     NULL,            /* 7,33 Latin/Hebrew to Latin/Greek */
  7023.     x62as,            /* 7,34 CP862 Hebrew to Latin/Greek */
  7024.     xeglg,            /* 7,35 ELOT 927 Greek to Latin/Greek */
  7025.     NULL,            /* 7,36 Latin/Greek to Latin/Greek */
  7026.     x69lg,            /* 7,37 CP869 to Latin/Greek */
  7027.     xl1as,            /* 7,38 latin-9 to Latin/Greek */
  7028.     xl1as,            /* 7,39 latin-9 to Latin/Hebrew*/
  7029.     xleft128,            /* 7,40 CP855 to Latin/Greek */
  7030.     xleft128,            /* 7,41 CP1251 to Latin/Greek */
  7031.     xleft128,            /* 7,42 Bulgarian to Latin/Greek */
  7032.     x1250as,            /* 7,43 CP1250 to Latin/Greek */
  7033.     xmzas,            /* 7,44 Mazovia to Latin/Greek */
  7034.     NULL,            /* 7,45 UCS-2 to Latin/Greek */
  7035.     NULL,            /* 7,46 UTF-8 to Latin/Greek */
  7036.     NULL,            /* 7,47 KOI8R to Latin/Greek */
  7037.     NULL,            /* 7,48 KOI8U to Latin/Greek */
  7038.     xw1lg,            /* 7,49 CP1252 to Latin/Greek */
  7039.     NULL,            /* 8,0 us ascii to latin-9 */
  7040.     xukl1,            /* 8,1 uk ascii to latin-9 */
  7041.     xdul1,            /* 8,2 dutch nrc to latin-9 */
  7042.     xfil1,            /* 8,3 finnish nrc to latin-9 */
  7043.     xfrl1,            /* 8,4 french nrc to latin-9 */
  7044.     xfcl1,            /* 8,5 french canadian nrc to latin-9 */
  7045.     xgel1,            /* 8,6 german nrc to latin-9 */
  7046.     xhul1,            /* 8,7 hungarian nrc to latin-9 */
  7047.     xitl1,            /* 8,8 italian nrc to latin-9 */
  7048.     xnol1,            /* 8,9 norwegian/danish nrc to latin-9 */
  7049.     xpol1,            /* 8,10 portuguese nrc to latin-9 */
  7050.     xspl1,            /* 8,11 spanish nrc to latin-9 */
  7051.     xswl1,            /* 8,12 swedish nrc to latin-9 */
  7052.     xchl1,            /* 8,13 swiss nrc to latin-9 */
  7053.     NULL,            /* 8,14 latin-1 to latin-9 */
  7054.     xl2l9,            /* 8,15 latin-2 to latin-9 */
  7055.     xdml9,            /* 8,16 dec mcs to latin-9 */
  7056.     xnel9,                      /* 8,17 NeXT To Latin-9 */
  7057.     x43l1,                      /* 8,18 CP437 To Latin-9 */
  7058.     x85l1,                      /* 8,19 CP850 To Latin-9 */
  7059.     x52l1,                      /* 8,20 CP852 To Latin-9 */
  7060.     xaql1,                      /* 8,21 Macintosh Latin To Latin-9 */
  7061.     xdgl1,                      /* 8,22 DGI To Latin-9 */
  7062.     xr8l1,                      /* 8,23 HP To Latin-9 */
  7063.     xlcas,                      /* 8,24 Latin/Cyrillic To Latin-9 */
  7064.     xacas,                      /* 8,25 CP866 To Latin-9 */
  7065.     xskas,                      /* 8,26 Short KOI To Latin-9 */
  7066.     xk8as,                      /* 8,27 Old KOI-8 Cyrillic To Latin-9 */
  7067.     NULL,            /* 8,28 Kanji ... */
  7068.     NULL,            /* 8,29 */
  7069.     NULL,            /* 8,30 */
  7070.     NULL,            /* 8,31 */
  7071.     xh7as,            /* 8,32 Hebrew-7 To Latin-9 */
  7072.     xlhl1,            /* 8,33 Latin/Hebrew To Latin-9 */
  7073.     x62l1,            /* 8,34 CP862 Hebrew To Latin-9 */
  7074.     xegas,            /* 8,35 ELOT 927 Greek To Latin-9 */
  7075.     xlgl1,            /* 8,36 Latin/Greek To Latin-9 */
  7076.     xl169,            /* 8,37 CP869 To Latin-9 */
  7077.     NULL,            /* 8,38 Latin-9 To Latin-9 */
  7078.     x58l9,            /* 8,39 cp858 To Latin-9 */
  7079.     x55as,            /* 8,40 cp855 To Latin-9 */
  7080.     x55as,            /* 8,41 cp1251 To Latin-9 */
  7081.     xleft128,            /* 8,42 Bulgarian To Latin-9 */
  7082.     x1250l9,            /* 8,43 CP1250 To Latin-9 */
  7083.     xmzl9,            /* 8,44 Mazovia To Latin-9 */
  7084.     NULL,            /* 8,45 UCS-2 to Latin-9 */
  7085.     NULL,            /* 8,46 UTF-8 to Latin-9 */
  7086.     NULL,            /* 8,47 KOI8R to Latin-9 */
  7087.     NULL,            /* 8,48 KOI8U to Latin-9 */
  7088.     xw1l9,            /* 8,49 CP1252 to Latin-9 */
  7089.     NULL,            /* 9,00 Unicode... */
  7090.     NULL,            /* 9,01 */
  7091.     NULL,            /* 9,02 */
  7092.     NULL,            /* 9,03 */
  7093.     NULL,            /* 9,04 */
  7094.     NULL,            /* 9,05 */
  7095.     NULL,            /* 9,06 */
  7096.     NULL,            /* 9,07 */
  7097.     NULL,            /* 9,08 */
  7098.     NULL,            /* 9,09 */
  7099.     NULL,            /* 9,10 */
  7100.     NULL,            /* 9,11 */
  7101.     NULL,            /* 9,12 */
  7102.     NULL,            /* 9,13 */
  7103.     NULL,            /* 9,14 */
  7104.     NULL,            /* 9,15 */
  7105.     NULL,            /* 9,16 */
  7106.     NULL,            /* 9,17 */
  7107.     NULL,            /* 9,18 */
  7108.     NULL,            /* 9,19 */
  7109.     NULL,            /* 9,20 */
  7110.     NULL,            /* 9,21 */
  7111.     NULL,            /* 9,22 */
  7112.     NULL,            /* 9,23 */
  7113.     NULL,            /* 9,24 */
  7114.     NULL,            /* 9,25 */
  7115.     NULL,            /* 9,26 */
  7116.     NULL,            /* 9,27 */
  7117.     NULL,            /* 9,28 */
  7118.     NULL,            /* 9,29 */
  7119.     NULL,            /* 9,30 */
  7120.     NULL,            /* 9,31 */
  7121.     NULL,            /* 9,32 */
  7122.     NULL,            /* 9,33 */
  7123.     NULL,            /* 9,34 */
  7124.     NULL,            /* 9,35 */
  7125.     NULL,            /* 9,36 */
  7126.     NULL,            /* 9,37 */
  7127.     NULL,            /* 9,38 */
  7128.     NULL,            /* 9,39 */
  7129.     NULL,            /* 9,40 */
  7130.     NULL,            /* 9,41 */
  7131.     NULL,            /* 9,42 */
  7132.     NULL,            /* 9,43 */
  7133.     NULL,            /* 9,44 */
  7134.     NULL,            /* 9,45 */
  7135.     NULL,            /* 9,46 */
  7136.     NULL,            /* 9,47 */
  7137.     NULL,            /* 9,48 */
  7138.     NULL,            /* 9,49 */
  7139.     NULL,            /* 10,00 */
  7140.     NULL,            /* 10,01 */
  7141.     NULL,            /* 10,02 */
  7142.     NULL,            /* 10,03 */
  7143.     NULL,            /* 10,04 */
  7144.     NULL,            /* 10,05 */
  7145.     NULL,            /* 10,06 */
  7146.     NULL,            /* 10,07 */
  7147.     NULL,            /* 10,08 */
  7148.     NULL,            /* 10,09 */
  7149.     NULL,            /* 10,10 */
  7150.     NULL,            /* 10,11 */
  7151.     NULL,            /* 10,12 */
  7152.     NULL,            /* 10,13 */
  7153.     NULL,            /* 10,14 */
  7154.     NULL,            /* 10,15 */
  7155.     NULL,            /* 10,16 */
  7156.     NULL,            /* 10,17 */
  7157.     NULL,            /* 10,18 */
  7158.     NULL,            /* 10,19 */
  7159.     NULL,            /* 10,20 */
  7160.     NULL,            /* 10,21 */
  7161.     NULL,            /* 10,22 */
  7162.     NULL,            /* 10,23 */
  7163.     NULL,            /* 10,24 */
  7164.     NULL,            /* 10,25 */
  7165.     NULL,            /* 10,26 */
  7166.     NULL,            /* 10,27 */
  7167.     NULL,            /* 10,28 */
  7168.     NULL,            /* 10,29 */
  7169.     NULL,            /* 10,30 */
  7170.     NULL,            /* 10,31 */
  7171.     NULL,            /* 10,32 */
  7172.     NULL,            /* 10,33 */
  7173.     NULL,            /* 10,34 */
  7174.     NULL,            /* 10,35 */
  7175.     NULL,            /* 10,36 */
  7176.     NULL,            /* 10,37 */
  7177.     NULL,            /* 10,38 */
  7178.     NULL,            /* 10,39 */
  7179.     NULL,            /* 10,40 */
  7180.     NULL,            /* 10,41 */
  7181.     NULL,            /* 10,42 */
  7182.     NULL,            /* 10,43 */
  7183.     NULL,            /* 10,44 */
  7184.     NULL,            /* 10,45 */
  7185.     NULL,            /* 10,46 */
  7186.     NULL,            /* 10,47 */
  7187.     NULL,            /* 10,48 */
  7188.     NULL            /* 10,49 */
  7189. };
  7190. int nxls = (sizeof(xls) / sizeof(CHAR *));
  7191.  
  7192. #ifndef NOLOCAL
  7193. /*
  7194.   The following routines are useful only for terminal character sets, and so
  7195.   ifdef'd out for NOLOCAL compilations.
  7196. */
  7197.  
  7198. /*
  7199.   C S _ I S _ N R C
  7200.  
  7201.   Returns nonzero if argument indicates a 7-bit national character set,
  7202.   zero otherwise.
  7203. */
  7204. int
  7205. cs_is_nrc(x) int x; {
  7206. #ifdef UNICODE
  7207.     if (x == TX_J201R || x == TX_DECSPEC || x == TX_DECTECH
  7208.         || txrinfo[x] == NULL)
  7209.       return(0);
  7210.     else
  7211.       return(txrinfo[x]->flags & X2U_STD && txrinfo[x]->size == 94);
  7212. #else /* UNICODE */
  7213.     if ((cs_size(x) == 94))
  7214.       return(1);
  7215.     else
  7216.       return(0);
  7217. #endif /* UNICODE */
  7218. }
  7219.  
  7220. /*
  7221.   C S _ I S _ S T D
  7222.  
  7223.   Returns nonzero if argument indicates an ISO 4873-standard-format
  7224.   character set, i.e. one in which the control region is NOT used for
  7225.   graphics; zero otherwise.
  7226. */
  7227. int
  7228. cs_is_std(x) int x; {
  7229. #ifdef UNICODE
  7230.     if (!txrinfo[x])            /* Even more safety */
  7231.       return(0);
  7232.     else if (txrinfo[x]->size == 128)    /* Just for safety */
  7233.       return(0);
  7234.     else
  7235.       return(txrinfo[x]->flags & X2U_STD); /* Only this should be needed */
  7236. #else
  7237.     switch (x) {
  7238.       case FC_CP437:            /* Code pages use C1 graphics */
  7239.       case FC_CP850:
  7240.       case FC_CP852:
  7241.       case FC_CP862:
  7242.       case FC_CP866:
  7243.       case FC_CP869:
  7244.       case FC_CP858:
  7245.       case FC_APPQD:            /* So do Apple and NeXTSTEP */
  7246.       case FC_NEXT:
  7247.     return(0);
  7248.       default:                /* Others behave */
  7249.     return(1);
  7250.     }
  7251. #endif /* CKOUINI */
  7252. }
  7253.  
  7254. int
  7255. cs_size(x) int x; {
  7256. #ifdef UNICODE
  7257.     if (!txrinfo[x])
  7258.       return(128);
  7259.     return(txrinfo[x]->size);
  7260. #else
  7261.     switch(x) {
  7262.       case FC_USASCII:
  7263.       case FC_UKASCII:
  7264.       case FC_DUASCII:
  7265.       case FC_FIASCII:
  7266.       case FC_FRASCII:
  7267.       case FC_FCASCII:
  7268.       case FC_GEASCII:
  7269.       case FC_HUASCII:
  7270.       case FC_ITASCII:
  7271.       case FC_NOASCII:
  7272.       case FC_POASCII:
  7273.       case FC_SPASCII:
  7274.       case FC_SWASCII:
  7275.       case FC_CHASCII:
  7276.       case FC_KOI7:
  7277.       case FC_HE7:
  7278.       case FC_ELOT:
  7279.     return(94);
  7280.  
  7281.       case FC_1LATIN:
  7282.       case FC_2LATIN:
  7283.       case FC_DECMCS:
  7284.       case FC_DGMCS:
  7285.       case FC_HPR8:
  7286.       case FC_CYRILL:
  7287.       case FC_KOI8:
  7288.       case FC_HEBREW:
  7289.       case FC_GREEK:
  7290.       case FC_9LATIN:
  7291.     return(96);
  7292.  
  7293.       case FC_NEXT:
  7294.       case FC_CP437:
  7295.       case FC_CP850:
  7296.       case FC_CP852:
  7297.       case FC_CP855:
  7298.       case FC_CP862:
  7299.       case FC_CP866:
  7300.       case FC_CP1251:
  7301.       case FC_APPQD:
  7302.     return(128);
  7303. #ifdef KANJI
  7304.       case FC_JIS7:
  7305.     return(-94);
  7306.       case FC_SHJIS:
  7307.     return(-128);
  7308.       case FC_JEUC:
  7309.       case FC_JDEC:
  7310.     return(-96);
  7311. #endif /* KANJI */
  7312.       case FC_CP858:
  7313.       default:
  7314.     return(-1);
  7315.     }
  7316. #endif /* UNICODE */
  7317. }
  7318. #endif /* NOLOCAL */
  7319.  
  7320. /*
  7321.   S E T X L A T Y P E  --  Set Translation Type
  7322.  
  7323.   Sets global xlatype to indicate which kind of translation:
  7324.  
  7325.     XLA_NONE      No translation
  7326.     XLA_BYTE      Byte-for-Byte translation
  7327.     XLA_JAPAN     Japanese Kanji translation
  7328.     XLA_UNICODE   Unicode translations
  7329.  
  7330.   And sets up the appropriate translation function pointers as follows:
  7331.  
  7332.   For no translation:
  7333.     All function pointers are NULL.
  7334.  
  7335.   For Byte-for-Byte transation:
  7336.     rx  = TCS to FCS (these functions are in this module...)
  7337.     sx  = FCS to TCS
  7338.  
  7339.   For Unicode translations:
  7340.     xfu = FCS to UCS (these functions are in ckcuni.c...)
  7341.     xtu = TCS to UCS
  7342.     xuf = UCS to FCS
  7343.     xut = UCS to TCS
  7344. */
  7345. VOID
  7346. setxlatype(tcs, fcs) int tcs, fcs; {
  7347. #ifdef UNICODE
  7348.     xfu = NULL;                /* Unicode <-> TCS/FCS functions */
  7349.     xtu = NULL;
  7350.     xuf = NULL;
  7351.     xut = NULL;
  7352. #endif /* UNICODE */
  7353.     rx = sx = NULL;
  7354.     debug(F101,"setxlatype fcs","",fcs);
  7355.     debug(F101,"setxlatype tcs","",tcs);
  7356.  
  7357.     if (tcs < 0 || tcs > MAXTCSETS) {
  7358.     debug(F101,"setxlatype bad tcs","",tcs);
  7359.     return;
  7360.     }
  7361.     if (fcs < 0 || fcs > MAXFCSETS) {
  7362.     debug(F101,"setxlatype bad fcs","",fcs);
  7363.     return;
  7364.     }
  7365.     if (tcs == TC_TRANSP || xfrxla == 0) { /* Transfer charset TRANSPARENT */
  7366.     debug(F101,"setxlatype transparent because TCS==Transparent","",tcs);
  7367.     xlatype = XLA_NONE;        /* Translation type is None */
  7368. #ifdef UNICODE
  7369.     /* If any of our charsets is Unicode we use Unicode functions */
  7370.     /* even if TCS and FCS are the same because of BOM and byte swapping */
  7371.     } else if (tcs == TC_UCS2 || tcs == TC_UTF8 ||
  7372.            fcs == FC_UCS2 || fcs == FC_UTF8) {
  7373.     debug(F101,"setxlatype Unicode tcs","",tcs);
  7374.     debug(F101,"setxlatype Unicode fcs","",fcs);
  7375.     /* Unicode <-> TCS/FCS functions */
  7376.     xfu = xl_fcu[fcs];        /* FCS -> UCS */
  7377.     xtu = xl_tcu[tcs];        /* TCS -> UCS */
  7378.     xuf = xl_ufc[fcs];        /* UCS -> FCS */
  7379.     xut = xl_utc[tcs];        /* UCS -> TCS */
  7380.         xlatype = XLA_UNICODE;        /* Translation type is Unicode */
  7381. #ifdef COMMENT
  7382.     /* These make trouble in 64-bit land */
  7383.     debug(F001,"setxlatype Unicode xfu","",(unsigned)xfu);
  7384.     debug(F001,"setxlatype Unicode xuf","",(unsigned)xuf);
  7385. #endif /* COMMENT */
  7386. #endif /* UNICODE */
  7387.     } else if (cseqtab[tcs] == fcs) {    /* Or if TCS == FCS */
  7388.     debug(F101,"setxlatype transparent because TCS==FCS","",tcs);
  7389.     xlatype = XLA_NONE;        /* translation type is also None */
  7390. #ifdef KANJI
  7391.     /* Otherwise if any of them is Japanese, we use Kanji functions */
  7392.     } else if (tcs == TC_JEUC || fcsinfo[fcs].alphabet == AL_JAPAN) {
  7393.     debug(F101,"setxlatype Japanese tcs","",tcs);
  7394.     debug(F101,"setxlatype Japanese fcs","",fcs);
  7395.         xlatype = XLA_JAPAN;        /* Translation type is Japanese */
  7396. #endif /* KANJI */
  7397.     /* Otherwise we use byte functions */
  7398.     } else {                /* Otherwise... */
  7399.     rx = xlr[tcs][fcs];        /* Input translation function */
  7400.     sx = xls[tcs][fcs];        /* Output translation function */
  7401.     debug(F101,"setxlatype Byte tcs","",tcs);
  7402.     debug(F101,"setxlatype Byte fcs","",fcs);
  7403.         xlatype = XLA_BYTE;        /* Translation type is Byte */
  7404.     }
  7405.     debug(F101,"setxlatype xlatype","",xlatype);
  7406. }
  7407.  
  7408. /* Set up translation between two file character sets with UCS intermediate */
  7409.  
  7410. #ifdef UNICODE
  7411. VOID
  7412. initxlate(csin, csout) int csin, csout; {
  7413.     xfu = NULL;
  7414.     xtu = NULL;
  7415.     xuf = NULL;
  7416.     xut = NULL;
  7417.  
  7418.     debug(F101,"initxlate csin","",csin);
  7419.     debug(F101,"initxlate csout","",csout);
  7420.  
  7421.     if (csin < 0 || csin > MAXFCSETS) {
  7422.     debug(F101,"initxlate bad csin","",csin);
  7423.     return;
  7424.     }
  7425.     if (csout < 0 || csout > MAXFCSETS) {
  7426.     debug(F101,"initxlate bad csout","",csout);
  7427.     return;
  7428.     }
  7429.     if (csin == csout && csin != FC_UCS2) {
  7430.     xlatype = XLA_NONE;        /* Translation type is None */
  7431.     return;
  7432.     }
  7433.     xlatype = XLA_UNICODE;        /* Translation type is Unicode */
  7434.     xfu = xl_fcu[csin];            /* FCS -> UCS */
  7435.     xuf = xl_ufc[csout];        /* UCS -> FCS */
  7436.     xpnbyte(-1,0,0,NULL);        /* Reset UCS-2 */
  7437. #ifdef COMMENT
  7438.     debug(F001,"initxlate Unicode xfu","",(unsigned)xfu);
  7439.     debug(F001,"initxlate Unicode xuf","",(unsigned)xuf);
  7440. #endif /* COMMENT */
  7441.     debug(F101,"initxlate xlatype","",xlatype);
  7442. }
  7443. #endif /* UNICODE */
  7444.  
  7445. int csetsinited = 0;
  7446.  
  7447. VOID
  7448. initcsets() {                /* Routine to reset or initialize */
  7449.     int i;                /* character-set associations. */
  7450.  
  7451. #ifdef UNICODE
  7452.     if (ucsorder < 0)            /* For creating UCS-2 files. */
  7453.       ucsorder = byteorder;
  7454.     if (ucsorder < 0)
  7455.       ucsorder = 0;
  7456.     if (fileorder < 0)            /* For reading UCS-2 files. */
  7457.       fileorder = ucsorder;
  7458. #endif /* UNICODE */
  7459.  
  7460.     debug(F101,"initcsets nxls","",nxls);
  7461.     debug(F101,"initcsets nxlr","",nxlr);
  7462.  
  7463.     debug(F101,"initcsets TERM LOCAL CSET","",tcsl);
  7464.     debug(F101,"initcsets TERM REMOTE CSET","",tcsr);
  7465.  
  7466.     for (i = 0; i <= MAXFCSETS; i++)    /* First clear them all... */
  7467.       afcset[i] = -1;
  7468.     for (i = 0; i <= MAXTCSETS; i++)
  7469.       axcset[i] = -1;
  7470.  
  7471.     /* Now set specific defaults for incoming files */
  7472.  
  7473.     xlatype = XLA_NONE;
  7474.  
  7475.     axcset[TC_TRANSP]  = FC_TRANSP;
  7476.     axcset[TC_USASCII] = FC_USASCII;
  7477.  
  7478. #ifdef OS2
  7479.     switch (fcharset) {
  7480.       case FC_CP850:
  7481.       case FC_CP858:
  7482.       case FC_CP437:
  7483.       case FC_1LATIN:
  7484.     axcset[TC_1LATIN]  = fcharset;
  7485.     break;
  7486.       default:
  7487.     axcset[TC_1LATIN]  = FC_CP850;
  7488.     }
  7489. #else
  7490. #ifdef HPUX
  7491.     axcset[TC_1LATIN]  = FC_HPR8;
  7492. #else
  7493. #ifdef VMS
  7494.     axcset[TC_1LATIN]  = FC_DECMCS;
  7495. #else
  7496. #ifdef NEXT
  7497.     axcset[TC_1LATIN]  = FC_NEXT;
  7498. #else
  7499. #ifdef datageneral
  7500.     axcset[TC_1LATIN]  = FC_DGMCS;
  7501. #else
  7502.     /* Should we use code pages on some PC based UNIXes? */
  7503.     axcset[TC_1LATIN]  = FC_1LATIN;
  7504. #endif /* datageneral */
  7505. #endif /* NEXT */
  7506. #endif /* VMS */
  7507. #endif /* HPUX */
  7508. #endif /* OS2 */
  7509.  
  7510. #ifdef OS2
  7511.     axcset[TC_2LATIN]  = FC_CP852;
  7512.     axcset[TC_CYRILL]  = FC_CP866;
  7513.     axcset[TC_JEUC]    = FC_SHJIS;
  7514.     axcset[TC_HEBREW]  = FC_CP862;
  7515.     axcset[TC_GREEK]   = FC_CP869;
  7516.     axcset[TC_9LATIN]  = FC_CP858;
  7517.     axcset[TC_UCS2]    = FC_UCS2;
  7518.     axcset[TC_UTF8]    = FC_UCS2;
  7519. #else
  7520.     axcset[TC_2LATIN]  = FC_2LATIN;
  7521.     axcset[TC_CYRILL]  = FC_CYRILL;
  7522.     axcset[TC_JEUC]    = FC_JEUC;
  7523.     axcset[TC_HEBREW]  = FC_HEBREW;
  7524.     axcset[TC_GREEK]   = FC_GREEK;
  7525.     axcset[TC_9LATIN]  = FC_9LATIN;
  7526.     axcset[TC_UCS2]    = FC_UTF8;
  7527.     axcset[TC_UTF8]    = FC_UTF8;
  7528. #endif /* OS2 */
  7529.  
  7530.     /* And for outbound files */
  7531.  
  7532.     afcset[FC_USASCII] = TC_USASCII;
  7533.     afcset[FC_UKASCII] = TC_1LATIN;
  7534.     afcset[FC_DUASCII] = TC_1LATIN;
  7535.     afcset[FC_FIASCII] = TC_1LATIN;
  7536.     afcset[FC_FRASCII] = TC_1LATIN;
  7537.     afcset[FC_FCASCII] = TC_1LATIN;
  7538.     afcset[FC_GEASCII] = TC_1LATIN;
  7539.     afcset[FC_HUASCII] = TC_2LATIN;
  7540.     afcset[FC_ITASCII] = TC_1LATIN;
  7541.     afcset[FC_NOASCII] = TC_1LATIN;
  7542.     afcset[FC_POASCII] = TC_1LATIN;
  7543.     afcset[FC_SPASCII] = TC_1LATIN;
  7544.     afcset[FC_SWASCII] = TC_1LATIN;
  7545.     afcset[FC_CHASCII] = TC_1LATIN;
  7546.     afcset[FC_1LATIN]  = TC_1LATIN;
  7547.     afcset[FC_2LATIN]  = TC_2LATIN;
  7548.     afcset[FC_DECMCS]  = TC_1LATIN;
  7549.     afcset[FC_NEXT]    = TC_1LATIN;
  7550.     afcset[FC_CP437]   = TC_1LATIN;
  7551.     afcset[FC_CP850]   = TC_1LATIN;
  7552.     afcset[FC_CP852]   = TC_2LATIN;
  7553.     afcset[FC_APPQD]   = TC_1LATIN;
  7554.     afcset[FC_DGMCS]   = TC_1LATIN;
  7555.     afcset[FC_HPR8]    = TC_1LATIN;
  7556.     afcset[FC_CYRILL]  = TC_CYRILL;
  7557.     afcset[FC_CP866]   = TC_CYRILL;
  7558.     afcset[FC_KOI7]    = TC_CYRILL;
  7559.     afcset[FC_KOI8]    = TC_CYRILL;
  7560.     afcset[FC_JIS7]    = TC_JEUC;
  7561.     afcset[FC_SHJIS]   = TC_JEUC;
  7562.     afcset[FC_JEUC]    = TC_JEUC;
  7563.     afcset[FC_JDEC]    = TC_JEUC;
  7564.     afcset[FC_HE7]     = TC_HEBREW;
  7565.     afcset[FC_HEBREW]  = TC_HEBREW;
  7566.     afcset[FC_CP862]   = TC_HEBREW;
  7567.     afcset[FC_ELOT]    = TC_GREEK;
  7568.     afcset[FC_GREEK]   = TC_GREEK;
  7569.     afcset[FC_CP869]   = TC_GREEK;
  7570.     afcset[FC_9LATIN]  = TC_9LATIN;
  7571.     afcset[FC_CP923]   = TC_9LATIN;
  7572.     afcset[FC_CP858]   = TC_9LATIN;
  7573.     afcset[FC_CP855]   = TC_CYRILL;
  7574.     afcset[FC_CP1251]  = TC_CYRILL;
  7575.     afcset[FC_BULGAR]  = TC_CYRILL;
  7576.     afcset[FC_CP1250]  = TC_2LATIN;
  7577.     afcset[FC_MAZOVIA] = TC_2LATIN;
  7578.     afcset[FC_UCS2]    = TC_UTF8;
  7579.     afcset[FC_UTF8]    = TC_UTF8;
  7580.  
  7581.     afcset[FC_KOI8R]   = TC_CYRILL;
  7582.     afcset[FC_KOI8U]   = TC_CYRILL;
  7583.     afcset[FC_CP1252]  = TC_1LATIN;
  7584.  
  7585.     csetsinited++;
  7586.     return;
  7587. }
  7588. #endif /* NOCSETS */
  7589.