home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / old / ckermit5a188 / ckuxla.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  154KB  |  3,975 lines

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