home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ptx-0.4-src.tgz / ptx-0.4-src.tar / fsf / ptx / diacrit.c < prev    next >
C/C++ Source or Header  |  1996-09-28  |  7KB  |  149 lines

  1. /* Diacritics processing for a few character codes.
  2.    Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  3.    Francois Pinard <pinard@iro.umontreal.ca>, 1988.
  4.  
  5.    All this file is a temporary hack, waiting for locales in GNU.
  6. */
  7.  
  8. #ifdef HAVE_CONFIG_H
  9. # include <config.h>
  10. #endif
  11.  
  12. #include "diacrit.h"
  13.  
  14. /* ISO 8859-1 Latin-1 code is used as the underlying character set.  If
  15.    MSDOS is defined, IBM-PC's character set code is used instead.  */
  16.  
  17. /*--------------------------------------------------------------------.
  18. | For each alphabetic character, returns what it would be without its |
  19. | possible diacritic symbol.                          |
  20. `--------------------------------------------------------------------*/
  21.  
  22. const char diacrit_base[256] =
  23. {
  24.   0,      0,      0,      0,      0,      0,      0,      0,
  25.   0,      0,      0,      0,      0,      0,      0,      0,
  26.   0,      0,      0,      0,      0,      0,      0,      0,
  27.   0,      0,      0,      0,      0,      0,      0,      0,
  28.   0,      0,      0,      0,      0,      0,      0,      0,
  29.   0,      0,      0,      0,      0,      0,      0,      0,
  30.   0,      0,      0,      0,      0,      0,      0,      0,
  31.   0,      0,      0,      0,      0,      0,      0,      0,
  32.   0,      'A',    'B',    'C',    'D',    'E',    'F',    'G',
  33.   'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
  34.   'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
  35.   'X',    'Y',    'Z',    0,      0,      0,      0,      0,
  36.   0,      'a',    'b',    'c',    'd',    'e',    'f',    'g',
  37.   'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
  38.   'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
  39.   'x',    'y',    'z',    0,      0,      0,      0,      0,
  40.  
  41. #ifdef MSDOS
  42.  
  43.   'C',    'u',    'e',    'a',    'a',    'a',    'a',    'c',
  44.   'e',    'e',    'e',    'i',    'i',    'i',    'A',    'A',
  45.   'E',    'e',    'E',    'o',    'o',    'o',    'u',    'u',
  46.   'y',    'O',    'U',    0,      0,      0,      0,      0,
  47.   'a',    'i',    'o',    'u',    'n',    'N',    0,      0,
  48.   0,      0,      0,      0,      0,      0,      0,      0,
  49.   0,      0,      0,      0,      0,      0,      0,      0,
  50.   0,      0,      0,      0,      0,      0,      0,      0,
  51.   0,      0,      0,      0,      0,      0,      0,      0,
  52.   0,      0,      0,      0,      0,      0,      0,      0,
  53.   0,      0,      0,      0,      0,      0,      0,      0,
  54.   0,      0,      0,      0,      0,      0,      0,      0,
  55.   0,      0,      0,      0,      0,      0,      0,      0,
  56.   0,      0,      0,      0,      0,      0,      0,      0,
  57.   0,      0,      0,      0,      0,      0,      0,      0,
  58.   0,      0,      0,      0,      0,      0,      0,      0,
  59.  
  60. #else /* not MSDOS */
  61.  
  62.   0,      0,      0,      0,      0,      0,      0,      0,
  63.   0,      0,      0,      0,      0,      0,      0,      0,
  64.   0,      0,      0,      0,      0,      0,      0,      0,
  65.   0,      0,      0,      0,      0,      0,      0,      0,
  66.   0,      0,      0,      0,      0,      0,      0,      0,
  67.   0,      0,      0,      0,      0,      0,      0,      0,
  68.   0,      0,      0,      0,      0,      0,      0,      0,
  69.   0,      0,      0,      0,      0,      0,      0,      0,
  70.   'A',    'A',    'A',    'A',    'A',    'A',    'A',    'C',
  71.   'E',    'E',    'E',    'E',    'I',    'I',    'I',    'I',
  72.   0,      'N',    'O',    'O',    'O',    'O',    'O',    0,
  73.   'O',    'U',    'U',    'U',    'U',    'Y',    0,      0,
  74.   'a',    'a',    'a',    'a',    'a',    'a',    'a',    'c',
  75.   'e',    'e',    'e',    'e',    'i',    'i',    'i',    'i',
  76.   0,      'n',    'o',    'o',    'o',    'o',    'o',    0,
  77.   'o',    'u',    'u',    'u',    'u',    'y',    0,      'y',
  78.  
  79. #endif /* not MSDOS */
  80. };
  81.  
  82. /*------------------------------------------------------------------------.
  83. | For each alphabetic character, returns a code of what its diacritic is, |
  84. | according to the following codes: 1 (eE) over aA for latin diphtongs; 2 |
  85. | (') acute accent; 3 (`) grave accent; 4 (^) circumflex accent; 5 (")      |
  86. | umlaut or diaraesis; 6 (~) tilda; 7 (,) cedilla; 8 (o) covering degree  |
  87. | symbol; 9 (|) slashed character.                      |
  88. `------------------------------------------------------------------------*/
  89.  
  90. const char diacrit_diac[256] =
  91. {
  92.   0,      0,      0,      0,      0,      0,      0,      0,
  93.   0,      0,      0,      0,      0,      0,      0,      0,
  94.   0,      0,      0,      0,      0,      0,      0,      0,
  95.   0,      0,      0,      0,      0,      0,      0,      0,
  96.   0,      0,      0,      0,      0,      0,      0,      0,
  97.   0,      0,      0,      0,      0,      0,      0,      0,
  98.   0,      0,      0,      0,      0,      0,      0,      0,
  99.   0,      0,      0,      0,      0,      0,      0,      0,
  100.   0,      0,      0,      0,      0,      0,      0,      0,
  101.   0,      0,      0,      0,      0,      0,      0,      0,
  102.   0,      0,      0,      0,      0,      0,      0,      0,
  103.   0,      0,      0,      0,      0,      0,      4,      0,
  104.   3,      0,      0,      0,      0,      0,      0,      0,
  105.   0,      0,      0,      0,      0,      0,      0,      0,
  106.   0,      0,      0,      0,      0,      0,      0,      0,
  107.   0,      0,      0,      0,      0,      0,      6,      0,
  108.  
  109. #ifdef MSDOS
  110.  
  111.   7,      5,      2,      4,      5,      3,      8,      7,
  112.   4,      5,      3,      5,      4,      3,      5,      8,
  113.   2,      1,      1,      4,      5,      3,      4,      3,
  114.   5,      5,      5,      0,      0,      0,      0,      0,
  115.   2,      2,      2,      2,      6,      6,      0,      0,
  116.   0,      0,      0,      0,      0,      0,      0,      0,
  117.   0,      0,      0,      0,      0,      0,      0,      0,
  118.   0,      0,      0,      0,      0,      0,      0,      0,
  119.   0,      0,      0,      0,      0,      0,      0,      0,
  120.   0,      0,      0,      0,      0,      0,      0,      0,
  121.   0,      0,      0,      0,      0,      0,      0,      0,
  122.   0,      0,      0,      0,      0,      0,      0,      0,
  123.   0,      0,      0,      0,      0,      0,      0,      0,
  124.   0,      0,      0,      0,      0,      0,      0,      0,
  125.   0,      0,      0,      0,      0,      0,      0,      0,
  126.   0,      0,      0,      0,      0,      0,      0,      0,
  127.  
  128. #else /* not MSDOS */
  129.  
  130.   0,      0,      0,      0,      0,      0,      0,      0,
  131.   0,      0,      0,      0,      0,      0,      0,      0,
  132.   0,      0,      0,      0,      0,      0,      0,      0,
  133.   0,      0,      0,      0,      0,      0,      0,      0,
  134.   0,      0,      0,      0,      0,      0,      0,      0,
  135.   0,      0,      0,      0,      0,      0,      0,      0,
  136.   0,      0,      0,      0,      0,      0,      0,      0,
  137.   0,      0,      0,      0,      0,      0,      0,      0,
  138.   3,      2,      4,      6,      5,      8,      1,      7,
  139.   3,      2,      4,      5,      3,      2,      4,      5,
  140.   0,      6,      3,      2,      4,      6,      5,      0,
  141.   9,      3,      2,      4,      5,      2,      0,      0,
  142.   3,      2,      4,      6,      5,      8,      1,      7,
  143.   3,      2,      4,      5,      3,      2,      4,      5,
  144.   0,      6,      3,      2,      4,      6,      5,      0,
  145.   9,      3,      2,      4,      5,      2,      0,      0,
  146.  
  147. #endif /* not MSDOS */
  148. };
  149.