home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / CK5A188S.ZIP / ckuxla.c < prev    next >
C/C++ Source or Header  |  1992-11-23  |  154KB  |  3,981 lines

  1. #ifndef NOCSETS
  2. char *xlav = "Character Set Translation 5A(018), 21 Nov 92";
  3.  
  4. /*  C K U X L A  */
  5.  
  6. /*  C-Kermit tables and functions supporting character set translation.  */
  7. /*
  8.   Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET),
  9.   Columbia University Center for Computing Activities.
  10.   Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New
  11.   York.  Permission is granted to any individual or institution to use this
  12.   software as long as it is not sold for profit.  This copyright notice must be
  13.   retained.  This software may not be included in commercial products without
  14.   written permission of Columbia University.
  15. */
  16.  
  17. /*
  18.   CAVEAT PROGRAMMOR: The mechanism used here turns out to be somewhat
  19.   inflexible and maybe a little dangerous.  It is designed for Kermit's
  20.   character-at-a-time processing during protocol operations.  Elaborate
  21.   kludges are used for translating one character into two (like stuffing an
  22.   extra character into the input stream), or two into one, or two into two.
  23.  
  24.   The whole translation business needs to be redesigned to be string-oriented
  25.   rather than character oriented, so (a) we can have more flexible
  26.   translations, and (b) we don't have to be concerned about which input stream
  27.   we are using.  The current mechanism is also quite inappropriate
  28.   for multibyte character sets and for flexible user-defined translations.
  29.  
  30.   For the future: perhaps it would be better to represent characters
  31.   internally using a universal character set like UNICODE (ISO 10646 BMP),
  32.   the ultimate "transfer character set".
  33. */
  34. #include "ckcdeb.h"            /* Includes... */
  35. #include "ckcker.h"
  36. #include "ckucmd.h"
  37. #include "ckcxla.h"
  38.  
  39. /* Character set translation data and functions */
  40.  
  41. extern int zincnt;            /* File i/o macros and variables */
  42. extern char *zinptr;
  43. extern int zoutcnt;
  44. extern char *zoutptr;
  45.  
  46. int tslevel  = TS_L0;            /* Transfer syntax level (0,1,2) */
  47. int tcharset = TC_TRANSP;        /* Transfer syntax character set */
  48. int tcsr     = FC_USASCII;        /* Remote terminal character set */
  49. int language = L_USASCII;        /* Language */
  50.  
  51. /*
  52.   Default local file and terminal character set.
  53.   Normally ASCII, but for some systems we know otherwise.
  54. */
  55. #ifdef datageneral            /* Data General AOS/VS */
  56. int fcharset = FC_DGMCS;        /* uses the DG International set */
  57. int tcsl     = FC_DGMCS;
  58. #else
  59. #ifdef NEXT                /* The NeXT workstation */
  60. int fcharset = FC_NEXT;            /* uses its own 8-bit set */
  61. int tcsl     = FC_NEXT;
  62. #else
  63. #ifdef MAC                /* The Macintosh */
  64. int fcharset = FC_APPQD;        /* uses an extended version of */
  65. int tcsl     = FC_APPQD;        /* Apple Quickdraw */
  66. #else
  67. #ifdef AUX
  68. int fcharset = FC_APPQD;        /* Ditto for Apple A/UX */
  69. int tcsl     = FC_APPQD;
  70. #else
  71. #ifdef AMIGA                /* The Commodore Amiga */
  72. int fcharset = FC_1LATIN;        /* uses Latin-1 */
  73. int tcsl     = FC_1LATIN;
  74. #else                    /* All others */
  75. int fcharset = FC_USASCII;        /* use ASCII by default */
  76. int tcsl     = FC_USASCII;
  77. #endif /* AMIGA */
  78. #endif /* AUX */
  79. #endif /* MAC */
  80. #endif /* NEXT */
  81. #endif /* datageneral */
  82.  
  83.  
  84.  
  85. _PROTOTYP( CHAR xnel1, (CHAR c) );    /* NeXT to Latin-1 */
  86. _PROTOTYP( CHAR xl143, (CHAR c) );    /* Latin-1 to IBM CP437 */
  87. _PROTOTYP( CHAR xl1as, (CHAR c) );    /* Latin-1 to US ASCII */
  88. _PROTOTYP( CHAR zl1as, (CHAR c) );    /* Latin-1 to US ASCII */
  89.  
  90. #ifdef CYRILLIC
  91. _PROTOTYP( CHAR xassk, (CHAR c) );    /* ASCII to Short KOI */
  92. _PROTOTYP( CHAR xskcy, (CHAR c) );    /* Short KOI to Latin/Cyrillic */
  93. #endif /* CYRILLIC */
  94.  
  95. #ifdef LATIN2
  96. _PROTOTYP( CHAR xnel2, (CHAR c) );    /* NeXT to Latin-2 */
  97. _PROTOTYP( CHAR xl243, (CHAR c) );    /* Latin-2 to IBM CP437 */
  98. _PROTOTYP( CHAR xl2as, (CHAR c) );    /* Latin-2 to US ASCII */
  99. _PROTOTYP( CHAR zl2as, (CHAR c) );    /* Latin-2 to US ASCII */
  100. #endif /* LATIN2 */
  101.  
  102. /* Transfer character-set info */
  103.  
  104. struct csinfo tcsinfo[] = {
  105. /*  Name                       size code      designator  alphabet           */
  106.     "TRANSPARENT, no translation", 256, TC_TRANSP,  "",       AL_UNK,   /* 0 */
  107.     "ASCII",                       128, TC_USASCII, "",       AL_ROMAN, /* 1 */
  108.     "LATIN1, ISO 8859-1",          256, TC_1LATIN,  "I6/100", AL_ROMAN, /* 2 */
  109. #ifdef LATIN2
  110.     "LATIN2, ISO 8859-2",          256, TC_2LATIN,  "I6/101", AL_ROMAN, /* 3 */
  111. #else
  112.     "LATIN2 not supported",          0, TC_TRANSP,   "XXX",   AL_UNK,   /* 3 */
  113. #endif /* LATIN2 */
  114. #ifdef CYRILLIC
  115.     "CYRILLIC, ISO 8859-5",        256, TC_CYRILL,   "I6/144",AL_CYRIL, /* 4 */
  116. #else
  117.     "CYRILLIC not supported",        0, TC_TRANSP,   "XXX",   AL_UNK,   /* 4 */
  118. #endif /* CYRILLIC */
  119. /*
  120.   NOTE: the second entry is obsolete, but retained temporarily.
  121.   The proper designator is given in the first entry.  C-Kermit sends the
  122.   first (proper) form, but accepts either form.
  123. */
  124. #ifdef KANJI
  125.     "KANJI (EUC)", 16384, TC_JEUC,  "I14/87/13", AL_JAPAN, /* 5 */
  126.     "KANJI (EUC)", 16384, TC_JEUC,  "I14/87E",   AL_JAPAN  /* 5 */
  127. #else
  128.     "KANJI not supported", 0, TC_TRANSP,"XXX",   AL_UNK,   /* 5 */
  129. #endif /* KANJI */
  130. };
  131. int ntcsets = (sizeof(tcsinfo) / sizeof(struct csinfo));
  132.  
  133. struct keytab tcstab[] = {        /* Keyword table for */
  134.     "ascii",         TC_USASCII, 0,    /* SET TRANSFER CHARACTER-SET */
  135. #ifdef CYRILLIC
  136.     "cyrillic-iso",  TC_CYRILL,  0,
  137. #endif /* CYRILLIC */
  138. #ifdef KANJI
  139.     "japanese-euc",  TC_JEUC,    0,
  140. #endif /* KANJI */
  141. #ifdef LATIN2
  142. /*
  143.   If Latin-2 is defined, let the following be invisible, non-unique
  144.   abbreviations for LATIN1.
  145. */
  146.     "l",             TC_1LATIN,  CM_ABR|CM_INV,
  147.     "la",            TC_1LATIN,  CM_ABR|CM_INV,
  148.     "lat",           TC_1LATIN,  CM_ABR|CM_INV,
  149.     "lati",          TC_1LATIN,  CM_ABR|CM_INV,
  150.     "latin",         TC_1LATIN,  CM_ABR|CM_INV,
  151. #endif /* LATIN2 */
  152.     "latin1-iso",    TC_1LATIN,  0,
  153. #ifdef LATIN2
  154.     "latin2-iso",    TC_2LATIN,  0,
  155. #endif /* LATIN2 */
  156.     "transparent",   TC_TRANSP,  0
  157. };
  158. int ntcs = (sizeof(tcstab) / sizeof(struct keytab));
  159.  
  160. /* File character set information structure, indexed by character set code, */
  161. /* as defined in ckuxla.h.  This table must be in order of file character */
  162. /* set number! */ 
  163.  
  164. struct csinfo fcsinfo[] = { /* File character set information... */
  165.   /* Descriptive Name              Size  Designator */
  166.     "US ASCII",                     128, FC_USASCII, NULL, AL_ROMAN,
  167.     "British/UK ISO-646",           128, FC_UKASCII, NULL, AL_ROMAN,
  168.     "Dutch ISO-646",                128, FC_DUASCII, NULL, AL_ROMAN,
  169.     "Finnish ISO-646",              128, FC_FIASCII, NULL, AL_ROMAN,
  170.     "French ISO-646",               128, FC_FRASCII, NULL, AL_ROMAN,
  171.     "Canadian-French ISO-646",      128, FC_FCASCII, NULL, AL_ROMAN,
  172.     "German ISO-646",               128, FC_GEASCII, NULL, AL_ROMAN,
  173.     "Hungarian ISO-646",            128, FC_HUASCII, NULL, AL_ROMAN,
  174.     "Italian ISO-646",              128, FC_ITASCII, NULL, AL_ROMAN,
  175.     "Norwegian/Danish ISO-646",     128, FC_NOASCII, NULL, AL_ROMAN,
  176.     "Portuguese ISO-646",           128, FC_POASCII, NULL, AL_ROMAN,
  177.     "Spanish ISO-646",              128, FC_SPASCII, NULL, AL_ROMAN,
  178.     "Swedish ISO-646",              128, FC_SWASCII, NULL, AL_ROMAN,
  179.     "Swiss ISO-646",                128, FC_CHASCII, NULL, AL_ROMAN,
  180.     "ISO 8859-1 Latin-1",           256, FC_1LATIN,  NULL, AL_ROMAN,
  181. #ifdef LATIN2
  182.     "ISO 8859-2 Latin-2",           256, FC_2LATIN,  NULL, AL_ROMAN,
  183. #endif /* LATIN2 */
  184.     "DEC Multinational",            256, FC_DECMCS,  NULL, AL_ROMAN,
  185.     "NeXT Multinational",           256, FC_NEXT,    NULL, AL_ROMAN,
  186.     "IBM Code Page 437",            256, FC_CP437,   NULL, AL_ROMAN,
  187.     "IBM Code Page 850",            256, FC_CP850,   NULL, AL_ROMAN,
  188. #ifdef LATIN2
  189.     "IBM Code Page 852",            256, FC_CP852,   NULL, AL_ROMAN,
  190. #endif /* LATIN2 */
  191.     "Apple Macintosh Latin",        256, FC_APPQD,   NULL, AL_ROMAN,
  192.     "Data General International",   256, FC_DGMCS,   NULL, AL_ROMAN
  193. #ifdef CYRILLIC
  194. ,   "ISO 8859-5 Latin/Cyrillic",    256, FC_CYRILL,  NULL, AL_CYRIL,
  195.     "CP866 Cyrillic",            256, FC_CP866,   NULL, AL_CYRIL,
  196.     "Short KOI",                    128, FC_KOI7,    NULL, AL_CYRIL,
  197.     "Old KOI-8 Cyrillic",           256, FC_KOI8,    NULL, AL_CYRIL
  198. #endif /* CYRILLIC */
  199. #ifdef KANJI
  200. ,   "Japanese JIS7",            256, FC_JIS7,    NULL, AL_JAPAN,
  201.     "Japanese Shift JIS",      16384, FC_SHJIS,   NULL, AL_JAPAN,
  202.     "Japanese EUC",          16384, FC_JEUC,    NULL, AL_JAPAN,
  203.     "Japanese DEC Kanji",      16384, FC_JDEC,    NULL, AL_JAPAN
  204. #endif /* KANJI */
  205. };    
  206.  
  207. /* Local file character sets */
  208. /* Includes 7-bit National Replacement Character Sets of ISO 646 */
  209. /* Plus ISO Latin-1, DEC Multinational Character Set (MCS), NeXT char set */
  210.  
  211. struct keytab fcstab[] = { /* Keyword table for 'set file character-set' */
  212.  
  213. /*
  214.   IMPORTANT: This table is replicated below as ttcstab (terminal character 
  215.   set table).  The only differences are the addition of TRANSPARENT
  216.   and the removal of the Kanji sets, which are not supported yet.
  217.   If you make changes to this table, also change ttcstab.
  218. */
  219.  
  220. /* Keyword             Value       Flags */
  221.     "apple-quickdraw",    FC_APPQD,   CM_INV, /* Apple Quickdraw */
  222.     "ascii",              FC_USASCII, 0, /* ASCII */
  223.     "british",            FC_UKASCII, 0, /* British NRC */
  224.     "canadian-french",    FC_FCASCII, 0, /* French Canadian NRC */
  225.     "cp437",              FC_CP437,   0, /* IBM CP437 */
  226.     "cp850",              FC_CP850,   0, /* IBM CP850 */
  227. #ifdef LATIN2
  228.     "cp852",              FC_CP852,   0, /* IBM CP852 */
  229. #endif /* LATIN2 */
  230. #ifdef CYRILLIC
  231.     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
  232.     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
  233. #endif /* CYRILLIC */
  234.     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
  235. #ifdef KANJI
  236.     "dec-kanji",          FC_JDEC,    0, /* Japanese DEC Kanji */
  237. #endif /* KANJI */
  238.     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
  239.     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
  240.     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
  241.     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
  242.     "french",             FC_FRASCII, 0, /* French NRC */
  243.     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
  244.     "german",             FC_GEASCII, 0, /* German NRC */
  245.     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
  246.     "italian",            FC_ITASCII, 0, /* Italian NRC */
  247. #ifdef KANJI
  248.     "japanese-euc",       FC_JEUC,    0, /* Japanese EUC */
  249.     "jis7-kanji",         FC_JIS7,    0, /* Japanese JIS7 7bit code */
  250. #endif /* KANJI */
  251. #ifdef CYRILLIC
  252.     "koi8-cyrillic",      FC_KOI8,    0, /* Old KOI-8 Cyrillic */
  253. #endif /* CYRILLIC */
  254. #ifdef LATIN2
  255.     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
  256.     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
  257.     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
  258.     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
  259.     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
  260. #endif /* LATIN2 */
  261.     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
  262. #ifdef LATIN2
  263.     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
  264. #endif /* LATIN2 */
  265.     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin" */
  266.     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
  267.     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
  268.     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
  269. #ifdef KANJI
  270.     "shift-jis-kanji",    FC_SHJIS,   0, /* Japanese Kanji Shift-JIS */
  271. #endif /* KANJI */
  272. #ifdef CYRILLIC
  273.     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
  274. #endif /* CYRILLIC */
  275.     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
  276.     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
  277.     "swiss",              FC_CHASCII, 0     /* Swiss NRC */
  278. };
  279. int nfilc = (sizeof(fcstab) / sizeof(struct keytab)); /* size of this table */
  280.  
  281.  
  282. struct keytab ttcstab[] = { /* Keyword table for SET TERMINAL CHARACTER-SET */
  283. /*
  284.   IMPORTANT: This table is a replica of fcstab, immediately above, with the
  285.   addition of TRANSPARENT.  If you make changes to this table, make the
  286.   corresponding changes to fcstab.
  287. */
  288. /* Keyword               Value       Flags */
  289.     "apple-quickdraw",    FC_APPQD,   CM_INV, /* Apple Quickdraw */
  290.     "ascii",              FC_USASCII, 0, /* ASCII */
  291.     "british",            FC_UKASCII, 0, /* British NRC */
  292.     "canadian-french",    FC_FCASCII, 0, /* French Canadian NRC */
  293.     "cp437",              FC_CP437,   0, /* IBM CP437 */
  294.     "cp850",              FC_CP850,   0, /* IBM CP850 */
  295. #ifdef LATIN2
  296.     "cp852",              FC_CP852,   0, /* IBM CP852 */
  297. #endif /* LATIN2 */
  298. #ifdef CYRILLIC
  299.     "cp866-cyrillic",     FC_CP866,   0, /* CP866 Cyrillic */
  300.     "cyrillic-iso",       FC_CYRILL,  0, /* ISO Latin/Cyrillic Alphabet */
  301. #endif /* CYRILLIC */
  302.     "danish",             FC_NOASCII, 0, /* Norwegian and Danish NRC */
  303. #ifdef COMMENT
  304. #ifdef KANJI
  305.     "dec-kanji",          FC_JDEC,    0, /* Japanese DEC Kanji */
  306. #endif /* KANJI */
  307. #endif /* COMMENT */
  308.     "dec-multinational",  FC_DECMCS,  0, /* DEC multinational character set */
  309.     "dg-international",   FC_DGMCS,   0, /* Data General multinational */
  310.     "dutch",              FC_DUASCII, 0, /* Dutch NRC */
  311.     "finnish",            FC_FIASCII, 0, /* Finnish NRC */
  312.     "french",             FC_FRASCII, 0, /* French NRC */
  313.     "fr-canadian",        FC_FCASCII, CM_INV, /* French Canadian NRC */
  314.     "german",             FC_GEASCII, 0, /* German NRC */
  315.     "hungarian",          FC_HUASCII, 0, /* Hungarian NRC */
  316.     "italian",            FC_ITASCII, 0, /* Italian NRC */
  317. #ifdef COMMENT
  318. /* Kanji terminal character sets not implemented yet */
  319. #ifdef KANJI
  320.     "japanese-euc",       FC_JEUC,    0, /* Japanese EUC */
  321.     "jis7-kanji",         FC_JIS7,    0, /* Japanese JIS7 7bit code */
  322. #endif /* KANJI */
  323. #endif /* COMMENT */
  324. #ifdef CYRILLIC
  325.     "koi8-cyrillic",      FC_KOI8,    0, /* Old KOI-8 Cyrillic */
  326. #endif /* CYRILLIC */
  327. #ifdef LATIN2
  328.     "l",                  FC_1LATIN,  CM_ABR|CM_INV,
  329.     "la",                 FC_1LATIN,  CM_ABR|CM_INV,
  330.     "lat",                FC_1LATIN,  CM_ABR|CM_INV,
  331.     "lati",               FC_1LATIN,  CM_ABR|CM_INV,
  332.     "latin",              FC_1LATIN,  CM_ABR|CM_INV,
  333. #endif /* LATIN2 */
  334.     "latin1-iso",         FC_1LATIN,  0, /* ISO Latin Alphabet 1 */
  335. #ifdef LATIN2
  336.     "latin2-iso",         FC_2LATIN,  0, /* ISO Latin Alphabet 2 */
  337. #endif /* LATIN2 */
  338.     "macintosh-latin",    FC_APPQD,   0, /* "Extended Mac Latin */
  339.     "next-multinational", FC_NEXT,    0, /* NeXT workstation */
  340.     "norwegian",          FC_NOASCII, 0, /* Norwegian and Danish NRC */
  341.     "portuguese",         FC_POASCII, 0, /* Portuguese NRC */
  342. #ifdef COMMENT
  343. /* Kanji terminal character sets not implemented yet. */
  344. #ifdef KANJI
  345.     "shift-jis-kanji",    FC_SHJIS,   0, /* Japanese Kanji Shift-JIS */
  346. #endif /* KANJI */
  347. #endif /* COMMENT */
  348. #ifdef CYRILLIC
  349.     "short-koi",          FC_KOI7,    0, /* Short KOI Cyrillic */
  350. #endif /* CYRILLIC */
  351.     "spanish",            FC_SPASCII, 0, /* Spanish NRC */
  352.     "swedish",            FC_SWASCII, 0, /* Swedish NRC */
  353.     "swiss",              FC_CHASCII, 0, /* Swiss NRC */
  354.     "transparent",        FC_TRANSP,  0  /* Transparent */
  355. };
  356. int ntermc = (sizeof(ttcstab) / sizeof(struct keytab)); /* size of table */
  357.  
  358. /*
  359.  Languages:
  360.  
  361.  This table allows C-Kermit to have a SET LANGUAGE command to apply special
  362.  language-specific rules when translating from a character set that contains
  363.  national characters into plain ASCII, like German umlaut-a becomes ae.
  364.  
  365.  Originally, I thought it would be a good idea to let SET LANGUAGE also select
  366.  an appropriate FILE CHARACTER-SET and TRANSFER CHARACTER-SET automatically,
  367.  and these are included in the langinfo structure.  Later I realized that this
  368.  was a bad idea.  Users are confused by unexpected side effects.  If this
  369.  functionality is desired, it's better to define a macro to do it.
  370. */
  371.  
  372. struct langinfo langs[] = {
  373. /*  Language code   File Charset Xfer Charset Name */
  374.     L_USASCII,      FC_USASCII,  TC_USASCII,  "ASCII (American English)",
  375.     L_DANISH,       FC_NOASCII,  TC_1LATIN,   "Danish",
  376.     L_DUTCH,        FC_DUASCII,  TC_1LATIN,   "Dutch",
  377.     L_FINNISH,      FC_FIASCII,  TC_1LATIN,   "Finnish",
  378.     L_FRENCH,       FC_FRASCII,  TC_1LATIN,   "French",
  379.     L_GERMAN,       FC_GEASCII,  TC_1LATIN,   "German",
  380.     L_HUNGARIAN,    FC_HUASCII,  TC_2LATIN,   "Hungarian",
  381.     L_ICELANDIC,    FC_USASCII,  TC_1LATIN,   "Icelandic",
  382.     L_ITALIAN,      FC_ITASCII,  TC_1LATIN,   "Italian",
  383. #ifdef KANJI
  384.     L_JAPANESE,     FC_JEUC,     TC_JEUC,     "Japanese",
  385. #endif /* KANJI */
  386.     L_NORWEGIAN,    FC_NOASCII,  TC_1LATIN,   "Norwegian",
  387.     L_PORTUGUESE,   FC_POASCII,  TC_1LATIN,   "Portuguese",
  388. #ifdef CYRILLIC
  389.     L_RUSSIAN,      FC_CP866,    TC_CYRILL,   "Russian",
  390. #endif /* CYRILLIC */
  391.     L_SPANISH,      FC_SPASCII,  TC_1LATIN,   "Spanish",
  392.     L_SWEDISH,      FC_SWASCII,  TC_1LATIN,   "Swedish",
  393.     L_SWISS,        FC_CHASCII,  TC_1LATIN,   "Swiss"
  394. };
  395. int nlangs = (sizeof(langs) / sizeof(struct langinfo));
  396.  
  397. /*
  398.   Keyword table for the SET LANGUAGE command.
  399.   Only a few of these (German, Scandinavian, etc) actually do anything.
  400.   The language is used to invoke special translation rules when converting
  401.   from an 8-bit character set to ASCII; for example, German u-diaeresis
  402.   becomes "ue", Dutch y-diaeresis becomes "ij".  Languages without associated
  403.   rules are invisible (CM_INV).
  404. */
  405. struct keytab lngtab[] = {
  406.     "ascii",            L_USASCII,    CM_INV,
  407.     "danish",           L_DANISH,     0,
  408.     "dutch",            L_DUTCH,      0,
  409.     "english",          L_USASCII,    CM_INV,
  410.     "finnish",          L_FINNISH,    0,
  411.     "french",           L_FRENCH,     0,
  412.     "german",           L_GERMAN,     0,
  413.     "hungarian",        L_HUNGARIAN,  CM_INV,
  414.     "icelandic",        L_ICELANDIC,  0,
  415.     "italian",          L_ITALIAN,    CM_INV,
  416. #ifdef KANJI
  417.     "japanese",         L_JAPANESE,   CM_INV,
  418. #endif /* KANJI */
  419.     "norwegian",        L_NORWEGIAN,  0,
  420.     "none",             L_USASCII,    0,
  421.     "portuguese",       L_PORTUGUESE, CM_INV,
  422. #ifdef CYRILLIC
  423.     "russian",          L_RUSSIAN,    0,
  424. #endif /* CYRILLIC */
  425.     "spanish",          L_SPANISH,    CM_INV,
  426.     "swedish",          L_SWEDISH,    0,
  427. #ifdef CYRILLIC
  428.     "ukrainian",        L_RUSSIAN,    0
  429. #endif /* CYRILLIC */
  430. };
  431. int nlng = (sizeof(lngtab) / sizeof(struct keytab)); /* how many languages */
  432.  
  433.  
  434. /* Translation tables ... */
  435.  
  436. /*
  437.   For each pair of (transfer,file) character sets, we need two translation
  438.   functions, one for sending, one for receiving.
  439. */
  440.  
  441. /*
  442.   Here is the first table, Latin-1 to ASCII, fully annotated...
  443.   This one is absolutely NOT invertible, since we're going from an 8-bit
  444.   set to a 7-bit set.  Accented letters are mapped to unaccented
  445.   equivalents, C1 control characters are all translated to "?", etc.
  446. */
  447. CHAR
  448. yl1as[] = {  /* ISO 8859-1 Latin Alphabet 1 to US ASCII */
  449.       /*  Source character    Description               => Translation */
  450.       /*  Dec row/col Set                                           */
  451.   0,  /*  000  00/00  C0 NUL  Ctrl-@                    =>  (self)  */
  452.   1,  /*  001  00/01  C0 SOH  Ctrl-A                    =>  (self)  */
  453.   2,  /*  002  00/02  C0 STX  Ctrl-B                    =>  (self)  */
  454.   3,  /*  003  00/03  C0 ETX  Ctrl-C                    =>  (self)  */
  455.   4,  /*  004  00/04  C0 EOT  Ctrl-D                    =>  (self)  */
  456.   5,  /*  005  00/05  C0 ENQ  Ctrl-E                    =>  (self)  */
  457.   6,  /*  006  00/06  C0 ACK  Ctrl-F                    =>  (self)  */
  458.   7,  /*  007  00/07  C0 BEL  Ctrl-G                    =>  (self)  */
  459.   8,  /*  008  00/08  C0 BS   Ctrl-H                    =>  (self)  */
  460.   9,  /*  009  00/09  C0 HT   Ctrl-I                    =>  (self)  */
  461.  10,  /*  010  00/10  C0 LF   Ctrl-J                    =>  (self)  */
  462.  11,  /*  011  00/11  C0 VT   Ctrl-K                    =>  (self)  */
  463.  12,  /*  012  00/12  C0 FF   Ctrl-L                    =>  (self)  */
  464.  13,  /*  013  00/13  C0 CR   Ctrl-M                    =>  (self)  */
  465.  14,  /*  014  00/14  C0 SO   Ctrl-N                    =>  (self)  */
  466.  15,  /*  015  00/15  C0 SI   Ctrl-O                    =>  (self)  */
  467.  16,  /*  016  01/00  C0 DLE  Ctrl-P                    =>  (self)  */
  468.  17,  /*  017  01/01  C0 DC1  Ctrl-Q                    =>  (self)  */
  469.  18,  /*  018  01/02  C0 DC2  Ctrl-R                    =>  (self)  */
  470.  19,  /*  019  01/03  C0 DC3  Ctrl-S                    =>  (self)  */
  471.  20,  /*  020  01/04  C0 DC4  Ctrl-T                    =>  (self)  */
  472.  21,  /*  021  01/05  C0 NAK  Ctrl-U                    =>  (self)  */
  473.  22,  /*  022  01/06  C0 SYN  Ctrl-V                    =>  (self)  */
  474.  23,  /*  023  01/07  C0 ETB  Ctrl-W                    =>  (self)  */
  475.  24,  /*  024  01/08  C0 CAN  Ctrl-X                    =>  (self)  */
  476.  25,  /*  025  01/09  C0 EM   Ctrl-Y                    =>  (self)  */
  477.  26,  /*  026  01/10  C0 SUB  Ctrl-Z                    =>  (self)  */
  478.  27,  /*  027  01/11  C0 ESC  Ctrl-[                    =>  (self)  */
  479.  28,  /*  028  01/12  C0 FS   Ctrl-\                    =>  (self)  */
  480.  29,  /*  029  01/13  C0 GS   Ctrl-]                    =>  (self)  */
  481.  30,  /*  030  01/14  C0 RS   Ctrl-^                    =>  (self)  */
  482.  31,  /*  031  01/15  C0 US   Ctrl-_                    =>  (self)  */
  483.  32,  /*  032  02/00     SP   Space                     =>  (self)  */
  484.  33,  /*  033  02/01  G0 !    Exclamation mark          =>  (self)  */
  485.  34,  /*  034  02/02  G0 "    Doublequote               =>  (self)  */
  486.  35,  /*  035  02/03  G0 #    Number sign               =>  (self)  */
  487.  36,  /*  036  02/04  G0 $    Dollar sign               =>  (self)  */
  488.  37,  /*  037  02/05  G0 %    Percent sign              =>  (self)  */
  489.  38,  /*  038  02/06  G0 &    Ampersand                 =>  (self)  */
  490.  39,  /*  039  02/07  G0 '    Apostrophe                =>  (self)  */
  491.  40,  /*  040  02/08  G0 (    Left parenthesis          =>  (self)  */
  492.  41,  /*  041  02/09  G0 )    Right parenthesis         =>  (self)  */
  493.  42,  /*  042  02/10  G0 *    Asterisk                  =>  (self)  */
  494.  43,  /*  043  02/11  G0 +    Plus sign                 =>  (self)  */
  495.  44,  /*  044  02/12  G0 ,    Comma                     =>  (self)  */
  496.  45,  /*  045  02/13  G0 -    Hyphen, minus sign        =>  (self)  */
  497.  46,  /*  046  02/14  G0 .    Period, full stop         =>  (self)  */
  498.  47,  /*  047  02/15  G0 /    Slash, solidus            =>  (self)  */
  499.  48,  /*  048  03/00  G0 0    Digit 0                   =>  (self)  */
  500.  49,  /*  049  03/01  G0 1    Digit 1                   =>  (self)  */
  501.  50,  /*  050  03/02  G0 2    Digit 2                   =>  (self)  */
  502.  51,  /*  051  03/03  G0 3    Digit 3                   =>  (self)  */
  503.  52,  /*  052  03/04  G0 4    Digit 4                   =>  (self)  */
  504.  53,  /*  053  03/05  G0 5    Digit 5                   =>  (self)  */
  505.  54,  /*  054  03/06  G0 6    Digit 6                   =>  (self)  */
  506.  55,  /*  055  03/07  G0 7    Digit 7                   =>  (self)  */
  507.  56,  /*  056  03/08  G0 8    Digit 8                   =>  (self)  */
  508.  57,  /*  057  03/09  G0 9    Digit 9                   =>  (self)  */
  509.  58,  /*  058  03/10  G0 :    Colon                     =>  (self)  */
  510.  59,  /*  059  03/11  G0 ;    Semicolon                 =>  (self)  */
  511.  60,  /*  060  03/12  G0 <    Less-than sign            =>  (self)  */
  512.  61,  /*  061  03/13  G0 =    Equals sign               =>  (self)  */
  513.  62,  /*  062  03/14  G0 >    Greater-than sign         =>  (self)  */
  514.  63,  /*  063  03/15  G0 ?    Question mark             =>  (self)  */
  515.  64,  /*  064  04/00  G0 @    Commercial at sign        =>  (self)  */
  516.  65,  /*  065  04/01  G0 A    Letter A                  =>  (self)  */
  517.  66,  /*  066  04/02  G0 B    Letter B                  =>  (self)  */
  518.  67,  /*  067  04/03  G0 C    Letter C                  =>  (self)  */
  519.  68,  /*  068  04/04  G0 D    Letter D                  =>  (self)  */
  520.  69,  /*  069  04/05  G0 E    Letter E                  =>  (self)  */
  521.  70,  /*  070  04/06  G0 F    Letter F                  =>  (self)  */
  522.  71,  /*  071  04/07  G0 G    Letter G                  =>  (self)  */
  523.  72,  /*  072  04/08  G0 H    Letter H                  =>  (self)  */
  524.  73,  /*  073  04/09  G0 I    Letter I                  =>  (self)  */
  525.  74,  /*  074  04/10  G0 J    Letter J                  =>  (self)  */
  526.  75,  /*  075  04/11  G0 K    Letter K                  =>  (self)  */
  527.  76,  /*  076  04/12  G0 L    Letter L                  =>  (self)  */
  528.  77,  /*  077  04/13  G0 M    Letter M                  =>  (self)  */
  529.  78,  /*  078  04/14  G0 N    Letter N                  =>  (self)  */
  530.  79,  /*  079  04/15  G0 O    Letter O                  =>  (self)  */
  531.  80,  /*  080  05/00  G0 P    Letter P                  =>  (self)  */
  532.  81,  /*  081  05/01  G0 Q    Letter Q                  =>  (self)  */
  533.  82,  /*  082  05/02  G0 R    Letter R                  =>  (self)  */
  534.  83,  /*  083  05/03  G0 S    Letter S                  =>  (self)  */
  535.  84,  /*  084  05/04  G0 T    Letter T                  =>  (self)  */
  536.  85,  /*  085  05/05  G0 U    Letter U                  =>  (self)  */
  537.  86,  /*  086  05/06  G0 V    Letter V                  =>  (self)  */
  538.  87,  /*  087  05/07  G0 W    Letter W                  =>  (self)  */
  539.  88,  /*  088  05/08  G0 X    Letter X                  =>  (self)  */
  540.  89,  /*  089  05/09  G0 Y    Letter Y                  =>  (self)  */
  541.  90,  /*  090  05/10  G0 Z    Letter Z                  =>  (self)  */
  542.  91,  /*  091  05/11  G0 [    Left square bracket       =>  (self)  */
  543.  92,  /*  092  05/12  G0 \    Reverse slash             =>  (self)  */
  544.  93,  /*  093  05/13  G0 ]    Right square bracket      =>  (self)  */
  545.  94,  /*  094  05/14  G0 ^    Circumflex accent         =>  (self)  */
  546.  95,  /*  095  05/15  G0 _    Underline, low line       =>  (self)  */
  547.  96,  /*  096  06/00  G0 `    Grave accent              =>  (self)  */
  548.  97,  /*  097  06/01  G0 a    Letter a                  =>  (self)  */
  549.  98,  /*  098  06/02  G0 b    Letter b                  =>  (self)  */
  550.  99,  /*  099  06/03  G0 c    Letter c                  =>  (self)  */
  551. 100,  /*  100  06/04  G0 d    Letter d                  =>  (self)  */
  552. 101,  /*  101  06/05  G0 e    Letter e                  =>  (self)  */
  553. 102,  /*  102  06/06  G0 f    Letter f                  =>  (self)  */
  554. 103,  /*  103  06/07  G0 g    Letter g                  =>  (self)  */
  555. 104,  /*  104  06/08  G0 h    Letter h                  =>  (self)  */
  556. 105,  /*  105  06/09  G0 i    Letter i                  =>  (self)  */
  557. 106,  /*  106  06/10  G0 j    Letter j                  =>  (self)  */
  558. 107,  /*  107  06/11  G0 k    Letter k                  =>  (self)  */
  559. 108,  /*  108  06/12  G0 l    Letter l                  =>  (self)  */
  560. 109,  /*  109  06/13  G0 m    Letter m                  =>  (self)  */
  561. 110,  /*  110  06/14  G0 n    Letter n                  =>  (self)  */
  562. 111,  /*  111  06/15  G0 o    Letter o                  =>  (self)  */
  563. 112,  /*  112  07/00  G0 p    Letter p                  =>  (self)  */
  564. 113,  /*  113  07/01  G0 q    Letter q                  =>  (self)  */
  565. 114,  /*  114  07/02  G0 r    Letter r                  =>  (self)  */
  566. 115,  /*  115  07/03  G0 s    Letter s                  =>  (self)  */
  567. 116,  /*  116  07/04  G0 t    Letter t                  =>  (self)  */
  568. 117,  /*  117  07/05  G0 u    Letter u                  =>  (self)  */
  569. 118,  /*  118  07/06  G0 v    Letter v                  =>  (self)  */
  570. 119,  /*  119  07/07  G0 w    Letter w                  =>  (self)  */
  571. 120,  /*  120  07/08  G0 x    Letter x                  =>  (self)  */
  572. 121,  /*  121  07/09  G0 y    Letter y                  =>  (self)  */
  573. 122,  /*  122  07/10  G0 z    Letter z                  =>  (self)  */
  574. 123,  /*  123  07/11  G0 {    Left curly bracket        =>  (self)  */
  575. 124,  /*  124  07/12  G0 |    Vertical bar              =>  (self)  */
  576. 125,  /*  125  07/13  G0 }    Right curly bracket       =>  (self)  */
  577. 126,  /*  126  07/14  G0 ~    Tilde                     =>  (self)  */
  578. 127,  /*  127  07/15     DEL  Delete, Rubout            =>  (self)  */
  579. UNK,  /*  128  08/00  C1                                =>  UNK     */
  580. UNK,  /*  129  08/01  C1                                =>  UNK     */
  581. UNK,  /*  130  08/02  C1                                =>  UNK     */
  582. UNK,  /*  131  08/03  C1                                =>  UNK     */
  583. UNK,  /*  132  08/04  C1 IND                            =>  UNK     */
  584. UNK,  /*  133  08/05  C1 NEL                            =>  UNK     */
  585. UNK,  /*  134  08/06  C1 SSA                            =>  UNK     */
  586. UNK,  /*  135  08/07  C1 ESA                            =>  UNK     */
  587. UNK,  /*  136  08/08  C1 HTS                            =>  UNK     */
  588. UNK,  /*  137  08/09  C1                                =>  UNK     */
  589. UNK,  /*  138  08/10  C1                                =>  UNK     */
  590. UNK,  /*  139  08/11  C1                                =>  UNK     */
  591. UNK,  /*  140  08/12  C1                                =>  UNK     */
  592. UNK,  /*  141  08/13  C1 RI                             =>  UNK     */
  593. UNK,  /*  142  08/14  C1 SS2                            =>  UNK     */
  594. UNK,  /*  143  08/15  C1 SS3                            =>  UNK     */
  595. UNK,  /*  144  09/00  C1 DCS                            =>  UNK     */
  596. UNK,  /*  145  09/01  C1                                =>  UNK     */
  597. UNK,  /*  146  09/02  C1                                =>  UNK     */
  598. UNK,  /*  147  09/03  C1 STS                            =>  UNK     */
  599. UNK,  /*  148  09/04  C1                                =>  UNK     */
  600. UNK,  /*  149  09/05  C1                                =>  UNK     */
  601. UNK,  /*  150  09/06  C1 SPA                            =>  UNK     */
  602. UNK,  /*  151  09/07  C1 EPA                            =>  UNK     */
  603. UNK,  /*  152  09/08  C1                                =>  UNK     */
  604. UNK,  /*  153  09/09  C1                                =>  UNK     */
  605. UNK,  /*  154  09/10  C1                                =>  UNK     */
  606. UNK,  /*  155  09/11  C1 CSI                            =>  UNK     */
  607. UNK,  /*  156  09/12  C1 ST                             =>  UNK     */
  608. UNK,  /*  157  09/13  C1 OSC                            =>  UNK     */
  609. UNK,  /*  158  09/14  C1 PM                             =>  UNK     */
  610. UNK,  /*  159  09/15  C1 APC                            =>  UNK     */
  611.  32,  /*  160  10/00  G1      No-break space            =>  SP      */
  612.  33,  /*  161  10/01  G1      Inverted exclamation      =>  !       */
  613.  99,  /*  162  10/02  G1      Cent sign                 =>  c       */
  614.  35,  /*  163  10/03  G1      Pound sign                =>  #       */
  615.  36,  /*  164  10/04  G1      Currency sign             =>  $       */
  616.  89,  /*  165  10/05  G1      Yen sign                  =>  Y       */
  617. 124,  /*  166  10/06  G1      Broken bar                =>  |       */
  618.  80,  /*  167  10/07  G1      Paragraph sign            =>  P       */
  619.  34,  /*  168  10/08  G1      Diaeresis                 =>  "       */
  620.  67,  /*  169  10/09  G1      Copyright sign            =>  C       */
  621.  97,  /*  170  10/10  G1      Feminine ordinal          =>  a       */
  622.  34,  /*  171  10/11  G1      Left angle quotation      =>  "       */
  623. 126,  /*  172  10/12  G1      Not sign                  =>  ~       */
  624.  45,  /*  173  10/13  G1      Soft hyphen               =>  -       */
  625.  82,  /*  174  10/14  G1      Registered trade mark     =>  R       */
  626.  95,  /*  175  10/15  G1      Macron                    =>  _       */
  627. 111,  /*  176  11/00  G1      Degree sign, ring above   =>  o       */
  628. UNK,  /*  177  11/01  G1      Plus-minus sign           =>  UNK     */
  629.  50,  /*  178  11/02  G1      Superscript two           =>  2       */
  630.  51,  /*  179  11/03  G1      Superscript three         =>  3       */
  631.  39,  /*  180  11/04  G1      Acute accent              =>  '       */
  632. 117,  /*  181  11/05  G1      Micro sign                =>  u       */
  633.  45,  /*  182  11/06  G1      Pilcrow sign              =>  -       */
  634.  45,  /*  183  11/07  G1      Middle dot                =>  -       */
  635.  44,  /*  184  11/08  G1      Cedilla                   =>  ,       */
  636.  49,  /*  185  11/09  G1      Superscript one           =>  1       */
  637. 111,  /*  186  11/10  G1      Masculine ordinal         =>  o       */
  638.  34,  /*  187  11/11  G1      Right angle quotation     =>  "       */
  639. UNK,  /*  188  11/12  G1      One quarter               =>  UNK     */
  640. UNK,  /*  189  11/13  G1      One half                  =>  UNK     */
  641. UNK,  /*  190  11/14  G1      Three quarters            =>  UNK     */
  642.  63,  /*  191  11/15  G1      Inverted question mark    =>  ?       */
  643.  65,  /*  192  12/00  G1      A grave                   =>  A       */
  644.  65,  /*  193  12/01  G1      A acute                   =>  A       */
  645.  65,  /*  194  12/02  G1      A circumflex              =>  A       */
  646.  65,  /*  195  12/03  G1      A tilde                   =>  A       */
  647.  65,  /*  196  12/04  G1      A diaeresis               =>  A       */
  648.  65,  /*  197  12/05  G1      A ring above              =>  A       */
  649.  65,  /*  198  12/06  G1      A with E                  =>  A       */
  650.  67,  /*  199  12/07  G1      C Cedilla                 =>  C       */
  651.  69,  /*  200  12/08  G1      E grave                   =>  E       */
  652.  69,  /*  201  12/09  G1      E acute                   =>  E       */
  653.  69,  /*  202  12/10  G1      E circumflex              =>  E       */
  654.  69,  /*  203  12/11  G1      E diaeresis               =>  E       */
  655.  73,  /*  204  12/12  G1      I grave                   =>  I       */
  656.  73,  /*  205  12/13  G1      I acute                   =>  I       */
  657.  73,  /*  206  12/14  G1      I circumflex              =>  I       */
  658.  73,  /*  207  12/15  G1      I diaeresis               =>  I       */
  659.  68,  /*  208  13/00  G1      Icelandic Eth             =>  D       */
  660.  78,  /*  209  13/01  G1      N tilde                   =>  N       */
  661.  79,  /*  210  13/02  G1      O grave                   =>  O       */
  662.  79,  /*  211  13/03  G1      O acute                   =>  O       */
  663.  79,  /*  212  13/04  G1      O circumflex              =>  O       */
  664.  79,  /*  213  13/05  G1      O tilde                   =>  O       */
  665.  79,  /*  214  13/06  G1      O diaeresis               =>  O       */
  666. 120,  /*  215  13/07  G1      Multiplication sign       =>  x       */
  667.  79,  /*  216  13/08  G1      O oblique stroke          =>  O       */
  668.  85,  /*  217  13/09  G1      U grave                   =>  U       */
  669.  85,  /*  218  13/10  G1      U acute                   =>  U       */
  670.  85,  /*  219  13/11  G1      U circumflex              =>  U       */
  671.  85,  /*  220  13/12  G1      U diaeresis               =>  U       */
  672.  89,  /*  221  13/13  G1      Y acute                   =>  Y       */
  673.  84,  /*  222  13/14  G1      Icelandic Thorn           =>  T       */
  674. 115,  /*  223  13/15  G1      German sharp s            =>  s       */
  675.  97,  /*  224  14/00  G1      a grave                   =>  a       */
  676.  97,  /*  225  14/01  G1      a acute                   =>  a       */
  677.  97,  /*  226  14/02  G1      a circumflex              =>  a       */
  678.  97,  /*  227  14/03  G1      a tilde                   =>  a       */
  679.  97,  /*  228  14/04  G1      a diaeresis               =>  a       */
  680.  97,  /*  229  14/05  G1      a ring above              =>  a       */
  681.  97,  /*  230  14/06  G1      a with e                  =>  a       */
  682.  99,  /*  231  14/07  G1      c cedilla                 =>  c       */
  683. 101,  /*  232  14/08  G1      e grave                   =>  e       */
  684. 101,  /*  233  14/09  G1      e acute                   =>  e       */
  685. 101,  /*  234  14/10  G1      e circumflex              =>  e       */
  686. 101,  /*  235  14/11  G1      e diaeresis               =>  e       */
  687. 105,  /*  236  14/12  G1      i grave                   =>  i       */
  688. 105,  /*  237  14/13  G1      i acute                   =>  i       */
  689. 105,  /*  238  14/14  G1      i circumflex              =>  i       */
  690. 105,  /*  239  14/15  G1      i diaeresis               =>  i       */
  691. 100,  /*  240  15/00  G1      Icelandic eth             =>  d       */
  692. 110,  /*  241  15/01  G1      n tilde                   =>  n       */
  693. 111,  /*  242  15/02  G1      o grave                   =>  o       */
  694. 111,  /*  243  15/03  G1      o acute                   =>  o       */
  695. 111,  /*  244  15/04  G1      o circumflex              =>  o       */
  696. 111,  /*  245  15/05  G1      o tilde                   =>  o       */
  697. 111,  /*  246  15/06  G1      o diaeresis               =>  o       */
  698.  47,  /*  247  15/07  G1      Division sign             =>  /       */
  699. 111,  /*  248  15/08  G1      o oblique stroke          =>  o       */
  700. 117,  /*  249  15/09  G1      u grave                   =>  u       */
  701. 117,  /*  250  15/10  G1      u acute                   =>  u       */
  702. 117,  /*  251  15/11  G1      u circumflex              =>  u       */
  703. 117,  /*  252  15/12  G1      u diaeresis               =>  u       */
  704. 121,  /*  253  15/13  G1      y acute                   =>  y       */
  705. 116,  /*  254  15/14  G1      Icelandic thorn           =>  t       */
  706. 121   /*  255  15/15  G1      y diaeresis               =>  y       */
  707. };
  708.  
  709.  
  710. /* Translation tables for ISO Latin Alphabet 1 to local file character sets */
  711.  
  712. /*
  713.   Most of the remaining tables are not annotated like the one above, because
  714.   the size of the resulting source file would be ridiculous.  Each row in the
  715.   following tables corresponds to a column of ISO 8859-1.
  716. */
  717.  
  718. CHAR
  719. yl185[] = {  /* ISO 8859-1 Latin Alphabet 1 (Latin-1) to IBM Code Page 850 */
  720. /*
  721.   This is IBM's official invertible translation.  Reference: IBM Character
  722.   Data Representation Architecture (CDRA), Level 1, Registry, SC09-1291-00
  723.   (1990), p.152.  (Note: Latin-1 is IBM Code Page 00819.)  Note the bizarre
  724.   rearrangement of C0 controls and DEL.
  725. */
  726.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  727.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  728.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  729.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  730.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  731.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  732.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  733. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  734. 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
  735. 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
  736. 255, 173, 189, 156, 207, 190, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
  737. 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
  738. 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
  739. 209, 165, 227, 224, 226, 229, 153, 158, 157, 235, 233, 234, 154, 237, 232, 225,
  740. 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
  741. 208, 164, 149, 162, 147, 228, 148, 246, 155, 151, 163, 150, 129, 236, 231, 152
  742. };
  743.  
  744. CHAR
  745. y85l1[] = {  /* IBM Code Page 850 to Latin-1 */
  746. /*
  747.   This is from IBM CDRA page 153.  It is the inverse of yl185[].
  748.   As of edit 183, this table is no longer pure CDRA.  The translations 
  749.   involving C0 controls have been removed.
  750. */
  751.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  752.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  753.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  754.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  755.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  756.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  757.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  758. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  759. 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
  760. 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 248, 163, 216, 215, 159,
  761. 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
  762. 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 162, 165, 147,
  763. 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
  764. 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
  765. 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
  766. 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
  767. };
  768.  
  769. CHAR
  770. yl143[] = {  /* Latin-1 to IBM Code Page 437 */
  771. /*
  772.   Although the IBM CDRA does not include an official translation between CP437
  773.   and ISO Latin Alphabet 1, it does include an official, invertible
  774.   translation between CP437 and CP850 (page 196), and another from CP850 to
  775.   Latin-1 (CP819) (page 153).  This translation was obtained with a two-step
  776.   process based on those tables.
  777.   As of edit 183, the translation is modified to leave C0 controls alone.
  778. */
  779.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  780.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  781.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  782.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  783.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  784.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  785.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  786. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  787. 186, 205, 201, 187, 200, 188, 204, 185, 203, 202, 206, 223, 220, 219, 254, 242,
  788. 179, 196, 218, 191, 192, 217, 195, 180, 194, 193, 197, 176, 177, 178, 213, 159,
  789. 255, 173, 155, 156, 207, 157, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
  790. 248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
  791. 183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
  792. 209, 165, 227, 224, 226, 229, 153, 158, 190, 235, 233, 234, 154, 237, 232, 225,
  793. 133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
  794. 208, 164, 149, 162, 147, 228, 148, 246, 189, 151, 163, 150, 129, 236, 231, 152
  795. };
  796.  
  797. CHAR
  798. y43l1[] = {  /* IBM Code Page 437 to Latin-1 */
  799. /*
  800.   This table is the inverse of yl143[].
  801. */
  802.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  803.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  804.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  805.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  806.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  807.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  808.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  809. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  810. 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197,
  811. 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 215, 159,
  812. 225, 237, 243, 250, 241, 209, 170, 186, 191, 174, 172, 189, 188, 161, 171, 187,
  813. 155, 156, 157, 144, 151, 193, 194, 192, 169, 135, 128, 131, 133, 248, 216, 147,
  814. 148, 153, 152, 150, 145, 154, 227, 195, 132, 130, 137, 136, 134, 129, 138, 164,
  815. 240, 208, 202, 203, 200, 158, 205, 206, 207, 149, 146, 141, 140, 166, 204, 139,
  816. 211, 223, 212, 210, 245, 213, 181, 254, 222, 218, 219, 217, 253, 221, 175, 180,
  817. 173, 177, 143, 190, 182, 167, 247, 184, 176, 168, 183, 185, 179, 178, 142, 160
  818. };
  819.  
  820. CHAR
  821. yl1aq[] = {  /* Latin-1 to Extended Mac Latin (based on Apple QuickDraw) */
  822.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  823.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  824.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  825.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  826.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  827.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  828.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  829. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  830. 182, 183, 184, 185, 189, 196, 197, 198, 206, 207, 210, 211, 217, 218, 195, 212,
  831. 209, 215, 213, 226, 227, 228, 240, 245, 246, 247, 249, 250, 251, 253, 254, 255,
  832. 202, 193, 162, 163, 219, 180, 201, 164, 172, 169, 187, 199, 194, 208, 168, 248,
  833. 161, 177, 170, 173, 171, 181, 166, 225, 252, 176, 188, 200, 178, 179, 186, 192,
  834. 203, 231, 229, 204, 128, 129, 174, 130, 233, 131, 230, 232, 237, 234, 235, 236,
  835. 220, 132, 241, 238, 239, 205, 133, 165, 175, 244, 242, 243, 134, 160, 222, 167,
  836. 136, 135, 137, 139, 138, 140, 190, 141, 143, 142, 144, 145, 147, 146, 148, 149,
  837. 221, 150, 152, 151, 153, 155, 154, 214, 191, 157, 156, 158, 159, 224, 223, 216
  838. };
  839.  
  840. CHAR
  841. yl1du[] = {  /* Latin-1 to Dutch ISO 646 */
  842.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  843.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  844.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  845.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  846. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  847.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  848.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  849. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK,  39, 127,
  850. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  851. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  852.  32,  33, UNK,  35, 124, UNK, UNK,  93, 123,  67, UNK,  34, UNK,  45,  82, UNK,
  853.  91, UNK, UNK, UNK, 126, 117, UNK, UNK,  44, UNK, UNK,  34, 125,  92,  64,  63,
  854.  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  855. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  856.  97,  97,  97,  97,  97,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  857. UNK, 110, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK,  91
  858. };
  859.  
  860. CHAR
  861. yl1fi[] = {  /* Latin-1 to Finnish ISO 646 */
  862.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  863.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  864.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  865.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  866.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  867.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  868. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  869. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, UNK,
  870. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  871. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  872.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  873. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  874.  65,  65,  65,  65,  91,  93,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  875. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
  876.  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
  877. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
  878. };
  879.  
  880. CHAR
  881. yl1fr[] = {  /* Latin-1 to French ISO 646 */
  882.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  883.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  884.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  885.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  886. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  887.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  888.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  889. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  890. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  891. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  892.  32,  33, UNK,  35, UNK, UNK, UNK,  93,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  893.  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  894.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  895. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  896.  64,  97,  97,  97,  97,  97,  97,  92, 125, 123, 101, 101, 105, 105, 105, 105,
  897. UNK, 110, 111, 111, 111, 111, 111,  47, 111, 124, 117, 117, 117, 121, UNK, 121
  898. };
  899.  
  900. CHAR
  901. yl1fc[] = {  /* Latin-1 to French-Canadian ISO 646 */
  902.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  903.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  904.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  905.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  906. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  907.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  908. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  909. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  910. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  911. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  912.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  913. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  914.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  915. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  916.  64,  97,  91,  97,  97,  97,  97,  92, 125, 123,  93, 101, 105, 105,  94, 105,
  917. UNK, 110, 111, 111,  96, 111, 111,  47, 111, 124, 117, 126, 117, 121, UNK, 121
  918. };
  919.  
  920. CHAR
  921. yl1ge[] = {  /* Latin-1 to German ISO 646 */
  922.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  923.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  924.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  925.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  926. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  927.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  928.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  929. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  930. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  931. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  932.  32,  33, UNK, UNK, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  933. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  934.  65,  65,  65,  65,  91,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  935. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 126,
  936.  97,  97,  97,  97, 123,  97,  97,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  937. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
  938. };
  939.  
  940. CHAR
  941. yl1hu[] = {  /* Latin-1 to Hungarian ISO-646 */
  942.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  943.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  944.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  945.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  946.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  947.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  948.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  949. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  950. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  951. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  952.  32,  33, UNK, UNK,  36, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  953. UNK,  64, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  954.  65,  65,  65,  65,  65,  65,  65,  67,  69,  91,  69,  69,  73,  73,  73,  73,
  955. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  93,  89, UNK, 115,
  956.  97,  96,  97,  97,  97,  97,  97,  99, 101, 123, 101, 101, 105, 105, 105, 105,
  957. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 125, 121, UNK, 121
  958. };
  959.  
  960. CHAR
  961. yl1it[] = {  /* Latin-1 to Italian ISO 646 */
  962.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  963.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  964.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  965.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  966. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  967.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  968. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  969. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  970. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  971. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  972.  32,  33, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  973.  91, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  974.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  975. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  976. 123,  97,  97,  97,  97,  97,  97,  92, 125,  93, 101, 101, 126, 105, 105, 105,
  977. UNK, 110, 124, 111, 111, 111, 111,  47, 111,  96, 117, 117, 117, 121, UNK, 121
  978. };
  979.  
  980. CHAR
  981. yl1ne[] = {  /* Latin-1 to NeXT */
  982. /* NEED TO MAKE THIS ONE INVERTIBLE, LIKE CP850 */
  983. /*
  984.   Which means finding all the graphic characters in the NeXT set that have
  985.   no equivalent in Latin-1 and assigning them to the UNK positions (mostly
  986.   Latin-1 C1 controls).  Then make the ynel1[] table be the inverse of this
  987.   one.  But first we should try to get an official Latin-1/NeXT translation
  988.   table from NeXT, Inc.
  989. */
  990.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  991.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  992.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  993.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  994.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  995.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  996.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  997. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  998. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  999. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1000.  32, 161, 162, 163, 168, 165, 181, 167, 200, 160, 227, 171, 190, UNK, 176, 197,
  1001. 202, 209, 201, 204, 194, 157, 182, 183, 203, 192, 235, 187, 210, 211, 212, 191,
  1002. 129, 130, 131, 132, 133, 134, 225, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1003. 144, 145, 146, 147, 148, 149, 150, 158, 233, 151, 152, 153, 154, 155, 156, 251,
  1004. 213, 214, 215, 216, 217, 218, 241, 219, 220, 221, 222, 223, 224, 226, 228, 229,
  1005. 230, 231, 236, 237, 238, 239, 240, 159, 249, 242, 243, 244, 246, 247, 252, 253
  1006. };
  1007.  
  1008. CHAR
  1009. yl1no[] = {  /* Latin-1 to Norwegian/Danish ISO 646 */
  1010.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1011.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1012.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1013.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1014.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1015.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1016.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1017. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, 126, 127,
  1018. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1019. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1020.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1021. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1022.  65,  65,  65,  65,  65,  93,  91,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1023. UNK,  78,  79,  79,  79,  79,  79, 120,  92,  85,  85,  85,  85,  89, UNK, 115,
  1024.  97,  97,  97,  97,  97, 125, 123,  99, 101, 101, 101, 101, 105, 105, 105, 105,
  1025. UNK, 110, 111, 111, 111, 111, 111,  47, 124, 117, 117, 117, 117, 121, UNK, 121
  1026. };
  1027.  
  1028. CHAR
  1029. yl1po[] = {  /* Latin-1 to Portuguese ISO 646 */
  1030.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1031.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1032.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1033.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1034.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1035.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1036.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1037. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, 126, 127,
  1038. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1039. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1040.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1041. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1042.  65,  65,  65,  91,  65,  65,  65,  92,  69,  69,  69,  69,  73,  73,  73,  73,
  1043. UNK,  78,  79,  79,  79,  93,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1044.  97,  97,  97, 123,  97,  97,  97, 124, 101, 101, 101, 101, 105, 105, 105, 105,
  1045. UNK, 110, 111, 111, 111, 125, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
  1046. };
  1047.  
  1048. CHAR
  1049. yl1sp[] = {  /* Latin-1 to Spanish ISO 646 */
  1050.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1051.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1052.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1053.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1054. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1055.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK,  94,  95,
  1056.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1057. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,  96, UNK, UNK, 126, 127,
  1058. 126, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1059. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1060.  32,  91, UNK,  35, UNK, UNK, UNK,  64,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1061. 123, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  93,
  1062.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1063. UNK,  92,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1064. 124,  97,  97,  97,  97,  97,  97, 125, 101, 101, 101, 101, 105, 105, 105, 105,
  1065. UNK, 124, 111, 111, 111, 111, 111,  47, 111, 117, 117, 117, 117, 121, UNK, 121
  1066. };
  1067.  
  1068. CHAR
  1069. yl1sw[] = {  /* Latin-1 to Swedish ISO 646 */
  1070.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1071.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1072.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1073.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1074. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1075.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK,  95,
  1076. UNK,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1077. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1078. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1079. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1080.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1081. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1082.  65,  65,  65,  65,  91,  93,  65,  67,  69,  64,  69,  69,  73,  73,  73,  73,
  1083. UNK,  78,  79,  79,  79,  79,  92, 120,  79,  85,  85,  85,  94,  89, UNK, 115,
  1084.  97,  97,  97,  97, 123, 125,  97,  99, 101,  96, 101, 101, 105, 105, 105, 105,
  1085. UNK, 110, 111, 111, 111, 111, 124,  47, 111, 117, 117, 117, 126, 121, UNK, 121
  1086. };
  1087.  
  1088. CHAR
  1089. yl1ch[] = {  /* Latin-1 to Swiss ISO 646 */
  1090.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1091.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1092.  32,  33,  34, UNK,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1093.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1094. UNK,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1095.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, UNK, UNK, UNK, UNK, UNK,
  1096.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1097. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, UNK, UNK, UNK, UNK, 127,
  1098. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1099. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1100.  32,  33, UNK, UNK, UNK, UNK, UNK, UNK,  34,  67, UNK,  34, UNK,  45,  82, UNK,
  1101. UNK, UNK, UNK, UNK,  39, 117, UNK, UNK,  44, UNK, UNK,  34, UNK, UNK, UNK,  63,
  1102.  65,  65,  65,  65,  65,  65,  65,  67,  69,  69,  69,  69,  73,  73,  73,  73,
  1103. UNK,  78,  79,  79,  79,  79,  79, 120,  79,  85,  85,  85,  85,  89, UNK, 115,
  1104.  64,  97,  97,  97, 123,  97,  97,  92,  95,  91,  93, 101, 105, 105,  94, 105,
  1105. UNK, 110, 111, 111,  96, 111, 124,  47, 111,  35, 117, 126, 125, 121, UNK, 121
  1106. };
  1107.  
  1108. CHAR
  1109. yl1dm[] = {  /* Latin-1 to DEC Multinational Character Set */
  1110.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1111.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1112.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1113.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1114.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1115.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1116.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1117. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1118. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1119. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1120.  32, 161, 162, 163, 168, 165, 124, 167,  34, 169, 170, 171, 126, UNK,  82, UNK,
  1121. 176, 177, 178, 179,  39, 181, 182, 183,  44, 185, 186, 187, 188, 189, UNK, 191,
  1122. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1123. UNK, 209, 210, 211, 212, 213, 214, 120, 216, 217, 218, 219, 220, 221, UNK, 223,
  1124. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1125. UNK, 241, 242, 243, 244, 245, 246,  47, 248, 249, 250, 251, 252, UNK, UNK, 253
  1126. };
  1127.  
  1128. CHAR
  1129. yl1dg[] = {  /* Latin-1 to Data General International Character Set */
  1130.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1131.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1132.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1133.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1134.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1135.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1136.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1137. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1138. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1139. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1140. 160, 171, 167, 168, 166, 181, 191, 187, 189, 173, 169, 177, 161, 255, 174, 175,
  1141. 188, 182, 164, 165, 190, 163, 178, 185, 186, 179, 170, 176, 223, 162, 220, 172,
  1142. 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
  1143. 184, 208, 210, 209, 211, 213, 212, 215, 214, 217, 216, 218, 219, 221, 222, 252,
  1144. 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
  1145. 183, 240, 242, 241, 243, 245, 244, 247, 246, 249, 248, 250, 251, 180, 254, 253
  1146. };
  1147.  
  1148.  
  1149. /* Local file character sets to ISO Latin Alphabet 1 */
  1150.  
  1151. #ifdef NOTUSED
  1152. CHAR
  1153. yasl1[] = {  /* ASCII to Latin-1 */
  1154.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1155.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1156.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1157.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1158.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1159.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1160.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1161. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127
  1162. };
  1163. #endif /* NOTUSED */
  1164.  
  1165. CHAR
  1166. yaql1[] = {  /* Extended Mac Latin (based on Apple Quickdraw) to Latin-1 */
  1167.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1168.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1169.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1170.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1171.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1172.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1173.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1174. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1175. 196, 197, 199, 201, 209, 214, 220, 225, 224, 226, 228, 227, 229, 231, 233, 232,
  1176. 234, 235, 237, 236, 238, 239, 241, 243, 242, 244, 246, 245, 250, 249, 251, 252,
  1177. 221, 176, 162, 163, 167, 215, 182, 223, 174, 169, 178, 180, 168, 179, 198, 216,
  1178. 185, 177, 188, 189, 165, 181, 128, 129, 130, 131, 190, 170, 186, 132, 230, 248,
  1179. 191, 161, 172, 142, 133, 134, 135, 171, 187, 166, 160, 192, 195, 213, 136, 137,
  1180. 173, 144, 138, 139, 143, 146, 247, 145, 255, 140, 141, 164, 208, 240, 222, 254,
  1181. 253, 183, 147, 148, 149, 194, 202, 193, 203, 200, 205, 206, 207, 204, 211, 212,
  1182. 150, 210, 218, 219, 217, 151, 152, 153, 175, 154, 155, 156, 184, 157, 158, 159
  1183. };
  1184.  
  1185. CHAR
  1186. ydul1[] = {  /* Dutch ISO 646 to Latin-1 */
  1187.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1188.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1189.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1190.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1191. 190,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1192.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 255, 189, 124,  94,  95,
  1193.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1194. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 168, 164, 188,  39, 127
  1195. };
  1196.  
  1197. CHAR
  1198. yfil1[] = {  /* Finnish ISO 646 to Latin-1 */
  1199.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1200.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1201.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1202.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1203.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1204.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
  1205. 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1206. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
  1207. };
  1208.  
  1209. CHAR
  1210. yfrl1[] = {  /* French ISO 646 to Latin-1 */
  1211.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1212.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1213.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1214.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1215. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1216.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 167,  94,  95,
  1217.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1218. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 168, 127
  1219. };
  1220.  
  1221. CHAR
  1222. yfcl1[] = {  /* French-Canadian ISO 646 to Latin-1 */
  1223.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1224.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1225.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1226.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1227. 224,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1228.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 226, 231, 234, 238,  95,
  1229. 244,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1230. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 249, 232, 251, 127
  1231. };
  1232.  
  1233. CHAR
  1234. ygel1[] = {  /* German ISO 646 to Latin-1 */
  1235.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1236.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1237.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1238.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1239. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1240.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 220,  94,  95,
  1241.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1242. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 252, 223, 127
  1243. };
  1244.  
  1245. CHAR
  1246. yitl1[] = {  /* Italian ISO 646 to Latin-1 */
  1247.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1248.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1249.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1250.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1251. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1252.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 176, 231, 233,  94,  95,
  1253. 249,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1254. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 224, 242, 232, 236, 127
  1255. };
  1256.  
  1257. CHAR
  1258. ynel1[] = {  /* NeXT to Latin-1 */
  1259. /* NEED TO MAKE THIS ONE INVERTIBLE */
  1260.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1261.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1262.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1263.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1264.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1265.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1266.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1267. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1268. 160, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1269. 208, 209, 210, 211, 212, 213, 214, 217, 218, 219, 220, 221, 222, 181, 215, 247,
  1270. 169, 161, 162, 163, UNK, 165, UNK, 167, 164, UNK, UNK, 171, UNK, UNK, UNK, UNK,
  1271. 174, UNK, UNK, UNK, 183, 166, 182, UNK, UNK, UNK, UNK, 187, UNK, UNK, 172, 191,
  1272. 185,  96, 180,  94, 126, 175, UNK, UNK, 168, 178, 176, 184, 179, UNK, UNK, UNK,
  1273. UNK, 177, 188, 189, 190, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235,
  1274. 236, 198, 237, 170, 238, 239, 240, 241, UNK, 216, UNK, 186, 242, 243, 244, 245,
  1275. 246, 230, 249, 250, 251, UNK, 252, 253, UNK, 248, UNK, 223, 254, 255, UNK, UNK
  1276. };
  1277.  
  1278. CHAR
  1279. ynol1[] = {  /* Norwegian/Danish ISO 646 to Latin-1 */
  1280.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1281.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1282.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1283.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1284.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1285.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 198, 216, 197,  94,  95,
  1286.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1287. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 230, 248, 229, 126, 127
  1288. };
  1289.  
  1290. CHAR
  1291. ypol1[] = {  /* Portuguese ISO 646 to Latin-1 */
  1292.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1293.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1294.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1295.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1296.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1297.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 195, 199, 213,  94,  95,
  1298.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1299. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 227, 231, 245, 126, 127
  1300. };
  1301.  
  1302. CHAR
  1303. yspl1[] = {  /* Spanish ISO 646 to Latin-1 */
  1304.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1305.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1306.  32,  33,  34, 163,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1307.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1308. 167,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1309.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 161, 209, 191,  94,  95,
  1310.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1311. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 176, 241, 231, 126, 127
  1312. };
  1313.  
  1314. CHAR
  1315. yswl1[] = {  /* Swedish ISO 646 to Latin-1 */
  1316.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1317.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1318.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1319.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1320. 201,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1321.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 196, 214, 197, 220,  95,
  1322. 233,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1323. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 228, 246, 229, 252, 127
  1324. };
  1325.  
  1326. CHAR
  1327. ychl1[] = {  /* Swiss ISO 646 to Latin-1 */
  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, 249,  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. 224,  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, 233, 231, 234, 238, 232,
  1334. 244,  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, 228, 246, 252, 251, 127
  1336. };
  1337.  
  1338. CHAR
  1339. yhul1[] = {  /* Hungarian ISO 646 to Latin-1 */
  1340.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1341.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1342.  32,  33,  34,  35, 164,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1343.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1344. 193,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1345.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 201, 214, 220,  94,  95,
  1346. 225,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1347. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 233, 246, 252,  34, 127
  1348. };
  1349.  
  1350. CHAR
  1351. ydml1[] = {  /* DEC Multinational Character Set to Latin-1 */
  1352.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1353.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1354.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1355.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1356.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1357.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1358.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1359. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1360. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1361. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1362. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1363. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1364. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1365. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1366. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1367. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
  1368. };
  1369.  
  1370. CHAR
  1371. ydgl1[] = {  /* Data General International to Latin-1 */
  1372.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1373.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1374.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1375.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1376.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1377.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1378.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1379. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1380. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1381. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1382. 160, 172, 189, 181, 178, 179, 164, 162, 163, 170, 186, 161, 191, 169, 174, 175,
  1383. 187, 171, 182, 185, 253, 165, 177, 240, 208, 183, 184, 167, 176, 168, 180, 166,
  1384. 193, 192, 194, 196, 195, 197, 198, 199, 201, 200, 202, 203, 205, 204, 206, 207,
  1385. 209, 211, 210, 212, 214, 213, 216, 215, 218, 217, 219, 220, 190, 221, 222, 188,
  1386. 225, 224, 226, 228, 227, 229, 230, 231, 233, 232, 234, 235, 237, 236, 238, 239,
  1387. 241, 243, 242, 244, 246, 245, 248, 247, 250, 249, 251, 252, 223, 255, 254, 173
  1388. };
  1389.  
  1390.  
  1391. /* Translation tables for Cyrillic character sets */
  1392.  
  1393. #ifdef CYRILLIC
  1394. CHAR
  1395. ylcac[] = {  /* Latin/Cyrillic to CP866 */
  1396.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1397.  16,  17,  18,  19, 208, 209,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1398.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1399.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1400.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1401.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1402.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1403. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1404. 196, 179, 192, 217, 191, 218, 195, 193, 180, 194, 197, 176, 177, 178, 211, 216,
  1405. 205, 186, 200, 188, 187, 201, 204, 202, 185, 203, 206, 223, 220, 219, 254, UNK,
  1406. 255, 240, 132, 131, 242,  83,  73, 244,  74, 139, 141, 151, 138,  45, 246, 135,
  1407. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1408. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1409. 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  1410. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1411. 252, 241, 164, 163, 243, 115, 105, 245, 106, 171, 173, 231, 170,  21, 247, 167
  1412. };
  1413.  
  1414. CHAR
  1415. ylck8[] = {  /* Latin/Cyrillic to Old KOI-8 Cyrillic */
  1416.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1417.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1418.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1419.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1420.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1421.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1422.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1423. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1424. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1425. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1426. UNK, 229, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 235, UNK, 245, UNK,
  1427. 225, 226, 247, 231, 228, 229, 246, 250, 233, 234, 235, 236, 237, 238, 239, 240,
  1428. 242, 243, 244, 245, 230, 232, 227, 254, 251, 253, 255, 249, 248, 252, 224, 241,
  1429. 193, 194, 215, 199, 196, 197, 214, 218, 201, 202, 203, 204, 205, 206, 207, 208,
  1430. 210, 211, 212, 213, 198, 200, 195, 222, 219, 221, 223, 217, 216, 220, 192, 209,
  1431. UNK, 197, UNK, UNK, UNK, 115, 105, 105, 106, UNK, UNK, UNK, 203, UNK, 213, UNK
  1432. };
  1433.  
  1434. CHAR
  1435. yaclc[] = {  /* CP866 to Latin/Cyrillic */
  1436. /* NEED TO MAKE THIS ONE INVERTIBLE */
  1437.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1438.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1439.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1440.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1441.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1442.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1443.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1444. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1445. 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
  1446. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  1447. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  1448. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1449. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1450. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1451. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  1452. 161, 241, 164, 244, 167, 247, 174, 254, UNK, UNK, UNK, UNK, 240, UNK, UNK, UNK
  1453. };
  1454.  
  1455. CHAR
  1456. yk8lc[] = {  /* Old KOI-8 Cyrillic to Latin/Cyrillic */
  1457.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1458.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1459.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1460.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1461.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1462.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1463.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1464. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1465. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1466. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1467. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1468. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1469. 238, 208, 209, 230, 212, 213, 228, 211, 229, 216, 217, 218, 219, 220, 221, 222,
  1470. 223, 239, 224, 225, 226, 227, 214, 210, 236, 235, 215, 232, 237, 233, 231, 234,
  1471. 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
  1472. 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
  1473. };
  1474.  
  1475. CHAR
  1476. ylcsk[] = {  /* Latin/Cyrillic to Short KOI */
  1477.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1478.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1479.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1480.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1481.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1482.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1483.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1484.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94, 127,
  1485.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1486.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1487.  32, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107,  45, 117, UNK,
  1488.  97,  98, 119, 103, 100, 101, 118, 122, 105, 106, 107, 108, 109, 110, 111, 112,
  1489. 114, 115, 116, 117, 102, 104,  99, 126, 123, 125,  39, 121, 120, 124,  96, 113,
  1490.  97,  98, 119, 103, 100, 101, 118, 122, 105, 106, 107, 108, 109, 110, 111, 112,
  1491. 114, 115, 116, 117, 102, 104,  99, 126, 123, 125,  39, 121, 120, 124,  96, 113,
  1492. UNK, 101, UNK, UNK, UNK,  83,  73,  73,  74, UNK, UNK, UNK, 107, UNK, 117, UNK
  1493. };
  1494.  
  1495. CHAR yskcy[] = {  /* Short KOI to Latin/Cyrillic */
  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,  35,  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.  64,  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,  91,  92,  93,  94,  95,
  1502. 206, 176, 177, 198, 180, 181, 196, 179, 197, 184, 185, 186, 187, 188, 189, 190,
  1503. 191, 207, 192, 193, 194, 195, 182, 178, 204, 203, 183, 200, 205, 201, 199, 127
  1504. };
  1505. #endif /* CYRILLIC */
  1506.  
  1507. #ifdef LATIN2
  1508.  
  1509. /* Latin-2 tables */
  1510.  
  1511. CHAR
  1512. yl252[] = {  /* Latin-2 to Code Page 852 */
  1513.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1514.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1515.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1516.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1517.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1518.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1519.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1520. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1521. 174, 175, 176, 177, 178, 179, 180, 185, 186, 187, 188, 191, 192, 193, 194, 195,
  1522. 196, 197, 200, 201, 202, 203, 204, 205, 206, 217, 218, 219, 220, 223, 240, 254,
  1523. 255, 164, 244, 157, 207, 149, 151, 245, 249, 230, 184, 155, 141, 170, 166, 189,
  1524. 248, 165, 242, 136, 239, 150, 152, 243, 247, 231, 173, 156, 171, 241, 167, 190,
  1525. 232, 181, 182, 198, 142, 145, 143, 128, 172, 144, 168, 211, 183, 214, 215, 210,
  1526. 209, 227, 213, 224, 226, 138, 153, 158, 252, 222, 233, 235, 154, 237, 221, 225,
  1527. 234, 160, 131, 199, 132, 146, 134, 135, 159, 130, 169, 137, 216, 161, 140, 212,
  1528. 208, 228, 229, 162, 147, 139, 148, 246, 253, 133, 163, 251, 129, 236, 238, 250
  1529. };
  1530.  
  1531. CHAR
  1532. y52l2[] = {  /* Code Page 852 to Latin-2 */
  1533.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1534.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1535.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1536.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1537.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1538.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1539.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1540. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1541. 199, 252, 233, 226, 228, 249, 230, 231, 179, 235, 213, 245, 238, 172, 196, 198,
  1542. 201, 197, 229, 244, 246, 165, 181, 166, 182, 214, 220, 171, 187, 163, 215, 232,
  1543. 225, 237, 243, 250, 161, 177, 174, 190, 202, 234, 173, 188, 200, 186, 128, 129,
  1544. 130, 131, 132, 133, 134, 193, 194, 204, 170, 135, 136, 137, 138, 175, 191, 139,
  1545. 140, 141, 142, 143, 144, 145, 195, 227, 146, 147, 148, 149, 150, 151, 152, 164,
  1546. 240, 208, 207, 203, 239, 210, 205, 206, 236, 153, 154, 155, 156, 222, 217, 157,
  1547. 211, 223, 212, 209, 241, 242, 169, 185, 192, 218, 224, 219, 253, 221, 254, 180,
  1548. 158, 189, 178, 183, 162, 167, 247, 184, 176, 168, 255, 251, 216, 248, 159, 160
  1549. };
  1550.  
  1551. CHAR
  1552. yl2l1[] = {  /* Latin-2 to Latin-1 */
  1553.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1554.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1555.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1556.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1557.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1558.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1559.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1560. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1561. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1562. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1563. 160, 'A', UNK, 'L', 164, 'L', 'S', 167, 168, 'S', 'S', 'T', 'Z', 173, 'Z', 'Z',
  1564. 176, 'a', UNK, 'l', 180, 'l', 's', UNK, 184, 's', 's', 't', 'z', UNK, 'z', 'z',
  1565. 'R', 193, 194, 'A', 196, 'L', 'C', 199, 'C', 201, 'E', 203, 'E', 205, 'I', 'D',
  1566. 208, 'N', 'N', 211, 212, 'O', 214, 215, 'R', 'U', 218, 'U', 220, 221, 'T', 's',
  1567. 'r', 225, 226, 'a', 228, 'l', 'c', 231, 'c', 233, 'e', 235, 'e', 237, 'i', 'd',
  1568. 240, 'n', 'n', 243, 244, 'o', 246, 247, 'r', 'u', 250, 'u', 252, 253, 't', '.'
  1569. };
  1570.  
  1571. CHAR
  1572. yl1l2[] = {  /* Latin-1 to Latin-2 */
  1573.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1574.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1575.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1576.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1577.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1578.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1579.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1580. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1581. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  1582. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  1583. 160, 'A', UNK, 'L', 164, UNK, UNK, 167, 168, 'C', 'a', '<', '>', 173, 'R', UNK,
  1584. 176, UNK, UNK, UNK, 180, UNK, UNK, UNK, 184, UNK, 'o', '>', UNK, UNK, UNK, UNK,
  1585. 'A', 193, 194, 'A', 196, 'A', 'A', 199, 'E', 201, 'E', 203, 'I', 205, 'I', 'I',
  1586. 208, 'N', 'O', 211, 212, 'O', 214, 215, 'O', 'U', 218, 'U', 220, 221, UNK, 223,
  1587. 'a', 225, 226, 'a', 228, 'a', 'a', 231, 'e', 233, 'e', 235, 'i', 237, 'i', 'i',
  1588. 240, 'n', 'o', 243, 244, 'o', 246, 247, 'o', 'u', 250, 'u', 252, 253, UNK, 'y'
  1589. };
  1590.  
  1591. CHAR
  1592. yl2as[] = {  /* Latin-2 to ASCII */
  1593.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  1594.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  1595.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  1596.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  1597.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  1598.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  1599.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  1600. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  1601. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1602. UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK,
  1603.  32, 'A', UNK, 'L', UNK, 'L', 'S', UNK,  34, 'S', 'S', 'T', 'Z', '-', 'Z', 'Z',
  1604. UNK, 'a', UNK, 'l',  39, 'l', 's', UNK,  44, 's', 's', 't', 'z', UNK, 'z', 'z',
  1605. 'R', 'A', 'A', 'A', 'A', 'L', 'C', 'C', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'D',
  1606. 'D', 'N', 'N', 'O', 'O', 'O', 'O', 'x', 'R', 'U', 'U', 'U', 'U', 'Y', 'T', 's',
  1607. 'r', 'a', 'a', 'a', 'a', 'l', 'c', 'c', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'd',
  1608. 'd', 'n', 'n', 'o', 'o', 'o', 'o', '/', 'r', 'u', 'u', 'u', 'u', 'y', 't', '.'
  1609. };
  1610. #endif /* LATIN2 */
  1611.  
  1612. /* Translation functions ... */
  1613.  
  1614. CHAR                /* The identity translation function.  */
  1615. #ifdef CK_ANSIC
  1616. ident(CHAR c)                /* (no longer used) */
  1617. #else
  1618. ident(c) CHAR c;
  1619. #endif /* CK_ANSIC */
  1620. { /* ident */
  1621.     return(c);                /* Instead, enter NULL in the  */
  1622. }                    /* table of functions to avoid */
  1623.                     /* needless function calls.    */
  1624. CHAR
  1625. #ifdef CK_ANSIC
  1626. xl1as(CHAR c) 
  1627. #else
  1628. xl1as(c) CHAR c; 
  1629. #endif /* CK_ANSIC */
  1630. { /* xl1as */             /* Latin-1 to US ASCII... */
  1631.     switch(langs[language].id) {
  1632.  
  1633.       case L_DUTCH:
  1634.     if (c == 255) {            /* Dutch umlaut-y */
  1635.         zmstuff('j');        /* becomes ij */
  1636.         return('i');
  1637.     } else return(yl1as[c]);    /* all others by the book */
  1638.  
  1639.       case L_GERMAN:
  1640.     switch (c) {            /* German, special rules. */
  1641.       case 196:            /* umlaut-A -> Ae */
  1642.         zmstuff('e');
  1643.         return('A');
  1644.       case 214:            /* umlaut-O -> Oe */
  1645.         zmstuff('e');
  1646.         return('O');
  1647.       case 220:            /* umlaut-U -> Ue */
  1648.         zmstuff('e');
  1649.         return('U');
  1650.       case 228:            /* umlaut-a -> ae */
  1651.         zmstuff('e');
  1652.         return('a');
  1653.       case 246:            /* umlaut-o -> oe */
  1654.         zmstuff('e');
  1655.         return('o');
  1656.       case 252:            /* umlaut-u -> ue */
  1657.         zmstuff('e');
  1658.         return('u');
  1659.       case 223:            /* ess-zet -> ss */
  1660.         zmstuff('s');
  1661.         return('s');
  1662.       default: return(yl1as[c]);    /* all others by the book */
  1663.     }
  1664.       case L_DANISH:
  1665.       case L_FINNISH:
  1666.       case L_NORWEGIAN:
  1667.       case L_SWEDISH:
  1668.     switch (c) {            /* Scandanavian languages. */
  1669.       case 196:            /* umlaut-A -> Ae */
  1670.           case 198:            /* AE ligature also -> Ae */
  1671.         zmstuff('e');
  1672.         return('A');
  1673.       case 214:            /* umlaut-O -> Oe */
  1674.       case 216:            /* O-slash -> Oe */
  1675.         zmstuff('e');
  1676.         return('O');
  1677.       case 220:            /* umlaut-U -> Ue */
  1678.       /*  return('Y'); replaced by "Ue" by popular demand. */
  1679.           /*  Y for Umlaut-U is only used in German names. */
  1680.         zmstuff('e');
  1681.         return('U');
  1682.       case 228:            /* umlaut-a -> ae */
  1683.           case 230:            /* ditto for ae ligature */
  1684.         zmstuff('e');
  1685.         return('a');
  1686.       case 246:            /* umlaut-o -> oe */
  1687.       case 248:            /* o-slash -> oe */
  1688.         zmstuff('e');
  1689.         return('o');
  1690.       case 252:            /* umlaut-u -> ue */
  1691.       /*  return('y'); replaced by "ue" by popular demand. */
  1692.         zmstuff('e');
  1693.         return('u');
  1694.       case 197:            /* A-ring -> Aa */
  1695.         zmstuff('a');
  1696.         return('A');
  1697.           case 229:            /* a-ring -> aa */
  1698.         zmstuff('a');
  1699.         return('a');
  1700.       default: return(yl1as[c]);    /* All others by the book */
  1701.     }
  1702.       case L_ICELANDIC:            /* Icelandic. */
  1703.     switch (c) {    
  1704.       case 198:            /* uppercase AE -> AE */
  1705.         zmstuff('e');
  1706.         return('A');
  1707.       case 208:            /* uppercase Eth -> D */
  1708.         return('D');
  1709.       case 214:            /* uppercase O-diaeresis -> Oe */
  1710.         zmstuff('e');
  1711.         return('O');
  1712.       case 222:            /* uppercase Thorn -> Th */
  1713.         zmstuff('h');
  1714.         return('T');
  1715.       case 230:            /* lowercase ae -> ae */
  1716.         zmstuff('e');
  1717.         return('a');
  1718.       case 240:            /* lowercase Eth -> d */
  1719.         return('d');
  1720.       case 246:            /* lowercase O-diaeresis -> oe */
  1721.         zmstuff('e');
  1722.         return('o');
  1723.       case 254:            /* lowercase Thorn -> th */
  1724.         zmstuff('h');
  1725.         return('t');
  1726.       default: return(yl1as[c]);    /* All others by the book */
  1727.     }
  1728.       default:
  1729.     return(yl1as[c]);        /* None of the above, by the table. */
  1730.     }
  1731. }
  1732.  
  1733. CHAR                    /* Latin-1 to German */
  1734. #ifdef CK_ANSIC
  1735. xl1ge(CHAR c) 
  1736. #else
  1737. xl1ge(c) CHAR c; 
  1738. #endif /* CK_ANSIC */
  1739. { /* xl1ge */
  1740.     return(yl1ge[c]);
  1741. }
  1742.  
  1743. CHAR                    /* German to Latin-1 */
  1744. #ifdef CK_ANSIC
  1745. xgel1(CHAR c) 
  1746. #else
  1747. xgel1(c) CHAR c; 
  1748. #endif /* CK_ANSIC */
  1749. { /* xgel1 */
  1750.     return(ygel1[c]);
  1751. }
  1752.  
  1753. CHAR
  1754. #ifdef CK_ANSIC
  1755. xgeas(CHAR c) 
  1756. #else
  1757. xgeas(c) CHAR c; 
  1758. #endif /* CK_ANSIC */
  1759. { /* xgeas */            /* German ISO 646 to ASCII */
  1760.     switch (c) {
  1761.       case 91:                /* umlaut-A -> Ae */
  1762.     zmstuff('e');
  1763.     return('A');
  1764.       case 92:                /* umlaut-O -> Oe */
  1765.     zmstuff('e');
  1766.     return('O');
  1767.       case 93:                /* umlaut-U -> Ue */
  1768.     zmstuff('e');
  1769.     return('U');
  1770.       case 123:                /* umlaut-a -> ae */
  1771.     zmstuff('e');
  1772.     return('a');
  1773.       case 124:                /* umlaut-o -> oe */
  1774.     zmstuff('e');
  1775.     return('o');
  1776.       case 125:                /* umlaut-u -> ue */
  1777.     zmstuff('e');
  1778.     return('u');
  1779.       case 126:                /* ess-zet -> ss */
  1780.     zmstuff('s');
  1781.     return('s');
  1782.       default:  return(c);        /* all others stay the same */
  1783.     }
  1784. }
  1785.  
  1786. CHAR
  1787. #ifdef CK_ANSIC
  1788. xduas(CHAR c) 
  1789. #else
  1790. xduas(c) CHAR c; 
  1791. #endif /* CK_ANSIC */
  1792. { /* xduas */            /* Dutch ISO 646 to US ASCII */
  1793.     switch (c) {
  1794.       case 64:  return(UNK);        /* 3/4 */
  1795.       case 91:                /* y-diaeresis */
  1796.     zmstuff('j');
  1797.     return('i');
  1798.       case 92:  return(UNK);        /* 1/2 */
  1799.       case 93:  return(124);        /* vertical bar */
  1800.       case 123: return(34);        /* diaeresis */
  1801.       case 124: return(UNK);        /* Florin */
  1802.       case 125: return(UNK);        /* 1/4 */
  1803.       case 126: return(39);        /* Apostrophe */
  1804.       default:  return(c);
  1805.     }
  1806. }
  1807.  
  1808. CHAR
  1809. #ifdef CK_ANSIC
  1810. xfias(CHAR c) 
  1811. #else
  1812. xfias(c) CHAR c; 
  1813. #endif /* CK_ANSIC */
  1814. { /* xfias */            /* Finnish ISO 646 to US ASCII */
  1815.     switch (c) {
  1816.       case 91:                /* A-diaeresis */
  1817.     zmstuff('e');
  1818.     return('A');
  1819.       case 92:                /* O-diaeresis */
  1820.     zmstuff('e');
  1821.     return('O');
  1822.       case 93:                /* A-ring */
  1823.     zmstuff('a');
  1824.     return('A');
  1825.       case 94:                /* U-diaeresis */
  1826.     /* return('Y'); */
  1827.     zmstuff('e');
  1828.     return('U');
  1829.       case 96:                /* e-acute */
  1830.     return('e');
  1831.       case 123:                /* a-diaeresis */
  1832.     zmstuff('e');
  1833.     return('a');
  1834.       case 124:                /* o-diaeresis */
  1835.     zmstuff('e');
  1836.     return('o');
  1837.       case 125:                /* a-ring */
  1838.     zmstuff('a');
  1839.     return('a');
  1840.       case 126:                /* u-diaeresis */
  1841.     /* return('y'); */
  1842.     zmstuff('e');
  1843.     return('U');
  1844.       default:
  1845.     return(c);
  1846.     }
  1847. }
  1848.  
  1849. CHAR
  1850. #ifdef CK_ANSIC
  1851. xfras(CHAR c) 
  1852. #else
  1853. xfras(c) CHAR c; 
  1854. #endif /* CK_ANSIC */
  1855. { /* xfras */            /* French ISO 646 to US ASCII */
  1856.     switch (c) {
  1857.       case 64:  return(97);        /* a grave */
  1858.       case 91:  return(UNK);        /* degree sign */
  1859.       case 92:  return(99);        /* c cedilla */
  1860.       case 93:  return(UNK);        /* paragraph sign */
  1861.       case 123: return(101);        /* e acute */
  1862.       case 124: return(117);        /* u grave */
  1863.       case 125: return(101);        /* e grave */
  1864.       case 126: return(34);        /* diaeresis */
  1865.       default:  return(c);
  1866.     }
  1867. }
  1868.  
  1869. CHAR
  1870. #ifdef CK_ANSIC
  1871. xfcas(CHAR c) 
  1872. #else
  1873. xfcas(c) CHAR c; 
  1874. #endif /* CK_ANSIC */
  1875. { /* xfcas */            /* French Canadian ISO 646 to ASCII */
  1876.     switch (c) {
  1877.       case 64:  return('a');        /* a grave */
  1878.       case 91:  return('a');        /* a circumflex */
  1879.       case 92:  return('c');        /* c cedilla */
  1880.       case 93:  return('e');        /* e circumflex */
  1881.       case 94:  return('i');        /* i circumflex */
  1882.       case 96:  return('o');        /* o circumflex */
  1883.       case 123: return('e');        /* e acute */
  1884.       case 124: return('u');        /* u grave */
  1885.       case 125: return('e');        /* e grave */
  1886.       case 126: return('u');        /* u circumflex */
  1887.       default:  return(c);
  1888.     }
  1889. }
  1890.  
  1891. CHAR
  1892. #ifdef CK_ANSIC
  1893. xitas(CHAR c) 
  1894. #else
  1895. xitas(c) CHAR c; 
  1896. #endif /* CK_ANSIC */
  1897. { /* xitas */            /* Italian ISO 646 to ASCII */
  1898.     switch (c) {
  1899.       case 91:  return(UNK);        /* degree */
  1900.       case 92:  return('c');        /* c cedilla */
  1901.       case 93:  return('e');        /* e acute */
  1902.       case 96:  return('u');        /* u grave */
  1903.       case 123: return('a');        /* a grave */
  1904.       case 124: return('o');        /* o grave */
  1905.       case 125: return('e');        /* e grave */
  1906.       case 126: return('i');        /* i grave */
  1907.       default:  return(c);
  1908.     }
  1909. }
  1910.  
  1911. CHAR
  1912. #ifdef CK_ANSIC
  1913. xneas(CHAR c) 
  1914. #else
  1915. xneas(c) CHAR c; 
  1916. #endif /* CK_ANSIC */
  1917. { /* xneas */            /* NeXT to ASCII */
  1918.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  1919.     if (c == 234) {            /* handle OE digraph. */
  1920.         zmstuff('E');
  1921.         return('O');
  1922.     } else if (c == 250) {        /* Also lowercase oe. */
  1923.         zmstuff('e');
  1924.         return('o');
  1925.     }
  1926.     }
  1927.     c = xnel1(c);            /* Convert to Latin-1 */
  1928.     return(yl1as[c]);            /* Convert Latin-1 to ASCII */
  1929. }
  1930.  
  1931. CHAR
  1932. #ifdef CK_ANSIC
  1933. xnoas(CHAR c) 
  1934. #else
  1935. xnoas(c) CHAR c; 
  1936. #endif /* CK_ANSIC */
  1937. { /* xnoas */            /* Norge/Danish ISO 646 to ASCII */
  1938.     switch (c) {
  1939.       case 91:
  1940.     zmstuff('E');            /* AE digraph */
  1941.     return('A');
  1942.       case 92: return('O');        /* O slash */
  1943.       case 93:                /* A ring */
  1944.     zmstuff('a');
  1945.     return('A');
  1946.       case 123:                /* ae digraph */
  1947.     zmstuff('e');
  1948.     return('a');
  1949.       case 124: return('o');        /* o slash */
  1950.       case 125:                /* a ring */
  1951.     zmstuff('a');
  1952.     return('a');
  1953.       default:  return(c);
  1954.     }
  1955. }
  1956.  
  1957. CHAR
  1958. #ifdef CK_ANSIC
  1959. xpoas(CHAR c) 
  1960. #else
  1961. xpoas(c) CHAR c; 
  1962. #endif /* CK_ANSIC */
  1963. { /* xpoas */            /* Portuguese ISO 646 to ASCII */
  1964.     switch (c) {
  1965.       case 91:  return('A');        /* A tilde */
  1966.       case 92:  return('C');        /* C cedilla */
  1967.       case 93:  return('O');        /* O tilde */
  1968.       case 123: return('a');        /* a tilde */
  1969.       case 124: return('c');        /* c cedilla */
  1970.       case 125: return('o');        /* o tilde */
  1971.       default:  return(c);
  1972.     }
  1973. }
  1974.  
  1975. CHAR
  1976. #ifdef CK_ANSIC
  1977. xspas(CHAR c) 
  1978. #else
  1979. xspas(c) CHAR c; 
  1980. #endif /* CK_ANSIC */
  1981. { /* xspas */            /* Spanish ISO 646 to ASCII */
  1982.     switch (c) {
  1983.       case 91:  return(33);        /* Inverted exclamation */
  1984.       case 92:  return('N');        /* N tilde */
  1985.       case 93:  return(63);        /* Inverted question mark */
  1986.       case 123: return(UNK);        /* degree */
  1987.       case 124: return('n');        /* n tilde */
  1988.       case 125: return('c');        /* c cedilla */
  1989.       default:  return(c);
  1990.     }
  1991. }
  1992.  
  1993. CHAR
  1994. #ifdef CK_ANSIC
  1995. xswas(CHAR c) 
  1996. #else
  1997. xswas(c) CHAR c; 
  1998. #endif /* CK_ANSIC */
  1999. { /* xswas */            /* Swedish ISO 646 to ASCII */
  2000.     switch (c) {
  2001.       case 64:  return('E');        /* E acute */
  2002.       case 91:                /* A diaeresis */
  2003.     zmstuff('e');
  2004.     return('A');
  2005.       case 92:                /* O diaeresis */
  2006.     zmstuff('e');
  2007.     return('O');
  2008.       case 93:                /* A ring */
  2009.     zmstuff('a');
  2010.     return('A');
  2011.       case 94:                /* U diaeresis */
  2012.     /* return('Y'); */
  2013.     zmstuff('e');
  2014.     return('U');
  2015.       case 96:  return('e');        /* e acute */
  2016.       case 123:                /* a diaeresis */
  2017.     zmstuff('e');
  2018.     return('a');
  2019.       case 124:                /* o diaeresis */
  2020.     zmstuff('e');
  2021.     return('o');
  2022.       case 125:                /* a ring */
  2023.     zmstuff('a');
  2024.     return('a');
  2025.       case 126:                /* u diaeresis */
  2026.     /* return('y'); */
  2027.     zmstuff('e');
  2028.     return('u');
  2029.       default:  return(c);
  2030.     }
  2031. }
  2032.  
  2033. CHAR
  2034. #ifdef CK_ANSIC
  2035. xchas(CHAR c) 
  2036. #else
  2037. xchas(c) CHAR c; 
  2038. #endif /* CK_ANSIC */
  2039. { /* xchas */            /* Swiss ISO 646 to ASCII */
  2040.     switch (c) {
  2041.       case 35:  return('u');        /* u grave */
  2042.       case 64:  return('a');        /* a grave */
  2043.       case 91:  return('e');        /* e acute */
  2044.       case 92:  return('c');        /* c cedilla */
  2045.       case 93:  return('e');        /* e circumflex */
  2046.       case 94:  return('i');        /* i circumflex */
  2047.       case 95:  return('e');        /* e grave */
  2048.       case 96:  return('o');        /* o circumflex */
  2049.       case 123:                /* a diaeresis */
  2050.     zmstuff('e');
  2051.     return('a');
  2052.       case 124:                /* o diaeresis */
  2053.     zmstuff('e');
  2054.     return('o');
  2055.       case 125:                /* u diaeresis */
  2056.     zmstuff('e');
  2057.     return('u');
  2058.       case 126: return('u');        /* u circumflex */
  2059.       default:  return(c);
  2060.     }
  2061. }
  2062.  
  2063. CHAR
  2064. #ifdef CK_ANSIC
  2065. xhuas(CHAR c) 
  2066. #else
  2067. xhuas(c) CHAR c; 
  2068. #endif /* CK_ANSIC */
  2069. { /* xhuas */            /* Hungarian ISO 646 to ASCII */
  2070.     switch (c) {
  2071.       case 64:  return('A');        /* A acute */
  2072.       case 91:  return('E');        /* E acute */
  2073.       case 92:  return('O');        /* O diaeresis */
  2074.       case 93:  return('U');        /* U diaeresis */
  2075.       case 96:  return('a');        /* a acute */
  2076.       case 123: return('e');        /* e acute */
  2077.       case 124: return('o');        /* o acute */
  2078.       case 125: return('u');        /* u acute */
  2079.       case 126: return(34);        /* double acute accent */
  2080.       default:  return(c);
  2081.     }
  2082. }
  2083.  
  2084. CHAR
  2085. #ifdef CK_ANSIC
  2086. xdmas(CHAR c) 
  2087. #else
  2088. xdmas(c) CHAR c; 
  2089. #endif /* CK_ANSIC */
  2090. { /* xdmas */            /* DEC MCS to ASCII */
  2091.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2092.     if (c == 215) {            /* handle OE digraph. */
  2093.         zmstuff('E');
  2094.         return('O');
  2095.     } else if (c == 247) {        /* Also lowercase oe. */
  2096.         zmstuff('e');
  2097.         return('o');
  2098.     }
  2099.     }
  2100.     return(yl1as[c]);            /* Otherwise treat like Latin-1 */
  2101. }
  2102.  
  2103. CHAR
  2104. #ifdef CK_ANSIC
  2105. xdgas(CHAR c)
  2106. #else
  2107. xdgas(c) CHAR c;
  2108. #endif /* CK_ANSIC */
  2109. { /*  xdgas */            /* Data General to ASCII */
  2110.     switch(c) {
  2111.       case 180: return('f');        /* Florin */
  2112.       case 183: return('<');        /* Less-equal */
  2113.       case 184: return('>');        /* Greater-equal */
  2114.       case 186: return(96);        /* Grave accent */
  2115.       case 191: return('^');        /* Uparrow */
  2116.       case 215:
  2117.     if (langs[language].id == L_FRENCH) { /* OE digraph */
  2118.         zmstuff('E');
  2119.         return('O');
  2120.     } else return('O');
  2121.       case 247:
  2122.     if (langs[language].id == L_FRENCH) { /* oe digraph */
  2123.         zmstuff('e');
  2124.         return('o');
  2125.     } else return('o');
  2126.       case 175: case 179: case 220: case 222:
  2127.       case 223: case 254: case 255:
  2128.     return(UNK);
  2129.       default:                /* The rest, convert to Latin-1 */
  2130.     return(yl1as[ydgl1[c]]);    /* and from there to ASCII */
  2131.     }
  2132. }
  2133.  
  2134. CHAR
  2135. #ifdef CK_ANSIC
  2136. xukl1(CHAR c) 
  2137. #else
  2138. xukl1(c) CHAR c; 
  2139. #endif /* CK_ANSIC */
  2140. { /* xukl1 */            /* UK ASCII to Latin-1 */
  2141.     if (c == 35)
  2142.       return(163);
  2143.     else return(c);
  2144. }
  2145.  
  2146. CHAR
  2147. #ifdef CK_ANSIC
  2148. xl1uk(CHAR c) 
  2149. #else
  2150. xl1uk(c) CHAR c; 
  2151. #endif /* CK_ANSIC */
  2152. { /* xl1uk */            /* Latin-1 to UK ASCII */
  2153.     if (c == 163)
  2154.       return(35);
  2155.     else return(yl1as[c]);
  2156. }
  2157.  
  2158. CHAR                    /* Latin-1 to French ISO 646 */
  2159. #ifdef CK_ANSIC
  2160. xl1fr(CHAR c) 
  2161. #else
  2162. xl1fr(c) CHAR c; 
  2163. #endif /* CK_ANSIC */
  2164. { /* xl1fr */
  2165.     return(yl1fr[c]);
  2166. }
  2167.  
  2168.  
  2169. CHAR                    /* French ASCII to Latin-1 */
  2170. #ifdef CK_ANSIC
  2171. xfrl1(CHAR c) 
  2172. #else
  2173. xfrl1(c) CHAR c; 
  2174. #endif /* CK_ANSIC */
  2175. { /* xfrl1 */
  2176.     return(yfrl1[c]);
  2177. }
  2178.  
  2179. CHAR                    /* Latin-1 to Dutch ASCII */
  2180. #ifdef CK_ANSIC
  2181. xl1du(CHAR c) 
  2182. #else
  2183. xl1du(c) CHAR c; 
  2184. #endif /* CK_ANSIC */
  2185. { /* xl1du */
  2186.     return(yl1du[c]);
  2187. }
  2188.  
  2189. CHAR
  2190. #ifdef CK_ANSIC
  2191. xdul1(CHAR c) 
  2192. #else
  2193. xdul1(c) CHAR c; 
  2194. #endif /* CK_ANSIC */
  2195. { /* xdul1 */            /* Dutch ISO 646 to Latin-1 */
  2196.     return(ydul1[c]);
  2197. }
  2198.  
  2199. CHAR
  2200. #ifdef CK_ANSIC
  2201. xfil1(CHAR c) 
  2202. #else
  2203. xfil1(c) CHAR c; 
  2204. #endif /* CK_ANSIC */
  2205. { /* xfil1 */            /* Finnish ISO 646 to Latin-1 */
  2206.     return(yfil1[c]); 
  2207. }
  2208.  
  2209. CHAR
  2210. #ifdef CK_ANSIC
  2211. xl1fi(CHAR c) 
  2212. #else
  2213. xl1fi(c) CHAR c; 
  2214. #endif /* CK_ANSIC */
  2215. { /* xl1fi */            /* Latin-1 to Finnish ISO 646 */
  2216.     return(yl1fi[c]); 
  2217. }
  2218.  
  2219. CHAR
  2220. #ifdef CK_ANSIC
  2221. xfcl1(CHAR c) 
  2222. #else
  2223. xfcl1(c) CHAR c; 
  2224. #endif /* CK_ANSIC */
  2225. { /* xfcl1 */            /* French Canadian ISO646 to Latin-1 */
  2226.     return(yfcl1[c]); 
  2227. }
  2228.  
  2229. CHAR
  2230. #ifdef CK_ANSIC
  2231. xl1fc(CHAR c) 
  2232. #else
  2233. xl1fc(c) CHAR c; 
  2234. #endif /* CK_ANSIC */
  2235. { /* xl1fc */            /* Latin-1 to French Canadian ISO646 */
  2236.     return(yl1fc[c]); 
  2237. }
  2238.  
  2239. CHAR
  2240. #ifdef CK_ANSIC
  2241. xitl1(CHAR c) 
  2242. #else
  2243. xitl1(c) CHAR c; 
  2244. #endif /* CK_ANSIC */
  2245. { /* xitl1 */            /* Italian ISO 646 to Latin-1 */
  2246.     return(yitl1[c]); 
  2247. }
  2248.  
  2249. CHAR
  2250. #ifdef CK_ANSIC
  2251. xl1it(CHAR c) 
  2252. #else
  2253. xl1it(c) CHAR c; 
  2254. #endif /* CK_ANSIC */
  2255. { /* xl1it */            /* Latin-1 to Italian ISO 646 */
  2256.     return(yl1it[c]); 
  2257. }
  2258.  
  2259. CHAR
  2260. #ifdef CK_ANSIC
  2261. xnel1(CHAR c) 
  2262. #else
  2263. xnel1(c) CHAR c; 
  2264. #endif /* CK_ANSIC */
  2265. { /* xnel1 */         /* NeXT to Latin-1 */
  2266.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2267.     if (c == 234) {            /* handle OE digraph. */
  2268.         zmstuff('E');
  2269.         return('O');
  2270.     } else if (c == 250) {        /* Also lowercase oe. */
  2271.         zmstuff('e');
  2272.         return('o');
  2273.     }
  2274.     }
  2275.     return(ynel1[c]);
  2276. }
  2277.  
  2278. CHAR
  2279. #ifdef CK_ANSIC
  2280. xl1ne(CHAR c) 
  2281. #else
  2282. xl1ne(c) CHAR c; 
  2283. #endif /* CK_ANSIC */
  2284. { /* xl1ne */         /* Latin-1 to NeXT */
  2285.     return(yl1ne[c]);
  2286. }
  2287.  
  2288. CHAR
  2289. #ifdef CK_ANSIC
  2290. xnol1(CHAR c) 
  2291. #else
  2292. xnol1(c) CHAR c; 
  2293. #endif /* CK_ANSIC */
  2294. { /* xnol1 */         /* Norwegian and Danish ISO 646 to Latin-1 */
  2295.     return(ynol1[c]); 
  2296. }
  2297.  
  2298. CHAR
  2299. #ifdef CK_ANSIC
  2300. xl1no(CHAR c) 
  2301. #else
  2302. xl1no(c) CHAR c; 
  2303. #endif /* CK_ANSIC */
  2304. { /* xl1no */         /* Latin-1 to Norwegian and Danish ISO 646 */
  2305.     return(yl1no[c]); 
  2306. }
  2307.  
  2308. CHAR
  2309. #ifdef CK_ANSIC
  2310. xpol1(CHAR c) 
  2311. #else
  2312. xpol1(c) CHAR c; 
  2313. #endif /* CK_ANSIC */
  2314. { /* xpol1 */            /* Portuguese ISO 646 to Latin-1 */
  2315.     return(ypol1[c]); 
  2316. }
  2317.  
  2318. CHAR
  2319. #ifdef CK_ANSIC
  2320. xl1po(CHAR c) 
  2321. #else
  2322. xl1po(c) CHAR c; 
  2323. #endif /* CK_ANSIC */
  2324. { /* xl1po */            /* Latin-1 to Portuguese ISO 646 */
  2325.     return(yl1po[c]); 
  2326. }
  2327.  
  2328. CHAR
  2329. #ifdef CK_ANSIC
  2330. xspl1(CHAR c) 
  2331. #else
  2332. xspl1(c) CHAR c; 
  2333. #endif /* CK_ANSIC */
  2334. { /* xspl1 */            /* Spanish ISO 646 to Latin-1 */
  2335.     return(yspl1[c]); 
  2336. }
  2337.  
  2338. CHAR
  2339. #ifdef CK_ANSIC
  2340. xl1sp(CHAR c) 
  2341. #else
  2342. xl1sp(c) CHAR c; 
  2343. #endif /* CK_ANSIC */
  2344. { /* xl1sp */            /* Latin-1 to Spanish ISO 646 */
  2345.     return(yl1sp[c]); 
  2346. }
  2347.  
  2348. CHAR
  2349. #ifdef CK_ANSIC
  2350. xswl1(CHAR c) 
  2351. #else
  2352. xswl1(c) CHAR c; 
  2353. #endif /* CK_ANSIC */
  2354. { /* xswl1 */            /* Swedish ISO 646 to Latin-1 */
  2355.     return(yswl1[c]); 
  2356. }
  2357.  
  2358. CHAR
  2359. #ifdef CK_ANSIC
  2360. xl1sw(CHAR c) 
  2361. #else
  2362. xl1sw(c) CHAR c; 
  2363. #endif /* CK_ANSIC */
  2364. { /* xl1sw */            /* Latin-1 to Swedish ISO 646 */
  2365.     return(yl1sw[c]); 
  2366. }
  2367.  
  2368. CHAR
  2369. #ifdef CK_ANSIC
  2370. xchl1(CHAR c) 
  2371. #else
  2372. xchl1(c) CHAR c; 
  2373. #endif /* CK_ANSIC */
  2374. { /* xchl1 */            /* Swiss ISO 646 to Latin-1 */
  2375.     return(ychl1[c]); 
  2376. }
  2377.  
  2378. CHAR
  2379. #ifdef CK_ANSIC
  2380. xl1ch(CHAR c) 
  2381. #else
  2382. xl1ch(c) CHAR c; 
  2383. #endif /* CK_ANSIC */
  2384. { /* xl1ch */            /* Latin-1 to Swiss ISO 646 */
  2385.     return(yl1ch[c]); 
  2386. }
  2387.  
  2388. CHAR
  2389. #ifdef CK_ANSIC
  2390. xhul1(CHAR c) 
  2391. #else
  2392. xhul1(c) CHAR c; 
  2393. #endif /* CK_ANSIC */
  2394. { /* xhul1 */            /* Hungarian ISO 646 to Latin-1 */
  2395.     return(yhul1[c]);
  2396. }
  2397.  
  2398. CHAR
  2399. #ifdef CK_ANSIC
  2400. xl1hu(CHAR c) 
  2401. #else
  2402. xl1hu(c) CHAR c; 
  2403. #endif /* CK_ANSIC */
  2404. { /* xl1hu */            /* Latin-1 to Hungarian ISO 646 */
  2405.     return(yl1hu[c]);
  2406. }
  2407.  
  2408. CHAR
  2409. #ifdef CK_ANSIC
  2410. xl1dm(CHAR c) 
  2411. #else
  2412. xl1dm(c) CHAR c; 
  2413. #endif /* CK_ANSIC */
  2414. { /* xl1dm */ /* Latin-1 to DEC Multinational Character Set (MCS) */
  2415.     return(yl1dm[c]); 
  2416. }
  2417.  
  2418. CHAR
  2419. #ifdef CK_ANSIC
  2420. xl1dg(CHAR c) 
  2421. #else
  2422. xl1dg(c) CHAR c; 
  2423. #endif /* CK_ANSIC */
  2424. { /* xl1dg */ /* Latin-1 to DG International Character Set (MCS) */
  2425.     return(yl1dg[c]); 
  2426. }
  2427.  
  2428. CHAR
  2429. #ifdef CK_ANSIC
  2430. xdml1(CHAR c) 
  2431. #else
  2432. xdml1(c) CHAR c; 
  2433. #endif /* CK_ANSIC */
  2434. { /* xdml1 */ /* DEC Multinational Character Set (MCS) to Latin-1 */
  2435.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2436.     if (c == 215) {            /* handle OE digraph. */
  2437.         zmstuff('E');
  2438.         return('O');
  2439.     } else if (c == 247) {        /* Also lowercase oe. */
  2440.         zmstuff('e');
  2441.         return('o');
  2442.     }
  2443.     }
  2444.     return(ydml1[c]); 
  2445. }
  2446.  
  2447. CHAR
  2448. #ifdef CK_ANSIC
  2449. xdgl1(CHAR c) 
  2450. #else
  2451. xdgl1(c) CHAR c; 
  2452. #endif /* CK_ANSIC */
  2453. { /* xdgl1 */ /* DG International Character Set (MCS) to Latin-1 */
  2454.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2455.     if (c == 215) {            /* handle OE digraph. */
  2456.         zmstuff('E');
  2457.         return('O');
  2458.     } else if (c == 247) {        /* Also lowercase oe. */
  2459.         zmstuff('e');
  2460.         return('o');
  2461.     }
  2462.     }
  2463.     return(ydgl1[c]); 
  2464. }
  2465.  
  2466. /* Translation functions for receiving files and translating them into ASCII */
  2467.  
  2468. CHAR
  2469. #ifdef CK_ANSIC
  2470. zl1as(CHAR c) 
  2471. #else
  2472. zl1as(c) CHAR c; 
  2473. #endif /* CK_ANSIC */
  2474. { /* zl1as */
  2475.     switch(langs[language].id) {
  2476.  
  2477.       case L_DUTCH:
  2478.     if (c == 255) {            /* Dutch umlaut-y */
  2479.         zdstuff('j');        /* becomes ij */
  2480.         return('i');
  2481.     } else return(yl1as[c]);    /* all others by the book */
  2482.  
  2483.       case L_GERMAN:
  2484.     switch (c) {            /* German, special rules. */
  2485.       case 196:            /* umlaut-A -> Ae */
  2486.         zdstuff('e');
  2487.         return('A');
  2488.       case 214:            /* umlaut-O -> Oe */
  2489.         zdstuff('e');
  2490.         return('O');
  2491.       case 220:            /* umlaut-U -> Ue */
  2492.         zdstuff('e');
  2493.         return('U');
  2494.       case 228:            /* umlaut-a -> ae */
  2495.         zdstuff('e');
  2496.         return('a');
  2497.       case 246:            /* umlaut-o -> oe */
  2498.         zdstuff('e');
  2499.         return('o');
  2500.       case 252:            /* umlaut-u -> ue */
  2501.         zdstuff('e');
  2502.         return('u');
  2503.       case 223:            /* ess-zet -> ss */
  2504.         zdstuff('s');
  2505.         return('s');
  2506.       default: return(yl1as[c]);    /* all others by the book */
  2507.     }
  2508.       case L_DANISH:
  2509.       case L_FINNISH:
  2510.       case L_NORWEGIAN:
  2511.       case L_SWEDISH:
  2512.     switch (c) {            /* Scandanavian languages. */
  2513.       case 196:            /* umlaut-A -> Ae */
  2514.         zdstuff('e');
  2515.         return('A');
  2516.       case 214:            /* umlaut-O -> Oe */
  2517.       case 216:            /* O-slash -> Oe */
  2518.         zdstuff('e');
  2519.         return('O');
  2520.       case 220:            /* umlaut-U -> Y */
  2521.         /* return('Y'); */
  2522.         zdstuff('e');
  2523.         return('U');
  2524.       case 228:            /* umlaut-a -> ae */
  2525.         zdstuff('e');
  2526.         return('a');
  2527.       case 246:            /* umlaut-o -> oe */
  2528.       case 248:            /* o-slash -> oe */
  2529.         zdstuff('e');
  2530.         return('o');
  2531.       case 252:            /* umlaut-u -> y */
  2532.         /* return('y'); */
  2533.         zdstuff('e');
  2534.         return('u');
  2535.       case 197:            /* A-ring -> Aa */
  2536.         zdstuff('a');
  2537.         return('A');
  2538.           case 229:            /* a-ring -> aa */
  2539.         zdstuff('a');
  2540.         return('a');
  2541.       default: return(yl1as[c]);    /* All others by the book */
  2542.     }
  2543.       default:
  2544.     return(yl1as[c]);        /* Not German, by the table. */
  2545.     }
  2546. }
  2547.  
  2548. CHAR                    /* IBM CP437 to Latin-1 */
  2549. #ifdef CK_ANSIC
  2550. x43l1(CHAR c) 
  2551. #else
  2552. x43l1(c) CHAR c; 
  2553. #endif /* CK_ANSIC */
  2554. { /* x43l1 */
  2555.     return(y43l1[c]);
  2556. }
  2557.  
  2558. CHAR                    /* IBM CP850 to Latin-1 */
  2559. #ifdef CK_ANSIC
  2560. x85l1(CHAR c) 
  2561. #else
  2562. x85l1(c) CHAR c; 
  2563. #endif /* CK_ANSIC */
  2564. { /* x85l1 */
  2565.     return(y85l1[c]);
  2566. }
  2567.  
  2568. CHAR                    /* Latin-1 to IBM CP437 */
  2569. #ifdef CK_ANSIC
  2570. xl143(CHAR c) 
  2571. #else
  2572. xl143(c) CHAR c; 
  2573. #endif /* CK_ANSIC */
  2574. { /* xl143 */
  2575.     return(yl143[c]);
  2576. }
  2577.  
  2578. CHAR                    /* Latin-1 to CP850 */
  2579. #ifdef CK_ANSIC
  2580. xl185(CHAR c) 
  2581. #else
  2582. xl185(c) CHAR c; 
  2583. #endif /* CK_ANSIC */
  2584. { /* xl185 */
  2585.     return(yl185[c]);
  2586. }
  2587.  
  2588. CHAR
  2589. #ifdef CK_ANSIC
  2590. x43as(CHAR c) 
  2591. #else
  2592. x43as(c) CHAR c; 
  2593. #endif /* CK_ANSIC */
  2594. { /* x43as */                /* CP437 to ASCII */
  2595.     c = y43l1[c];            /* Translate to Latin-1 */
  2596.     return(xl143(c));            /* and from Latin-1 to ASCII. */
  2597. }
  2598.  
  2599. CHAR
  2600. #ifdef CK_ANSIC
  2601. x85as(CHAR c) 
  2602. #else
  2603. x85as(c) CHAR c; 
  2604. #endif /* CK_ANSIC */
  2605. { /* x85as */                /* CP850 to ASCII */
  2606.     c = y85l1[c];            /* Translate to Latin-1 */
  2607.     return(xl1as(c));            /* and from Latin-1 to ASCII. */
  2608. }
  2609.  
  2610. CHAR                    /* Macintosh Latin to Latin-1 */
  2611. #ifdef CK_ANSIC
  2612. xaql1(CHAR c) 
  2613. #else
  2614. xaql1(c) CHAR c; 
  2615. #endif /* CK_ANSIC */
  2616. { /* xaql1 */
  2617.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2618.     if (c == 206) {            /* handle OE digraph. */
  2619.         zmstuff('E');
  2620.         return('O');
  2621.     } else if (c == 207) {        /* Also lowercase oe. */
  2622.         zmstuff('e');
  2623.         return('o');
  2624.     }
  2625.     }
  2626.     return(yaql1[c]);
  2627. }
  2628.  
  2629. CHAR                    /* Macintosh Latin to ASCII */
  2630. #ifdef CK_ANSIC
  2631. xaqas(CHAR c) 
  2632. #else
  2633. xaqas(c) CHAR c; 
  2634. #endif /* CK_ANSIC */
  2635. { /* xaqas */
  2636.     if (langs[language].id == L_FRENCH) { /* If SET LANGUAGE FRENCH */
  2637.     if (c == 206) {            /* handle OE digraph. */
  2638.         zmstuff('E');
  2639.         return('O');
  2640.     } else if (c == 207) {        /* Also lowercase oe. */
  2641.         zmstuff('e');
  2642.         return('o');
  2643.     }
  2644.     }
  2645.     c = yaql1[c];            /* Translate to Latin-1 */
  2646.     return(xl1as(c));            /* then to ASCII. */
  2647. }
  2648.  
  2649. CHAR                    /* Latin-1 to Macintosh Latin */
  2650. #ifdef CK_ANSIC
  2651. xl1aq(CHAR c) 
  2652. #else
  2653. xl1aq(c) CHAR c; 
  2654. #endif /* CK_ANSIC */
  2655. { /* xl1aq */
  2656.     return(yl1aq[c]);
  2657. }
  2658.  
  2659. #ifdef LATIN2
  2660.  
  2661. /* Translation functions for Latin Alphabet 2 */
  2662.  
  2663. CHAR                    /* Latin-2 to Latin-1 */
  2664. #ifdef CK_ANSIC
  2665. xl2l1(CHAR c) 
  2666. #else
  2667. xl2l1(c) CHAR c; 
  2668. #endif /* CK_ANSIC */
  2669. { /* xll2l1 */
  2670.     return(yl2l1[c]);
  2671. }
  2672.  
  2673. CHAR                    /* Latin-1 to Latin-2 */
  2674. #ifdef CK_ANSIC
  2675. xl1l2(CHAR c) 
  2676. #else
  2677. xl1l2(c) CHAR c; 
  2678. #endif /* CK_ANSIC */
  2679. { /* xll1l2 */
  2680.     return(yl1l2[c]);
  2681. }
  2682.  
  2683. CHAR                    /* Latin-2 to ASCII */
  2684. #ifdef CK_ANSIC
  2685. xl2as(CHAR c) 
  2686. #else
  2687. xl2as(c) CHAR c; 
  2688. #endif /* CK_ANSIC */
  2689. { /* xll2as */
  2690.     return(yl2as[c]);
  2691. }
  2692.  
  2693. CHAR                    /* Latin-2 to CP852 */
  2694. #ifdef CK_ANSIC
  2695. xl252(CHAR c) 
  2696. #else
  2697. xl252(c) CHAR c; 
  2698. #endif /* CK_ANSIC */
  2699. { /* xll252 */
  2700.     return(yl252[c]);
  2701. }
  2702.  
  2703. CHAR                    /* CP852 to Latin-2 */
  2704. #ifdef CK_ANSIC
  2705. x52l2(CHAR c) 
  2706. #else
  2707. x52l2(c) CHAR c; 
  2708. #endif /* CK_ANSIC */
  2709. { /* x52l2 */
  2710.     return(y52l2[c]);
  2711. }
  2712.  
  2713. CHAR                    /* CP852 to ASCII */
  2714. #ifdef CK_ANSIC
  2715. x52as(CHAR c) 
  2716. #else
  2717. x52as(c) CHAR c; 
  2718. #endif /* CK_ANSIC */
  2719. { /* xl52as */
  2720.     return(yl2as[y52l2[c]]);        /* CP852 -> Latin-2 -> ASCII */
  2721. }
  2722.  
  2723. CHAR                    /* CP852 to Latin-1 */
  2724. #ifdef CK_ANSIC
  2725. x52l1(CHAR c) 
  2726. #else
  2727. x52l1(c) CHAR c; 
  2728. #endif /* CK_ANSIC */
  2729. { /* xl52l1 */
  2730.     return(yl2l1[y52l2[c]]);        /* CP852 -> Latin-2 -> Latin-1 */
  2731. }
  2732.  
  2733. CHAR                    /* Latin-1 to CP852 */
  2734. #ifdef CK_ANSIC
  2735. xl152(CHAR c) 
  2736. #else
  2737. xl152(c) CHAR c; 
  2738. #endif /* CK_ANSIC */
  2739. { /* xll152 */
  2740.     return(yl252[yl1l2[c]]);        /* Latin-1 -> Latin-2 -> CP852 */
  2741. }
  2742.  
  2743. CHAR                    /* Latin-2 to NeXT */
  2744. #ifdef CK_ANSIC
  2745. xl2ne(CHAR c) 
  2746. #else
  2747. xl2ne(c) CHAR c; 
  2748. #endif /* CK_ANSIC */
  2749. { /* xll2ne */
  2750.     switch(c) {
  2751.       case 162: return(198);        /* Breve */
  2752.       case 163: return(232);        /* L with stroke */
  2753.       case 178: return(206);        /* Ogonek */
  2754.       case 179: return(248);        /* l with stroke */
  2755.       case 183: return(207);        /* Caron */
  2756.       case 189: return(205);        /* Double acute */
  2757.       case 208: return(144);        /* D stroke = Eth */
  2758.       case 240: return(230);        /* d stroke = eth */
  2759.       case 255: return(199);        /* Dot above */
  2760.       default:  return(yl1ne[yl2l1[c]]);
  2761.     }
  2762. }
  2763.  
  2764. CHAR                    /* Latin-2 to CP437 */
  2765. #ifdef CK_ANSIC
  2766. xl243(CHAR c) 
  2767. #else
  2768. xl243(c) CHAR c; 
  2769. #endif /* CK_ANSIC */
  2770. { /* xll243 */
  2771.     return(yl1l2[y43l1[c]]);
  2772. }
  2773.  
  2774. CHAR                    /* Latin-2 to CP850 */
  2775. #ifdef CK_ANSIC
  2776. xl285(CHAR c) 
  2777. #else
  2778. xl285(c) CHAR c; 
  2779. #endif /* CK_ANSIC */
  2780. { /* xll285 */
  2781.     return(yl1l2[y85l1[c]]);
  2782. }
  2783.  
  2784. CHAR                    /* Latin-2 to Apple */
  2785. #ifdef CK_ANSIC
  2786. xl2aq(CHAR c) 
  2787. #else
  2788. xl2aq(c) CHAR c; 
  2789. #endif /* CK_ANSIC */
  2790. { /* xl2aq */
  2791.     return(yl1aq[yl2l1[c]]);        /* Could do more... */
  2792. }
  2793.  
  2794. CHAR                    /* Latin-2 to DGI */
  2795. #ifdef CK_ANSIC
  2796. xl2dg(CHAR c) 
  2797. #else
  2798. xl2dg(c) CHAR c; 
  2799. #endif /* CK_ANSIC */
  2800. { /* xll2dg */
  2801.     return(yl1l2[ydgl1[c]]);
  2802. }
  2803.  
  2804. CHAR                    /* Latin-2 to Short KOI */
  2805. #ifdef CK_ANSIC
  2806. xl2sk(CHAR c) 
  2807. #else
  2808. xl2sk(c) CHAR c; 
  2809. #endif /* CK_ANSIC */
  2810. { /* xll2sk */
  2811.     return(islower(c) ? toupper(c) : c);
  2812. }
  2813.  
  2814. CHAR                    /* NeXT to Latin-2 */
  2815. #ifdef CK_ANSIC
  2816. xnel2(CHAR c) 
  2817. #else
  2818. xnel2(c) CHAR c; 
  2819. #endif /* CK_ANSIC */
  2820. { /* xnel2 */
  2821.     switch (c) {
  2822.       case 144: return(208);        /* D stroke = Eth */
  2823.       case 198: return(162);        /* Breve */
  2824.       case 199: return(255);        /* Dot above */
  2825.       case 205: return(189);        /* Double acute */
  2826.       case 206: return(178);        /* Ogonek */
  2827.       case 207: return(183);        /* Caron */
  2828.       case 230: return(240);        /* d stroke = eth */
  2829.       case 232: return(163);        /* L with stroke */
  2830.       case 248: return(179);        /* l with stroke */
  2831.       default:  return(yl1l2[ynel1[c]]); /* Others, go thru Latin-1 */
  2832.     }
  2833. }
  2834.  
  2835. CHAR                    /* CP437 to Latin-2 */
  2836. #ifdef CK_ANSIC
  2837. x43l2(CHAR c) 
  2838. #else
  2839. x43l2(c) CHAR c; 
  2840. #endif /* CK_ANSIC */
  2841. { /* xl43l2 */
  2842.     return(yl1l2[y43l1[c]]);
  2843. }
  2844.  
  2845. CHAR                    /* CP850 to Latin-2 */
  2846. #ifdef CK_ANSIC
  2847. x85l2(CHAR c) 
  2848. #else
  2849. x85l2(c) CHAR c; 
  2850. #endif /* CK_ANSIC */
  2851. { /* xl85l2 */
  2852.     return(yl1l2[y85l1[c]]);
  2853. }
  2854.  
  2855. CHAR                    /* Apple to Latin-2 */
  2856. #ifdef CK_ANSIC
  2857. xaql2(CHAR c) 
  2858. #else
  2859. xaql2(c) CHAR c; 
  2860. #endif /* CK_ANSIC */
  2861. { /* xlaql2 */
  2862.     switch (c) {
  2863.       case 249: return(162);        /* Breve accent */
  2864.       case 250: return(255);        /* Dot accent */
  2865.       case 253: return(189);        /* Double acute */
  2866.       default: return(yl1l2[yaql1[c]]);
  2867.     }
  2868. }
  2869.  
  2870. CHAR                    /* DGI to Latin-2 */
  2871. #ifdef CK_ANSIC
  2872. xdgl2(CHAR c) 
  2873. #else
  2874. xdgl2(c) CHAR c; 
  2875. #endif /* CK_ANSIC */
  2876. { /* xldgl2 */
  2877.     return(yl1l2[ydgl1[c]]);        /* (for now) */
  2878. }
  2879.  
  2880. CHAR                    /* Short KOI to Latin-2 */
  2881. #ifdef CK_ANSIC
  2882. xskl2(CHAR c) 
  2883. #else
  2884. xskl2(c) CHAR c; 
  2885. #endif /* CK_ANSIC */
  2886. { /* xlskl2 */
  2887.     return(islower(c) ? toupper(c) : c);
  2888. }
  2889.  
  2890. CHAR                    /* Latin-2 to German */
  2891. #ifdef CK_ANSIC
  2892. xl2ge(CHAR c) 
  2893. #else
  2894. xl2ge(c) CHAR c; 
  2895. #endif /* CK_ANSIC */
  2896. { /* xll2ge */
  2897.     switch(c) {
  2898.       case 167: return(64);        /* Paragraph sign */
  2899.       case 196: return(91);        /* A-diaeresis */
  2900.       case 214: return(92);        /* O-diaeresis */
  2901.       case 220: return(93);        /* U-diaeresis */
  2902.       case 223: return(126);        /* double-s */
  2903.       case 228: return(123);        /* a-diaeresis */
  2904.       case 246: return(124);        /* o-diaeresis */
  2905.       case 252: return(125);        /* u-diaeresis */
  2906.       default:  return(yl2as[c]);    /* Others */
  2907.     }
  2908. }
  2909.  
  2910. CHAR                    /* German to Latin-2 */
  2911. #ifdef CK_ANSIC
  2912. xgel2(CHAR c) 
  2913. #else
  2914. xgel2(c) CHAR c; 
  2915. #endif /* CK_ANSIC */
  2916. { /* xlgel2 */
  2917.     switch(c) {
  2918.       case 64:  return(167);        /* Paragraph sign */
  2919.       case 91:  return(196);        /* A-diaeresis */
  2920.       case 92:  return(214);        /* O-diaeresis */
  2921.       case 93:  return(220);        /* U-diaeresis */
  2922.       case 123: return(228);        /* a-diaeresis */
  2923.       case 126: return(223);        /* double-s */
  2924.       case 124: return(246);        /* o-diaeresis */
  2925.       case 125: return(252);        /* u-diaeresis */
  2926.       default:  return(c);        /* Others */
  2927.     }
  2928. }
  2929.  
  2930. CHAR                    /* Latin-2 to Hungarian */
  2931. #ifdef CK_ANSIC
  2932. xl2hu(CHAR c) 
  2933. #else
  2934. xl2hu(c) CHAR c; 
  2935. #endif /* CK_ANSIC */
  2936. { /* xll2hu */
  2937.     switch(c) {
  2938.       case 164: return(36);        /* Currency symbol */
  2939.       case 189: return(126);        /* Double acute accent */
  2940.       case 193: return(64);        /* A-acute */
  2941.       case 201: return(91);        /* E-acute */
  2942.       case 214: return(92);        /* O-diaeresis */
  2943.       case 220: return(93);        /* U-diaeresis */
  2944.       case 225: return(96);        /* a-acute */
  2945.       case 233: return(123);        /* e-acute */
  2946.       case 246: return(124);        /* o-diaeresis */
  2947.       case 252: return(125);        /* u-diaeresis */
  2948.       default:  return(yl2as[c]);    /* Others */
  2949.     }
  2950. }
  2951.  
  2952. CHAR                    /* Hungarian to Latin-2 */
  2953. #ifdef CK_ANSIC
  2954. xhul2(CHAR c) 
  2955. #else
  2956. xhul2(c) CHAR c; 
  2957. #endif /* CK_ANSIC */
  2958. { /* xlhul2 */
  2959.     switch(c) {
  2960.       case 36:  return(164);        /* Currency symbol */
  2961.       case 64:  return(193);        /* A-acute */
  2962.       case 91:  return(201);        /* E-acute */
  2963.       case 92:  return(214);        /* O-diaeresis */
  2964.       case 93:  return(220);        /* U-diaeresis */
  2965.       case 96:  return(225);        /* a-acute */
  2966.       case 123: return(233);        /* e-acute */
  2967.       case 124: return(246);        /* o-diaeresis */
  2968.       case 125: return(252);        /* u-diaeresis */
  2969.       case 126: return(189);        /* Double acute accent */
  2970.       default:  return(c);        /* Others */
  2971.     }
  2972. }
  2973. #else /* NOLATIN2 */
  2974. #define xl2l1 NULL
  2975. #define xl1l2 NULL
  2976. #define xl2as NULL
  2977. #define xl252 NULL
  2978. #define x52l2 NULL
  2979. #define x52as NULL
  2980. #define x52l1 NULL
  2981. #define xl152 NULL
  2982. #define xl2ne NULL
  2983. #define xl243 NULL
  2984. #define xl285 NULL
  2985. #define xl2aq NULL
  2986. #define xl2dg NULL
  2987. #define xl2sk NULL
  2988. #define xnel2 NULL
  2989. #define x43l2 NULL
  2990. #define x85l2 NULL
  2991. #define xaql2 NULL
  2992. #define xdgl2 NULL
  2993. #define xskl2 NULL
  2994. #define xl2ge NULL
  2995. #define xgel2 NULL
  2996. #define xl2hu NULL
  2997. #define xhul2 NULL
  2998. #endif /* LATIN2 */
  2999.  
  3000. #ifdef CYRILLIC
  3001. /* Translation functions for Cyrillic character sets */
  3002.  
  3003. CHAR                    /* Latin/Cyrillic to */
  3004. #ifdef CK_ANSIC
  3005. xlcac(CHAR c) 
  3006. #else
  3007. xlcac(c) CHAR c; 
  3008. #endif /* CK_ANSIC */
  3009. { /* xlcac */            /* Microsoft Code Page 866 */
  3010.     return(ylcac[c]);
  3011. }
  3012.  
  3013. CHAR                    /* Latin/Cyrillic to Old KOI-8 */
  3014. #ifdef CK_ANSIC
  3015. xlck8(CHAR c) 
  3016. #else
  3017. xlck8(c) CHAR c; 
  3018. #endif /* CK_ANSIC */
  3019. { /* xlck8 */
  3020.     return(ylck8[c]);
  3021. }
  3022.  
  3023. CHAR
  3024. #ifdef CK_ANSIC
  3025. xlcsk(CHAR c) 
  3026. #else
  3027. xlcsk(c) CHAR c; 
  3028. #endif /* CK_ANSIC */
  3029. { /* xlcsk */            /* Latin/Cyrillic to Short KOI */
  3030.     return(ylcsk[c]);
  3031. }
  3032.  
  3033. CHAR
  3034. #ifdef CK_ANSIC
  3035. xlcas(CHAR c) 
  3036. #else
  3037. xlcas(c) CHAR c; 
  3038. #endif /* CK_ANSIC */
  3039. { /* xlcas */            /* Latin/Cyrillic to ASCII */
  3040.     if (langs[language].id == L_RUSSIAN)
  3041.       return(ylcsk[c]);
  3042.     else
  3043.       return((c > 127) ? '?' : c);
  3044. }
  3045.  
  3046. CHAR                    /* CP866 */
  3047. #ifdef CK_ANSIC
  3048. xaclc(CHAR c) 
  3049. #else
  3050. xaclc(c) CHAR c; 
  3051. #endif /* CK_ANSIC */
  3052. { /* xaclc */            /* to Latin/Cyrillic */
  3053.     return(yaclc[c]);
  3054. }
  3055.  
  3056. CHAR                    /* Old KOI-8 to Latin/Cyrillic */
  3057. #ifdef CK_ANSIC
  3058. xk8lc(CHAR c) 
  3059. #else
  3060. xk8lc(c) CHAR c; 
  3061. #endif /* CK_ANSIC */
  3062. { /* xk8lc */
  3063.     return(yk8lc[c]);
  3064. }
  3065.  
  3066. CHAR
  3067. #ifdef CK_ANSIC
  3068. xskcy(CHAR c) 
  3069. #else
  3070. xskcy(c) CHAR c; 
  3071. #endif /* CK_ANSIC */
  3072. { /* xskcy */            /* Short KOI to Latin/Cyrillic */
  3073.     return(yskcy[c & 0x7f]);
  3074. }
  3075.  
  3076. CHAR
  3077. #ifdef CK_ANSIC
  3078. xascy(CHAR c) 
  3079. #else
  3080. xascy(c) CHAR c; 
  3081. #endif /* CK_ANSIC */
  3082. { /* xascy */            /* ASCII to Latin/Cyrillic */
  3083.     if (langs[language].id == L_RUSSIAN) { /* If LANGUAGE == RUSSIAN  */
  3084.     return(yskcy[c & 0x7f]);    /* treat ASCII as Short KOI */
  3085.     } else return((c > 127) ? '?' : c);
  3086. }
  3087.  
  3088. CHAR
  3089. #ifdef CK_ANSIC
  3090. xacas(CHAR c) 
  3091. #else
  3092. xacas(c) CHAR c; 
  3093. #endif /* CK_ANSIC */
  3094. { /* xacas */            /* CP866 to ASCII */
  3095.     if (langs[language].id == L_RUSSIAN) {
  3096.     c = yaclc[c];            /* First to Latin/Cyrillic */
  3097.     return(ylcsk[c]);        /* Then to Short KOI */
  3098.     } else return((c > 127) ? '?' : c);
  3099. }
  3100.  
  3101. CHAR
  3102. #ifdef CK_ANSIC
  3103. xskas(CHAR c) 
  3104. #else
  3105. xskas(c) CHAR c; 
  3106. #endif /* CK_ANSIC */
  3107. { /* xskas */            /* Short KOI to ASCII */
  3108.     return((c > 95) ? '?' : c);
  3109. }
  3110.  
  3111. CHAR
  3112. #ifdef CK_ANSIC
  3113. xk8as(CHAR c) 
  3114. #else
  3115. xk8as(c) CHAR c; 
  3116. #endif /* CK_ANSIC */
  3117. { /* xk8as */            /* Old KOI-8 Cyrillic to ASCII */
  3118.     if (langs[language].id == L_RUSSIAN) {
  3119.     c = yk8lc[c];            /* First to Latin/Cyrillic */
  3120.     return(ylcsk[c]);        /* Then to Short KOI */
  3121.     } else return((c > 127) ? '?' : c);
  3122. }
  3123.  
  3124. CHAR
  3125. #ifdef CK_ANSIC
  3126. xassk(CHAR c) 
  3127. #else
  3128. xassk(c) CHAR c; 
  3129. #endif /* CK_ANSIC */
  3130. { /* xassk */            /* ASCII to Short KOI */
  3131.     c &= 0x77;                /* Force it to be ASCII */
  3132.     return((c > 95) ? (c - 32) : c);    /* Fold columns 6-7 to 4-5 */
  3133. }
  3134.  
  3135. CHAR
  3136. #ifdef CK_ANSIC
  3137. xl1sk(CHAR c) 
  3138. #else
  3139. xl1sk(c) CHAR c; 
  3140. #endif /* CK_ANSIC */
  3141. { /* xl1sk */            /* Latin-1 to Short KOI */
  3142.     c = zl1as(c);            /* Convert to ASCII */
  3143.     return(c = xassk(c));        /* Convert ASCII to Short KOI */
  3144. }
  3145.  
  3146. CHAR
  3147. #ifdef CK_ANSIC
  3148. xaslc(CHAR c) 
  3149. #else
  3150. xaslc(c) CHAR c; 
  3151. #endif /* CK_ANSIC */
  3152. { /* xaslc */            /* ASCII to Latin/Cyrillic */
  3153.     if (langs[language].id == L_RUSSIAN)
  3154.       return(yskcy[c & 0x7f]);
  3155.     else return(c & 0x7f);
  3156. }
  3157.  
  3158. CHAR
  3159. #ifdef CK_ANSIC
  3160. xasac(CHAR c) 
  3161. #else
  3162. xasac(c) CHAR c; 
  3163. #endif /* CK_ANSIC */
  3164. { /* xasac */            /* ASCII to CP866 */
  3165.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  3166.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  3167.     return(ylcac[c]);        /* Then to CP866 */
  3168.     } else return(c & 0x7f);
  3169. }
  3170.  
  3171. CHAR
  3172. #ifdef CK_ANSIC
  3173. xask8(CHAR c) 
  3174. #else
  3175. xask8(c) CHAR c; 
  3176. #endif /* CK_ANSIC */
  3177. { /* xask8 */            /* ASCII to KOI-8 */
  3178.     if (langs[language].id == L_RUSSIAN) { /* Use Short KOI */
  3179.     c = xskcy(c);            /* Translate to Latin/Cyrillic */
  3180.     return(ylck8[c]);        /* Then to KOI-8 */
  3181.     } else return(c & 0x7f);
  3182. }
  3183. #else
  3184. #define xacas NULL
  3185. #define xaclc NULL
  3186. #define xasac NULL
  3187. #define xascy NULL
  3188. #define xask8 NULL
  3189. #define xaslc NULL
  3190. #define xassk NULL
  3191. #define xk8as NULL
  3192. #define xk8lc NULL
  3193. #define xl1sk NULL
  3194. #define xlcac NULL
  3195. #define xlcas NULL
  3196. #define xlck8 NULL
  3197. #define xlcsk NULL
  3198. #define xskas NULL
  3199. #define xskcy NULL
  3200. #endif /* CYRILLIC */
  3201.  
  3202. /* Translation functions for Japanese Kanji character sets */
  3203.  
  3204. #ifdef KANJI
  3205. /*
  3206.   Translate Kanji Transfer Character Set (EUC) to local file character set,
  3207.   contributed by Dr. Hirofumi Fujii, Japan High Energy Research Laboratory
  3208.   (KEK), Tokyo, Japan.
  3209.  
  3210.   a is a byte to be translated, which may be a single-byte character,
  3211.   the Katakana prefix, the first byte of a two-byte Kanji character, or the
  3212.   second byte of 2-byte Kanji character.
  3213.  
  3214.   fn is the output function.
  3215.  
  3216.   Returns 0 on success, -1 on failure.
  3217. */
  3218.  
  3219. _PROTOTYP(static int jpnxas, (int, int[]) );
  3220. _PROTOTYP(static int jpnxkt, (int, int[]) );
  3221. _PROTOTYP(static int jpnxkn, (int[], int[]) );
  3222.  
  3223. static int jpncnt;       /* byte count for Japanese */
  3224. static int jpnlst;       /* last status (for JIS7) */
  3225.  
  3226. static int
  3227. jpnxas(a, obuf) int a; int obuf[]; { /* Translate ASCII to local file code */
  3228.     int r;
  3229.  
  3230.     r = 0;
  3231.     if (fcharset == FC_JIS7) {
  3232.     switch (jpnlst) {
  3233.       case 1:
  3234.         obuf[0] = 0x0f;
  3235.         obuf[1] = a;
  3236.         r = 2;
  3237.         break;
  3238.       case 2:
  3239.         obuf[0] = 0x1b;
  3240.         obuf[1] = 0x28;
  3241.         obuf[2] = 0x4a;
  3242.         obuf[3] = a;
  3243.         r = 4;
  3244.         break;
  3245.       default:
  3246.         obuf[0] = a;
  3247.         r = 1;
  3248.         break;
  3249.     }
  3250.     } else {
  3251.     obuf[0] = a;
  3252.     r = 1;
  3253.     }
  3254.     return(r);
  3255. }
  3256.  
  3257. static int
  3258. jpnxkt(a, obuf) int a; int obuf[]; { 
  3259. /* Translate JIS X 201 Katakana to local code */
  3260.  
  3261.     int r;
  3262.   
  3263.     r = 0;
  3264.     if (fcharset == FC_JIS7) {
  3265.     switch (jpnlst) {
  3266.       case 2:                /* from Kanji */
  3267.         obuf[r++] = 0x1b;
  3268.         obuf[r++] = 0x28;
  3269.         obuf[r++] = 0x4a;
  3270.       case 0:                /* from Roman */
  3271.         obuf[r++] = 0x0e;
  3272.       default:
  3273.         obuf[r++] = (a & 0x7f);
  3274.       break;
  3275.     }
  3276.     } else {
  3277.     if (fcharset == FC_JEUC)
  3278.       obuf[r++] = 0x8e;
  3279.     obuf[r++] = (a | 0x80);
  3280.     }
  3281.     return(r);
  3282. }
  3283.  
  3284. static int
  3285. jpnxkn(ibuf, obuf) int ibuf[], obuf[]; {
  3286.     /* Translate JIS X 0208 Kanji to local code */
  3287.     int c1, c2;
  3288.     int r;
  3289.  
  3290.     c1 = ibuf[0] & 0x7f;
  3291.     c2 = ibuf[1] & 0x7f;
  3292.  
  3293.     if (fcharset == FC_SHJIS) {
  3294.     if (c1 & 1)
  3295.       c2 += 0x1f;
  3296.     else
  3297.       c2 += 0x7d;
  3298.  
  3299.         if (c2 >= 0x7f) c2++;
  3300.  
  3301.         c1 = ((c1 - 0x21) >> 1) + 0x81;
  3302.         if (c1 > 0x9f) c1 += 0x40;
  3303.  
  3304.         obuf[0] = c1;
  3305.         obuf[1] = c2;
  3306.         r = 2;
  3307.     } else if (fcharset == FC_JIS7) {
  3308.         r = 0;
  3309.         switch (jpnlst) {
  3310.         case 1:
  3311.         obuf[r++] = 0x0f; /* From Katakana */
  3312.         case 0:
  3313.         obuf[r++] = 0x1b;
  3314.         obuf[r++] = 0x24;
  3315.         obuf[r++] = 0x42;
  3316.       default:
  3317.         obuf[r++] = c1;
  3318.         obuf[r++] = c2;
  3319.         break;
  3320.     }
  3321.     } else {
  3322.         obuf[0] = (c1 | 0x80);
  3323.         obuf[1] = (c2 | 0x80);
  3324.         r = 2;
  3325.     }
  3326.     return(r);
  3327. }
  3328.  
  3329. int
  3330. xkanjf() {
  3331. /* Initialize parameters for xkanji */
  3332. /* This function should be called when F/X-packet is received */
  3333.     jpncnt = jpnlst = 0;
  3334.     return(0);
  3335. }
  3336.  
  3337. int
  3338. #ifdef CK_ANSIC
  3339. xkanjz( int (*fn)(char) )
  3340. #else
  3341. xkanjz( fn ) int (*fn)();
  3342. #endif /* CK_ANSIC */
  3343. { /* xkanjz */
  3344. /*
  3345.   Terminate xkanji
  3346.   This function must be called when Z-packet is received
  3347.   (before closing the file).
  3348. */
  3349.     static int obuf[6];
  3350.     int r, i, c;
  3351.   
  3352.     if (fcharset == FC_JIS7) {
  3353.         c = 'A';            /* Dummy Roman character */
  3354.         r = jpnxas(c, obuf) - 1;    /* -1 removes Dummy character */
  3355.         if (r > 0) {
  3356.         for (i = 0; i < r; i++)
  3357.           if ( ((*fn)((char) obuf[i])) < 0 )
  3358.         return( -1 );
  3359.     }
  3360.     }
  3361.     return( 0 );
  3362. }
  3363.  
  3364. int
  3365. #ifdef CK_ANSIC
  3366. xkanji(int a, int (*fn)(char))
  3367. #else
  3368. xkanji(a, fn) int a; int (*fn)();
  3369. #endif /* CK_ANSIC */
  3370. { /* xkanji */
  3371.     static int xbuf[2];
  3372.     static int obuf[8];
  3373.  
  3374.     int i, r;
  3375.     int c7;
  3376.     int state;
  3377.  
  3378.     r = 0;
  3379.     if (jpncnt == 0) {
  3380.     /* 1st byte */
  3381.     if ( (a & 0x80) == 0 ) {
  3382.         /* 8th bit is 0, i.e., single-byte code */
  3383.         r = jpnxas(a, obuf);
  3384.         state = 0;
  3385.     } else {
  3386.         /* 8th bit is 1, check the range */
  3387.         c7 = a & 0x7f;
  3388.         if ( ((c7 > 0x20) && (c7 < 0x7f)) || (c7 == 0x0e) ) {
  3389.             /* double byte code */
  3390.             xbuf[jpncnt++] = a;
  3391.         } else {
  3392.             /* single byte code */
  3393.             r = jpnxas(a, obuf);
  3394.             state = 0;
  3395.         }
  3396.     }
  3397.     } else {
  3398.     /* not the 1st byte */
  3399.     xbuf[jpncnt++] = a;
  3400.     if (xbuf[0] == 0x8e) {
  3401.         r = jpnxkt( xbuf[1], obuf );
  3402.         state = 1;
  3403.     } else {
  3404.         r = jpnxkn(xbuf, obuf);
  3405.         state = 2;
  3406.     }
  3407.     }
  3408.     if (r > 0) {
  3409.         for (i = 0; i < r; i++ )
  3410.       if ( ((*fn)((char) obuf[i])) < 0 )
  3411.         return( -1 );
  3412.         jpnlst = state;
  3413.         jpncnt = 0;
  3414.     }
  3415.     return( 0 );
  3416. }
  3417.  
  3418. /*
  3419.   Function for translating from Japanese file character set
  3420.   to Japanese EUC transfer character set.
  3421.   Returns a pointer to a string containing 0, 1, or 2 bytes.
  3422. */
  3423.  
  3424. /* zkanji */
  3425. static int jpnstz;            /* status for JIS-7 */
  3426. static int jpnpnd;            /* number of pending bytes */
  3427. static int jpnpnt;            /* pending buffer index */
  3428. static int jpnpbf[8];            /* pending buffer */
  3429.  
  3430. int
  3431. zkanjf() {                /* Initialize */
  3432.     jpnstz = jpnpnd = jpnpnt = 0;
  3433.     return(0);
  3434. }
  3435.  
  3436. int
  3437. zkanjz() {
  3438.     return( 0 );
  3439. }
  3440.  
  3441. int
  3442. #ifdef CK_ANSIC
  3443. zkanji( int (*fn)(void) )
  3444. #else
  3445. zkanji( fn ) int (*fn)();
  3446. #endif /* CK_ANSIC */
  3447. { /* zkanji */
  3448.     /* Read Japanese local code and translate to Japanese EUC */
  3449.     int a;
  3450.     int sc[3];
  3451.     
  3452.     /* No pending characters */
  3453.     if (fcharset == FC_SHJIS) {        /* Translating from Shift-JIS */
  3454.         if (jpnpnd) {
  3455.             jpnpnd--;
  3456.             return( jpnpbf[jpnpnt++] );
  3457.         }
  3458.         
  3459.         a = (*fn)();
  3460.     jpnpnd = jpnpnt = 0;
  3461.     if (((a >= 0x81) && (a <= 0x9f)) ||
  3462.         ((a >= 0xe0) && (a <= 0xfc))) { /* 2-byte Kanji code */
  3463.         sc[0] = a;
  3464.         if ((sc[1] = (*fn)()) < 0)    /* Get second byte */
  3465.           return( sc[1] );
  3466.         if (sc[0] <= 0x9f)
  3467.           sc[0] -= 0x71;
  3468.         else
  3469.           sc[0] -= 0xb1;
  3470.         sc[0] = sc[0] * 2 + 1;
  3471.         if (sc[1] > 0x7f)
  3472.           sc[1]--;
  3473.         if (sc[1] >= 0x9e) {
  3474.             sc[1] -= 0x7d;
  3475.             sc[0]++;
  3476.         } else {
  3477.             sc[1] -= 0x1f;
  3478.         }
  3479.         a = (sc[0] | 0x80);
  3480.         jpnpbf[0] = (sc[1] | 0x80);
  3481.         jpnpnd = 1;
  3482.         jpnpnt = 0;
  3483.     } else if ((a >= 0xa1) && (a <= 0xdf)) { /* Katakana */
  3484.         jpnpbf[0] = a;
  3485.         jpnpnd = 1;
  3486.         jpnpnt = 0;
  3487.         a = 0x8e;
  3488.     }
  3489.     return(a);
  3490.     } else if (fcharset == FC_JIS7 ) {    /* 7-bit JIS X 0208 */
  3491.         if (jpnpnd) {
  3492.             a = jpnpbf[jpnpnt++];
  3493.         jpnpnd--;
  3494.             return(a);
  3495.         }
  3496.         jpnpnt = 0;
  3497.         if ((a = (*fn)()) < 0)
  3498.       return(a);
  3499.         while (jpnpnd == 0) {
  3500.             if ((a > 0x20) && (a < 0x7f)) {
  3501.                 switch (jpnstz) {
  3502.           case 1:
  3503.             jpnpbf[jpnpnd++] = 0x80; /* Katakana */
  3504.             jpnpbf[jpnpnd++] = (a | 0x80);
  3505.             break;
  3506.           case 2:
  3507.             jpnpbf[jpnpnd++] = (a | 0x80); /* Kanji */
  3508.             if ((a = (*fn)()) < 0)
  3509.               return(a);
  3510.             jpnpbf[jpnpnd++] = (a | 0x80);
  3511.             break;
  3512.           default:
  3513.             jpnpbf[jpnpnd++] = a; /* Single byte */
  3514.             break;
  3515.                 }
  3516.             } else if (a == 0x0e) {
  3517.                 jpnstz = 1;
  3518.                 if ((a = (*fn)()) < 0)
  3519.           return(a);
  3520.             } else if (a == 0x0f) {
  3521.                 jpnstz = 0;
  3522.                 if ((a = (*fn)()) < 0)
  3523.           return(a);
  3524.             } else if (a == 0x1b) {
  3525.                 jpnpbf[jpnpnd++] = a;    /* Escape */
  3526.                 if ((a = (*fn)()) < 0)
  3527.           return(a);
  3528.                 jpnpbf[jpnpnd++] = a;
  3529.                 if (a == '$') {
  3530.                     if ((a = (*fn)()) < 0)
  3531.               return(a);
  3532.                     jpnpbf[jpnpnd++] = a;
  3533.                     if ((a == '@') || (a == 'B')) {
  3534.                         jpnstz = 2;
  3535.             jpnpnt = jpnpnd = 0;
  3536.                         if ((a = (*fn)()) < 0)
  3537.               return(a);
  3538.                     }
  3539.                 } else if (a == '(') {
  3540.                     if ((a = (*fn)()) < 0)
  3541.               return( a );
  3542.                     jpnpbf[jpnpnd++] = a;
  3543.                     if ((a == 'B') || (a == 'J')) {
  3544.                         jpnstz = 0;
  3545.             jpnpnt = jpnpnd = 0;
  3546.                         if ((a = (*fn)()) < 0)
  3547.               return(a);
  3548.                     }
  3549.                 } else if (a == 0x1b) {
  3550.                     jpnpnt = jpnpnd = 0;
  3551.                     if ((a = (*fn)()) < 0)
  3552.               return(a);
  3553.                 }
  3554.             } else {
  3555.                 jpnpbf[jpnpnd++] = a;
  3556.             }
  3557.         }
  3558.         jpnpnt = 0;
  3559.         a = jpnpbf[jpnpnt++];
  3560.     jpnpnd--;
  3561.         return(a);
  3562.     } else {
  3563.         a = (*fn)();
  3564.         return(a);
  3565.     }
  3566. }
  3567. #endif /* KANJI */
  3568.  
  3569.  
  3570. /*  TABLES OF TRANSLATION FUNCTIONS */
  3571.  
  3572. /*
  3573.   First, the table of translation functions for RECEIVING files.
  3574.   That is, *from* the TRANSFER character set *to* the FILE character set,
  3575.   an array of pointers to functions.  The first index is the
  3576.   transfer syntax character set number, the second index is the file 
  3577.   character set number.
  3578.  
  3579.   These arrays must be fully populated, even if (as is the case with
  3580.   Kanji character sets), all the entries are NULL.  Otherwise, 
  3581.   subscript calculations will be wrong and we'll use the wrong functions.
  3582. */
  3583.  
  3584. #ifdef CK_ANSIC
  3585. CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR) = 
  3586. #else
  3587. CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])() = 
  3588. #endif /* CK_ANSIC */
  3589. {
  3590.     NULL,            /* 0,0 transparent to us ascii */
  3591.     NULL,            /* 0,1 transparent to uk ascii */
  3592.     NULL,            /* 0,2 transparent to dutch nrc */
  3593.     NULL,            /* 0,3 transparent to finnish nrc */
  3594.     NULL,            /* 0,4 transparent to french nrc */
  3595.     NULL,            /* 0,5 transparent to fr-canadian nrc */
  3596.     NULL,            /* 0,6 transparent to german nrc */
  3597.     NULL,            /* 0,7 transparent to hungarian nrc */
  3598.     NULL,            /* 0,8 transparent to italian nrc */
  3599.     NULL,            /* 0,9 transparent to norge/danish nrc */
  3600.     NULL,            /* 0,10 transparent to portuguese nrc */
  3601.     NULL,            /* 0,11 transparent to spanish nrc */
  3602.     NULL,            /* 0,12 transparent to swedish nrc */
  3603.     NULL,            /* 0,13 transparent to swiss nrc */
  3604.     NULL,            /* 0,14 transparent to latin-1 */
  3605.     NULL,            /* 0,15 transparent to latin-2 */
  3606.     NULL,            /* 0,16 transparent to DEC MCS */
  3607.     NULL,            /* 0,17 transparent to NeXT */
  3608.     NULL,            /* 0,18 transparent to CP437 */
  3609.     NULL,            /* 0,19 transparent to CP850 */
  3610.     NULL,            /* 0,20 transparent to CP852 */
  3611.     NULL,            /* 0,21 transparent to Macintosh Latin */
  3612.     NULL,            /* 0,22 transparent to DGI */
  3613.     NULL,            /* 0,23 transparent to Latin/Cyrillic */
  3614.     NULL,                       /* 0,24 transparent to CP866 */
  3615.     NULL,            /* 0,25 transparent to Short KOI-7 */
  3616.     NULL,                       /* 0,26 transparent to Old KOI-8 Cyrillic */
  3617.     NULL,            /* 0,27 transparent to JIS-7 */
  3618.     NULL,            /* 0,28 transparent to Shift-JIS */
  3619.     NULL,            /* 0,29 transparent to J-EUC */
  3620.     NULL,            /* 0,30 transparent to DEC Kanji */
  3621.     NULL,            /* 1,0 ascii to us ascii */
  3622.     NULL,            /* 1,1 ascii to uk ascii */
  3623.     NULL,            /* 1,2 ascii to dutch nrc */
  3624.     NULL,            /* 1,3 ascii to finnish nrc */
  3625.     NULL,            /* 1,4 ascii to french nrc */
  3626.     NULL,            /* 1,5 ascii to fr-canadian nrc */
  3627.     NULL,            /* 1,6 ascii to german nrc */
  3628.     NULL,            /* 1,7 ascii to hungarian nrc */
  3629.     NULL,            /* 1,8 ascii to italian nrc */
  3630.     NULL,            /* 1,9 ascii to norge/danish nrc */
  3631.     NULL,            /* 1,10 ascii to portuguese nrc */
  3632.     NULL,            /* 1,11 ascii to spanish nrc */
  3633.     NULL,            /* 1,12 ascii to swedish nrc */
  3634.     NULL,            /* 1,13 ascii to swiss nrc */
  3635.     NULL,            /* 1,14 ascii to latin-1 */
  3636.     NULL,            /* 1,15 ascii to latin-2 */
  3637.     NULL,            /* 1,16 ascii to DEC MCS */
  3638.     NULL,            /* 1,17 ascii to NeXT */
  3639.     NULL,            /* 1,18 ascii to CP437 */
  3640.     NULL,            /* 1,19 ascii to CP850 */
  3641.     NULL,            /* 1,20 ascii to CP852 */
  3642.     NULL,            /* 1,21 ascii to Macintosh Latin */
  3643.     NULL,            /* 1,22 ascii to DGI */
  3644.     xaslc,                      /* 1,23 ascii to Latin/Cyrillic */
  3645.     xasac,                      /* 1,24 ascii to CP866 */
  3646.     xassk,                      /* 1,25 ascii to Short KOI */
  3647.     xask8,                      /* 1,26 ascii to Old KOI-8 Cyrillic */
  3648.     NULL,            /* 1,27 ascii to JIS-7 */
  3649.     NULL,            /* 1,28 ascii to Shift-JIS */
  3650.     NULL,            /* 1,29 ascii to J-EUC */
  3651.     NULL,            /* 1,30 ascii to DEC Kanji */
  3652.     zl1as,            /* 2,0 latin-1 to us ascii */
  3653.     xl1uk,            /* 2,1 latin-1 to uk ascii */
  3654.     xl1du,            /* 2,2 latin-1 to dutch nrc */
  3655.     xl1fi,            /* 2,3 latin-1 to finnish nrc */
  3656.     xl1fr,            /* 2,4 latin-1 to french nrc */
  3657.     xl1fc,            /* 2,5 latin-1 to fr-canadian nrc */
  3658.     xl1ge,            /* 2,6 latin-1 to german nrc */
  3659.     xl1it,            /* 2,7 latin-1 to italian nrc */
  3660.     xl1hu,            /* 2,8 latin-1 to hungarian nrc */
  3661.     xl1no,            /* 2,9 latin-1 to norge/danish nrc */
  3662.     xl1po,            /* 2,10 latin-1 to portuguese nrc */
  3663.     xl1sp,            /* 2,11 latin-1 to spanish nrc */
  3664.     xl1sw,            /* 2,12 latin-1 to swedish nrc */
  3665.     xl1ch,            /* 2,13 latin-1 to swiss nrc */
  3666.     NULL,            /* 2,14 latin-1 to latin-1 */
  3667.     xl1l2,            /* 2,15 latin-1 to latin-2 */
  3668.     xl1dm,            /* 2,16 latin-1 to DEC MCS */
  3669.     xl1ne,            /* 2,17 latin-1 to NeXT */
  3670.     xl143,            /* 2,18 latin-1 to CP437 */
  3671.     xl185,            /* 2,19 latin-1 to CP850 */
  3672.     xl152,            /* 2,20 latin-1 to CP852 */
  3673.     xl1aq,            /* 2,21 latin-1 to Macintosh Latin */
  3674.     xl1dg,            /* 2,22 latin-1 to DGI */
  3675.     zl1as,            /* 2,23 latin-1 to Latin/Cyrillic */
  3676.     zl1as,                      /* 2,24 latin-1 to CP866 */
  3677.     xl1sk,                      /* 2,25 latin-1 to Short KOI */
  3678.     zl1as,                   /* 2,26 latin-1 to Old KOI-8 Cyrillic */
  3679.     NULL,            /* 2,27 latin-1 to JIS-7 */
  3680.     NULL,            /* 2,28 latin-1 to Shift-JIS */
  3681.     NULL,            /* 2,29 latin-1 to J-EUC */
  3682.     NULL,            /* 2,30 latin-1 to DEC Kanji */
  3683.     xl2as,            /* 3,0 latin-2 to us ascii */
  3684.     xl2as,            /* 3,1 latin-2 to uk ascii */
  3685.     xl2as,            /* 3,2 latin-2 to dutch nrc */
  3686.     xl2as,            /* 3,3 latin-2 to finnish nrc */
  3687.     xl2as,            /* 3,4 latin-2 to french nrc */
  3688.     xl2as,            /* 3,5 latin-2 to fr-canadian nrc */
  3689.     xl2as,            /* 3,6 latin-2 to german nrc */
  3690.     xl2as,            /* 3,7 latin-2 to italian nrc */
  3691.     xl2as,            /* 3,8 latin-2 to hungarian nrc */
  3692.     xl2as,            /* 3,9 latin-2 to norge/danish nrc */
  3693.     xl2as,            /* 3,10 latin-2 to portuguese nrc */
  3694.     xl2as,            /* 3,11 latin-2 to spanish nrc */
  3695.     xl2as,            /* 3,12 latin-2 to swedish nrc */
  3696.     xl2as,            /* 3,13 latin-2 to swiss nrc */
  3697.     xl2l1,            /* 3,14 latin-2 to latin-1 */
  3698.     NULL,            /* 3,15 latin-2 to latin-2 */
  3699.     xl2l1,            /* 3,16 latin-2 to DEC MCS */
  3700.     xl2ne,            /* 3,17 latin-2 to NeXT */
  3701.     xl243,            /* 3,18 latin-2 to CP437 */
  3702.     xl285,            /* 3,19 latin-2 to CP850 */
  3703.     xl252,            /* 3,20 latin-2 to CP852 */
  3704.     xl2aq,            /* 3,21 latin-2 to Macintosh Latin */
  3705.     xl2dg,            /* 3,22 latin-2 to DGI */
  3706.     xl2as,            /* 3,23 latin-2 to Latin/Cyrillic */
  3707.     xl2as,                      /* 3,24 latin-2 to CP866 */
  3708.     xl2sk,                      /* 3,25 latin-2 to Short KOI */
  3709.     xl2as,                   /* 3,26 latin-2 to Old KOI-8 Cyrillic */
  3710.     NULL,            /* 3,27 latin-2 to JIS-7 */
  3711.     NULL,            /* 3,28 latin-2 to Shift-JIS */
  3712.     NULL,            /* 3,29 latin-2 to J-EUC */
  3713.     NULL,            /* 3,30 latin-2 to DEC Kanji */
  3714.     xlcas,            /* 4,0 latin/cyrillic to us ascii */
  3715.     xlcas,            /* 4,1 latin/cyrillic to uk ascii */
  3716.     xlcas,                 /* 4,2 latin/cyrillic to dutch nrc */
  3717.     xlcas,            /* 4,3 latin/cyrillic to finnish ascii */
  3718.     xlcas,            /* 4,4 latin/cyrillic to french nrc */
  3719.     xlcas,            /* 4,5 latin/cyrillic to fr-canadian nrc */
  3720.     xlcas,            /* 4,6 latin/cyrillic to german nrc */
  3721.     xlcas,            /* 4,7 latin/cyrillic to italian nrc */
  3722.     xlcas,            /* 4,8 latin/cyrillic to hungarian nrc */
  3723.     xlcas,            /* 4,9 latin/cyrillic to norge/danish nrc */
  3724.     xlcas,            /* 4,10 latin/cyrillic to portuguese nrc */
  3725.     xlcas,            /* 4,11 latin/cyrillic to spanish nrc */
  3726.     xlcas,            /* 4,12 latin/cyrillic to swedish nrc */
  3727.     xlcas,            /* 4,13 latin/cyrillic to swiss nrc */
  3728.     xlcas,            /* 4,14 latin/cyrillic to latin-1 */
  3729.     xlcas,            /* 4,15 latin/cyrillic to latin-2 */
  3730.     xlcas,            /* 4,16 latin/cyrillic to DEC MCS */
  3731.     xlcas,            /* 4,17 latin/cyrillic to NeXT */
  3732.     xlcas,            /* 4,18 latin/cyrillic to CP437 */
  3733.     xlcas,            /* 4,19 latin/cyrillic to CP850 */
  3734.     xlcas,            /* 4,20 latin/cyrillic to CP852 */
  3735.     xlcas,            /* 4,21 latin/cyrillic to Macintosh Latin */
  3736.     xlcas,            /* 4,22 latin/cyrillic to DGI */
  3737.     NULL,                       /* 4,23 latin/cyrillic to Latin/Cyrillic */
  3738.     xlcac,                      /* 4,24 latin/cyrillic to CP866 */
  3739.     xlcsk,                      /* 4,25 latin/cyrillic to Short KOI */
  3740.     xlck8,                   /* 4,26 latin/cyrillic to Old KOI-8 Cyrillic */
  3741.     NULL,            /* 4,27 latin/cyril to JIS-7 */
  3742.     NULL,            /* 4,28 latin/cyril to Shift-JIS */
  3743.     NULL,            /* 4,29 latin/cyril to J-EUC */
  3744.     NULL,            /* 4,30 latin/cyril to DEC Kanji */
  3745.  
  3746. /* Kanji to others ... */
  3747.  
  3748.     NULL,            /* 5,00 */
  3749.     NULL,            /* 5,01 */
  3750.     NULL,            /* 5,02 */
  3751.     NULL,            /* 5,03 */
  3752.     NULL,            /* 5,04 */
  3753.     NULL,            /* 5,05 */
  3754.     NULL,            /* 5,06 */
  3755.     NULL,            /* 5,07 */
  3756.     NULL,            /* 5,08 */
  3757.     NULL,            /* 5,09 */
  3758.     NULL,            /* 5,10 */
  3759.     NULL,            /* 5,11 */
  3760.     NULL,            /* 5,12 */
  3761.     NULL,            /* 5,13 */
  3762.     NULL,            /* 5,14 */
  3763.     NULL,            /* 5,15 */
  3764.     NULL,            /* 5,16 */
  3765.     NULL,            /* 5,17 */
  3766.     NULL,            /* 5,18 */
  3767.     NULL,            /* 5,19 */
  3768.     NULL,            /* 5,20 */
  3769.     NULL,            /* 5,21 */
  3770.     NULL,            /* 5,22 */
  3771.     NULL,            /* 5,23 */
  3772.     NULL,            /* 5,24 */
  3773.     NULL,            /* 5,25 */
  3774.     NULL,            /* 5,26 */
  3775.     NULL,            /* 5,27 */
  3776.     NULL,            /* 5,28 */
  3777.     NULL,            /* 5,29 */
  3778.     NULL            /* 5,30 */
  3779. };
  3780.  
  3781. /*
  3782.   Translation function table for sending files.
  3783.   Array of pointers to functions for translating from the local file
  3784.   character set to the transfer syntax character set.  Indexed in the same
  3785.   way as the xlr array above.
  3786. */
  3787. #ifdef CK_ANSIC
  3788. CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
  3789. #else
  3790. CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])() =
  3791. #endif /* CK_ANSIC */
  3792. {
  3793.     NULL,            /* 0,0 us ascii to transparent */
  3794.     NULL,            /* 0,1 uk ascii to transparent */
  3795.     NULL,            /* 0,2 dutch nrc to transparent */
  3796.     NULL,            /* 0,3 finnish nrc to transparent */
  3797.     NULL,            /* 0,4 french nrc to transparent */
  3798.     NULL,            /* 0,5 fr-canadian nrc to transparent */
  3799.     NULL,            /* 0,6 german nrc to transparent */
  3800.     NULL,            /* 0,7 hungarian nrc to transparent */
  3801.     NULL,            /* 0,8 italian nrc to transparent */
  3802.     NULL,            /* 0,9 norge/danish nrc to transparent */
  3803.     NULL,            /* 0,10 portuguese nrc to transparent */
  3804.     NULL,            /* 0,11 spanish nrc to transparent */
  3805.     NULL,            /* 0,12 swedish nrc to transparent */
  3806.     NULL,            /* 0,13 swiss nrc to transparent */
  3807.     NULL,            /* 0,14 latin-1 to transparent */
  3808.     NULL,            /* 0,15 latin-2 to transparent */
  3809.     NULL,            /* 0,16 DEC MCS to transparent */
  3810.     NULL,            /* 0,17 NeXT to transparent */
  3811.     NULL,            /* 0,18 CP437 to transparent */
  3812.     NULL,            /* 0,19 CP850 to transparent */
  3813.     NULL,            /* 0,20 CP852 to transparent */
  3814.     NULL,            /* 0,21 Macintosh Latin to transparent */
  3815.     NULL,            /* 0,22 DGI to transparent */
  3816.     NULL,            /* 0,23 Latin/Cyrillic to transparent */
  3817.     NULL,                       /* 0,24 CP866 to transparent */
  3818.     NULL,                       /* 0,25 Short KOI to transparent */
  3819.     NULL,                       /* 0,26 Old KOI-8 to transparent */
  3820.     NULL,            /* 0,27 JIS-7 to transparent */
  3821.     NULL,            /* 0,28 Shift JIS to transparent */
  3822.     NULL,            /* 0,29 Japanese EUC to transparent */
  3823.     NULL,            /* 0,30 DEC Kanji to transparent */
  3824.     NULL,            /* 1,0 us ascii to ascii */
  3825.     NULL,            /* 1,1 uk ascii to ascii */
  3826.     xduas,            /* 1,2 dutch nrc to ascii */
  3827.     xfias,            /* 1,3 finnish nrc to ascii */
  3828.     xfras,            /* 1,4 french nrc to ascii */
  3829.     xfcas,            /* 1,5 french canadian nrc to ascii */
  3830.     xgeas,            /* 1,6 german nrc to ascii */
  3831.     xhuas,            /* 1,7 hungarian nrc to ascii */
  3832.     xitas,            /* 1,8 italian nrc to ascii */
  3833.     xnoas,            /* 1,9 norwegian/danish nrc to ascii */
  3834.     xpoas,            /* 1,10 portuguese nrc to ascii */
  3835.     xspas,            /* 1,11 spanish nrc to ascii */
  3836.     xswas,            /* 1,12 swedish nrc to ascii */
  3837.     xchas,            /* 1,13 swiss nrc to ascii */
  3838.     xl1as,            /* 1,14 latin-1 to ascii */
  3839.     xl2as,            /* 1,15 latin-2 to ascii */
  3840.     xdmas,            /* 1,16 dec mcs to ascii */
  3841.     xneas,            /* 1,17 NeXT to ascii */
  3842.     x43as,            /* 1,18 CP437 to ascii */
  3843.     x85as,            /* 1,19 CP850 to ascii */
  3844.     x52as,            /* 1,20 CP850 to ascii */
  3845.     xaqas,            /* 1,21 Macintosh Latin to ascii */
  3846.     xdgas,            /* 1,22 DGI to ascii */
  3847.     xlcas,            /* 1,23 Latin/Cyrillic to ASCII */
  3848.     xacas,                      /* 1,24 CP866 to ASCII */
  3849.     xskas,            /* 1,25 Short KOI to ASCII */
  3850.     xk8as,                      /* 1,26 Old KOI-8 Cyrillic to ASCII */
  3851.     NULL,            /* 1,27 */
  3852.     NULL,            /* 1,28 */
  3853.     NULL,            /* 1,29 */
  3854.     NULL,            /* 1,30 */
  3855.     NULL,            /* 2,0 us ascii to latin-1 */
  3856.     xukl1,            /* 2,1 uk ascii to latin-1 */
  3857.     xdul1,            /* 2,2 dutch nrc to latin-1 */
  3858.     xfil1,            /* 2,3 finnish nrc to latin-1 */
  3859.     xfrl1,            /* 2,4 french nrc to latin-1 */
  3860.     xfcl1,            /* 2,5 french canadian nrc to latin-1 */
  3861.     xgel1,            /* 2,6 german nrc to latin-1 */
  3862.     xhul1,            /* 2,7 hungarian nrc to latin-1 */
  3863.     xitl1,            /* 2,8 italian nrc to latin-1 */
  3864.     xnol1,            /* 2,9 norwegian/danish nrc to latin-1 */
  3865.     xpol1,            /* 2,10 portuguese nrc to latin-1 */
  3866.     xspl1,            /* 2,11 spanish nrc to latin-1 */
  3867.     xswl1,            /* 2,12 swedish nrc to latin-1 */
  3868.     xchl1,            /* 2,13 swiss nrc to latin-1 */
  3869.     NULL,            /* 2,14 latin-1 to latin-1 */
  3870.     xl2l1,            /* 2,15 latin-2 to latin-1 */
  3871.     xdml1,            /* 2,16 dec mcs to latin-1 */
  3872.     xnel1,                      /* 2,17 NeXT to Latin-1 */
  3873.     x43l1,                      /* 2,18 CP437 to Latin-1 */
  3874.     x85l1,                      /* 2,19 CP850 to Latin-1 */
  3875.     x52l1,                      /* 2,20 CP852 to Latin-1 */
  3876.     xaql1,                      /* 2,21 Macintosh Latin to Latin-1 */
  3877.     xdgl1,                      /* 2,22 DGI to Latin-1 */
  3878.     xlcas,                      /* 2,23 Latin/Cyrillic to Latin-1 */
  3879.     xacas,                      /* 2,24 CP866 to Latin-1 */
  3880.     xskas,                      /* 2,25 Short KOI to Latin-1 */
  3881.     xk8as,                      /* 2,26 Old KOI-8 Cyrillic to Latin-1 */
  3882.     NULL,            /* 2,27 Kanji ... */
  3883.     NULL,            /* 2,28 */
  3884.     NULL,            /* 2,29 */
  3885.     NULL,            /* 2,30 */
  3886.     NULL,            /* 3,0 us ascii to latin-2 */
  3887.     NULL,            /* 3,1 uk ascii to latin-2 */
  3888.     xduas,            /* 3,2 dutch nrc to latin-2 */
  3889.     xfias,            /* 3,3 finnish nrc to latin-2 */
  3890.     xfras,            /* 3,4 french nrc to latin-2 */
  3891.     xfcas,            /* 3,5 french canadian nrc to latin-2 */
  3892.     xgel2,            /* 3,6 german nrc to latin-2 */
  3893.     xhul2,            /* 3,7 hungarian nrc to latin-2 */
  3894.     xitas,            /* 3,8 italian nrc to latin-2 */
  3895.     xnoas,            /* 3,9 norwegian/danish nrc to latin-2 */
  3896.     xpoas,            /* 3,10 portuguese nrc to latin-2 */
  3897.     xspas,            /* 3,11 spanish nrc to latin-2 */
  3898.     xswas,            /* 3,12 swedish nrc to latin-2 */
  3899.     xchas,            /* 3,13 swiss nrc to latin-2 */
  3900.     xl1l2,            /* 3,14 latin-1 to latin-2 */
  3901.     NULL,            /* 3,15 latin-2 to latin-2 */
  3902.     xl1l2,            /* 3,16 dec mcs to latin-2 */
  3903.     xnel2,                      /* 3,17 NeXT to Latin-2 */
  3904.     x43l2,                      /* 3,18 CP437 to Latin-2 */
  3905.     x85l2,                      /* 3,19 CP850 to Latin-2 */
  3906.     x52l2,                      /* 3,20 CP852 to Latin-2 */
  3907.     xaql2,                      /* 3,21 Macintosh Latin to Latin-2 */
  3908.     xdgl2,                      /* 3,22 DGI to Latin-2 */
  3909.     xlcas,                      /* 3,23 Latin/Cyrillic to Latin-2 */
  3910.     xacas,                      /* 3,24 CP866 to Latin-2 */
  3911.     xskas,                      /* 3,25 Short KOI to Latin-2 */
  3912.     xk8as,                      /* 3,26 Old KOI-8 Cyrillic to Latin-2 */
  3913.     NULL,            /* 3,27 Kanji ... */
  3914.     NULL,            /* 3,28 */
  3915.     NULL,            /* 3,29 */
  3916.     NULL,            /* 3,30 */
  3917.     xaslc,            /* 4,0 us ascii to latin/cyrillic */
  3918.     xaslc,            /* 4,1 uk ascii to latin/cyrillic */
  3919.     xduas,            /* 4,2 dutch nrc to latin/cyrillic */
  3920.     xfias,            /* 4,3 finnish nrc to latin/cyrillic */
  3921.     xfras,            /* 4,4 french nrc to latin/cyrillic */
  3922.     xfcas,            /* 4,5 french canadian nrc to latin/cyrillic */
  3923.     xgeas,            /* 4,6 german nrc to latin/cyrillic */
  3924.     xhuas,            /* 4,7 hungarian nrc to latin/cyrillic */
  3925.     xitas,            /* 4,8 italian nrc to latin/cyrillic */
  3926.     xnoas,            /* 4,9 norge/danish nrc to latin/cyrillic */
  3927.     xpoas,            /* 4,10 portuguese nrc to latin/cyrillic */
  3928.     xspas,            /* 4,11 spanish nrc to latin/cyrillic */
  3929.     xswas,            /* 4,12 swedish nrc to latin/cyrillic */
  3930.     xchas,            /* 4,13 swiss nrc to latin/cyrillic */
  3931.     xl1as,            /* 4,14 latin-1 to latin/cyrillic */
  3932.     xl2as,            /* 4,15 latin-2 to latin/cyrillic */
  3933.     xdmas,            /* 4,16 dec mcs to latin/cyrillic */
  3934.     xneas,            /* 4,17 NeXT to latin/cyrillic */
  3935.     x43as,            /* 4,18 CP437 to latin/cyrillic */
  3936.     x85as,            /* 4,19 CP850 to latin/cyrillic */
  3937.     x52as,            /* 4,20 CP852 to latin/cyrillic */
  3938.     xaqas,            /* 4,21 Macintosh Latin to latin/cyrillic */
  3939.     xdgas,            /* 4,22 DGI to Latin/Cyrillic */
  3940.     NULL,                       /* 4,23 Latin/Cyrillic to Latin/Cyrillic */
  3941.     xaclc,                      /* 4,24 CP866 to Latin/Cyrillic */
  3942.     xskcy,                      /* 4,25 Short KOI to Latin/Cyrillic */
  3943.     xk8lc,                      /* 4,26 Old KOI-8 Cyrillic to Latin/Cyrillic */
  3944.     NULL,            /* 4,27 Kanji... */
  3945.     NULL,            /* 4,28 */
  3946.     NULL,            /* 4,29 */
  3947.     NULL,            /* 4,30 */
  3948.     NULL,            /* 5,00 */
  3949.     NULL,            /* 5,01 */
  3950.     NULL,            /* 5,02 */
  3951.     NULL,            /* 5,03 */
  3952.     NULL,            /* 5,04 */
  3953.     NULL,            /* 5,05 */
  3954.     NULL,            /* 5,06 */
  3955.     NULL,            /* 4.07 */
  3956.     NULL,            /* 5,08 */
  3957.     NULL,            /* 5,09 */
  3958.     NULL,            /* 5,10 */
  3959.     NULL,            /* 5,11 */
  3960.     NULL,            /* 5,12 */
  3961.     NULL,            /* 5,13 */
  3962.     NULL,            /* 5,14 */
  3963.     NULL,            /* 5,15 */
  3964.     NULL,            /* 5,16 */
  3965.     NULL,            /* 5,17 */
  3966.     NULL,            /* 5,18 */
  3967.     NULL,            /* 5,19 */
  3968.     NULL,            /* 5,20 */
  3969.     NULL,            /* 5,21 */
  3970.     NULL,            /* 5,22 */
  3971.     NULL,            /* 5,23 */
  3972.     NULL,            /* 5,24 */
  3973.     NULL,            /* 5,25 */
  3974.     NULL,            /* 5,26 */
  3975.     NULL,            /* 5,27 */
  3976.     NULL,            /* 5,28 */
  3977.     NULL,            /* 5,29 */
  3978.     NULL,            /* 5,30 */
  3979. };
  3980. #endif /* NOCSETS */
  3981.