home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnurecod.zip / lat1asci.c < prev    next >
C/C++ Source or Header  |  1994-10-11  |  7KB  |  183 lines

  1. /* Conversion of files between different charsets and usages.
  2.    Copyright (C) 1990, 1993, 1994 Free Software Foundation, Inc.
  3.    Francois Pinard <pinard@iro.umontreal.ca>, 1988.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful, but
  11.    WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. #include "recode.h"
  21.  
  22. static const char *const translation_table[128] =
  23.   {
  24.     NULL,            /* 128 */
  25.     NULL,            /* 129 */
  26.     NULL,            /* 130 */
  27.     NULL,            /* 131 */
  28.     NULL,            /* 132 */
  29.     NULL,            /* 133 */
  30.     NULL,            /* 134 */
  31.     NULL,            /* 135 */
  32.     NULL,            /* 136 */
  33.     NULL,            /* 137 */
  34.     NULL,            /* 138 */
  35.     NULL,            /* 139 */
  36.     NULL,            /* 140 */
  37.     NULL,            /* 141 */
  38.     NULL,            /* 142 */
  39.     NULL,            /* 143 */
  40.     NULL,            /* 144 */
  41.     NULL,            /* 145 */
  42.     NULL,            /* 146 */
  43.     NULL,            /* 147 */
  44.     NULL,            /* 148 */
  45.     NULL,            /* 149 */
  46.     NULL,            /* 150 */
  47.     NULL,            /* 151 */
  48.     NULL,            /* 152 */
  49.     NULL,            /* 153 */
  50.     NULL,            /* 154 */
  51.     NULL,            /* 155 */
  52.     NULL,            /* 156 */
  53.     NULL,            /* 157 */
  54.     NULL,            /* 158 */
  55.     NULL,            /* 159 */
  56.  
  57.     " ",            /* 160 no-break space */
  58.     NULL,            /* 161 inverted exclamation mark */
  59.     NULL,            /* 162 cent sign */
  60.     NULL,            /* 163 pound sign */
  61.     NULL,            /* 164 currency sign */
  62.     NULL,            /* 165 yen sign */
  63.     NULL,            /* 166 broken bar */
  64.     NULL,            /* 167 paragraph sign, section sign */
  65.     NULL,            /* 168 diaeresis */
  66.     NULL,            /* 169 copyright sign */
  67.     NULL,            /* 170 feminine ordinal indicator */
  68.     "<\b\"",            /* 171 left angle quotation mark */
  69.     NULL,            /* 172 not sign */
  70.     NULL,            /* 173 soft hyphen */
  71.     NULL,            /* 174 registered trade mark sign */
  72.     NULL,            /* 175 macron */
  73.     NULL,            /* 176 degree sign */
  74.     NULL,            /* 177 plus-minus sign */
  75.     NULL,            /* 178 superscript two */
  76.     NULL,            /* 179 superscript three */
  77.     NULL,            /* 180 acute accent */
  78.     NULL,            /* 181 small greek mu, micro sign */
  79.     NULL,            /* 182 pilcrow sign */
  80.     NULL,            /* 183 middle dot */
  81.     NULL,            /* 184 cedilla */
  82.     NULL,            /* 185 superscript one */
  83.     NULL,            /* 186 masculine ordinal indicator */
  84.     ">\b\"",            /* 187 right angle quotation mark */
  85.     NULL,            /* 188 vulgar fraction one quarter */
  86.     NULL,            /* 189 vulgar fraction one half */
  87.     NULL,            /* 190 vulgar fraction three quarters */
  88.     NULL,            /* 191 inverted question mark */
  89.     "`\bA",            /* 192 capital A with grave accent */
  90.     "'\bA",            /* 193 capital A with acute accent */
  91.     "^\bA",            /* 194 capital A with circumflex accent */
  92.     "~\bA",            /* 195 capital A with tilde */
  93.     "\"\bA",            /* 196 capital A diaeresis */
  94.     NULL,            /* 197 capital A with ring above */
  95.     NULL,            /* 198 capital diphthong A with E */
  96.     ",\bC",            /* 199 capital C with cedilla */
  97.     "`\bE",            /* 200 capital E with grave accent */
  98.     "'\bE",            /* 201 capital E with acute accent */
  99.     "^\bE",            /* 202 capital E with circumflex accent */
  100.     "\"\bE",            /* 203 capital E with diaeresis */
  101.     "`\bI",            /* 204 capital I with grave accent */
  102.     "'\bI",            /* 205 capital I with acute accent */
  103.     "^\bI",            /* 206 capital I with circumflex accent */
  104.     "\"\bI",            /* 207 capital I with diaeresis */
  105.     NULL,            /* 208 capital icelandic ETH */
  106.     "~\bN",            /* 209 capital N with tilde */
  107.     "`\bO",            /* 210 capital O with grave accent */
  108.     "'\bO",            /* 211 capital O with acute accent */
  109.     "^\bO",            /* 212 capital O with circumflex accent */
  110.     "~\bO",            /* 213 capital O with tilde */
  111.     "\"\bO",            /* 214 capital O with diaeresis */
  112.     NULL,            /* 215 multiplication sign */
  113.     "/\bO",            /* 216 capital O with oblique stroke */
  114.     "`\bU",            /* 217 capital U with grave accent */
  115.     "'\bU",            /* 218 capital U with acute accent */
  116.     "^\bU",            /* 219 capital U with circumflex accent */
  117.     "\"\bU",            /* 220 capital U with diaeresis */
  118.     "'\bY",            /* 221 capital Y with acute accent */
  119.     NULL,            /* 222 capital icelandic THORN */
  120.     "\"\bs",            /* 223 small german sharp s */
  121.     "`\ba",            /* 224 small a with grave accent */
  122.     "'\ba",            /* 225 small a with acute accent */
  123.     "^\ba",            /* 226 small a with circumflex accent */
  124.     "~\ba",            /* 227 small a with tilde */
  125.     "\"\ba",            /* 228 small a with diaeresis */
  126.     NULL,            /* 229 small a with ring above */
  127.     NULL,            /* 230 small diphthong a with e */
  128.     ",\bc",            /* 231 small c with cedilla */
  129.     "`\be",            /* 232 small e with grave accent */
  130.     "'\be",            /* 233 small e with acute accent */
  131.     "^\be",            /* 234 small e with circumflex accent */
  132.     "\"\be",            /* 235 small e with diaeresis */
  133.     "`\bi",            /* 236 small i with grave accent */
  134.     "'\bi",            /* 237 small i with acute accent */
  135.     "^\bi",            /* 238 small i with circumflex accent */
  136.     "\"\bi",            /* 239 small i with diaeresis */
  137.     NULL,            /* 240 small icelandic eth */
  138.     "~\bn",            /* 241 small n with tilde */
  139.     "`\bo",            /* 242 small o with grave accent */
  140.     "'\bo",            /* 243 small o with acute accent */
  141.     "^\bo",            /* 244 small o with circumflex accent */
  142.     "~\bo",            /* 245 small o with tilde */
  143.     "\"\bo",            /* 246 small o with diaeresis */
  144.     NULL,            /* 247 division sign */
  145.     "/\bo",            /* 248 small o with oblique stroke */
  146.     "`\bu",            /* 249 small u with grave accent */
  147.     "'\bu",            /* 250 small u with acute accent */
  148.     "^\bu",            /* 251 small u with circumflex accent */
  149.     "\"\bu",            /* 252 small u with diaeresis */
  150.     "'\by",            /* 253 small y with acute accent */
  151.     NULL,            /* 254 small icelandic thorn */
  152.     "\"\by",            /* 255 small y with diaeresis */
  153.   };
  154.  
  155. static void
  156. init_latin1_ascii (STEP *step)
  157. {
  158.   const char **table;
  159.   char *pool;
  160.   int counter;
  161.  
  162.   table = (const char **) xmalloc (256 * sizeof (char *) + 256);
  163.   pool = (char *) (table + 256);
  164.  
  165.   for (counter = 0; counter < 128; counter++)
  166.     {
  167.       table[counter] = pool;
  168.       *pool++ = counter;
  169.       *pool++ = '\0';
  170.     }
  171.   for (; counter < 256; counter++)
  172.     table[counter] = translation_table[counter - 128];
  173.  
  174.   step->one_to_many = table;
  175. }
  176.  
  177. void
  178. module_latin1_ascii (void)
  179. {
  180.   declare_step ("Latin-1", "ASCII-BS", ONE_TO_MANY, init_latin1_ascii,
  181.         file_one_to_many);
  182. }
  183.