home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckv192.zip / ckuxla.c < prev    next >
C/C++ Source or Header  |  1996-12-28  |  182KB  |  4,747 lines

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