*** empty log message ***
[gnulib.git] / lib / diacrit.c
1 /* Diacritics processing for a few character codes.
2    Copyright (C) 1990, 1991, 1992, 1993, 2000 Free Software Foundation, Inc.
3    François Pinard <pinard@iro.umontreal.ca>, 1988.
4
5    All this file is a temporary hack, waiting for locales in GNU.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2, or (at your option)
10    any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; see the file COPYING.
19    If not, write to the Free Software Foundation,
20    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
21
22 #ifdef HAVE_CONFIG_H
23 # include <config.h>
24 #endif
25
26 #include "diacrit.h"
27
28 /* ISO 8859-1 Latin-1 code is used as the underlying character set.  If
29    MSDOS is defined, IBM-PC's character set code is used instead.  */
30
31 /*--------------------------------------------------------------------.
32 | For each alphabetic character, returns what it would be without its |
33 | possible diacritic symbol.                                          |
34 `--------------------------------------------------------------------*/
35
36 const char diacrit_base[256] =
37 {
38   0,      0,      0,      0,      0,      0,      0,      0,
39   0,      0,      0,      0,      0,      0,      0,      0,
40   0,      0,      0,      0,      0,      0,      0,      0,
41   0,      0,      0,      0,      0,      0,      0,      0,
42   0,      0,      0,      0,      0,      0,      0,      0,
43   0,      0,      0,      0,      0,      0,      0,      0,
44   0,      0,      0,      0,      0,      0,      0,      0,
45   0,      0,      0,      0,      0,      0,      0,      0,
46   0,      'A',    'B',    'C',    'D',    'E',    'F',    'G',
47   'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
48   'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
49   'X',    'Y',    'Z',    0,      0,      0,      0,      0,
50   0,      'a',    'b',    'c',    'd',    'e',    'f',    'g',
51   'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
52   'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
53   'x',    'y',    'z',    0,      0,      0,      0,      0,
54
55 #ifdef __MSDOS__
56
57   'C',    'u',    'e',    'a',    'a',    'a',    'a',    'c',
58   'e',    'e',    'e',    'i',    'i',    'i',    'A',    'A',
59   'E',    'e',    'E',    'o',    'o',    'o',    'u',    'u',
60   'y',    'O',    'U',    0,      0,      0,      0,      0,
61   'a',    'i',    'o',    'u',    'n',    'N',    0,      0,
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   0,      0,      0,      0,      0,      0,      0,      0,
71   0,      0,      0,      0,      0,      0,      0,      0,
72   0,      0,      0,      0,      0,      0,      0,      0,
73
74 #else
75
76   0,      0,      0,      0,      0,      0,      0,      0,
77   0,      0,      0,      0,      0,      0,      0,      0,
78   0,      0,      0,      0,      0,      0,      0,      0,
79   0,      0,      0,      0,      0,      0,      0,      0,
80   0,      0,      0,      0,      0,      0,      0,      0,
81   0,      0,      0,      0,      0,      0,      0,      0,
82   0,      0,      0,      0,      0,      0,      0,      0,
83   0,      0,      0,      0,      0,      0,      0,      0,
84   'A',    'A',    'A',    'A',    'A',    'A',    'A',    'C',
85   'E',    'E',    'E',    'E',    'I',    'I',    'I',    'I',
86   0,      'N',    'O',    'O',    'O',    'O',    'O',    0,
87   'O',    'U',    'U',    'U',    'U',    'Y',    0,      0,
88   'a',    'a',    'a',    'a',    'a',    'a',    'a',    'c',
89   'e',    'e',    'e',    'e',    'i',    'i',    'i',    'i',
90   0,      'n',    'o',    'o',    'o',    'o',    'o',    0,
91   'o',    'u',    'u',    'u',    'u',    'y',    0,      'y',
92
93 #endif
94 };
95
96 /*------------------------------------------------------------------------.
97 | For each alphabetic character, returns a code of what its diacritic is, |
98 | according to the following codes: 1 (eE) over aA for latin diphtongs; 2 |
99 | (') acute accent; 3 (`) grave accent; 4 (^) circumflex accent; 5 (")    |
100 | umlaut or diaraesis; 6 (~) tilda; 7 (,) cedilla; 8 (o) covering degree  |
101 | symbol; 9 (|) slashed character.                                        |
102 `------------------------------------------------------------------------*/
103
104 const char diacrit_diac[256] =
105 {
106   0,      0,      0,      0,      0,      0,      0,      0,
107   0,      0,      0,      0,      0,      0,      0,      0,
108   0,      0,      0,      0,      0,      0,      0,      0,
109   0,      0,      0,      0,      0,      0,      0,      0,
110   0,      0,      0,      0,      0,      0,      0,      0,
111   0,      0,      0,      0,      0,      0,      0,      0,
112   0,      0,      0,      0,      0,      0,      0,      0,
113   0,      0,      0,      0,      0,      0,      0,      0,
114   0,      0,      0,      0,      0,      0,      0,      0,
115   0,      0,      0,      0,      0,      0,      0,      0,
116   0,      0,      0,      0,      0,      0,      0,      0,
117   0,      0,      0,      0,      0,      0,      4,      0,
118   3,      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,      6,      0,
122
123 #ifdef __MSDOS__
124
125   7,      5,      2,      4,      5,      3,      8,      7,
126   4,      5,      3,      5,      4,      3,      5,      8,
127   2,      1,      1,      4,      5,      3,      4,      3,
128   5,      5,      5,      0,      0,      0,      0,      0,
129   2,      2,      2,      2,      6,      6,      0,      0,
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   0,      0,      0,      0,      0,      0,      0,      0,
139   0,      0,      0,      0,      0,      0,      0,      0,
140   0,      0,      0,      0,      0,      0,      0,      0,
141
142 #else
143
144   0,      0,      0,      0,      0,      0,      0,      0,
145   0,      0,      0,      0,      0,      0,      0,      0,
146   0,      0,      0,      0,      0,      0,      0,      0,
147   0,      0,      0,      0,      0,      0,      0,      0,
148   0,      0,      0,      0,      0,      0,      0,      0,
149   0,      0,      0,      0,      0,      0,      0,      0,
150   0,      0,      0,      0,      0,      0,      0,      0,
151   0,      0,      0,      0,      0,      0,      0,      0,
152   3,      2,      4,      6,      5,      8,      1,      7,
153   3,      2,      4,      5,      3,      2,      4,      5,
154   0,      6,      3,      2,      4,      6,      5,      0,
155   9,      3,      2,      4,      5,      2,      0,      0,
156   3,      2,      4,      6,      5,      8,      1,      7,
157   3,      2,      4,      5,      3,      2,      4,      5,
158   0,      6,      3,      2,      4,      6,      5,      0,
159   9,      3,      2,      4,      5,      2,      0,      0,
160
161 #endif
162 };